]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
arm64: Handle sp, lr, fp as DwReg in CfiExpr
authorMark Wielaard <mark@klomp.org>
Thu, 4 Mar 2021 18:24:06 +0000 (19:24 +0100)
committerMark Wielaard <mark@klomp.org>
Thu, 4 Mar 2021 18:24:06 +0000 (19:24 +0100)
When copy_convert_CfiExpr_tree sees a DwReg on arm64 we simply call
I_die_here; This causes an issue in the case we really do have to handle
that case (see https://bugzilla.redhat.com/show_bug.cgi?id=1923493).

Handle the stack pointer (sp), link register (x30) and frame pointer (x29),
which we already keep in D3UnwindRegs, like we do for other architectures
in evalCfiExpr and copy_convert_CfiExpr_tree.

https://bugs.kde.org/show_bug.cgi?id=433898

NEWS
coregrind/m_debuginfo/d3basics.c
coregrind/m_debuginfo/debuginfo.c
coregrind/m_debuginfo/priv_storage.h
coregrind/m_debuginfo/readdwarf.c
coregrind/m_debuginfo/storage.c

diff --git a/NEWS b/NEWS
index 8595a9034a328a93a69283e2cfdc987ba0472751..6cb270c1c40e3ddab9c7a6006af01e064ba85ad2 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -152,6 +152,7 @@ where XXXXXX is the bug number as listed below.
 433500  DRD regtest faulures when libstdc++ and libgcc debuginfo are installed
 433629  valgrind/README has type "abd" instead of "and"
 433641  Rust std::sys::unix::fs::try_statx Syscall param fstatat(file_name)
+433898  arm64: Handle sp, lr, fp as DwReg in CfiExpr
 n-i-bz  helgrind: If hg_cli__realloc fails, return NULL.
 
 
index e1127ffe2f6b17375cf607eed3b88e89140e142e..1bc5f8f0520bb4689fb859babc1564866d861ffe 100644 (file)
@@ -523,6 +523,7 @@ static Bool get_Dwarf_Reg( /*OUT*/Addr* a, Word regno, const RegSummary* regs )
    if (regno == 30) { *a = regs->fp; return True; }
 #  elif defined(VGP_arm64_linux)
    if (regno == 31) { *a = regs->sp; return True; }
+   if (regno == 29) { *a = regs->fp; return True; }
 #  else
 #    error "Unknown platform"
 #  endif
index c4a5ea593a31ff4ea2cc884fbdf52ec7f99eb5be..bc2578b37786fd52d9ea3fd42a36cbe239785a7c 100644 (file)
@@ -2874,7 +2874,9 @@ UWord evalCfiExpr ( const XArray* exprs, Int ix,
 #           elif defined(VGA_ppc32) || defined(VGA_ppc64be) \
                || defined(VGA_ppc64le)
 #           elif defined(VGP_arm64_linux)
+            case Creg_ARM64_SP: return eec->uregs->sp;
             case Creg_ARM64_X30: return eec->uregs->x30;
+            case Creg_ARM64_X29: return eec->uregs->x29;
 #           else
 #             error "Unsupported arch"
 #           endif
index 39456eccbd3cb3e7e10ca02379b7ad613e55bd35..ae44ca34e539d79db6e8021862e9e236dad222bd 100644 (file)
@@ -415,7 +415,9 @@ typedef
       Creg_ARM_R15,
       Creg_ARM_R14,
       Creg_ARM_R7,
+      Creg_ARM64_SP,
       Creg_ARM64_X30,
+      Creg_ARM64_X29,
       Creg_S390_IA,
       Creg_S390_SP,
       Creg_S390_FP,
index 3996623edba975b3332b28f02652b3405a1ba5ae..bcacca4cb930283b04964a60ecb8109cfc4dfe62 100644 (file)
@@ -2816,7 +2816,12 @@ static Int copy_convert_CfiExpr_tree ( XArray*        dstxa,
          if (dwreg == srcuc->ra_reg)
             return ML_(CfiExpr_CfiReg)( dstxa, Creg_IA_IP );
 #        elif defined(VGA_arm64)
-         I_die_here;
+         if (dwreg == SP_REG)
+            return ML_(CfiExpr_CfiReg)( dstxa, Creg_ARM64_SP );
+         if (dwreg == FP_REG)
+            return ML_(CfiExpr_CfiReg)( dstxa, Creg_ARM64_X29 );
+         if (dwreg == srcuc->ra_reg)
+            return ML_(CfiExpr_CfiReg)( dstxa, Creg_ARM64_X30 );
 #        elif defined(VGA_ppc32) || defined(VGA_ppc64be) \
             || defined(VGA_ppc64le)
 #        else
index 8667d123ffbb896bd2ae24c5ec007ae10329b7ba..48a92b4029f48bd33194a0dfa4c6e2df8f181e5d 100644 (file)
@@ -1002,7 +1002,9 @@ static void ppCfiReg ( CfiReg reg )
       case Creg_ARM_R15:   VG_(printf)("R15"); break;
       case Creg_ARM_R14:   VG_(printf)("R14"); break;
       case Creg_ARM_R7:    VG_(printf)("R7");  break;
+      case Creg_ARM64_SP:  VG_(printf)("SP"); break;
       case Creg_ARM64_X30: VG_(printf)("X30"); break;
+      case Creg_ARM64_X29: VG_(printf)("X29"); break;
       case Creg_MIPS_RA:   VG_(printf)("RA"); break;
       case Creg_S390_IA:   VG_(printf)("IA"); break;
       case Creg_S390_SP:   VG_(printf)("SP"); break;