Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2020-06-24 21:37:50 +0000
committerEugene Tarassov2020-06-24 21:37:50 +0000
commit1ce19786727c6b498effd69b7dbf3347a5d674cd (patch)
treed339728a1c57093a87f00a88fe795a8b6cdb8c00
parentc7f8fa6155cc65a0404520e24e588fa3ff4ab8bb (diff)
downloadorg.eclipse.tcf.agent-1ce19786727c6b498effd69b7dbf3347a5d674cd.tar.gz
org.eclipse.tcf.agent-1ce19786727c6b498effd69b7dbf3347a5d674cd.tar.xz
org.eclipse.tcf.agent-1ce19786727c6b498effd69b7dbf3347a5d674cd.zip
TCF Agent: X86 stack crawl: check for register definition changes
-rw-r--r--agent/machine/x86_64/tcf/cpudefs-mdep.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/agent/machine/x86_64/tcf/cpudefs-mdep.c b/agent/machine/x86_64/tcf/cpudefs-mdep.c
index fbb7ebd1..85720def 100644
--- a/agent/machine/x86_64/tcf/cpudefs-mdep.c
+++ b/agent/machine/x86_64/tcf/cpudefs-mdep.c
@@ -858,9 +858,9 @@ static int is_func_exit(unsigned char * code) {
int crawl_stack_frame(StackFrame * frame, StackFrame * down) {
- static RegisterDefinition * pc_def = NULL;
- static RegisterDefinition * sp_def = NULL;
- static RegisterDefinition * bp_def = NULL;
+ RegisterDefinition * pc_def = NULL;
+ RegisterDefinition * sp_def = NULL;
+ RegisterDefinition * bp_def = NULL;
ContextAddress reg_pc = 0;
ContextAddress reg_bp = 0;
@@ -873,13 +873,17 @@ int crawl_stack_frame(StackFrame * frame, StackFrame * down) {
size_t word_size = context_word_size(ctx);
int x64 = word_size == 8;
- if (pc_def == NULL) {
- RegisterDefinition * r;
- for (r = get_reg_definitions(ctx); r->name != NULL; r++) {
+ {
+ RegisterDefinition * r = get_reg_definitions(ctx);
+ if (r == NULL) return 0;
+ for (; r->name != NULL; r++) {
if (r->offset == offsetof(REG_SET, REG_IP)) pc_def = r;
if (r->offset == offsetof(REG_SET, REG_SP)) sp_def = r;
if (r->offset == offsetof(REG_SET, REG_BP)) bp_def = r;
}
+ if (pc_def == NULL) return 0;
+ if (sp_def == NULL) return 0;
+ if (bp_def == NULL) return 0;
}
if (read_reg(frame, pc_def, word_size, &reg_pc) < 0) return 0;

Back to the top