Commit 036392c5 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dbghelp: Added preliminary CFA management.

parent 0eef5d68
...@@ -477,6 +477,8 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw, LPSTACKFR ...@@ -477,6 +477,8 @@ static BOOL interpret_function_table_entry(struct cpu_stack_walk* csw, LPSTACKFR
static BOOL x86_64_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context) static BOOL x86_64_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, CONTEXT* context)
{ {
DWORD64 base; DWORD64 base;
DWORD_PTR cfa;
unsigned deltapc = 0;
/* sanity check */ /* sanity check */
if (curr_mode >= stm_done) return FALSE; if (curr_mode >= stm_done) return FALSE;
...@@ -511,18 +513,33 @@ static BOOL x86_64_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame, ...@@ -511,18 +513,33 @@ static BOOL x86_64_stack_walk(struct cpu_stack_walk* csw, LPSTACKFRAME64 frame,
{ {
if (frame->AddrReturn.Offset == 0) goto done_err; if (frame->AddrReturn.Offset == 0) goto done_err;
frame->AddrPC = frame->AddrReturn; frame->AddrPC = frame->AddrReturn;
deltapc = 1;
} }
if (frame->AddrPC.Offset && (base = sw_module_base(csw, frame->AddrPC.Offset))) if (frame->AddrPC.Offset && (base = sw_module_base(csw, frame->AddrPC.Offset)))
frame->FuncTableEntry = sw_table_access(csw, frame->AddrPC.Offset); frame->FuncTableEntry = sw_table_access(csw, frame->AddrPC.Offset);
else else
frame->FuncTableEntry = NULL; frame->FuncTableEntry = NULL;
frame->AddrStack.Mode = frame->AddrFrame.Mode = frame->AddrReturn.Mode = AddrModeFlat;
if (frame->FuncTableEntry) if (frame->FuncTableEntry)
{ {
if (!interpret_function_table_entry(csw, frame, context, frame->FuncTableEntry, base)) if (!interpret_function_table_entry(csw, frame, context, frame->FuncTableEntry, base))
goto done_err; goto done_err;
} }
/* FIXME: should check "native" debug format for native modules */ else if (dwarf2_virtual_unwind(csw, frame->AddrPC.Offset - deltapc, context, &cfa))
{
frame->AddrStack.Offset = context->Rsp = cfa;
frame->AddrReturn.Offset = context->Rip;
TRACE("next function rip=%016lx\n", context->Rip);
TRACE(" rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n",
context->Rax, context->Rbx, context->Rcx, context->Rdx);
TRACE(" rsi=%016lx rdi=%016lx rbp=%016lx rsp=%016lx\n",
context->Rsi, context->Rdi, context->Rbp, context->Rsp);
TRACE(" r8=%016lx r9=%016lx r10=%016lx r11=%016lx\n",
context->R8, context->R9, context->R10, context->R11);
TRACE(" r12=%016lx r13=%016lx r14=%016lx r15=%016lx\n",
context->R12, context->R13, context->R14, context->R15);
}
else if (!default_unwind(csw, frame, context)) goto done_err; else if (!default_unwind(csw, frame, context)) goto done_err;
memset(&frame->Params, 0, sizeof(frame->Params)); memset(&frame->Params, 0, sizeof(frame->Params));
......
...@@ -120,6 +120,7 @@ extern unsigned dbghelp_options; ...@@ -120,6 +120,7 @@ extern unsigned dbghelp_options;
#define SYMOPT_WINE_WITH_NATIVE_MODULES 0x40000000 #define SYMOPT_WINE_WITH_NATIVE_MODULES 0x40000000
enum location_kind {loc_error, /* reg is the error code */ enum location_kind {loc_error, /* reg is the error code */
loc_unavailable, /* location is not available */
loc_absolute, /* offset is the location */ loc_absolute, /* offset is the location */
loc_register, /* reg is the location */ loc_register, /* reg is the location */
loc_regrel, /* [reg+offset] is the location */ loc_regrel, /* [reg+offset] is the location */
...@@ -601,6 +602,8 @@ extern BOOL stabs_parse(struct module* module, unsigned long load_offset ...@@ -601,6 +602,8 @@ extern BOOL stabs_parse(struct module* module, unsigned long load_offset
extern BOOL dwarf2_parse(struct module* module, unsigned long load_offset, extern BOOL dwarf2_parse(struct module* module, unsigned long load_offset,
const struct elf_thunk_area* thunks, const struct elf_thunk_area* thunks,
struct image_file_map* fmap); struct image_file_map* fmap);
extern BOOL dwarf2_virtual_unwind(struct cpu_stack_walk* csw, DWORD_PTR ip,
CONTEXT* context, ULONG_PTR* cfa);
/* stack.c */ /* stack.c */
extern BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz); extern BOOL sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz);
......
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