From be2bed2712097dae6d44bb1a9d46da2b0c17db4a Mon Sep 17 00:00:00 2001 From: "homeip.net!davidm" Date: Fri, 20 Aug 2004 11:23:15 +0000 Subject: [PATCH] (tdep_access_reg): If c->dwarf.cfa_is_sp is set, treat UNW_X86_64_RSP as a read-only alias of CFA. (Logical change 1.253) --- src/x86/Gregs.c | 11 ++++++++++- src/x86_64/Gregs.c | 11 ++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/x86/Gregs.c b/src/x86/Gregs.c index b607f3c2..fa94cc0a 100644 --- a/src/x86/Gregs.c +++ b/src/x86/Gregs.c @@ -156,7 +156,16 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, case UNW_X86_ECX: loc = c->dwarf.loc[ECX]; break; case UNW_X86_EDX: loc = c->dwarf.loc[EDX]; break; case UNW_X86_EBX: loc = c->dwarf.loc[EBX]; break; - case UNW_X86_ESP: loc = c->dwarf.loc[ESP]; break; + case UNW_X86_ESP: + if (c->dwarf.cfa_is_sp) + { + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + } + loc = c->dwarf.loc[ESP]; + break; case UNW_X86_EBP: loc = c->dwarf.loc[EBP]; break; case UNW_X86_ESI: loc = c->dwarf.loc[ESI]; break; case UNW_X86_EDI: loc = c->dwarf.loc[EDI]; break; diff --git a/src/x86_64/Gregs.c b/src/x86_64/Gregs.c index 608bec76..da04fcbe 100644 --- a/src/x86_64/Gregs.c +++ b/src/x86_64/Gregs.c @@ -82,7 +82,16 @@ tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, 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: loc = c->dwarf.loc[RSP]; break; + case UNW_X86_64_RSP: + if (c->dwarf.cfa_is_sp) + { + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + } + loc = c->dwarf.loc[RSP]; + 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;