Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: gdb-patches@sourceware.org
Subject: [patch] Handle signed addresses in the dwarf2 unwinder
Date: Sat, 28 Apr 2007 20:45:00 -0000	[thread overview]
Message-ID: <20070428204247.GA8582@caradoc.them.org> (raw)

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)
     {


             reply	other threads:[~2007-04-28 20:42 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-28 20:45 Daniel Jacobowitz [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070428204247.GA8582@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox