This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[rfa] Add some flags to tramp frame unwinder


I'd like to use the generic tramp frame code for pa targets;
unfortunately hpux decided that the signal trampoline function should
have a regular function name, so we cannot use the generic 
infrastructure (it considers code which is inside a function to be not a
trampoline).

I added some flags to the tramp_frame structure to make those checks
optional. Really, I only need the "ok_inside_function" flag, but for
completeness I added "ok_inside_section" as well.

is this ok?

randolph

2004-12-09  Randolph Chung  <tausq@debian.org>

	* tramp-frame.h (tramp_frame): Add flags for trampoline frame checks.
	* tramp-frame.c (tramp_frame_sniffer): Use new flags to control
	sniffer checks.
	* mips-linux-tdep.c (mips_linux_o32_sigframe): Initialize new flags.
	(mips_linux_o32_rt_sigframe): Likewise.
	(mips_linux_n32_rt_sigframe): Likewise.
	(mips_linux_n64_rt_sigframe): Likewise.
	* mips64obsd-tdep.c (mips64obsd_sigframe): Likewise.
	* ppcnbsd-tdep.c (ppcnbsd_sigtram): Likewise.

Index: tramp-frame.h
===================================================================
RCS file: /cvs/src/src/gdb/tramp-frame.h,v
retrieving revision 1.5
diff -u -p -r1.5 tramp-frame.h
--- tramp-frame.h	20 Jul 2004 15:11:37 -0000	1.5
+++ tramp-frame.h	9 Dec 2004 17:15:11 -0000
@@ -71,6 +71,11 @@ struct tramp_frame
 		struct frame_info *next_frame,
 		struct trad_frame_cache *this_cache,
 		CORE_ADDR func);
+  /* Typically, a trampoline is not inside a function or section, but on
+     some targets (e.g. HPUX) they can be.  Make these checks optional.  */
+  unsigned int ok_inside_function:1;
+  unsigned int ok_inside_section:1;
+
 };
 
 void tramp_frame_prepend_unwinder (struct gdbarch *gdbarch,
Index: tramp-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/tramp-frame.c,v
retrieving revision 1.7
diff -u -p -r1.7 tramp-frame.c
--- tramp-frame.c	7 Nov 2004 12:54:58 -0000	1.7
+++ tramp-frame.c	9 Dec 2004 17:15:11 -0000
@@ -128,11 +128,11 @@ tramp_frame_sniffer (const struct frame_
   /* If the function has a valid symbol name, it isn't a
      trampoline.  */
   find_pc_partial_function (pc, &name, NULL, NULL);
-  if (name != NULL)
+  if (!tramp->ok_inside_function && name != NULL)
     return 0;
   /* If the function lives in a valid section (even without a starting
      point) it isn't a trampoline.  */
-  if (find_pc_section (pc) != NULL)
+  if (!tramp->ok_inside_section && find_pc_section (pc) != NULL)
     return 0;
   /* Finally, check that the trampoline matches at PC.  */
   func = tramp_frame_start (tramp, next_frame, pc);
Index: mips-linux-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-linux-tdep.c,v
retrieving revision 1.35
diff -u -p -r1.35 mips-linux-tdep.c
--- mips-linux-tdep.c	14 Nov 2004 19:29:27 -0000	1.35
+++ mips-linux-tdep.c	9 Dec 2004 17:15:10 -0000
@@ -841,7 +841,8 @@ static const struct tramp_frame mips_lin
     { MIPS_INST_SYSCALL, -1 },
     { TRAMP_SENTINEL_INSN, -1 }
   },
-  mips_linux_o32_sigframe_init
+  mips_linux_o32_sigframe_init,
+  0, 0
 };
 
 static const struct tramp_frame mips_linux_o32_rt_sigframe = {
@@ -851,7 +852,8 @@ static const struct tramp_frame mips_lin
     { MIPS_INST_LI_V0_RT_SIGRETURN, -1 },
     { MIPS_INST_SYSCALL, -1 },
     { TRAMP_SENTINEL_INSN, -1 } },
-  mips_linux_o32_sigframe_init
+  mips_linux_o32_sigframe_init,
+  0, 0
 };
 
 static const struct tramp_frame mips_linux_n32_rt_sigframe = {
@@ -862,14 +864,16 @@ static const struct tramp_frame mips_lin
     { MIPS_INST_SYSCALL, -1 },
     { TRAMP_SENTINEL_INSN, -1 }
   },
-  mips_linux_n32n64_sigframe_init
+  mips_linux_n32n64_sigframe_init,
+  0, 0
 };
 
 static const struct tramp_frame mips_linux_n64_rt_sigframe = {
   SIGTRAMP_FRAME,
   4,
   { MIPS_INST_LI_V0_N64_RT_SIGRETURN, MIPS_INST_SYSCALL, TRAMP_SENTINEL_INSN },
-  mips_linux_n32n64_sigframe_init
+  mips_linux_n32n64_sigframe_init,
+  0, 0
 };
 
 /* *INDENT-OFF* */
Index: mips64obsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips64obsd-tdep.c,v
retrieving revision 1.2
diff -u -p -r1.2 mips64obsd-tdep.c
--- mips64obsd-tdep.c	7 Nov 2004 17:02:44 -0000	1.2
+++ mips64obsd-tdep.c	9 Dec 2004 17:15:10 -0000
@@ -125,7 +125,8 @@ static const struct tramp_frame mips64ob
     { 0x0000000d, -1 },		/* break */
     { TRAMP_SENTINEL_INSN, -1 }
   },
-  mips64obsd_sigframe_init
+  mips64obsd_sigframe_init,
+  0, 0
 };
 
 
Index: ppcnbsd-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ppcnbsd-tdep.c,v
retrieving revision 1.25
diff -u -p -r1.25 ppcnbsd-tdep.c
--- ppcnbsd-tdep.c	24 Jul 2004 01:00:20 -0000	1.25
+++ ppcnbsd-tdep.c	9 Dec 2004 17:15:10 -0000
@@ -314,7 +314,8 @@ static const struct tramp_frame ppcnbsd_
     { 0x44000002, -1 }, /* sc */
     { TRAMP_SENTINEL_INSN, -1 }
   },
-  ppcnbsd_sigtramp_cache_init
+  ppcnbsd_sigtramp_cache_init,
+  0, 0
 };
 
 static void
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]