Commit a596da54 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

winedbg: Correctly read register values through dbg_lvalue structure.

parent 1ebccd0f
...@@ -404,7 +404,7 @@ extern BOOL memory_get_current_pc(ADDRESS64* address); ...@@ -404,7 +404,7 @@ extern BOOL memory_get_current_pc(ADDRESS64* address);
extern BOOL memory_get_current_stack(ADDRESS64* address); extern BOOL memory_get_current_stack(ADDRESS64* address);
extern BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size); extern BOOL memory_get_string(struct dbg_process* pcs, void* addr, BOOL in_debuggee, BOOL unicode, char* buffer, int size);
extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, WCHAR* buffer, int size); extern BOOL memory_get_string_indirect(struct dbg_process* pcs, void* addr, BOOL unicode, WCHAR* buffer, int size);
extern BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len); extern BOOL memory_get_register(DWORD regno, struct dbg_lvalue* value, char* buffer, int len);
extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count); extern void memory_disassemble(const struct dbg_lvalue*, const struct dbg_lvalue*, int instruction_count);
extern BOOL memory_disasm_one_insn(ADDRESS64* addr); extern BOOL memory_disasm_one_insn(ADDRESS64* addr);
#define MAX_OFFSET_TO_STR_LEN 19 #define MAX_OFFSET_TO_STR_LEN 19
...@@ -425,7 +425,7 @@ extern void source_free_files(struct dbg_process* p); ...@@ -425,7 +425,7 @@ extern void source_free_files(struct dbg_process* p);
extern void stack_info(int len); extern void stack_info(int len);
extern void stack_backtrace(DWORD threadID); extern void stack_backtrace(DWORD threadID);
extern BOOL stack_set_frame(int newframe); extern BOOL stack_set_frame(int newframe);
extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval); extern BOOL stack_get_register_frame(const struct dbg_internal_var* div, struct dbg_lvalue* lvalue);
extern unsigned stack_fetch_frames(const dbg_ctx_t *ctx); extern unsigned stack_fetch_frames(const dbg_ctx_t *ctx);
extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym); extern BOOL stack_get_current_symbol(SYMBOL_INFO* sym);
static inline struct dbg_frame* static inline struct dbg_frame*
......
...@@ -783,7 +783,7 @@ void memory_disassemble(const struct dbg_lvalue* xstart, ...@@ -783,7 +783,7 @@ void memory_disassemble(const struct dbg_lvalue* xstart,
memory_disasm_one_insn(&last); memory_disasm_one_insn(&last);
} }
BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len) BOOL memory_get_register(DWORD regno, struct dbg_lvalue* lvalue, char* buffer, int len)
{ {
const struct dbg_internal_var* div; const struct dbg_internal_var* div;
...@@ -813,7 +813,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len) ...@@ -813,7 +813,7 @@ BOOL memory_get_register(DWORD regno, DWORD_PTR** value, char* buffer, int len)
{ {
if (div->val == regno) if (div->val == regno)
{ {
if (!stack_get_register_frame(div, value)) if (!stack_get_register_frame(div, lvalue))
{ {
if (buffer) snprintf(buffer, len, "<register %s not accessible in this frame>", div->name); if (buffer) snprintf(buffer, len, "<register %s not accessible in this frame>", div->name);
return FALSE; return FALSE;
......
...@@ -98,12 +98,13 @@ static BOOL stack_set_frame_internal(int newframe) ...@@ -98,12 +98,13 @@ static BOOL stack_set_frame_internal(int newframe)
return TRUE; return TRUE;
} }
BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pval) BOOL stack_get_register_frame(const struct dbg_internal_var* div, struct dbg_lvalue* lvalue)
{ {
struct dbg_frame* currfrm = stack_get_curr_frame(); struct dbg_frame* currfrm = stack_get_curr_frame();
if (currfrm == NULL) return FALSE; if (currfrm == NULL) return FALSE;
if (currfrm->is_ctx_valid) if (currfrm->is_ctx_valid)
*pval = (DWORD_PTR*)((char*)&currfrm->context + (DWORD_PTR)div->pval); init_lvalue_in_debugger(lvalue, div->typeid,
(char*)&currfrm->context + (DWORD_PTR)div->pval);
else else
{ {
enum be_cpu_addr kind; enum be_cpu_addr kind;
...@@ -114,13 +115,13 @@ BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pv ...@@ -114,13 +115,13 @@ BOOL stack_get_register_frame(const struct dbg_internal_var* div, DWORD_PTR** pv
switch (kind) switch (kind)
{ {
case be_cpu_addr_pc: case be_cpu_addr_pc:
*pval = &currfrm->linear_pc; init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_pc);
break; break;
case be_cpu_addr_stack: case be_cpu_addr_stack:
*pval = &currfrm->linear_stack; init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_stack);
break; break;
case be_cpu_addr_frame: case be_cpu_addr_frame:
*pval = &currfrm->linear_frame; init_lvalue_in_debugger(lvalue, dbg_itype_unsigned_long_int, &currfrm->linear_frame);
break; break;
} }
} }
......
...@@ -67,24 +67,20 @@ static BOOL fill_sym_lvalue(const SYMBOL_INFO* sym, ULONG_PTR base, ...@@ -67,24 +67,20 @@ static BOOL fill_sym_lvalue(const SYMBOL_INFO* sym, ULONG_PTR base,
if (buffer) buffer[0] = '\0'; if (buffer) buffer[0] = '\0';
if (sym->Flags & SYMFLAG_REGISTER) if (sym->Flags & SYMFLAG_REGISTER)
{ {
DWORD_PTR* pval; if (!memory_get_register(sym->Register, lvalue, buffer, sz))
if (!memory_get_register(sym->Register, &pval, buffer, sz))
return FALSE; return FALSE;
init_lvalue(lvalue, FALSE, pval);
} }
else if (sym->Flags & SYMFLAG_REGREL) else if (sym->Flags & SYMFLAG_REGREL)
{ {
DWORD_PTR* pval;
size_t l; size_t l;
*buffer++ = '['; sz--; *buffer++ = '['; sz--;
if (!memory_get_register(sym->Register, &pval, buffer, sz)) if (!memory_get_register(sym->Register, lvalue, buffer, sz))
return FALSE; return FALSE;
l = strlen(buffer); l = strlen(buffer);
sz -= l; sz -= l;
buffer += l; buffer += l;
init_lvalue(lvalue, TRUE, (void*)(DWORD_PTR)(*pval + sym->Address)); init_lvalue(lvalue, TRUE, (void*)(DWORD_PTR)(types_extract_as_integer(lvalue) + sym->Address));
if ((LONG64)sym->Address >= 0) if ((LONG64)sym->Address >= 0)
snprintf(buffer, sz, "+%I64d]", sym->Address); snprintf(buffer, sz, "+%I64d]", sym->Address);
else else
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment