Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Use DWARF CFI frame unwinder on powerpc
@ 2006-05-09 14:16 Andreas Schwab
  2006-05-09 17:17 ` PAUL GILLIAM
  2006-05-15 16:46 ` Daniel Jacobowitz
  0 siblings, 2 replies; 11+ messages in thread
From: Andreas Schwab @ 2006-05-09 14:16 UTC (permalink / raw)
  To: gdb-patches

Together with the previous patch this enables the use of the DWARF CFI
frame unwinder on powerpc.  This fixes the following testsuite failures:

-FAIL: gdb.base/break.exp: next over recursive call
-FAIL: gdb.base/break.exp: backtrace from factorial(5.1)
-FAIL: gdb.base/recurse.exp: continue to recurse (a = 4)
-FAIL: gdb.base/recurse.exp: continue to recurse (a = 3)
-FAIL: gdb.base/recurse.exp: continue to recurse (a = 2)
-FAIL: gdb.base/recurse.exp: continue to recurse (a = 1)
-FAIL: gdb.base/recurse.exp: continue to second instance watchpoint, second time
-FAIL: gdb.base/recurse.exp: second instance watchpoint deleted when leaving scope
-FAIL: gdb.base/recurse.exp: continue to first instance watchpoint, second time
-FAIL: gdb.base/recurse.exp: first instance watchpoint deleted when leaving scope
-FAIL: gdb.base/sepdebug.exp: next over recursive call
-FAIL: gdb.base/sepdebug.exp: backtrace from factorial(5.1)

without any new regressions.  Tested with powerpc-suse-linux.

Andreas.

2006-05-09  Andreas Schwab  <schwab@suse.de>

	* rs6000-tdep.c: Include "dwarf2-frame.h".
	(rs6000_eh_frame_regnum): Define.
	(rs6000_gdbarch_init): Enable use of DWARF CFI frame unwinder.
	Register rs6000_eh_frame_regnum.

	* Makefile.in (rs6000-tdep.o): Update dependencies.

Index: gdb/Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.812
diff -u -a -p -u -p -a -r1.812 gdb/Makefile.in
--- gdb/Makefile.in	5 May 2006 22:39:12 -0000	1.812
+++ gdb/Makefile.in	9 May 2006 14:10:40 -0000
@@ -2515,7 +2515,7 @@ rs6000-tdep.o: rs6000-tdep.c $(defs_h) $
 	$(reggroups_h) $(libbfd_h) $(coff_internal_h) $(libcoff_h) \
 	$(coff_xcoff_h) $(libxcoff_h) $(elf_bfd_h) $(solib_svr4_h) \
 	$(ppc_tdep_h) $(gdb_assert_h) $(dis_asm_h) $(trad_frame_h) \
-	$(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h)
+	$(frame_unwind_h) $(frame_base_h) $(rs6000_tdep_h) $(dwarf2_frame_h)
 rs6000-aix-tdep.o: rs6000-aix-tdep.c $(defs_h) $(osabi_h) $(rs6000_tdep_h)
 s390-nat.o: s390-nat.c $(defs_h) $(tm_h) $(regcache_h) $(inferior_h) \
 	$(s390_tdep_h) $(target_h) $(linux_nat_h)
Index: gdb/rs6000-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v
retrieving revision 1.258
diff -u -a -p -u -p -a -r1.258 gdb/rs6000-tdep.c
--- gdb/rs6000-tdep.c	23 Apr 2006 14:15:01 -0000	1.258
+++ gdb/rs6000-tdep.c	9 May 2006 14:10:15 -0000
@@ -40,6 +40,7 @@
 #include "sim-regno.h"
 #include "gdb/sim-ppc.h"
 #include "reggroups.h"
+#include "dwarf2-frame.h"
 
 #include "libbfd.h"		/* for bfd_default_set_arch_mach */
 #include "coff/internal.h"	/* for libcoff.h */
@@ -2243,6 +2244,40 @@ rs6000_dwarf2_reg_to_regnum (int num)
 }
 
 
+/* Convert a .eh_frame register number to a Dwarf 2 register number.  */
+static int
+rs6000_eh_frame_regnum (struct gdbarch *gdbarch, int num)
+{
+  if (0 <= num && num <= 63)	/* r0-r31,fp0-fp31 */
+    return num;
+  else if (68 <= num && num <= 75) /* cr0-cr8 */
+    return num - 68 + 86;
+  else if (77 <= num && num <= 108) /* vr0-vr31 */
+    return num - 77 + 1124;
+  else
+    switch (num)
+      {
+      case 64: /* mq */
+	return 100;
+      case 65: /* lr */
+	return 108;
+      case 66: /* ctr */
+	return 109;
+      case 76: /* xer */
+	return 101;
+      case 109: /* vrsave */
+	return 356;
+      case 110: /* vscr */
+	return 67;
+      case 111: /* spe_acc */
+	return 99;
+      case 112: /* spefscr */
+	return 612;
+      default:
+	return num;
+      }
+}
+
 static void
 rs6000_store_return_value (struct type *type,
                            struct regcache *regcache,
@@ -3461,6 +3496,10 @@ rs6000_gdbarch_init (struct gdbarch_info
   /* Helpers for function argument information.  */
   set_gdbarch_fetch_pointer_argument (gdbarch, rs6000_fetch_pointer_argument);
 
+  /* Hook in the DWARF CFI frame unwinder.  */
+  frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+  dwarf2_frame_set_eh_frame_regnum (gdbarch, rs6000_eh_frame_regnum);
+
   /* Hook in ABI-specific overrides, if they have been registered.  */
   gdbarch_init_osabi (info, gdbarch);
 

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 14:16 Use DWARF CFI frame unwinder on powerpc Andreas Schwab
@ 2006-05-09 17:17 ` PAUL GILLIAM
  2006-05-09 17:23   ` Daniel Jacobowitz
  2006-05-09 17:46   ` Andreas Schwab
  2006-05-15 16:46 ` Daniel Jacobowitz
  1 sibling, 2 replies; 11+ messages in thread
From: PAUL GILLIAM @ 2006-05-09 17:17 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

On Tue, 2006-05-09 at 16:16 +0200, Andreas Schwab wrote:
> Together with the previous patch this enables the use of the DWARF CFI
> frame unwinder on powerpc.  

I applied your patches and gave them a spin and had a slight problem...

Here is the source for the target program:

        #include <stdio.h>
        
        void hello ()
        {
          printf ("Hello, world!\n");
        }
        
        int main()
        {
          hello();
        
          return 0;
        }
        
Here is a transcript:

        [pgilliam@dufur gdb]$ ./gdb ../../hello32
        GNU gdb 6.4.50.20060509-cvs
        Copyright (C) 2006 Free Software Foundation, Inc.
        GDB is free software, covered by the GNU General Public License,
        and you are
        welcome to change it and/or distribute copies of it under
        certain conditions.
        Type "show copying" to see the conditions.
        There is absolutely no warranty for GDB.  Type "show warranty"
        for details.
        This GDB was configured as "powerpc64-unknown-linux-gnu"...Using
        host libthread_db library "/lib/libthread_db.so.1".
        
        Setting up the environment for debugging gdb.
        Function "internal_error" not defined.
        Function "info_command" not defined.
        /home/pgilliam/gdb/tree-head/build32/gdb/.gdbinit:8: Error in
        sourced command file:
        No breakpoint number 0.
        (gdb) b hello
        Breakpoint 1 at 0x10000464: file hello.c, line 5.
        (gdb) r
        Starting program: /home/pgilliam/gdb/tree-head/hello32
        
        Breakpoint 1, hello () at hello.c:5
        5         printf ("Hello, world!\n");
        (gdb) n
>>>>During symbol reading, incomplete CFI data; unspecified registers
>>>>(e.g., r0) at 0x10000464.
        Hello, world!
        6       }
        (gdb) q
        The program is running.  Exit anyway? (y or n) y
        
Do I need a flag other then -g when compiling to get CFI data?

This was on a ppc64 system, 32-bit GDB, 32-bit target program.
I got the same results with 64-bit GDB, 32 and 64-bit target programs.

-=# Paul #=-


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 17:17 ` PAUL GILLIAM
@ 2006-05-09 17:23   ` Daniel Jacobowitz
  2006-05-09 22:26     ` PAUL GILLIAM
  2006-05-09 17:46   ` Andreas Schwab
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-05-09 17:23 UTC (permalink / raw)
  To: PAUL GILLIAM; +Cc: Andreas Schwab, gdb-patches

On Tue, May 09, 2006 at 10:18:44AM -0700, PAUL GILLIAM wrote:
>         (gdb) n
> >>>>During symbol reading, incomplete CFI data; unspecified registers
> >>>>(e.g., r0) at 0x10000464.

Don't run in the GDB directory, which has a .gdbinit file which uses
"set complaints", and you won't see this message.  For more
information, you can search the list archives - it's been discussed
many times.  See, for instance, the current S/390 and SH ports.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 17:17 ` PAUL GILLIAM
  2006-05-09 17:23   ` Daniel Jacobowitz
@ 2006-05-09 17:46   ` Andreas Schwab
  2006-05-09 18:01     ` David S. Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2006-05-09 17:46 UTC (permalink / raw)
  To: pgilliam; +Cc: gdb-patches

PAUL GILLIAM <pgilliam@us.ibm.com> writes:

>>>>>During symbol reading, incomplete CFI data; unspecified registers
>>>>>(e.g., r0) at 0x10000464.

That is presumably a gcc problem:

	/* NOTE: cagney/2003-09-05: CFI should specify the disposition
	   of all debug info registers.  If it doesn't, complain (but
	   not too loudly).  It turns out that GCC assumes that an
	   unspecified register implies "same value" when CFI (draft
	   7) specifies nothing at all.  Such a register could equally
	   be interpreted as "undefined".  Also note that this check
	   isn't sufficient; it only checks that all registers in the
	   range [0 .. max column] are specified, and won't detect
	   problems when a debug info register falls outside of the
	   table.  We need a way of iterating through all the valid
	   DWARF2 register numbers.  */

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 17:46   ` Andreas Schwab
@ 2006-05-09 18:01     ` David S. Miller
  2006-05-09 18:39       ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: David S. Miller @ 2006-05-09 18:01 UTC (permalink / raw)
  To: schwab; +Cc: pgilliam, gdb-patches

From: Andreas Schwab <schwab@suse.de>
Date: Tue, 09 May 2006 19:46:13 +0200

> That is presumably a gcc problem:
> 
> 	/* NOTE: cagney/2003-09-05: CFI should specify the disposition
> 	   of all debug info registers.  If it doesn't, complain (but
> 	   not too loudly).  It turns out that GCC assumes that an
> 	   unspecified register implies "same value" when CFI (draft
> 	   7) specifies nothing at all.  Such a register could equally
> 	   be interpreted as "undefined".  Also note that this check
> 	   isn't sufficient; it only checks that all registers in the
> 	   range [0 .. max column] are specified, and won't detect
> 	   problems when a debug info register falls outside of the
> 	   table.  We need a way of iterating through all the valid
> 	   DWARF2 register numbers.  */
> 
> Andreas.

I really think this warning message should be off by default,
9 times out of 10 when it triggers the situation is completely
harmless.


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 18:01     ` David S. Miller
@ 2006-05-09 18:39       ` Daniel Jacobowitz
  2006-05-09 21:07         ` David S. Miller
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-05-09 18:39 UTC (permalink / raw)
  To: David S. Miller; +Cc: schwab, pgilliam, gdb-patches

On Tue, May 09, 2006 at 11:00:14AM -0700, David S. Miller wrote:
> I really think this warning message should be off by default,
> 9 times out of 10 when it triggers the situation is completely
> harmless.

It is :-)

See my earlier comment: GDB hackers run into this message a lot,
because GDB's default gdbinit turns it on.  GCC hackers do too:

# Make gdb complain about symbol reading errors.  This is so that gcc
# developers can see and fix bugs in gcc debug output.
set complaints 20


-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 18:39       ` Daniel Jacobowitz
@ 2006-05-09 21:07         ` David S. Miller
  0 siblings, 0 replies; 11+ messages in thread
From: David S. Miller @ 2006-05-09 21:07 UTC (permalink / raw)
  To: drow; +Cc: schwab, pgilliam, gdb-patches

From: Daniel Jacobowitz <drow@false.org>
Date: Tue, 9 May 2006 14:38:50 -0400

> See my earlier comment: GDB hackers run into this message a lot,
> because GDB's default gdbinit turns it on.

Sorry I didn't notice this.  Thanks for pointing this out (again) :-)


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 17:23   ` Daniel Jacobowitz
@ 2006-05-09 22:26     ` PAUL GILLIAM
  0 siblings, 0 replies; 11+ messages in thread
From: PAUL GILLIAM @ 2006-05-09 22:26 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: Andreas Schwab, gdb-patches

On Tue, 2006-05-09 at 13:23 -0400, Daniel Jacobowitz wrote:
> On Tue, May 09, 2006 at 10:18:44AM -0700, PAUL GILLIAM wrote:
> >         (gdb) n
> > >>>>During symbol reading, incomplete CFI data; unspecified registers
> > >>>>(e.g., r0) at 0x10000464.
> 
> Don't run in the GDB directory, which has a .gdbinit file which uses
> "set complaints", and you won't see this message.  For more
> information, you can search the list archives - it's been discussed
> many times.  See, for instance, the current S/390 and SH ports.
> 

Oops!  Sorry,

-=# Paul #=-

(And here I thought I was being such a good community member :-)


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-09 14:16 Use DWARF CFI frame unwinder on powerpc Andreas Schwab
  2006-05-09 17:17 ` PAUL GILLIAM
@ 2006-05-15 16:46 ` Daniel Jacobowitz
  2006-05-15 19:10   ` Mark Kettenis
  1 sibling, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-05-15 16:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

On Tue, May 09, 2006 at 04:16:00PM +0200, Andreas Schwab wrote:
> Together with the previous patch this enables the use of the DWARF CFI
> frame unwinder on powerpc.  This fixes the following testsuite failures:
> 
> -FAIL: gdb.base/break.exp: next over recursive call
> -FAIL: gdb.base/break.exp: backtrace from factorial(5.1)
> -FAIL: gdb.base/recurse.exp: continue to recurse (a = 4)
> -FAIL: gdb.base/recurse.exp: continue to recurse (a = 3)
> -FAIL: gdb.base/recurse.exp: continue to recurse (a = 2)
> -FAIL: gdb.base/recurse.exp: continue to recurse (a = 1)
> -FAIL: gdb.base/recurse.exp: continue to second instance watchpoint, second time
> -FAIL: gdb.base/recurse.exp: second instance watchpoint deleted when leaving scope
> -FAIL: gdb.base/recurse.exp: continue to first instance watchpoint, second time
> -FAIL: gdb.base/recurse.exp: first instance watchpoint deleted when leaving scope
> -FAIL: gdb.base/sepdebug.exp: next over recursive call
> -FAIL: gdb.base/sepdebug.exp: backtrace from factorial(5.1)
> 
> without any new regressions.  Tested with powerpc-suse-linux.
> 
> Andreas.
> 
> 2006-05-09  Andreas Schwab  <schwab@suse.de>
> 
> 	* rs6000-tdep.c: Include "dwarf2-frame.h".
> 	(rs6000_eh_frame_regnum): Define.
> 	(rs6000_gdbarch_init): Enable use of DWARF CFI frame unwinder.
> 	Register rs6000_eh_frame_regnum.
> 
> 	* Makefile.in (rs6000-tdep.o): Update dependencies.

Hi Andreas,

I know we tried to do this once before, and ran into hiccups based on
the GCC numbering being inconsistent.  Do we know which versions of GCC
this is likely to work with, and which are likely to make it fall down
horribly?  I recall that GPRs were OK, but the numbering for LR was
ambiguous.

It might have been this:
2004-01-21  Alan Modra  <amodra@bigpond.net.au>

        * config/rs6000/sysv4.h (DWARF2_FRAME_REG_OUT): Define.
        * dwarf2out.c (output_cfi): Map regs using DWARF2_FRAME_REG_OUT.
        * doc/tm.texi (DWARF_FRAME_REGNUM, DWARF2_FRAME_REG_OUT): Document.

Yep, here's Mark K. and Alan discussing it:
  http://gcc.gnu.org/ml/gcc/2004-01/msg00025.html

I'm worried that since we don't currently use the "this is the unwind
column" to indicate where lr lives in the table, although we could,
we'll break on pre-3.4-ish(?) binaries.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-15 16:46 ` Daniel Jacobowitz
@ 2006-05-15 19:10   ` Mark Kettenis
  2006-05-15 20:43     ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Kettenis @ 2006-05-15 19:10 UTC (permalink / raw)
  To: drow; +Cc: schwab, gdb-patches

> Date: Mon, 15 May 2006 12:12:13 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> Hi Andreas,
> 
> I know we tried to do this once before, and ran into hiccups based on
> the GCC numbering being inconsistent.  Do we know which versions of GCC
> this is likely to work with, and which are likely to make it fall down
> horribly?  I recall that GPRs were OK, but the numbering for LR was
> ambiguous.
> 
> It might have been this:
> 2004-01-21  Alan Modra  <amodra@bigpond.net.au>
> 
>         * config/rs6000/sysv4.h (DWARF2_FRAME_REG_OUT): Define.
>         * dwarf2out.c (output_cfi): Map regs using DWARF2_FRAME_REG_OUT.
>         * doc/tm.texi (DWARF_FRAME_REGNUM, DWARF2_FRAME_REG_OUT): Document.
> 
> Yep, here's Mark K. and Alan discussing it:
>   http://gcc.gnu.org/ml/gcc/2004-01/msg00025.html
> 
> I'm worried that since we don't currently use the "this is the unwind
> column" to indicate where lr lives in the table, although we could,
> we'll break on pre-3.4-ish(?) binaries.

Just verified that Andreas' patch breaks GDB on OpenBSD/macppc 3.9
which uses GCC 3.3.5 :(.  I'm afraid this means we can't
unconditionally enable the dwarf2 unwinder on all powerpc targets.
Selectively enabling them on platforms that are unlikely to have ever
used GCC versions before 3.4 should be fine.  I think all 64-bit
powerpc targets should be fine.

I'll have a look at what's needed to make things work for the old
unwind information.

Mark


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

* Re: Use DWARF CFI frame unwinder on powerpc
  2006-05-15 19:10   ` Mark Kettenis
@ 2006-05-15 20:43     ` Daniel Jacobowitz
  0 siblings, 0 replies; 11+ messages in thread
From: Daniel Jacobowitz @ 2006-05-15 20:43 UTC (permalink / raw)
  To: Mark Kettenis; +Cc: schwab, gdb-patches

On Mon, May 15, 2006 at 09:06:14PM +0200, Mark Kettenis wrote:
> I'll have a look at what's needed to make things work for the old
> unwind information.

Thanks!

-- 
Daniel Jacobowitz
CodeSourcery


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

end of thread, other threads:[~2006-05-15 19:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-09 14:16 Use DWARF CFI frame unwinder on powerpc Andreas Schwab
2006-05-09 17:17 ` PAUL GILLIAM
2006-05-09 17:23   ` Daniel Jacobowitz
2006-05-09 22:26     ` PAUL GILLIAM
2006-05-09 17:46   ` Andreas Schwab
2006-05-09 18:01     ` David S. Miller
2006-05-09 18:39       ` Daniel Jacobowitz
2006-05-09 21:07         ` David S. Miller
2006-05-15 16:46 ` Daniel Jacobowitz
2006-05-15 19:10   ` Mark Kettenis
2006-05-15 20:43     ` Daniel Jacobowitz

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