mirror of
https://github.com/reactos/reactos.git
synced 2024-07-02 10:45:24 +00:00
[WINESYNC] dbghelp/dwarf: Use the correct backend CPU in dwarf2_virtual_unwind().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id 9ae588a96ef5f07ba22e0fadc3aacf61b274efe5 by Zebediah Figura <z.figura12@gmail.com>
This commit is contained in:
parent
7470eb9ced
commit
1825a61069
|
@ -473,6 +473,7 @@ struct cpu_stack_walk
|
|||
HANDLE hProcess;
|
||||
HANDLE hThread;
|
||||
BOOL is32;
|
||||
struct cpu * cpu;
|
||||
union
|
||||
{
|
||||
struct
|
||||
|
|
|
@ -3031,10 +3031,11 @@ static void execute_cfa_instructions(dwarf2_traverse_context_t* ctx,
|
|||
}
|
||||
|
||||
/* retrieve a context register from its dwarf number */
|
||||
static ULONG_PTR get_context_reg(union ctx *context, ULONG_PTR dw_reg)
|
||||
static ULONG_PTR get_context_reg(struct cpu_stack_walk *csw, union ctx *context,
|
||||
ULONG_PTR dw_reg)
|
||||
{
|
||||
unsigned regno = dbghelp_current_cpu->map_dwarf_register(dw_reg, TRUE), sz;
|
||||
ULONG_PTR* ptr = dbghelp_current_cpu->fetch_context_reg(context, regno, &sz);
|
||||
unsigned regno = csw->cpu->map_dwarf_register(dw_reg, TRUE), sz;
|
||||
ULONG_PTR* ptr = csw->cpu->fetch_context_reg(context, regno, &sz);
|
||||
|
||||
if (sz != sizeof(ULONG_PTR))
|
||||
{
|
||||
|
@ -3048,8 +3049,8 @@ static ULONG_PTR get_context_reg(union ctx *context, ULONG_PTR dw_reg)
|
|||
static void set_context_reg(struct cpu_stack_walk* csw, union ctx *context,
|
||||
ULONG_PTR dw_reg, ULONG_PTR val, BOOL isdebuggee)
|
||||
{
|
||||
unsigned regno = dbghelp_current_cpu->map_dwarf_register(dw_reg, TRUE), sz;
|
||||
ULONG_PTR* ptr = dbghelp_current_cpu->fetch_context_reg(context, regno, &sz);
|
||||
unsigned regno = csw->cpu->map_dwarf_register(dw_reg, TRUE), sz;
|
||||
ULONG_PTR* ptr = csw->cpu->fetch_context_reg(context, regno, &sz);
|
||||
|
||||
if (isdebuggee)
|
||||
{
|
||||
|
@ -3079,13 +3080,14 @@ static void set_context_reg(struct cpu_stack_walk* csw, union ctx *context,
|
|||
}
|
||||
|
||||
/* copy a register from one context to another using dwarf number */
|
||||
static void copy_context_reg(union ctx *dstcontext, ULONG_PTR dwregdst,
|
||||
union ctx *srccontext, ULONG_PTR dwregsrc)
|
||||
static void copy_context_reg(struct cpu_stack_walk *csw,
|
||||
union ctx *dstcontext, ULONG_PTR dwregdst,
|
||||
union ctx *srccontext, ULONG_PTR dwregsrc)
|
||||
{
|
||||
unsigned regdstno = dbghelp_current_cpu->map_dwarf_register(dwregdst, TRUE), szdst;
|
||||
unsigned regsrcno = dbghelp_current_cpu->map_dwarf_register(dwregsrc, TRUE), szsrc;
|
||||
ULONG_PTR* ptrdst = dbghelp_current_cpu->fetch_context_reg(dstcontext, regdstno, &szdst);
|
||||
ULONG_PTR* ptrsrc = dbghelp_current_cpu->fetch_context_reg(srccontext, regsrcno, &szsrc);
|
||||
unsigned regdstno = csw->cpu->map_dwarf_register(dwregdst, TRUE), szdst;
|
||||
unsigned regsrcno = csw->cpu->map_dwarf_register(dwregsrc, TRUE), szsrc;
|
||||
ULONG_PTR* ptrdst = csw->cpu->fetch_context_reg(dstcontext, regdstno, &szdst);
|
||||
ULONG_PTR* ptrsrc = csw->cpu->fetch_context_reg(srccontext, regsrcno, &szsrc);
|
||||
|
||||
if (szdst != szsrc)
|
||||
{
|
||||
|
@ -3117,9 +3119,10 @@ static ULONG_PTR eval_expression(const struct module* module, struct cpu_stack_w
|
|||
if (opcode >= DW_OP_lit0 && opcode <= DW_OP_lit31)
|
||||
stack[++sp] = opcode - DW_OP_lit0;
|
||||
else if (opcode >= DW_OP_reg0 && opcode <= DW_OP_reg31)
|
||||
stack[++sp] = get_context_reg(context, opcode - DW_OP_reg0);
|
||||
stack[++sp] = get_context_reg(csw, context, opcode - DW_OP_reg0);
|
||||
else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31)
|
||||
stack[++sp] = get_context_reg(context, opcode - DW_OP_breg0) + dwarf2_leb128_as_signed(&ctx);
|
||||
stack[++sp] = get_context_reg(csw, context, opcode - DW_OP_breg0)
|
||||
+ dwarf2_leb128_as_signed(&ctx);
|
||||
else switch (opcode)
|
||||
{
|
||||
case DW_OP_nop: break;
|
||||
|
@ -3176,12 +3179,12 @@ static ULONG_PTR eval_expression(const struct module* module, struct cpu_stack_w
|
|||
stack[++sp] = dwarf2_parse_augmentation_ptr(&ctx, tmp);
|
||||
break;
|
||||
case DW_OP_regx:
|
||||
stack[++sp] = get_context_reg(context, dwarf2_leb128_as_unsigned(&ctx));
|
||||
stack[++sp] = get_context_reg(csw, context, dwarf2_leb128_as_unsigned(&ctx));
|
||||
break;
|
||||
case DW_OP_bregx:
|
||||
reg = dwarf2_leb128_as_unsigned(&ctx);
|
||||
tmp = dwarf2_leb128_as_signed(&ctx);
|
||||
stack[++sp] = get_context_reg(context, reg) + tmp;
|
||||
stack[++sp] = get_context_reg(csw, context, reg) + tmp;
|
||||
break;
|
||||
case DW_OP_deref_size:
|
||||
sz = dwarf2_parse_byte(&ctx);
|
||||
|
@ -3228,7 +3231,7 @@ static void apply_frame_state(const struct module* module, struct cpu_stack_walk
|
|||
*cfa = eval_expression(module, csw, (const unsigned char*)state->cfa_offset, context);
|
||||
break;
|
||||
default:
|
||||
*cfa = get_context_reg(context, state->cfa_reg) + state->cfa_offset;
|
||||
*cfa = get_context_reg(csw, context, state->cfa_reg) + state->cfa_offset;
|
||||
break;
|
||||
}
|
||||
if (!*cfa) return;
|
||||
|
@ -3245,7 +3248,7 @@ static void apply_frame_state(const struct module* module, struct cpu_stack_walk
|
|||
set_context_reg(csw, &new_context, i, *cfa + state->regs[i], TRUE);
|
||||
break;
|
||||
case RULE_OTHER_REG:
|
||||
copy_context_reg(&new_context, i, context, state->regs[i]);
|
||||
copy_context_reg(csw, &new_context, i, context, state->regs[i]);
|
||||
break;
|
||||
case RULE_EXPRESSION:
|
||||
value = eval_expression(module, csw, (const unsigned char*)state->regs[i], context);
|
||||
|
@ -3305,7 +3308,7 @@ BOOL dwarf2_virtual_unwind(struct cpu_stack_walk *csw, ULONG_PTR ip,
|
|||
|
||||
TRACE("function %lx/%lx code_align %lu data_align %ld retaddr %s\n",
|
||||
ip, info.ip, info.code_align, info.data_align,
|
||||
dbghelp_current_cpu->fetch_regname(dbghelp_current_cpu->map_dwarf_register(info.retaddr_reg, TRUE)));
|
||||
csw->cpu->fetch_regname(csw->cpu->map_dwarf_register(info.retaddr_reg, TRUE)));
|
||||
|
||||
/* if at very beginning of function, return and use default unwinder */
|
||||
if (ip == info.ip) return FALSE;
|
||||
|
|
|
@ -175,6 +175,7 @@ BOOL WINAPI StackWalk(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
|
|||
csw.hProcess = hProcess;
|
||||
csw.hThread = hThread;
|
||||
csw.is32 = TRUE;
|
||||
csw.cpu = cpu;
|
||||
/* sigh... MS isn't even consistent in the func prototypes */
|
||||
csw.u.s32.f_read_mem = (f_read_mem) ? f_read_mem : read_mem;
|
||||
csw.u.s32.f_xlat_adr = f_xlat_adr;
|
||||
|
@ -231,6 +232,7 @@ BOOL WINAPI StackWalk64(DWORD MachineType, HANDLE hProcess, HANDLE hThread,
|
|||
csw.hProcess = hProcess;
|
||||
csw.hThread = hThread;
|
||||
csw.is32 = FALSE;
|
||||
csw.cpu = cpu;
|
||||
/* sigh... MS isn't even consistent in the func prototypes */
|
||||
csw.u.s64.f_read_mem = (f_read_mem) ? f_read_mem : read_mem64;
|
||||
csw.u.s64.f_xlat_adr = (f_xlat_adr) ? f_xlat_adr : addr_to_linear;
|
||||
|
|
|
@ -3,4 +3,4 @@ directories:
|
|||
files:
|
||||
include/dbghelp.h: sdk/include/psdk/dbghelp.h
|
||||
tags:
|
||||
wine: 3ce304e60100962503bcded0adb69659f849d1b4
|
||||
wine: 9ae588a96ef5f07ba22e0fadc3aacf61b274efe5
|
||||
|
|
Loading…
Reference in a new issue