Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] Handle signed addresses in the dwarf2 unwinder
@ 2007-04-28 20:45 Daniel Jacobowitz
  2007-04-30 13:03 ` Maciej W. Rozycki
  2007-05-14 17:20 ` Daniel Jacobowitz
  0 siblings, 2 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-04-28 20:45 UTC (permalink / raw)
  To: gdb-patches

This is along the same lines as a patch Kevin wrote (and Martin Hunt
submitted) several years ago.  If we have a MIPS binary with 32-bit
addresses, but a 64-bit CORE_ADDR, we should sign extend as necessary.

Unfortunately mips-linux testing doesn't really cover this; userspace
binaries sit below 0x80000000.  However, I'm pretty sure this is
necessary to debug programs linked above that point.  I'll check it in
when I turn on the CFI unwinder for MIPS, which will be just after we
figure out what to do about store_typed_address (my last message).

Tested on mips64-linux o32 / n32 / n64.

-- 
Daniel Jacobowitz
CodeSourcery

2007-04-28  Daniel Jacobowitz  <dan@codesourcery.com>

	* dwarf2-frame.c (read_encoded_value): Correct type.  Use
	DW_EH_PE_signed if appropriate.

---
 dwarf2-frame.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Index: gdb/dwarf2-frame.c
===================================================================
--- gdb.orig/dwarf2-frame.c	2007-04-27 17:42:37.000000000 -0400
+++ gdb/dwarf2-frame.c	2007-04-27 19:27:15.000000000 -0400
@@ -1446,7 +1446,7 @@ read_encoded_value (struct comp_unit *un
       base = 0;
       break;
     case DW_EH_PE_pcrel:
-      base = bfd_get_section_vma (unit->bfd, unit->dwarf_frame_section);
+      base = bfd_get_section_vma (unit->abfd, unit->dwarf_frame_section);
       base += (buf - unit->dwarf_frame_buffer);
       break;
     case DW_EH_PE_datarel:
@@ -1477,7 +1477,11 @@ read_encoded_value (struct comp_unit *un
     }
 
   if ((encoding & 0x07) == 0x00)
-    encoding |= encoding_for_size (ptr_len);
+    {
+      encoding |= encoding_for_size (ptr_len);
+      if (bfd_get_sign_extend_vma (unit->abfd))
+	encoding |= DW_EH_PE_signed;
+    }
 
   switch (encoding & 0x0f)
     {


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2007-05-14 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-28 20:45 [patch] Handle signed addresses in the dwarf2 unwinder Daniel Jacobowitz
2007-04-30 13:03 ` Maciej W. Rozycki
2007-04-30 13:16   ` Daniel Jacobowitz
2007-04-30 13:21     ` Maciej W. Rozycki
2007-05-14 17:20 ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox