* [PATCH]: Get dwarf2 working on sparc64 too.
@ 2006-04-06 0:16 David S. Miller
2006-04-08 21:01 ` Mark Kettenis
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2006-04-06 0:16 UTC (permalink / raw)
To: gdb-patches
There were two problems:
1) The sparc32 registry of the dwarf2 reg_init function has
to occur before osabi init, so that osabi can override
properly.
2) We have to mark the global registers as explicitly undefined.
Besides, they are call clobbered.
This handles the case where gcc emits a DW_CFA_GNU_window_save,
which causes the gdb dwarf2 frame code to allocate a reg set out
to 32 registers, but it only sets up entries 8 --> 16. We get ugly
warnings.
And this also enables the dwarf2 frame sniffer on sparc64/Linux.
No regressions in the test suite on both sparc32/Linux and
sparc64/Linux.
Ok to apply?
2006-04-05 David S. Miller <davem@sunset.davemloft.net>
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Append dwarf2
frame sniffer.
* sparc-tdep.c (sparc32_gdbarch_init): Make sure to call
dwarf2_frame_set_init_reg() before gdbarch_init_osabi() so
that the latter can override.
(sparc32_dwarf2_frame_init_reg): Mark global registers as
undefined.
* sparc64-tdep.c (sparc64_dwarf2_frame_init_reg): Likewise.
* Makefile.in (sparc64-linux-tdep.o): Update dependencies.
--- ./sparc64-linux-tdep.c.~1~ 2006-04-05 12:18:50.000000000 -0700
+++ ./sparc64-linux-tdep.c 2006-04-05 14:27:31.000000000 -0700
@@ -22,6 +22,7 @@
#include "defs.h"
#include "frame.h"
#include "frame-unwind.h"
+#include "dwarf2-frame.h"
#include "gdbarch.h"
#include "osabi.h"
#include "solib-svr4.h"
@@ -106,6 +107,9 @@ sparc64_linux_init_abi (struct gdbarch_i
tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe);
+ /* Hook in the DWARF CFI frame unwinder. */
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+
sparc64_init_abi (info, gdbarch);
/* GNU/Linux has SVR4-style shared libraries... */
--- ./sparc-tdep.c.~1~ 2006-04-05 12:07:20.000000000 -0700
+++ ./sparc-tdep.c 2006-04-05 16:48:44.000000000 -0700
@@ -1029,6 +1029,15 @@ sparc32_dwarf2_frame_init_reg (struct gd
don't warn about that. */
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
break;
+ case SPARC_G1_REGNUM:
+ case SPARC_G2_REGNUM:
+ case SPARC_G3_REGNUM:
+ case SPARC_G4_REGNUM:
+ case SPARC_G5_REGNUM:
+ case SPARC_G6_REGNUM:
+ case SPARC_G7_REGNUM:
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ break;
case SPARC_SP_REGNUM:
reg->how = DWARF2_FRAME_REG_CFA;
break;
@@ -1296,14 +1305,14 @@ sparc32_gdbarch_init (struct gdbarch_inf
frame_base_set_default (gdbarch, &sparc32_frame_base);
- /* Hook in ABI-specific overrides, if they have been registered. */
- gdbarch_init_osabi (info, gdbarch);
-
/* Hook in the DWARF CFI frame unwinder. */
dwarf2_frame_set_init_reg (gdbarch, sparc32_dwarf2_frame_init_reg);
/* FIXME: kettenis/20050423: Don't enable the unwinder until the
StackGhost issues have been resolved. */
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
+
frame_unwind_append_sniffer (gdbarch, sparc32_frame_sniffer);
/* If we have register sets, enable the generic core file support. */
--- ./sparc64-tdep.c.~1~ 2006-04-05 11:59:49.000000000 -0700
+++ ./sparc64-tdep.c 2006-04-05 16:48:18.000000000 -0700
@@ -1117,6 +1117,15 @@ sparc64_dwarf2_frame_init_reg (struct gd
don't warn about that. */
reg->how = DWARF2_FRAME_REG_SAME_VALUE;
break;
+ case SPARC_G1_REGNUM:
+ case SPARC_G2_REGNUM:
+ case SPARC_G3_REGNUM:
+ case SPARC_G4_REGNUM:
+ case SPARC_G5_REGNUM:
+ case SPARC_G6_REGNUM:
+ case SPARC_G7_REGNUM:
+ reg->how = DWARF2_FRAME_REG_UNDEFINED;
+ break;
case SPARC_SP_REGNUM:
reg->how = DWARF2_FRAME_REG_CFA;
break;
--- ./Makefile.in.~1~ 2006-04-05 15:55:07.000000000 -0700
+++ ./Makefile.in 2006-04-05 16:50:56.000000000 -0700
@@ -2616,8 +2616,9 @@ sparc64-linux-nat.o: sparc64-linux-nat.c
$(gregset_h) $(sparc64_tdep_h) $(sparc_tdep_h) \
$(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
- $(frame_unwind_h) $(gdbarch_h) $(osabi_h) $(solib_svr4_h) \
- $(symtab_h) $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
+ $(frame_unwind_h) $(dwarf2_frame_h) $(gdbarch_h) $(osabi_h) \
+ $(solib_svr4_h) $(symtab_h) $(trad_frame_h) $(tramp_frame_h) \
+ $(sparc64_tdep_h)
sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH]: Get dwarf2 working on sparc64 too.
2006-04-06 0:16 [PATCH]: Get dwarf2 working on sparc64 too David S. Miller
@ 2006-04-08 21:01 ` Mark Kettenis
2006-04-08 22:16 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: Mark Kettenis @ 2006-04-08 21:01 UTC (permalink / raw)
To: davem; +Cc: gdb-patches
> Date: Wed, 05 Apr 2006 17:15:55 -0700 (PDT)
> From: "David S. Miller" <davem@davemloft.net>
>
> There were two problems:
>
> 1) The sparc32 registry of the dwarf2 reg_init function has
> to occur before osabi init, so that osabi can override
> properly.
Duh, yes.
> 2) We have to mark the global registers as explicitly undefined.
> Besides, they are call clobbered.
>
> This handles the case where gcc emits a DW_CFA_GNU_window_save,
> which causes the gdb dwarf2 frame code to allocate a reg set out
> to 32 registers, but it only sets up entries 8 --> 16. We get ugly
> warnings.
This looks wrong to me. For one thing %g2, %g3, %g6 and %g7 are *not*
call clobbered according to SCD 2.4.1. And I fail to see why
DW_CFA_GNU_window_save has anything to do with the global registers,
since window saves only affect the other 24 general purpose registers.
What are the ugly warnings that you're trying to fix?
> 2006-04-05 David S. Miller <davem@sunset.davemloft.net>
>
> * sparc64-linux-tdep.c (sparc64_linux_init_abi): Append dwarf2
> frame sniffer.
> * sparc-tdep.c (sparc32_gdbarch_init): Make sure to call
> dwarf2_frame_set_init_reg() before gdbarch_init_osabi() so
> that the latter can override.
> (sparc32_dwarf2_frame_init_reg): Mark global registers as
> undefined.
> * sparc64-tdep.c (sparc64_dwarf2_frame_init_reg): Likewise.
> * Makefile.in (sparc64-linux-tdep.o): Update dependencies.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH]: Get dwarf2 working on sparc64 too.
2006-04-08 21:01 ` Mark Kettenis
@ 2006-04-08 22:16 ` David S. Miller
2006-04-08 23:03 ` David S. Miller
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2006-04-08 22:16 UTC (permalink / raw)
To: mark.kettenis; +Cc: gdb-patches
From: Mark Kettenis <mark.kettenis@xs4all.nl>
Date: Sat, 8 Apr 2006 23:00:21 +0200 (CEST)
> This looks wrong to me. For one thing %g2, %g3, %g6 and %g7 are *not*
> call clobbered according to SCD 2.4.1. And I fail to see why
> DW_CFA_GNU_window_save has anything to do with the global registers,
> since window saves only affect the other 24 general purpose registers.
The code for DW_CFA_GNU_window_save explicitly initializes registers
8 and later, this leaves %g1-%g7 unintiialized.
> What are the ugly warnings that you're trying to fix?
The one generated here in dwarf2-frame.c:dwarf2_frame_cache():
if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
{
if (cache->reg[regnum].how == DWARF2_FRAME_REG_UNSPECIFIED)
complaint (&symfile_complaints, _("\
incomplete CFI data; unspecified registers (e.g., %s) at 0x%s"),
gdbarch_register_name (gdbarch, regnum),
paddr_nz (fs->pc));
}
It will be generated for every global register (other than %g0 which
we already explicitly mark on Sparc) without my change.
There is also no real reason for GCC to emit explicit entries for the
global registers. Global registers are used as function local
temporaries and are volatile across by calls.
Given all of the above, I think my change makes sense.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH]: Get dwarf2 working on sparc64 too.
2006-04-08 22:16 ` David S. Miller
@ 2006-04-08 23:03 ` David S. Miller
2006-04-09 7:17 ` Mark Kettenis
0 siblings, 1 reply; 5+ messages in thread
From: David S. Miller @ 2006-04-08 23:03 UTC (permalink / raw)
To: mark.kettenis; +Cc: gdb-patches
From: "David S. Miller" <davem@davemloft.net>
Date: Sat, 08 Apr 2006 15:16:11 -0700 (PDT)
Actually...
> The one generated here in dwarf2-frame.c:dwarf2_frame_cache():
>
> if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED)
> {
> if (cache->reg[regnum].how == DWARF2_FRAME_REG_UNSPECIFIED)
> complaint (&symfile_complaints, _("\
> incomplete CFI data; unspecified registers (e.g., %s) at 0x%s"),
> gdbarch_register_name (gdbarch, regnum),
> paddr_nz (fs->pc));
> }
>
> It will be generated for every global register (other than %g0 which
> we already explicitly mark on Sparc) without my change.
I went back and I'm having trouble reproducing this issue right now.
Really strange.
So let's just do the obvious stuff since the testsuite works fine
and doesn't generate the warnings anymore on Sparc/Linux with the
following patch.
Ok to apply?
We can investigate the global register stuff later if it pops up
again.
Thanks a bunch for your reviewing efforts Mark.
2006-04-08 David S. Miller <davem@sunset.davemloft.net>
* sparc64-linux-tdep.c (sparc64_linux_init_abi): Append dwarf2
frame sniffer.
* sparc-tdep.c (sparc32_gdbarch_init): Make sure to call
dwarf2_frame_set_init_reg() before gdbarch_init_osabi() so
that the latter can override.
* Makefile.in (sparc64-linux-tdep.o): Update dependencies.
Index: sparc-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
retrieving revision 1.170
diff -u -p -r1.170 sparc-tdep.c
--- sparc-tdep.c 5 Apr 2006 20:01:19 -0000 1.170
+++ sparc-tdep.c 8 Apr 2006 22:57:48 -0000
@@ -1296,14 +1296,14 @@ sparc32_gdbarch_init (struct gdbarch_inf
frame_base_set_default (gdbarch, &sparc32_frame_base);
- /* Hook in ABI-specific overrides, if they have been registered. */
- gdbarch_init_osabi (info, gdbarch);
-
/* Hook in the DWARF CFI frame unwinder. */
dwarf2_frame_set_init_reg (gdbarch, sparc32_dwarf2_frame_init_reg);
/* FIXME: kettenis/20050423: Don't enable the unwinder until the
StackGhost issues have been resolved. */
+ /* Hook in ABI-specific overrides, if they have been registered. */
+ gdbarch_init_osabi (info, gdbarch);
+
frame_unwind_append_sniffer (gdbarch, sparc32_frame_sniffer);
/* If we have register sets, enable the generic core file support. */
Index: sparc64-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-linux-tdep.c,v
retrieving revision 1.13
diff -u -p -r1.13 sparc64-linux-tdep.c
--- sparc64-linux-tdep.c 8 Apr 2006 21:15:26 -0000 1.13
+++ sparc64-linux-tdep.c 8 Apr 2006 22:57:48 -0000
@@ -22,6 +22,7 @@
#include "defs.h"
#include "frame.h"
#include "frame-unwind.h"
+#include "dwarf2-frame.h"
#include "regset.h"
#include "regcache.h"
#include "gdbarch.h"
@@ -195,6 +196,9 @@ sparc64_linux_init_abi (struct gdbarch_i
tramp_frame_prepend_unwinder (gdbarch, &sparc64_linux_rt_sigframe);
+ /* Hook in the DWARF CFI frame unwinder. */
+ frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
+
sparc64_init_abi (info, gdbarch);
/* GNU/Linux has SVR4-style shared libraries... */
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.806
diff -u -p -r1.806 Makefile.in
--- Makefile.in 8 Apr 2006 21:15:26 -0000 1.806
+++ Makefile.in 8 Apr 2006 23:01:13 -0000
@@ -2616,9 +2616,9 @@ sparc64-linux-nat.o: sparc64-linux-nat.c
$(gregset_h) $(sparc64_tdep_h) $(sparc_tdep_h) \
$(sparc_nat_h) $(inferior_h) $(target_h) $(linux_nat_h)
sparc64-linux-tdep.o: sparc64-linux-tdep.c $(defs_h) $(frame_h) \
- $(frame_unwind_h) $(regset_h) $(regcache_h) $(gdbarch_h) \
- $(gdbcore_h) $(osabi_h) $(solib_svr4_h) $(symtab_h) $(trad_frame_h) \
- $(tramp_frame_h) $(sparc64_tdep_h)
+ $(frame_unwind_h) $(dwarf2-frame_h) $(regset_h) $(regcache_h) \
+ $(gdbarch_h) $(gdbcore_h) $(osabi_h) $(solib_svr4_h) $(symtab_h) \
+ $(trad_frame_h) $(tramp_frame_h) $(sparc64_tdep_h)
sparc64-nat.o: sparc64-nat.c $(defs_h) $(gdbarch_h) $(sparc64_tdep_h) \
$(sparc_nat_h)
sparc64nbsd-nat.o: sparc64nbsd-nat.c $(defs_h) $(regcache_h) $(target_h) \
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH]: Get dwarf2 working on sparc64 too.
2006-04-08 23:03 ` David S. Miller
@ 2006-04-09 7:17 ` Mark Kettenis
0 siblings, 0 replies; 5+ messages in thread
From: Mark Kettenis @ 2006-04-09 7:17 UTC (permalink / raw)
To: davem; +Cc: gdb-patches
> Date: Sat, 08 Apr 2006 16:03:42 -0700 (PDT)
> From: "David S. Miller" <davem@davemloft.net>
>
> So let's just do the obvious stuff since the testsuite works fine
> and doesn't generate the warnings anymore on Sparc/Linux with the
> following patch.
>
> Ok to apply?
Sure.
> We can investigate the global register stuff later if it pops up
> again.
>
> Thanks a bunch for your reviewing efforts Mark.
No problem.
> 2006-04-08 David S. Miller <davem@sunset.davemloft.net>
>
> * sparc64-linux-tdep.c (sparc64_linux_init_abi): Append dwarf2
> frame sniffer.
> * sparc-tdep.c (sparc32_gdbarch_init): Make sure to call
> dwarf2_frame_set_init_reg() before gdbarch_init_osabi() so
> that the latter can override.
> * Makefile.in (sparc64-linux-tdep.o): Update dependencies.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-04-09 7:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-04-06 0:16 [PATCH]: Get dwarf2 working on sparc64 too David S. Miller
2006-04-08 21:01 ` Mark Kettenis
2006-04-08 22:16 ` David S. Miller
2006-04-08 23:03 ` David S. Miller
2006-04-09 7:17 ` Mark Kettenis
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox