This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[COMMIT] Some sparc64 DWARF2 unwinder support code
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: gdb-patches at sourceware dot org
- Cc: davem at davemloft dot net
- Date: Sat, 23 Apr 2005 17:42:19 +0200 (CEST)
- Subject: [COMMIT] Some sparc64 DWARF2 unwinder support code
The last bit of missing support code. Due to issues with StackGhost I
cannot enable the DWARF2 unwinder for all targets, but with this code
present, it's possible to enable it on an individual basis without
duplicating the support code.
Dave, consider a patch that enables the DWARF2 unwinder for 64-bit
Linux pre-approved.
Mark
Index: ChangeLog
from Mark Kettenis <kettenis@gnu.org>
* sparc64-tdep.c: Include "dwarf2-frame.h".
(sparc64_dwarf2_frame_init_reg): New function.
* Makefile.in (sparc64-tdep.o): Update dependencies.
Index: sparc64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/sparc64-tdep.c,v
retrieving revision 1.21
diff -u -p -r1.21 sparc64-tdep.c
--- sparc64-tdep.c 28 Mar 2005 13:42:49 -0000 1.21
+++ sparc64-tdep.c 23 Apr 2005 15:33:52 -0000
@@ -21,6 +21,7 @@
#include "defs.h"
#include "arch-utils.h"
+#include "dwarf2-frame.h"
#include "floatformat.h"
#include "frame.h"
#include "frame-base.h"
@@ -1103,6 +1104,32 @@ sparc64_return_value (struct gdbarch *gd
}
+static void
+sparc64_dwarf2_frame_init_reg (struct gdbarch *gdbarch, int regnum,
+ struct dwarf2_frame_state_reg *reg)
+{
+ switch (regnum)
+ {
+ case SPARC_G0_REGNUM:
+ /* Since %g0 is always zero, there is no point in saving it, and
+ people will be inclined omit it from the CFI. Make sure we
+ don't warn about that. */
+ reg->how = DWARF2_FRAME_REG_SAME_VALUE;
+ break;
+ case SPARC_SP_REGNUM:
+ reg->how = DWARF2_FRAME_REG_CFA;
+ break;
+ case SPARC64_PC_REGNUM:
+ reg->how = DWARF2_FRAME_REG_RA_OFFSET;
+ reg->loc.offset = 8;
+ break;
+ case SPARC64_NPC_REGNUM:
+ reg->how = DWARF2_FRAME_REG_RA_OFFSET;
+ reg->loc.offset = 12;
+ break;
+ }
+}
+
void
sparc64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
{
@@ -1137,6 +1164,11 @@ sparc64_init_abi (struct gdbarch_info in
set_gdbarch_skip_prologue (gdbarch, sparc64_skip_prologue);
+ /* Hook in the DWARF CFI frame unwinder. */
+ dwarf2_frame_set_init_reg (gdbarch, sparc64_dwarf2_frame_init_reg);
+ /* FIXME: kettenis/20050423: Don't enable the unwinder until the
+ StackGhost issues have been resolved. */
+
frame_unwind_append_sniffer (gdbarch, sparc64_frame_sniffer);
frame_base_set_default (gdbarch, &sparc64_frame_base);
}