Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2012-08-04 01:32:28 -0400
committerEugene Tarassov2012-08-04 01:32:28 -0400
commitf8c51bc82793cfe0f27476319eabd473c1883acb (patch)
tree856f5f59d77869f918470f16734fb62987b83dd4
parent0809a0e0a1d3e4664efbe983c0aef3689a21e82a (diff)
downloadorg.eclipse.tcf.agent-f8c51bc82793cfe0f27476319eabd473c1883acb.tar.gz
org.eclipse.tcf.agent-f8c51bc82793cfe0f27476319eabd473c1883acb.tar.xz
org.eclipse.tcf.agent-f8c51bc82793cfe0f27476319eabd473c1883acb.zip
TCF Server: allow register definitions for debug contexts other then a thread
-rw-r--r--agent/machine/x86_64/tcf/cpudefs-mdep.c2
-rw-r--r--agent/tcf/services/runctrl.c5
-rw-r--r--server/tcf/services/context-proxy.c14
3 files changed, 17 insertions, 4 deletions
diff --git a/agent/machine/x86_64/tcf/cpudefs-mdep.c b/agent/machine/x86_64/tcf/cpudefs-mdep.c
index 147fc9ab..810e2485 100644
--- a/agent/machine/x86_64/tcf/cpudefs-mdep.c
+++ b/agent/machine/x86_64/tcf/cpudefs-mdep.c
@@ -720,6 +720,7 @@ int crawl_stack_frame(StackFrame * frame, StackFrame * down) {
RegisterDefinition * get_PC_definition(Context * ctx) {
static RegisterDefinition * reg_def = NULL;
+ if (!context_has_state(ctx)) return NULL;
if (reg_def == NULL) {
RegisterDefinition * defs = get_reg_definitions(ctx);
if (defs != NULL) {
@@ -729,7 +730,6 @@ RegisterDefinition * get_PC_definition(Context * ctx) {
reg_def = r;
break;
}
-
}
}
}
diff --git a/agent/tcf/services/runctrl.c b/agent/tcf/services/runctrl.c
index 45f91931..e5b68f6b 100644
--- a/agent/tcf/services/runctrl.c
+++ b/agent/tcf/services/runctrl.c
@@ -219,6 +219,11 @@ static void write_context(OutputStream * out, Context * ctx) {
json_write_boolean(out, 1);
}
+ write_stream(out, ',');
+ json_write_string(out, "WordSize");
+ write_stream(out, ':');
+ json_write_long(out, context_word_size(ctx));
+
if (context_can_resume(ctx, RM_TERMINATE)) {
write_stream(out, ',');
json_write_string(out, "CanTerminate");
diff --git a/server/tcf/services/context-proxy.c b/server/tcf/services/context-proxy.c
index a91731ec..1a8bab77 100644
--- a/server/tcf/services/context-proxy.c
+++ b/server/tcf/services/context-proxy.c
@@ -72,6 +72,7 @@ struct ContextCache {
RegisterDefinition * reg_defs;
RegisterDefinition * pc_def;
int pending_regs_cnt;
+ int regs_done;
/* Run Control Properties */
int has_state;
@@ -80,6 +81,7 @@ struct ContextCache {
long can_resume;
long can_count;
int can_terminate;
+ unsigned word_size;
/* Run Control State */
int pc_valid;
@@ -339,6 +341,7 @@ static void read_run_control_context_property(InputStream * inp, const char * na
else if (strcmp(name, "File") == 0) ctx->file = json_read_alloc_string(inp);
else if (strcmp(name, "HasState") == 0) ctx->has_state = json_read_boolean(inp);
else if (strcmp(name, "IsContainer") == 0) ctx->is_container = json_read_boolean(inp);
+ else if (strcmp(name, "WordSize") == 0) ctx->word_size = json_read_long(inp);
else if (strcmp(name, "CanSuspend") == 0) ctx->can_suspend = json_read_boolean(inp);
else if (strcmp(name, "CanResume") == 0) ctx->can_resume = json_read_long(inp);
else if (strcmp(name, "CanCount") == 0) ctx->can_count = json_read_long(inp);
@@ -1237,6 +1240,7 @@ static void validate_registers_cache(Channel * c, void * args, int error) {
}
}
cache->reg_size = offs;
+ cache->regs_done = 1;
cache_notify(&cache->regs_cache);
}
context_unlock(cache->ctx);
@@ -1245,7 +1249,7 @@ static void validate_registers_cache(Channel * c, void * args, int error) {
static void check_registers_cache(ContextCache * cache) {
if (cache->pending_regs_cnt > 0) cache_wait(&cache->regs_cache);
if (cache->reg_error != NULL) exception(set_error_report_errno(cache->reg_error));
- if (cache->reg_defs == NULL) {
+ if (!cache->regs_done) {
Channel * c = cache->peer->target;
cache->pending_regs_cnt++;
protocol_send_command(c, "Registers", "getChildren", validate_registers_cache, cache);
@@ -1521,8 +1525,12 @@ int get_next_frame(Context * ctx, int frame) {
}
unsigned context_word_size(Context * ctx) {
- RegisterDefinition * pc = get_PC_definition(ctx);
- return pc->size;
+ ContextCache * cache = *EXT(ctx);
+ if (cache->word_size == 0) {
+ RegisterDefinition * pc = get_PC_definition(ctx);
+ cache->word_size = pc == NULL ? 4 : pc->size;
+ }
+ return cache->word_size;
}
static void channel_close_listener(Channel * c) {

Back to the top