1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-23 07:57:38 +01:00

(tdep_access_reg): Buffer writes to EH argument registers (EAX

and EDX) in dwarf.eh_args[].


2004/11/17 02:43:39-08:00 mostang.com!davidm
(tdep_access_reg): Treat UNW_X86_ESP exactly like UNW_X86_CFA.

(Logical change 1.290)
This commit is contained in:
mostang.com!davidm 2005-05-03 09:13:17 +00:00
parent adeb9b5984
commit db1517609c

View file

@ -136,6 +136,8 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
int write) int write)
{ {
dwarf_loc_t loc = DWARF_NULL_LOC; dwarf_loc_t loc = DWARF_NULL_LOC;
unsigned int mask;
int arg_num;
switch (reg) switch (reg)
{ {
@ -147,25 +149,34 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
break; break;
case UNW_X86_CFA: case UNW_X86_CFA:
case UNW_X86_ESP:
if (write) if (write)
return -UNW_EREADONLYREG; return -UNW_EREADONLYREG;
*valp = c->dwarf.cfa; *valp = c->dwarf.cfa;
return 0; return 0;
case UNW_X86_EAX: loc = c->dwarf.loc[EAX]; break; case UNW_X86_EAX:
case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break; case UNW_X86_EDX:
case UNW_X86_EDX: loc = c->dwarf.loc[EDX]; break; arg_num = reg - UNW_X86_EAX;
case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break; mask = (1 << arg_num);
case UNW_X86_ESP: if (write)
if (c->dwarf.cfa_is_sp)
{ {
if (write) c->dwarf.eh_args[arg_num] = *valp;
return -UNW_EREADONLYREG; c->dwarf.eh_valid_mask |= mask;
*valp = c->dwarf.cfa;
return 0; return 0;
} }
loc = c->dwarf.loc[ESP]; else if ((c->dwarf.eh_valid_mask & mask) != 0)
{
*valp = c->dwarf.eh_args[arg_num];
return 0;
}
else
loc = c->dwarf.loc[(reg == UNW_X86_EAX) ? EAX : EDX];
break; break;
case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break;
case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break;
case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break; case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break;
case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break; case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break;
case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break; case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break;