From 9c09f14270fb7b6fd37f153910fd61979fb93074 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Mon, 11 Apr 2011 20:47:19 +0200 Subject: [PATCH] dbghelp: Extended CPU structure by adding a default register number for frame. --- dlls/dbghelp/cpu_arm.c | 1 + dlls/dbghelp/cpu_i386.c | 1 + dlls/dbghelp/cpu_ppc.c | 1 + dlls/dbghelp/cpu_sparc.c | 1 + dlls/dbghelp/cpu_x86_64.c | 1 + dlls/dbghelp/dbghelp_private.h | 2 ++ dlls/dbghelp/dwarf.c | 2 +- dlls/dbghelp/stabs.c | 4 ++-- dlls/dbghelp/symbol.c | 5 +++-- 9 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dlls/dbghelp/cpu_arm.c b/dlls/dbghelp/cpu_arm.c index fd0b781f3a3..43658288a91 100644 --- a/dlls/dbghelp/cpu_arm.c +++ b/dlls/dbghelp/cpu_arm.c @@ -73,6 +73,7 @@ static const char* arm_fetch_regname(unsigned regno) struct cpu cpu_arm = { IMAGE_FILE_MACHINE_ARM, 4, + CV_ARM_NOREG, /* FIXME */ arm_get_addr, arm_stack_walk, NULL, diff --git a/dlls/dbghelp/cpu_i386.c b/dlls/dbghelp/cpu_i386.c index 09d88a67e38..6abcddc192e 100644 --- a/dlls/dbghelp/cpu_i386.c +++ b/dlls/dbghelp/cpu_i386.c @@ -635,6 +635,7 @@ static const char* i386_fetch_regname(unsigned regno) struct cpu cpu_i386 = { IMAGE_FILE_MACHINE_I386, 4, + CV_REG_EBP, i386_get_addr, i386_stack_walk, NULL, diff --git a/dlls/dbghelp/cpu_ppc.c b/dlls/dbghelp/cpu_ppc.c index 938e3712f7a..96a5d7dbb7c 100644 --- a/dlls/dbghelp/cpu_ppc.c +++ b/dlls/dbghelp/cpu_ppc.c @@ -75,6 +75,7 @@ static const char* ppc_fetch_regname(unsigned regno) struct cpu cpu_ppc = { IMAGE_FILE_MACHINE_POWERPC, 4, + CV_REG_NONE, /* FIXME */ ppc_get_addr, ppc_stack_walk, NULL, diff --git a/dlls/dbghelp/cpu_sparc.c b/dlls/dbghelp/cpu_sparc.c index c69e41931b5..1de9436ac6b 100644 --- a/dlls/dbghelp/cpu_sparc.c +++ b/dlls/dbghelp/cpu_sparc.c @@ -70,6 +70,7 @@ static const char* sparc_fetch_regname(unsigned regno) struct cpu cpu_sparc = { IMAGE_FILE_MACHINE_SPARC, 4, + CV_REG_NONE, /* FIXME */ sparc_get_addr, sparc_stack_walk, NULL, diff --git a/dlls/dbghelp/cpu_x86_64.c b/dlls/dbghelp/cpu_x86_64.c index 375c0d840ba..5c0dece2578 100644 --- a/dlls/dbghelp/cpu_x86_64.c +++ b/dlls/dbghelp/cpu_x86_64.c @@ -799,6 +799,7 @@ static const char* x86_64_fetch_regname(unsigned regno) struct cpu cpu_x86_64 = { IMAGE_FILE_MACHINE_AMD64, 8, + CV_AMD64_RSP, x86_64_get_addr, x86_64_stack_walk, x86_64_find_runtime_function, diff --git a/dlls/dbghelp/dbghelp_private.h b/dlls/dbghelp/dbghelp_private.h index 7975379af6e..3c878cc6927 100644 --- a/dlls/dbghelp/dbghelp_private.h +++ b/dlls/dbghelp/dbghelp_private.h @@ -470,6 +470,8 @@ struct cpu { DWORD machine; DWORD word_size; + DWORD frame_regno; + /* address manipulation */ unsigned (*get_addr)(HANDLE hThread, const CONTEXT* ctx, enum cpu_addr, ADDRESS64* addr); diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c index 5b2cb013716..103bdbfdc36 100644 --- a/dlls/dbghelp/dwarf.c +++ b/dlls/dbghelp/dwarf.c @@ -1899,7 +1899,7 @@ static struct symt* dwarf2_parse_subprogram(dwarf2_parse_context_t* ctx, { /* on stack !! */ subpgm.frame.kind = loc_regrel; - subpgm.frame.reg = 0; + subpgm.frame.reg = dbghelp_current_cpu->frame_regno; subpgm.frame.offset = 0; } subpgm.non_computed_variable = FALSE; diff --git a/dlls/dbghelp/stabs.c b/dlls/dbghelp/stabs.c index 721d5e70183..3f280090f12 100644 --- a/dlls/dbghelp/stabs.c +++ b/dlls/dbghelp/stabs.c @@ -1417,7 +1417,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset, struct symt* param_type = stabs_parse_type(ptr); stab_strcpy(symname, sizeof(symname), ptr); loc.kind = loc_regrel; - loc.reg = 0; /* FIXME */ + loc.reg = dbghelp_current_cpu->frame_regno; loc.offset = stab_ptr->n_value; symt_add_func_local(module, curr_func, (int)stab_ptr->n_value >= 0 ? DataIsParam : DataIsLocal, @@ -1492,7 +1492,7 @@ BOOL stabs_parse(struct module* module, unsigned long load_offset, case N_LSYM: /* These are local variables */ loc.kind = loc_regrel; - loc.reg = 0; /* FIXME */ + loc.reg = dbghelp_current_cpu->frame_regno; loc.offset = stab_ptr->n_value; if (curr_func != NULL) pending_add_var(&pending_block, ptr, DataIsLocal, &loc); break; diff --git a/dlls/dbghelp/symbol.c b/dlls/dbghelp/symbol.c index e92d9989068..16923e4d031 100644 --- a/dlls/dbghelp/symbol.c +++ b/dlls/dbghelp/symbol.c @@ -721,8 +721,9 @@ static void symt_fill_sym_info(struct module_pair* pair, break; case loc_regrel: sym_info->Flags |= SYMFLAG_LOCAL | SYMFLAG_REGREL; - /* FIXME: it's i386 dependent !!! */ - sym_info->Register = loc.reg ? loc.reg : CV_REG_EBP; + sym_info->Register = loc.reg; + if (loc.reg == CV_REG_NONE || (int)loc.reg < 0 /* error */) + FIXME("suspicious register value %x\n", loc.reg); sym_info->Address = loc.offset; break; case loc_absolute: