1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-11-22 15:47:37 +01:00

(tdep_access_reg): When writing RAX/RDX, update eh_args[] and

eh_valid_mask instead.  When reading and the corresponding
	eh_valid_mask bit is set, read from eh_args[] instead.

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

(Logical change 1.290)
This commit is contained in:
hp.com!davidm 2005-05-03 09:13:17 +00:00
parent 5b0507c432
commit 555bae8aa3

View file

@ -62,6 +62,8 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
int write)
{
dwarf_loc_t loc = DWARF_NULL_LOC;
unsigned int mask;
int arg_num;
switch (reg)
{
@ -73,25 +75,34 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
break;
case UNW_X86_64_CFA:
case UNW_X86_64_RSP:
if (write)
return -UNW_EREADONLYREG;
*valp = c->dwarf.cfa;
return 0;
case UNW_X86_64_RAX: loc = c->dwarf.loc[RAX]; break;
case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break;
case UNW_X86_64_RDX: loc = c->dwarf.loc[RDX]; break;
case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break;
case UNW_X86_64_RSP:
if (c->dwarf.cfa_is_sp)
case UNW_X86_64_RAX:
case UNW_X86_64_RDX:
arg_num = reg - UNW_X86_64_RAX;
mask = (1 << arg_num);
if (write)
{
if (write)
return -UNW_EREADONLYREG;
*valp = c->dwarf.cfa;
c->dwarf.eh_args[arg_num] = *valp;
c->dwarf.eh_valid_mask |= mask;
return 0;
}
loc = c->dwarf.loc[RSP];
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_64_RAX) ? RAX : RDX];
break;
case UNW_X86_64_RCX: loc = c->dwarf.loc[RCX]; break;
case UNW_X86_64_RBX: loc = c->dwarf.loc[RBX]; break;
case UNW_X86_64_RBP: loc = c->dwarf.loc[RBP]; break;
case UNW_X86_64_RSI: loc = c->dwarf.loc[RSI]; break;
case UNW_X86_64_RDI: loc = c->dwarf.loc[RDI]; break;