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

* Re: [patch] Handle signed addresses in the dwarf2 unwinder
  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-05-14 17:20 ` Daniel Jacobowitz
  1 sibling, 1 reply; 5+ messages in thread
From: Maciej W. Rozycki @ 2007-04-30 13:03 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches, Maciej W. Rozycki

On Sat, 28 Apr 2007, Daniel Jacobowitz wrote:

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

 You can use the newlib configuration and the sde64 target board, like 
e.g.:

$ .../configure --target=mipsisa32-sde-elf
$ make
$ (cd gdb && make check//mips-sim-sde64/-EB)

Or if it does not work for you, then perhaps I could check if your patch 
does not break anything for me.

 OTOH, I don't seem to have a change like this in my queue and we have 
used DWARF-2 successfully for some time, including testing for n32 
targets.

  Maciej


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

* Re: [patch] Handle signed addresses in the dwarf2 unwinder
  2007-04-30 13:03 ` Maciej W. Rozycki
@ 2007-04-30 13:16   ` Daniel Jacobowitz
  2007-04-30 13:21     ` Maciej W. Rozycki
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-04-30 13:16 UTC (permalink / raw)
  To: Maciej W. Rozycki; +Cc: gdb-patches, Maciej W. Rozycki

On Mon, Apr 30, 2007 at 01:59:50PM +0100, Maciej W. Rozycki wrote:
> On Sat, 28 Apr 2007, Daniel Jacobowitz wrote:
> 
> > 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).
> 
>  You can use the newlib configuration and the sde64 target board, like 
> e.g.:
> 
> $ .../configure --target=mipsisa32-sde-elf
> $ make
> $ (cd gdb && make check//mips-sim-sde64/-EB)

Where's that board file supposed to come from?  It's not in the latest
dejagnu I checked.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: [patch] Handle signed addresses in the dwarf2 unwinder
  2007-04-30 13:16   ` Daniel Jacobowitz
@ 2007-04-30 13:21     ` Maciej W. Rozycki
  0 siblings, 0 replies; 5+ messages in thread
From: Maciej W. Rozycki @ 2007-04-30 13:21 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches, Maciej W. Rozycki

On Mon, 30 Apr 2007, Daniel Jacobowitz wrote:

> >  You can use the newlib configuration and the sde64 target board, like 
> > e.g.:
> > 
> > $ .../configure --target=mipsisa32-sde-elf
> > $ make
> > $ (cd gdb && make check//mips-sim-sde64/-EB)
> 
> Where's that board file supposed to come from?  It's not in the latest
> dejagnu I checked.

 Oops -- it looks like it's still pending somewhere internally -- sorry 
about the noise.  I can still see if I can verify your patch somehow 
though.

  Maciej


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

* Re: [patch] Handle signed addresses in the dwarf2 unwinder
  2007-04-28 20:45 [patch] Handle signed addresses in the dwarf2 unwinder Daniel Jacobowitz
  2007-04-30 13:03 ` Maciej W. Rozycki
@ 2007-05-14 17:20 ` Daniel Jacobowitz
  1 sibling, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2007-05-14 17:20 UTC (permalink / raw)
  To: gdb-patches

On Sat, Apr 28, 2007 at 04:42:47PM -0400, Daniel Jacobowitz wrote:
> 2007-04-28  Daniel Jacobowitz  <dan@codesourcery.com>
> 
> 	* dwarf2-frame.c (read_encoded_value): Correct type.  Use
> 	DW_EH_PE_signed if appropriate.

I checked this in.

-- 
Daniel Jacobowitz
CodeSourcery


^ 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