Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] Add some flags to tramp frame unwinder
@ 2004-12-09 17:35 Randolph Chung
  2004-12-09 17:59 ` Joel Brobecker
  2004-12-12 16:38 ` Andrew Cagney
  0 siblings, 2 replies; 5+ messages in thread
From: Randolph Chung @ 2004-12-09 17:35 UTC (permalink / raw)
  To: gdb-patches

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
 };
 
 \f
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/


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

* Re: [rfa] Add some flags to tramp frame unwinder
  2004-12-09 17:35 [rfa] Add some flags to tramp frame unwinder Randolph Chung
@ 2004-12-09 17:59 ` Joel Brobecker
  2004-12-12 16:38 ` Andrew Cagney
  1 sibling, 0 replies; 5+ messages in thread
From: Joel Brobecker @ 2004-12-09 17:59 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

> +  /* 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;

Just my two cents: I would find "maybe_inside_function" easier to
understand.

-- 
Joel


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

* Re: [rfa] Add some flags to tramp frame unwinder
  2004-12-09 17:35 [rfa] Add some flags to tramp frame unwinder Randolph Chung
  2004-12-09 17:59 ` Joel Brobecker
@ 2004-12-12 16:38 ` Andrew Cagney
  2004-12-13  4:06   ` Randolph Chung
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2004-12-12 16:38 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

Randolph Chung wrote:
> 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.

Instead of this, delete the test and in its place add a comment 
explaining what was there.  I just hit another similar case - signal 
trampolines on altstacks - where there's either/or a valid symbol or 
segment.

Andrew


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

* Re: [rfa] Add some flags to tramp frame unwinder
  2004-12-12 16:38 ` Andrew Cagney
@ 2004-12-13  4:06   ` Randolph Chung
  2004-12-13 21:34     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Randolph Chung @ 2004-12-13  4:06 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

> Instead of this, delete the test and in its place add a comment 
> explaining what was there.  I just hit another similar case - signal 
> trampolines on altstacks - where there's either/or a valid symbol or 
> segment.

ok, checked in the following



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

	* tramp-frame.c (tramp_frame_sniffer): Allow frames with names or 
	sections to be trampolines too.

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	13 Dec 2004 01:35:42 -0000
@@ -122,19 +122,12 @@ tramp_frame_sniffer (const struct frame_
   const struct tramp_frame *tramp = self->unwind_data->tramp_frame;
   CORE_ADDR pc = frame_pc_unwind (next_frame);
   CORE_ADDR func;
-  char *name;
   struct tramp_frame_cache *tramp_cache;
 
-  /* If the function has a valid symbol name, it isn't a
-     trampoline.  */
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  if (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)
-    return 0;
-  /* Finally, check that the trampoline matches at PC.  */
+  /* tausq/2004-12-12: We used to assume if pc has a name or is in a valid 
+     section, then this is not a trampoline.  However, this assumption is
+     false on HPUX which has a signal trampoline that has a name; it can
+     also be false when using an alternative signal stack.  */
   func = tramp_frame_start (tramp, next_frame, pc);
   if (func == 0)
     return 0;

randolph
-- 
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/


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

* Re: [rfa] Add some flags to tramp frame unwinder
  2004-12-13  4:06   ` Randolph Chung
@ 2004-12-13 21:34     ` Andrew Cagney
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2004-12-13 21:34 UTC (permalink / raw)
  To: Randolph Chung; +Cc: gdb-patches

Randolph Chung wrote:
>>Instead of this, delete the test and in its place add a comment 
>>explaining what was there.  I just hit another similar case - signal 
>>trampolines on altstacks - where there's either/or a valid symbol or 
>>segment.
> 
> 
> ok, checked in the following
> 
> 
> 
> 2004-12-12  Randolph Chung  <tausq@debian.org>
> 
> 	* tramp-frame.c (tramp_frame_sniffer): Allow frames with names or 
> 	sections to be trampolines too.

Thanks.

Andrew

> 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	13 Dec 2004 01:35:42 -0000
> @@ -122,19 +122,12 @@ tramp_frame_sniffer (const struct frame_
>    const struct tramp_frame *tramp = self->unwind_data->tramp_frame;
>    CORE_ADDR pc = frame_pc_unwind (next_frame);
>    CORE_ADDR func;
> -  char *name;
>    struct tramp_frame_cache *tramp_cache;
>  
> -  /* If the function has a valid symbol name, it isn't a
> -     trampoline.  */
> -  find_pc_partial_function (pc, &name, NULL, NULL);
> -  if (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)
> -    return 0;
> -  /* Finally, check that the trampoline matches at PC.  */
> +  /* tausq/2004-12-12: We used to assume if pc has a name or is in a valid 
> +     section, then this is not a trampoline.  However, this assumption is
> +     false on HPUX which has a signal trampoline that has a name; it can
> +     also be false when using an alternative signal stack.  */
>    func = tramp_frame_start (tramp, next_frame, pc);
>    if (func == 0)
>      return 0;
> 
> randolph


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

end of thread, other threads:[~2004-12-13 20:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-12-09 17:35 [rfa] Add some flags to tramp frame unwinder Randolph Chung
2004-12-09 17:59 ` Joel Brobecker
2004-12-12 16:38 ` Andrew Cagney
2004-12-13  4:06   ` Randolph Chung
2004-12-13 21:34     ` Andrew Cagney

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