diff options
author | eutarass | 2011-05-07 17:06:38 +0000 |
---|---|---|
committer | eutarass | 2011-05-07 17:06:38 +0000 |
commit | 00c92d51008563f7d1ad92758260d20e24e1bfb1 (patch) | |
tree | 006f54f4a7de5a9aa565794b349b5267393e1612 | |
parent | c061427befb6776913c5631d37871dc39887a5e3 (diff) | |
download | org.eclipse.tcf.agent-00c92d51008563f7d1ad92758260d20e24e1bfb1.tar.gz org.eclipse.tcf.agent-00c92d51008563f7d1ad92758260d20e24e1bfb1.tar.xz org.eclipse.tcf.agent-00c92d51008563f7d1ad92758260d20e24e1bfb1.zip |
TCF Agent: added new function in context.h: context_get_state_properties().
The function allows debugger back-end to define additional context state properties.
-rw-r--r-- | config.h | 4 | ||||
-rw-r--r-- | framework/context.c | 7 | ||||
-rw-r--r-- | framework/context.h | 6 | ||||
-rw-r--r-- | services/runctrl.c | 20 |
4 files changed, 37 insertions, 0 deletions
@@ -236,4 +236,8 @@ # define ENABLE_Unix_Domain (TARGET_UNIX || TARGET_SYMBIAN) #endif +#if !defined(ENABLE_ContextStateProperties) +# define ENABLE_ContextStateProperties 0 +#endif + #endif /* D_config */ diff --git a/framework/context.c b/framework/context.c index 08263f3c..b117d2f3 100644 --- a/framework/context.c +++ b/framework/context.c @@ -158,6 +158,13 @@ const char * context_state_name(Context * ctx) { return "running"; } +#if !ENABLE_ContextStateProperties +int context_get_state_properties(Context * ctx, const char *** names, const char *** values, int * cnt) { + *cnt = 0; + return 0; +} +#endif + void context_clear_memory_map(MemoryMap * map) { unsigned i; for (i = 0; i < map->region_cnt; i++) { diff --git a/framework/context.h b/framework/context.h index f68c184b..821362b4 100644 --- a/framework/context.h +++ b/framework/context.h @@ -233,6 +233,12 @@ extern void context_unlock(Context * ctx); extern int context_has_state(Context * ctx); /* + * Get context state properties. + * Return -1 and set errno if cannot access the properties. + */ +extern int context_get_state_properties(Context * ctx, const char *** names, const char *** values, int * cnt); + +/* * Stop execution of the context. * Execution can be resumed by calling context_continue() * Return -1 and set errno if the context cannot be stopped. diff --git a/services/runctrl.c b/services/runctrl.c index adcdc6da..7eaf6a98 100644 --- a/services/runctrl.c +++ b/services/runctrl.c @@ -321,6 +321,26 @@ static void write_context_state(OutputStream * out, Context * ctx) { write_error_object(out, pc_error); fst = 0; } +#if ENABLE_ContextStateProperties + { + /* Back-end context state properties */ + int cnt = 0; + const char ** names = NULL; + const char ** values = NULL; + if (context_get_state_properties(ctx, &names, &values, &cnt) == 0) { + while (cnt > 0) { + if (*values != NULL) { + if (!fst) write_stream(out, ','); + json_write_string(out, *names++); + write_stream(out, ':'); + json_write_string(out, *values++); + fst = 0; + } + cnt--; + } + } + } +#endif write_stream(out, '}'); write_stream(out, 0); } |