|
From: <sv...@va...> - 2008-02-19 12:51:27
|
Author: sewardj
Date: 2008-02-19 12:51:29 +0000 (Tue, 19 Feb 2008)
New Revision: 7425
Log:
Make Dwarf3-based local variable descriptions work at least marginally
on ppc32/64-linux.
Modified:
branches/DATASYMS/coregrind/m_debuginfo/d3basics.c
branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h
branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c
branches/DATASYMS/coregrind/m_stacktrace.c
Modified: branches/DATASYMS/coregrind/m_debuginfo/d3basics.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/d3basics.c 2008-02-18 02:16:22 UTC (rev 7424)
+++ branches/DATASYMS/coregrind/m_debuginfo/d3basics.c 2008-02-19 12:51:29 UTC (rev 7425)
@@ -379,6 +379,16 @@
# elif defined(VGP_x86_linux)
if (regno == 5/*EBP*/) { *a = regs->fp; return True; }
if (regno == 4/*ESP*/) { *a = regs->sp; return True; }
+# elif defined(VGP_ppc32_linux)
+ if (regno == 1/*SP*/) { *a = regs->sp; return True; }
+ VG_(printf)("get_Dwarf_Reg(ppc32-linux)(%ld)\n", regno);
+ if (regno == 31) return False;
+ vg_assert(0);
+# elif defined(VGP_ppc64_linux)
+ if (regno == 1/*SP*/) { *a = regs->sp; return True; }
+ VG_(printf)("get_Dwarf_Reg(ppc64-linux)(%ld)\n", regno);
+ if (regno == 31) return False;
+ vg_assert(0);
# else
# error "Unknown platform"
# endif
@@ -490,6 +500,12 @@
a1 += sw1;
PUSH( a1 );
break;
+ /* As per comment on DW_OP_breg*, the following denote that
+ the value in question is in a register, not in memory. So
+ we simply return failure. */
+ case DW_OP_reg0 ... DW_OP_reg31:
+ FAIL("evaluate_Dwarf3_Expr: DW_OP_reg* (value is in a register)");
+ break;
case DW_OP_plus_uconst:
POP(uw1);
uw1 += (UWord)read_leb128U( &expr );
@@ -498,8 +514,8 @@
default:
if (!VG_(clo_xml))
VG_(message)(Vg_DebugMsg,
- "Warning: DWARF3 CFI reader: unhandled DW_OP_ "
- "opcode 0x%x", (Int)opcode);
+ "warning: evaluate_Dwarf3_Expr: unhandled "
+ "DW_OP_ 0x%x", (Int)opcode);
FAIL("evaluate_Dwarf3_Expr: unhandled DW_OP_");
/*NOTREACHED*/
}
Modified: branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h 2008-02-18 02:16:22 UTC (rev 7424)
+++ branches/DATASYMS/coregrind/m_debuginfo/priv_d3basics.h 2008-02-19 12:51:29 UTC (rev 7425)
@@ -589,7 +589,8 @@
require knowing a suitably contextualising set of values for the
instruction, frame and stack pointers (and, in general, all
registers, though we punt on such generality here). Here's a
- struct to carry the bare essentials. */
+ struct to carry the bare essentials. ip, fp and sp are expected to
+ be provided for all platforms. */
typedef
struct { Addr ip; Addr sp; Addr fp; }
RegSummary;
Modified: branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c
===================================================================
--- branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c 2008-02-18 02:16:22 UTC (rev 7424)
+++ branches/DATASYMS/coregrind/m_debuginfo/readdwarf.c 2008-02-19 12:51:29 UTC (rev 7425)
@@ -1530,7 +1530,7 @@
the CFA].
JRS: on amd64, the dwarf register numbering is, as per
- gdb-6.3/gdb/tdep-amd64.c and also amd64-abi-0.98.pdf:
+ gdb-6.3/gdb/amd64-tdep.c and also amd64-abi-0.98.pdf:
0 1 2 3 4 5 6 7
RAX RDX RCX RBX RSI RDI RBP RSP
Modified: branches/DATASYMS/coregrind/m_stacktrace.c
===================================================================
--- branches/DATASYMS/coregrind/m_stacktrace.c 2008-02-18 02:16:22 UTC (rev 7424)
+++ branches/DATASYMS/coregrind/m_stacktrace.c 2008-02-19 12:51:29 UTC (rev 7425)
@@ -330,7 +330,7 @@
# undef M_VG_ERRTXT
}
- if (sps) sps[0] = sp;
+ if (sps) sps[0] = fp; /* NB. not sp */
if (fps) fps[0] = fp;
ips[0] = ip;
i = 1;
@@ -389,7 +389,7 @@
# endif
fp = (((UWord*)fp)[0]);
- if (sps) sps[i] = sp;
+ if (sps) sps[i] = fp; /* NB. not sp */
if (fps) fps[i] = fp;
ips[i++] = ip;
if (debug)
|