ntdll: Add support for Dwarf expressions in call frame information.
This commit is contained in:
parent
af22daf72b
commit
8824deb6c6
|
@ -390,6 +390,167 @@ enum dwarf_call_frame_info
|
|||
DW_CFA_val_expression = 0x16,
|
||||
};
|
||||
|
||||
enum dwarf_operation
|
||||
{
|
||||
DW_OP_addr = 0x03,
|
||||
DW_OP_deref = 0x06,
|
||||
DW_OP_const1u = 0x08,
|
||||
DW_OP_const1s = 0x09,
|
||||
DW_OP_const2u = 0x0a,
|
||||
DW_OP_const2s = 0x0b,
|
||||
DW_OP_const4u = 0x0c,
|
||||
DW_OP_const4s = 0x0d,
|
||||
DW_OP_const8u = 0x0e,
|
||||
DW_OP_const8s = 0x0f,
|
||||
DW_OP_constu = 0x10,
|
||||
DW_OP_consts = 0x11,
|
||||
DW_OP_dup = 0x12,
|
||||
DW_OP_drop = 0x13,
|
||||
DW_OP_over = 0x14,
|
||||
DW_OP_pick = 0x15,
|
||||
DW_OP_swap = 0x16,
|
||||
DW_OP_rot = 0x17,
|
||||
DW_OP_xderef = 0x18,
|
||||
DW_OP_abs = 0x19,
|
||||
DW_OP_and = 0x1a,
|
||||
DW_OP_div = 0x1b,
|
||||
DW_OP_minus = 0x1c,
|
||||
DW_OP_mod = 0x1d,
|
||||
DW_OP_mul = 0x1e,
|
||||
DW_OP_neg = 0x1f,
|
||||
DW_OP_not = 0x20,
|
||||
DW_OP_or = 0x21,
|
||||
DW_OP_plus = 0x22,
|
||||
DW_OP_plus_uconst = 0x23,
|
||||
DW_OP_shl = 0x24,
|
||||
DW_OP_shr = 0x25,
|
||||
DW_OP_shra = 0x26,
|
||||
DW_OP_xor = 0x27,
|
||||
DW_OP_bra = 0x28,
|
||||
DW_OP_eq = 0x29,
|
||||
DW_OP_ge = 0x2a,
|
||||
DW_OP_gt = 0x2b,
|
||||
DW_OP_le = 0x2c,
|
||||
DW_OP_lt = 0x2d,
|
||||
DW_OP_ne = 0x2e,
|
||||
DW_OP_skip = 0x2f,
|
||||
DW_OP_lit0 = 0x30,
|
||||
DW_OP_lit1 = 0x31,
|
||||
DW_OP_lit2 = 0x32,
|
||||
DW_OP_lit3 = 0x33,
|
||||
DW_OP_lit4 = 0x34,
|
||||
DW_OP_lit5 = 0x35,
|
||||
DW_OP_lit6 = 0x36,
|
||||
DW_OP_lit7 = 0x37,
|
||||
DW_OP_lit8 = 0x38,
|
||||
DW_OP_lit9 = 0x39,
|
||||
DW_OP_lit10 = 0x3a,
|
||||
DW_OP_lit11 = 0x3b,
|
||||
DW_OP_lit12 = 0x3c,
|
||||
DW_OP_lit13 = 0x3d,
|
||||
DW_OP_lit14 = 0x3e,
|
||||
DW_OP_lit15 = 0x3f,
|
||||
DW_OP_lit16 = 0x40,
|
||||
DW_OP_lit17 = 0x41,
|
||||
DW_OP_lit18 = 0x42,
|
||||
DW_OP_lit19 = 0x43,
|
||||
DW_OP_lit20 = 0x44,
|
||||
DW_OP_lit21 = 0x45,
|
||||
DW_OP_lit22 = 0x46,
|
||||
DW_OP_lit23 = 0x47,
|
||||
DW_OP_lit24 = 0x48,
|
||||
DW_OP_lit25 = 0x49,
|
||||
DW_OP_lit26 = 0x4a,
|
||||
DW_OP_lit27 = 0x4b,
|
||||
DW_OP_lit28 = 0x4c,
|
||||
DW_OP_lit29 = 0x4d,
|
||||
DW_OP_lit30 = 0x4e,
|
||||
DW_OP_lit31 = 0x4f,
|
||||
DW_OP_reg0 = 0x50,
|
||||
DW_OP_reg1 = 0x51,
|
||||
DW_OP_reg2 = 0x52,
|
||||
DW_OP_reg3 = 0x53,
|
||||
DW_OP_reg4 = 0x54,
|
||||
DW_OP_reg5 = 0x55,
|
||||
DW_OP_reg6 = 0x56,
|
||||
DW_OP_reg7 = 0x57,
|
||||
DW_OP_reg8 = 0x58,
|
||||
DW_OP_reg9 = 0x59,
|
||||
DW_OP_reg10 = 0x5a,
|
||||
DW_OP_reg11 = 0x5b,
|
||||
DW_OP_reg12 = 0x5c,
|
||||
DW_OP_reg13 = 0x5d,
|
||||
DW_OP_reg14 = 0x5e,
|
||||
DW_OP_reg15 = 0x5f,
|
||||
DW_OP_reg16 = 0x60,
|
||||
DW_OP_reg17 = 0x61,
|
||||
DW_OP_reg18 = 0x62,
|
||||
DW_OP_reg19 = 0x63,
|
||||
DW_OP_reg20 = 0x64,
|
||||
DW_OP_reg21 = 0x65,
|
||||
DW_OP_reg22 = 0x66,
|
||||
DW_OP_reg23 = 0x67,
|
||||
DW_OP_reg24 = 0x68,
|
||||
DW_OP_reg25 = 0x69,
|
||||
DW_OP_reg26 = 0x6a,
|
||||
DW_OP_reg27 = 0x6b,
|
||||
DW_OP_reg28 = 0x6c,
|
||||
DW_OP_reg29 = 0x6d,
|
||||
DW_OP_reg30 = 0x6e,
|
||||
DW_OP_reg31 = 0x6f,
|
||||
DW_OP_breg0 = 0x70,
|
||||
DW_OP_breg1 = 0x71,
|
||||
DW_OP_breg2 = 0x72,
|
||||
DW_OP_breg3 = 0x73,
|
||||
DW_OP_breg4 = 0x74,
|
||||
DW_OP_breg5 = 0x75,
|
||||
DW_OP_breg6 = 0x76,
|
||||
DW_OP_breg7 = 0x77,
|
||||
DW_OP_breg8 = 0x78,
|
||||
DW_OP_breg9 = 0x79,
|
||||
DW_OP_breg10 = 0x7a,
|
||||
DW_OP_breg11 = 0x7b,
|
||||
DW_OP_breg12 = 0x7c,
|
||||
DW_OP_breg13 = 0x7d,
|
||||
DW_OP_breg14 = 0x7e,
|
||||
DW_OP_breg15 = 0x7f,
|
||||
DW_OP_breg16 = 0x80,
|
||||
DW_OP_breg17 = 0x81,
|
||||
DW_OP_breg18 = 0x82,
|
||||
DW_OP_breg19 = 0x83,
|
||||
DW_OP_breg20 = 0x84,
|
||||
DW_OP_breg21 = 0x85,
|
||||
DW_OP_breg22 = 0x86,
|
||||
DW_OP_breg23 = 0x87,
|
||||
DW_OP_breg24 = 0x88,
|
||||
DW_OP_breg25 = 0x89,
|
||||
DW_OP_breg26 = 0x8a,
|
||||
DW_OP_breg27 = 0x8b,
|
||||
DW_OP_breg28 = 0x8c,
|
||||
DW_OP_breg29 = 0x8d,
|
||||
DW_OP_breg30 = 0x8e,
|
||||
DW_OP_breg31 = 0x8f,
|
||||
DW_OP_regx = 0x90,
|
||||
DW_OP_fbreg = 0x91,
|
||||
DW_OP_bregx = 0x92,
|
||||
DW_OP_piece = 0x93,
|
||||
DW_OP_deref_size = 0x94,
|
||||
DW_OP_xderef_size = 0x95,
|
||||
DW_OP_nop = 0x96,
|
||||
DW_OP_push_object_address = 0x97,
|
||||
DW_OP_call2 = 0x98,
|
||||
DW_OP_call4 = 0x99,
|
||||
DW_OP_call_ref = 0x9a,
|
||||
DW_OP_form_tls_address = 0x9b,
|
||||
DW_OP_call_frame_cfa = 0x9c,
|
||||
DW_OP_bit_piece = 0x9d,
|
||||
DW_OP_lo_user = 0xe0,
|
||||
DW_OP_hi_user = 0xff,
|
||||
DW_OP_GNU_push_tls_address = 0xe0,
|
||||
DW_OP_GNU_uninit = 0xf0,
|
||||
DW_OP_GNU_encoded_addr = 0xf1,
|
||||
};
|
||||
|
||||
#define DW_EH_PE_native 0x00
|
||||
#define DW_EH_PE_leb128 0x01
|
||||
#define DW_EH_PE_data2 0x02
|
||||
|
@ -428,6 +589,11 @@ struct dwarf_fde
|
|||
|
||||
extern const struct dwarf_fde *_Unwind_Find_FDE (void *, struct dwarf_eh_bases *);
|
||||
|
||||
static unsigned char dwarf_get_u1( const unsigned char **p )
|
||||
{
|
||||
return *(*p)++;
|
||||
}
|
||||
|
||||
static unsigned short dwarf_get_u2( const unsigned char **p )
|
||||
{
|
||||
unsigned int ret = (*p)[0] | ((*p)[1] << 8);
|
||||
|
@ -530,11 +696,13 @@ static ULONG_PTR dwarf_get_ptr( const unsigned char **p, unsigned char encoding
|
|||
|
||||
enum reg_rule
|
||||
{
|
||||
RULE_UNSET, /* not set at all */
|
||||
RULE_UNDEFINED, /* undefined value */
|
||||
RULE_SAME, /* same value as previous frame */
|
||||
RULE_CFA_OFFSET, /* stored at cfa offset */
|
||||
RULE_OTHER_REG /* stored in other register */
|
||||
RULE_UNSET, /* not set at all */
|
||||
RULE_UNDEFINED, /* undefined value */
|
||||
RULE_SAME, /* same value as previous frame */
|
||||
RULE_CFA_OFFSET, /* stored at cfa offset */
|
||||
RULE_OTHER_REG, /* stored in other register */
|
||||
RULE_EXPRESSION, /* address specified by expression */
|
||||
RULE_VAL_EXPRESSION /* value specified by expression */
|
||||
};
|
||||
|
||||
#define NB_FRAME_REGS 41
|
||||
|
@ -545,6 +713,7 @@ struct frame_info
|
|||
ULONG_PTR code_align;
|
||||
LONG_PTR data_align;
|
||||
ULONG_PTR cfa_offset;
|
||||
enum reg_rule cfa_rule;
|
||||
unsigned char cfa_reg;
|
||||
unsigned char retaddr_reg;
|
||||
unsigned char fde_encoding;
|
||||
|
@ -639,9 +808,11 @@ static void execute_cfa_instructions( const unsigned char *ptr, const unsigned c
|
|||
break;
|
||||
}
|
||||
case DW_CFA_offset_extended:
|
||||
case DW_CFA_offset_extended_sf:
|
||||
{
|
||||
ULONG_PTR reg = dwarf_get_uleb128( &ptr );
|
||||
LONG_PTR offset = dwarf_get_uleb128( &ptr ) * info->data_align;
|
||||
LONG_PTR offset = (op == DW_CFA_offset_extended) ? dwarf_get_uleb128( &ptr ) * info->data_align
|
||||
: dwarf_get_sleb128( &ptr ) * info->data_align;
|
||||
if (!valid_reg( reg )) break;
|
||||
TRACE( "%lx: DW_CFA_offset_extended %s, %ld\n", info->ip, dwarf_reg_names[reg], offset );
|
||||
info->regs[reg] = offset;
|
||||
|
@ -690,13 +861,16 @@ static void execute_cfa_instructions( const unsigned char *ptr, const unsigned c
|
|||
FIXME( "%lx: DW_CFA_restore_state not implemented\n", info->ip );
|
||||
break;
|
||||
case DW_CFA_def_cfa:
|
||||
case DW_CFA_def_cfa_sf:
|
||||
{
|
||||
ULONG_PTR reg = dwarf_get_uleb128( &ptr );
|
||||
ULONG_PTR offset = dwarf_get_uleb128( &ptr );
|
||||
ULONG_PTR offset = (op == DW_CFA_def_cfa) ? dwarf_get_uleb128( &ptr )
|
||||
: dwarf_get_sleb128( &ptr ) * info->data_align;
|
||||
if (!valid_reg( reg )) break;
|
||||
TRACE( "%lx: DW_CFA_def_cfa %s, %lu\n", info->ip, dwarf_reg_names[reg], offset );
|
||||
info->cfa_reg = reg;
|
||||
info->cfa_offset = offset;
|
||||
info->cfa_rule = RULE_CFA_OFFSET;
|
||||
break;
|
||||
}
|
||||
case DW_CFA_def_cfa_register:
|
||||
|
@ -705,13 +879,41 @@ static void execute_cfa_instructions( const unsigned char *ptr, const unsigned c
|
|||
if (!valid_reg( reg )) break;
|
||||
TRACE( "%lx: DW_CFA_def_cfa_register %s\n", info->ip, dwarf_reg_names[reg] );
|
||||
info->cfa_reg = reg;
|
||||
info->cfa_rule = RULE_CFA_OFFSET;
|
||||
break;
|
||||
}
|
||||
case DW_CFA_def_cfa_offset:
|
||||
case DW_CFA_def_cfa_offset_sf:
|
||||
{
|
||||
ULONG_PTR offset = dwarf_get_uleb128( &ptr );
|
||||
ULONG_PTR offset = (op == DW_CFA_def_cfa_offset) ? dwarf_get_uleb128( &ptr )
|
||||
: dwarf_get_sleb128( &ptr ) * info->data_align;
|
||||
TRACE( "%lx: DW_CFA_def_cfa_offset %lu\n", info->ip, offset );
|
||||
info->cfa_offset = offset;
|
||||
info->cfa_rule = RULE_CFA_OFFSET;
|
||||
break;
|
||||
}
|
||||
case DW_CFA_def_cfa_expression:
|
||||
{
|
||||
ULONG_PTR expr = (ULONG_PTR)ptr;
|
||||
ULONG_PTR len = dwarf_get_uleb128( &ptr );
|
||||
TRACE( "%lx: DW_CFA_def_cfa_expression %lx-%lx\n", info->ip, expr, expr+len );
|
||||
info->cfa_offset = expr;
|
||||
info->cfa_rule = RULE_VAL_EXPRESSION;
|
||||
ptr += len;
|
||||
break;
|
||||
}
|
||||
case DW_CFA_expression:
|
||||
case DW_CFA_val_expression:
|
||||
{
|
||||
ULONG_PTR reg = dwarf_get_uleb128( &ptr );
|
||||
ULONG_PTR expr = (ULONG_PTR)ptr;
|
||||
ULONG_PTR len = dwarf_get_uleb128( &ptr );
|
||||
if (!valid_reg( reg )) break;
|
||||
TRACE( "%lx: DW_CFA_%sexpression %s %lx-%lx\n",
|
||||
info->ip, (op == DW_CFA_expression) ? "" : "val_", dwarf_reg_names[reg], expr, expr+len );
|
||||
info->regs[reg] = expr;
|
||||
info->rules[reg] = (op == DW_CFA_expression) ? RULE_EXPRESSION : RULE_VAL_EXPRESSION;
|
||||
ptr += len;
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
@ -820,10 +1022,110 @@ static void set_context_reg( CONTEXT *context, ULONG_PTR dw_reg, void *val )
|
|||
}
|
||||
}
|
||||
|
||||
static ULONG_PTR eval_expression( const unsigned char *p, CONTEXT *context )
|
||||
{
|
||||
ULONG_PTR reg, tmp, stack[64];
|
||||
int sp = -1;
|
||||
ULONG_PTR len = dwarf_get_uleb128(&p);
|
||||
const unsigned char *end = p + len;
|
||||
|
||||
while (p < end)
|
||||
{
|
||||
unsigned char opcode = dwarf_get_u1(&p);
|
||||
|
||||
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] = *(ULONG_PTR *)get_context_reg( context, opcode - DW_OP_reg0 );
|
||||
else if (opcode >= DW_OP_breg0 && opcode <= DW_OP_breg31)
|
||||
stack[++sp] = *(ULONG_PTR *)get_context_reg( context, opcode - DW_OP_breg0 ) + dwarf_get_sleb128(&p);
|
||||
else switch (opcode)
|
||||
{
|
||||
case DW_OP_nop: break;
|
||||
case DW_OP_addr: stack[++sp] = dwarf_get_u8(&p); break;
|
||||
case DW_OP_const1u: stack[++sp] = dwarf_get_u1(&p); break;
|
||||
case DW_OP_const1s: stack[++sp] = (signed char)dwarf_get_u1(&p); break;
|
||||
case DW_OP_const2u: stack[++sp] = dwarf_get_u2(&p); break;
|
||||
case DW_OP_const2s: stack[++sp] = (short)dwarf_get_u2(&p); break;
|
||||
case DW_OP_const4u: stack[++sp] = dwarf_get_u4(&p); break;
|
||||
case DW_OP_const4s: stack[++sp] = (signed int)dwarf_get_u4(&p); break;
|
||||
case DW_OP_const8u: stack[++sp] = dwarf_get_u8(&p); break;
|
||||
case DW_OP_const8s: stack[++sp] = (LONG_PTR)dwarf_get_u8(&p); break;
|
||||
case DW_OP_constu: stack[++sp] = dwarf_get_uleb128(&p); break;
|
||||
case DW_OP_consts: stack[++sp] = dwarf_get_sleb128(&p); break;
|
||||
case DW_OP_deref: stack[sp] = *(ULONG_PTR *)stack[sp]; break;
|
||||
case DW_OP_dup: stack[sp + 1] = stack[sp]; sp++; break;
|
||||
case DW_OP_drop: sp--; break;
|
||||
case DW_OP_over: stack[sp + 1] = stack[sp - 1]; sp++; break;
|
||||
case DW_OP_pick: stack[sp + 1] = stack[sp - dwarf_get_u1(&p)]; sp++; break;
|
||||
case DW_OP_swap: tmp = stack[sp]; stack[sp] = stack[sp-1]; stack[sp-1] = tmp; break;
|
||||
case DW_OP_rot: tmp = stack[sp]; stack[sp] = stack[sp-1]; stack[sp-1] = stack[sp-2]; stack[sp-2] = tmp; break;
|
||||
case DW_OP_abs: stack[sp] = labs(stack[sp]); break;
|
||||
case DW_OP_neg: stack[sp] = -stack[sp]; break;
|
||||
case DW_OP_not: stack[sp] = ~stack[sp]; break;
|
||||
case DW_OP_and: stack[sp-1] &= stack[sp]; sp--; break;
|
||||
case DW_OP_or: stack[sp-1] |= stack[sp]; sp--; break;
|
||||
case DW_OP_minus: stack[sp-1] -= stack[sp]; sp--; break;
|
||||
case DW_OP_mul: stack[sp-1] *= stack[sp]; sp--; break;
|
||||
case DW_OP_plus: stack[sp-1] += stack[sp]; sp--; break;
|
||||
case DW_OP_xor: stack[sp-1] ^= stack[sp]; sp--; break;
|
||||
case DW_OP_shl: stack[sp-1] <<= stack[sp]; sp--; break;
|
||||
case DW_OP_shr: stack[sp-1] >>= stack[sp]; sp--; break;
|
||||
case DW_OP_plus_uconst: stack[sp] += dwarf_get_uleb128(&p); break;
|
||||
case DW_OP_shra: stack[sp-1] = (LONG_PTR)stack[sp-1] / (1 << stack[sp]); sp--; break;
|
||||
case DW_OP_div: stack[sp-1] = (LONG_PTR)stack[sp-1] / (LONG_PTR)stack[sp]; sp--; break;
|
||||
case DW_OP_mod: stack[sp-1] = (LONG_PTR)stack[sp-1] % (LONG_PTR)stack[sp]; sp--; break;
|
||||
case DW_OP_ge: stack[sp-1] = ((LONG_PTR)stack[sp-1] >= (LONG_PTR)stack[sp]); sp--; break;
|
||||
case DW_OP_gt: stack[sp-1] = ((LONG_PTR)stack[sp-1] > (LONG_PTR)stack[sp]); sp--; break;
|
||||
case DW_OP_le: stack[sp-1] = ((LONG_PTR)stack[sp-1] <= (LONG_PTR)stack[sp]); sp--; break;
|
||||
case DW_OP_lt: stack[sp-1] = ((LONG_PTR)stack[sp-1] < (LONG_PTR)stack[sp]); sp--; break;
|
||||
case DW_OP_eq: stack[sp-1] = (stack[sp-1] == stack[sp]); sp--; break;
|
||||
case DW_OP_ne: stack[sp-1] = (stack[sp-1] != stack[sp]); sp--; break;
|
||||
case DW_OP_skip: tmp = (short)dwarf_get_u2(&p); p += tmp; break;
|
||||
case DW_OP_bra: tmp = (short)dwarf_get_u2(&p); if (!stack[sp--]) p += tmp; break;
|
||||
case DW_OP_GNU_encoded_addr: tmp = *p++; stack[++sp] = dwarf_get_ptr( &p, tmp ); break;
|
||||
case DW_OP_regx: stack[++sp] = *(ULONG_PTR *)get_context_reg( context, dwarf_get_uleb128(&p) ); break;
|
||||
case DW_OP_bregx:
|
||||
reg = dwarf_get_uleb128(&p);
|
||||
tmp = dwarf_get_sleb128(&p);
|
||||
stack[++sp] = *(ULONG_PTR *)get_context_reg( context, reg ) + tmp;
|
||||
break;
|
||||
case DW_OP_deref_size:
|
||||
switch (*p++)
|
||||
{
|
||||
case 1: stack[sp] = *(unsigned char *)stack[sp]; break;
|
||||
case 2: stack[sp] = *(unsigned short *)stack[sp]; break;
|
||||
case 4: stack[sp] = *(unsigned int *)stack[sp]; break;
|
||||
case 8: stack[sp] = *(ULONG_PTR *)stack[sp]; break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
FIXME( "unhandled opcode %02x\n", opcode );
|
||||
}
|
||||
}
|
||||
return stack[sp];
|
||||
}
|
||||
|
||||
/* apply the computed frame info to the actual context */
|
||||
static void apply_frame_info( CONTEXT *context, struct frame_info *info, ULONG_PTR cfa )
|
||||
static void apply_frame_info( CONTEXT *context, struct frame_info *info )
|
||||
{
|
||||
unsigned int i;
|
||||
ULONG_PTR cfa, value;
|
||||
CONTEXT new_context = *context;
|
||||
|
||||
switch (info->cfa_rule)
|
||||
{
|
||||
case RULE_EXPRESSION:
|
||||
cfa = *(ULONG_PTR *)eval_expression( (const unsigned char *)info->cfa_offset, context );
|
||||
break;
|
||||
case RULE_VAL_EXPRESSION:
|
||||
cfa = eval_expression( (const unsigned char *)info->cfa_offset, context );
|
||||
break;
|
||||
default:
|
||||
cfa = *(ULONG_PTR *)get_context_reg( context, info->cfa_reg ) + info->cfa_offset;
|
||||
break;
|
||||
}
|
||||
if (!cfa) return;
|
||||
|
||||
for (i = 0; i < NB_FRAME_REGS; i++)
|
||||
{
|
||||
|
@ -834,15 +1136,23 @@ static void apply_frame_info( CONTEXT *context, struct frame_info *info, ULONG_P
|
|||
case RULE_SAME:
|
||||
break;
|
||||
case RULE_CFA_OFFSET:
|
||||
set_context_reg( context, i, (char *)cfa + info->regs[i] );
|
||||
set_context_reg( &new_context, i, (char *)cfa + info->regs[i] );
|
||||
break;
|
||||
case RULE_OTHER_REG:
|
||||
FIXME( "other reg rule (%s == %s) not supported yet\n",
|
||||
dwarf_reg_names[i], dwarf_reg_names[info->regs[i]] );
|
||||
set_context_reg( &new_context, i, get_context_reg( context, info->regs[i] ));
|
||||
break;
|
||||
case RULE_EXPRESSION:
|
||||
value = eval_expression( (const unsigned char *)info->regs[i], context );
|
||||
set_context_reg( &new_context, i, (void *)value );
|
||||
break;
|
||||
case RULE_VAL_EXPRESSION:
|
||||
value = eval_expression( (const unsigned char *)info->regs[i], context );
|
||||
set_context_reg( &new_context, i, &value );
|
||||
break;
|
||||
}
|
||||
}
|
||||
context->Rsp = cfa;
|
||||
new_context.Rsp = cfa;
|
||||
*context = new_context;
|
||||
}
|
||||
|
||||
|
||||
|
@ -857,7 +1167,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame,CONTEXT *contex
|
|||
{
|
||||
const struct dwarf_cie *cie;
|
||||
const unsigned char *ptr, *augmentation, *end;
|
||||
ULONG_PTR len, cfa, code_end;
|
||||
ULONG_PTR len, code_end;
|
||||
struct frame_info info;
|
||||
int aug_z_format = 0;
|
||||
unsigned char lsda_encoding = DW_EH_PE_omit;
|
||||
|
@ -880,6 +1190,7 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame,CONTEXT *contex
|
|||
info.code_align = dwarf_get_uleb128( &ptr );
|
||||
info.data_align = dwarf_get_sleb128( &ptr );
|
||||
info.retaddr_reg = *ptr++;
|
||||
info.cfa_rule = RULE_CFA_OFFSET;
|
||||
|
||||
TRACE( "function %lx base %p cie %p len %x id %x version %x aug '%s' code_align %lu data_align %ld retaddr %s\n",
|
||||
ip, bases->func, cie, cie->length, cie->id, cie->version, cie->augmentation,
|
||||
|
@ -938,9 +1249,8 @@ static NTSTATUS dwarf_virtual_unwind( ULONG64 ip, ULONG64 *frame,CONTEXT *contex
|
|||
TRACE( "fde %p len %x personality %p lsda %p code %lx-%lx\n",
|
||||
fde, fde->length, *handler, *handler_data, info.ip, code_end );
|
||||
execute_cfa_instructions( ptr, end, ip, &info );
|
||||
|
||||
*frame = cfa = *(ULONG_PTR *)get_context_reg( context, info.cfa_reg ) + info.cfa_offset;
|
||||
if (cfa) apply_frame_info( context, &info, cfa );
|
||||
apply_frame_info( context, &info );
|
||||
*frame = context->Rsp;
|
||||
|
||||
TRACE( "next function rip=%016lx\n", context->Rip );
|
||||
TRACE( " rax=%016lx rbx=%016lx rcx=%016lx rdx=%016lx\n",
|
||||
|
|
Loading…
Reference in New Issue