public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
@ 2015-02-04 15:47 John Baldwin
  2015-02-10 14:51 ` [PATCH] " John Baldwin
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-04 15:47 UTC (permalink / raw)
  To: gdb-patches

This patch fixes two issues with signal frame unwinding on recent FreeBSD/x86:

First, FreeBSD moved the signal trampoline code into a global shared page
exported by the kernel a few releases ago.  To try to make this easier to
detect, FreeBSD added a new per-process sysctl node that exports the starting
and ending address of the signal trampoline code.  This sysctl works on all
platforms that FreeBSD supports no matter where the signal trampoline lives,
but I have only updated i386 and amd64 in this patch.

Second, amd64fbsd_sigcontext_addr was using frame_unwind_register_unsigned to
fetch the stack pointer which resulted in infinite recursion.  I've changed it
to use get_frame_register() to match the sigcontext_addr methods in the
i386-bsd and amd64-linux targets instead.

Changelog:

2015-xx-xx  John Baldwin  <jhb@FreeBSD.org>

	* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP
	  sysctl to locate the signal trampoline.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Fix infinite recursion.

diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index 1c396e2..6227681 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 #include <machine/reg.h>
 
 #include "fbsd-nat.h"
@@ -244,6 +245,29 @@ Please report this to <bug-gdb@gnu.org>."),
 
   SC_RBP_OFFSET = offset;
 
+#ifdef KERN_PROC_SIGTRAMP
+  /* Newer versions of FreeBSD provide a kern.proc.sigtramp.<pid>
+     sysctl that returns the location of the signal trampoline.
+     Note that this fetches the address for the current (gdb) process.
+     This will be correct for other 64-bit processes, but the signal
+     trampoline location is not properly set for 32-bit processes. */
+  {
+    int mib[4];
+    struct kinfo_sigtramp kst;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
+      {
+	amd64fbsd_sigtramp_start_addr = (uintptr_t)kst.ksigtramp_start;
+	amd64fbsd_sigtramp_end_addr = (uintptr_t)kst.ksigtramp_end;
+      }
+  }
+#else
   /* FreeBSD provides a kern.ps_strings sysctl that we can use to
      locate the sigtramp.  That way we can still recognize a sigtramp
      if its location is changed in a new kernel.  Of course this is
@@ -264,4 +288,5 @@ Please report this to <bug-gdb@gnu.org>."),
 	amd64fbsd_sigtramp_end_addr = ps_strings;
       }
   }
+#endif
 }
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index 2d49cdf..abb0cab 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -37,12 +37,16 @@
 static CORE_ADDR
 amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
 {
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
+  gdb_byte buf[8];
 
   /* The `struct sigcontext' (which really is an `ucontext_t' on
      FreeBSD/amd64) lives at a fixed offset in the signal frame.  See
      <machine/sigframe.h>.  */
-  sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
+  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
+  sp = extract_unsigned_integer (buf, 8, byte_order);
   return sp + 16;
 }
 \f
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index f4951d1..5293f0f 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -25,6 +25,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 
 #include "fbsd-nat.h"
 #include "i386-tdep.h"
@@ -148,13 +149,34 @@ _initialize_i386fbsd_nat (void)
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (i386fbsd_supply_pcb);
 
+#ifdef KERN_PROC_SIGTRAMP
+  /* Newer versions of FreeBSD provide a kern.proc.sigtramp.<pid>
+     sysctl that returns the location of the signal trampoline.
+     Note that this fetches the address for the current (gdb) process,
+     but should be correct for other processes. */
+  {
+    int mib[4];
+    struct kinfo_sigtramp kst;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
+      {
+	i386fbsd_sigtramp_start_addr = (uintptr_t)kst.ksigtramp_start;
+	i386fbsd_sigtramp_end_addr = (uintptr_t)kst.ksigtramp_end;
+      }
+  }
+#elif defined(KERN_PS_STRINGS)
   /* FreeBSD provides a kern.ps_strings sysctl that we can use to
      locate the sigtramp.  That way we can still recognize a sigtramp
      if its location is changed in a new kernel.  Of course this is
      still based on the assumption that the sigtramp is placed
      directly under the location where the program arguments and
      environment can be found.  */
-#ifdef KERN_PS_STRINGS
   {
     int mib[2];
     u_long ps_strings;

-- 
John Baldwin

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

* [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-04 15:47 Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64 John Baldwin
@ 2015-02-10 14:51 ` John Baldwin
  2015-02-10 17:08   ` Pedro Alves
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-10 14:51 UTC (permalink / raw)
  To: gdb-patches

On Wednesday, February 04, 2015 10:47:07 AM John Baldwin wrote:
> This patch fixes two issues with signal frame unwinding on recent
> FreeBSD/x86:
> 
> First, FreeBSD moved the signal trampoline code into a global shared page
> exported by the kernel a few releases ago.  To try to make this easier to
> detect, FreeBSD added a new per-process sysctl node that exports the
> starting and ending address of the signal trampoline code.  This sysctl
> works on all platforms that FreeBSD supports no matter where the signal
> trampoline lives, but I have only updated i386 and amd64 in this patch.
> 
> Second, amd64fbsd_sigcontext_addr was using frame_unwind_register_unsigned
> to fetch the stack pointer which resulted in infinite recursion.  I've
> changed it to use get_frame_register() to match the sigcontext_addr methods
> in the i386-bsd and amd64-linux targets instead.

Does anyone have any comments on this patch or is there anything I need to fix 
in it?

> Changelog:
> 
> 2015-xx-xx  John Baldwin  <jhb@FreeBSD.org>
> 
> 	* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP
> 	  sysctl to locate the signal trampoline.
> 	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
> 	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Fix infinite recursion.
> 
> diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
> index 1c396e2..6227681 100644
> --- a/gdb/amd64fbsd-nat.c
> +++ b/gdb/amd64fbsd-nat.c
> @@ -26,6 +26,7 @@
>  #include <sys/types.h>
>  #include <sys/ptrace.h>
>  #include <sys/sysctl.h>
> +#include <sys/user.h>
>  #include <machine/reg.h>
> 
>  #include "fbsd-nat.h"
> @@ -244,6 +245,29 @@ Please report this to <bug-gdb@gnu.org>."),
> 
>    SC_RBP_OFFSET = offset;
> 
> +#ifdef KERN_PROC_SIGTRAMP
> +  /* Newer versions of FreeBSD provide a kern.proc.sigtramp.<pid>
> +     sysctl that returns the location of the signal trampoline.
> +     Note that this fetches the address for the current (gdb) process.
> +     This will be correct for other 64-bit processes, but the signal
> +     trampoline location is not properly set for 32-bit processes. */
> +  {
> +    int mib[4];
> +    struct kinfo_sigtramp kst;
> +    size_t len;
> +
> +    mib[0] = CTL_KERN;
> +    mib[1] = KERN_PROC;
> +    mib[2] = KERN_PROC_SIGTRAMP;
> +    mib[3] = getpid();
> +    len = sizeof (kst);
> +    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
> +      {
> +	amd64fbsd_sigtramp_start_addr = (uintptr_t)kst.ksigtramp_start;
> +	amd64fbsd_sigtramp_end_addr = (uintptr_t)kst.ksigtramp_end;
> +      }
> +  }
> +#else
>    /* FreeBSD provides a kern.ps_strings sysctl that we can use to
>       locate the sigtramp.  That way we can still recognize a sigtramp
>       if its location is changed in a new kernel.  Of course this is
> @@ -264,4 +288,5 @@ Please report this to <bug-gdb@gnu.org>."),
>  	amd64fbsd_sigtramp_end_addr = ps_strings;
>        }
>    }
> +#endif
>  }
> diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
> index 2d49cdf..abb0cab 100644
> --- a/gdb/amd64fbsd-tdep.c
> +++ b/gdb/amd64fbsd-tdep.c
> @@ -37,12 +37,16 @@
>  static CORE_ADDR
>  amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
>  {
> +  struct gdbarch *gdbarch = get_frame_arch (this_frame);
> +  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
>    CORE_ADDR sp;
> +  gdb_byte buf[8];
> 
>    /* The `struct sigcontext' (which really is an `ucontext_t' on
>       FreeBSD/amd64) lives at a fixed offset in the signal frame.  See
>       <machine/sigframe.h>.  */
> -  sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
> +  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
> +  sp = extract_unsigned_integer (buf, 8, byte_order);
>    return sp + 16;
>  }
>  \f
> diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
> index f4951d1..5293f0f 100644
> --- a/gdb/i386fbsd-nat.c
> +++ b/gdb/i386fbsd-nat.c
> @@ -25,6 +25,7 @@
>  #include <sys/types.h>
>  #include <sys/ptrace.h>
>  #include <sys/sysctl.h>
> +#include <sys/user.h>
> 
>  #include "fbsd-nat.h"
>  #include "i386-tdep.h"
> @@ -148,13 +149,34 @@ _initialize_i386fbsd_nat (void)
>    /* Support debugging kernel virtual memory images.  */
>    bsd_kvm_add_target (i386fbsd_supply_pcb);
> 
> +#ifdef KERN_PROC_SIGTRAMP
> +  /* Newer versions of FreeBSD provide a kern.proc.sigtramp.<pid>
> +     sysctl that returns the location of the signal trampoline.
> +     Note that this fetches the address for the current (gdb) process,
> +     but should be correct for other processes. */
> +  {
> +    int mib[4];
> +    struct kinfo_sigtramp kst;
> +    size_t len;
> +
> +    mib[0] = CTL_KERN;
> +    mib[1] = KERN_PROC;
> +    mib[2] = KERN_PROC_SIGTRAMP;
> +    mib[3] = getpid();
> +    len = sizeof (kst);
> +    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
> +      {
> +	i386fbsd_sigtramp_start_addr = (uintptr_t)kst.ksigtramp_start;
> +	i386fbsd_sigtramp_end_addr = (uintptr_t)kst.ksigtramp_end;
> +      }
> +  }
> +#elif defined(KERN_PS_STRINGS)
>    /* FreeBSD provides a kern.ps_strings sysctl that we can use to
>       locate the sigtramp.  That way we can still recognize a sigtramp
>       if its location is changed in a new kernel.  Of course this is
>       still based on the assumption that the sigtramp is placed
>       directly under the location where the program arguments and
>       environment can be found.  */
> -#ifdef KERN_PS_STRINGS
>    {
>      int mib[2];
>      u_long ps_strings;


-- 
John Baldwin

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-10 14:51 ` [PATCH] " John Baldwin
@ 2015-02-10 17:08   ` Pedro Alves
  2015-02-10 19:14     ` John Baldwin
  0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2015-02-10 17:08 UTC (permalink / raw)
  To: John Baldwin, gdb-patches

On 02/10/2015 02:50 PM, John Baldwin wrote:
> On Wednesday, February 04, 2015 10:47:07 AM John Baldwin wrote:
>> This patch fixes two issues with signal frame unwinding on recent
>> FreeBSD/x86:
>>
>> First, FreeBSD moved the signal trampoline code into a global shared page
>> exported by the kernel a few releases ago.  To try to make this easier to
>> detect, FreeBSD added a new per-process sysctl node that exports the
>> starting and ending address of the signal trampoline code.  This sysctl
>> works on all platforms that FreeBSD supports no matter where the signal
>> trampoline lives, but I have only updated i386 and amd64 in this patch.
>>
>> Second, amd64fbsd_sigcontext_addr was using frame_unwind_register_unsigned
>> to fetch the stack pointer which resulted in infinite recursion.  I've
>> changed it to use get_frame_register() to match the sigcontext_addr methods
>> in the i386-bsd and amd64-linux targets instead.
> 
> Does anyone have any comments on this patch or is there anything I need to fix 
> in it?
> 
>> Changelog:
>>
>> 2015-xx-xx  John Baldwin  <jhb@FreeBSD.org>
>>
>> 	* amd64fbsd-nat.c (_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP
>> 	  sysctl to locate the signal trampoline.

"sysctl" should be aligned to the tab as well (under the star).

>> 	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
>> 	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Fix infinite recursion.

"Fix infinite recursion." is what goes in the commit log.  Here say:

	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use get_frame_register.

>>
>> diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
>> index 1c396e2..6227681 100644
>> --- a/gdb/amd64fbsd-nat.c
>> +++ b/gdb/amd64fbsd-nat.c
>> @@ -26,6 +26,7 @@
>>  #include <sys/types.h>
>>  #include <sys/ptrace.h>
>>  #include <sys/sysctl.h>
>> +#include <sys/user.h>

Mention this new inclusion in the CL:

	* amd64fbsd-nat.c: Include sys/user.h.
	(_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP
	sysctl to locate the signal trampoline.


>>  #include <machine/reg.h>
>>
>>  #include "fbsd-nat.h"
>> @@ -244,6 +245,29 @@ Please report this to <bug-gdb@gnu.org>."),
>>
>>    SC_RBP_OFFSET = offset;
>>
>> +#ifdef KERN_PROC_SIGTRAMP
>> +  /* Newer versions of FreeBSD provide a kern.proc.sigtramp.<pid>

"Newer" will get old soon.  Can you replace that with some kind of
version number/name?

>> +     sysctl that returns the location of the signal trampoline.
>> +     Note that this fetches the address for the current (gdb) process.
>> +     This will be correct for other 64-bit processes, but the signal
>> +     trampoline location is not properly set for 32-bit processes. */

Double-space after periods:  "processes.  */"

I'm not sure I understand what does "but the signal trampoline
location is not properly set for 32-bit processes" means.  You mean
it's not properly set because GDB is 64-bit; or it's not properly set
in the kernel; or something else?

>> +  {
>> +    int mib[4];
>> +    struct kinfo_sigtramp kst;
>> +    size_t len;
>> +
>> +    mib[0] = CTL_KERN;
>> +    mib[1] = KERN_PROC;
>> +    mib[2] = KERN_PROC_SIGTRAMP;
>> +    mib[3] = getpid();

Space before parens:

   mib[3] = getpid ();


>> +    len = sizeof (kst);
>> +    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
>> +      {
>> +	amd64fbsd_sigtramp_start_addr = (uintptr_t)kst.ksigtramp_start;
>> +	amd64fbsd_sigtramp_end_addr = (uintptr_t)kst.ksigtramp_end;

In casts too:

	amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
	amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;

>> +      }
>> +  }
>> +#else

Did you consider making GDB fallback to the #else block at runtime, for the
case GDB that was built against newer FreeBSD headers but is actually
running on older FreeBSD ?

>>    /* FreeBSD provides a kern.ps_strings sysctl that we can use to
>>       locate the sigtramp.  That way we can still recognize a sigtramp
>>       if its location is changed in a new kernel.  Of course this is
>> @@ -264,4 +288,5 @@ Please report this to <bug-gdb@gnu.org>."),
>>  	amd64fbsd_sigtramp_end_addr = ps_strings;
>>        }
>>    }
>> +#endif
>>  }

Otherwise looks good to me too.

Thanks,
Pedro Alves

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-10 17:08   ` Pedro Alves
@ 2015-02-10 19:14     ` John Baldwin
  2015-02-10 23:34       ` Pedro Alves
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-10 19:14 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Tuesday, February 10, 2015 05:08:14 PM Pedro Alves wrote:
> On 02/10/2015 02:50 PM, John Baldwin wrote:
> >> +     sysctl that returns the location of the signal trampoline.
> >> +     Note that this fetches the address for the current (gdb) process.
> >> +     This will be correct for other 64-bit processes, but the signal
> >> +     trampoline location is not properly set for 32-bit processes. */
> 
> I'm not sure I understand what does "but the signal trampoline
> location is not properly set for 32-bit processes" means.  You mean
> it's not properly set because GDB is 64-bit; or it's not properly set
> in the kernel; or something else?

The sysctl is designed to be used against the target process, but I did not
see an easy way to hook into each run and ptrace attach to invoke the sysctl
against the inferior directly.  Instead, the sysctl is invoked on the running
gdb process under the assumption that all binaries using the same OSABI will
use the same signal trampoline location (which is true under FreeBSD).
However, the case that breaks is if I'm using a 64-bit gdb to debug a 32-bit
process.  That is, I don't have an easy way to set the i386fbsd_sigtramp_*
variables from amd64fbsd-nat.c as there isn't a specific PID I know I can
safely query these values from.  All that said, that's also a corner case and
this patch will at least fix the more common 64-on-64 and 32-on-32 cases.

> >> +      }
> >> +  }
> >> +#else
> 
> Did you consider making GDB fallback to the #else block at runtime, for the
> case GDB that was built against newer FreeBSD headers but is actually
> running on older FreeBSD ?

In general FreeBSD only supports backwards compatibility rather than forwards
compatibility (so a binary built on an older version should generally work on
newer versions, but the opposite is not guaranteed).  Given that the Os
doesn't really provide for newer binaries to run against older kernels, I
don't think it is worth extra work in gdb to tailor to that case.

I think the updated version below addresses your other comments (thanks!):

ChangeLog:

2015-xx-xx  John Baldwin  <jhb@FreeBSD.org>

	* amd64fbsd-nat.c: Include sys/user.h.
	(_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP sysctl to
	locate the signal trampoline.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use get_frame_register.

diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index 1c396e2..762b13f 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 #include <machine/reg.h>
 
 #include "fbsd-nat.h"
@@ -244,6 +245,29 @@ Please report this to <bug-gdb@gnu.org>."),
 
   SC_RBP_OFFSET = offset;
 
+#ifdef KERN_PROC_SIGTRAMP
+  /* FreeBSD 9.2 and later provide a kern.proc.sigtramp.<pid>
+     sysctl that returns the location of the signal trampoline.
+     Note that this fetches the address for the current (gdb) process.
+     This will be correct for other 64-bit processes, but the signal
+     trampoline location is not properly set for 32-bit processes.  */
+  {
+    int mib[4];
+    struct kinfo_sigtramp kst;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid ();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
+      {
+	amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
+	amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
+      }
+  }
+#else
   /* FreeBSD provides a kern.ps_strings sysctl that we can use to
      locate the sigtramp.  That way we can still recognize a sigtramp
      if its location is changed in a new kernel.  Of course this is
@@ -264,4 +288,5 @@ Please report this to <bug-gdb@gnu.org>."),
 	amd64fbsd_sigtramp_end_addr = ps_strings;
       }
   }
+#endif
 }
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index 2d49cdf..abb0cab 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -37,12 +37,16 @@
 static CORE_ADDR
 amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
 {
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
+  gdb_byte buf[8];
 
   /* The `struct sigcontext' (which really is an `ucontext_t' on
      FreeBSD/amd64) lives at a fixed offset in the signal frame.  See
      <machine/sigframe.h>.  */
-  sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
+  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
+  sp = extract_unsigned_integer (buf, 8, byte_order);
   return sp + 16;
 }
 \f
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index f4951d1..26123d6 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -25,6 +25,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 
 #include "fbsd-nat.h"
 #include "i386-tdep.h"
@@ -148,13 +149,34 @@ _initialize_i386fbsd_nat (void)
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (i386fbsd_supply_pcb);
 
+#ifdef KERN_PROC_SIGTRAMP
+  /* FreeBSD 9.2 and later provide a kern.proc.sigtramp.<pid>
+     sysctl that returns the location of the signal trampoline.
+     Note that this fetches the address for the current (gdb) process,
+     but should be correct for other processes.  */
+  {
+    int mib[4];
+    struct kinfo_sigtramp kst;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid ();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
+      {
+	i386fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
+	i386fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
+      }
+  }
+#elif defined(KERN_PS_STRINGS)
   /* FreeBSD provides a kern.ps_strings sysctl that we can use to
      locate the sigtramp.  That way we can still recognize a sigtramp
      if its location is changed in a new kernel.  Of course this is
      still based on the assumption that the sigtramp is placed
      directly under the location where the program arguments and
      environment can be found.  */
-#ifdef KERN_PS_STRINGS
   {
     int mib[2];
     u_long ps_strings;


-- 
John Baldwin

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-10 19:14     ` John Baldwin
@ 2015-02-10 23:34       ` Pedro Alves
  2015-02-11  0:01         ` Mark Kettenis
  2015-02-11 16:04         ` John Baldwin
  0 siblings, 2 replies; 13+ messages in thread
From: Pedro Alves @ 2015-02-10 23:34 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches

Thanks, updated patch looks good.  Feel free to push.

On 02/10/2015 07:14 PM, John Baldwin wrote:
> On Tuesday, February 10, 2015 05:08:14 PM Pedro Alves wrote:
>> On 02/10/2015 02:50 PM, John Baldwin wrote:
>>>> +     sysctl that returns the location of the signal trampoline.
>>>> +     Note that this fetches the address for the current (gdb) process.
>>>> +     This will be correct for other 64-bit processes, but the signal
>>>> +     trampoline location is not properly set for 32-bit processes. */
>>
>> I'm not sure I understand what does "but the signal trampoline
>> location is not properly set for 32-bit processes" means.  You mean
>> it's not properly set because GDB is 64-bit; or it's not properly set
>> in the kernel; or something else?
> 
> The sysctl is designed to be used against the target process, but I did not
> see an easy way to hook into each run and ptrace attach to invoke the sysctl
> against the inferior directly.  

You'd do something like the patch below, on top of yours.  Completely
untested.  Just for illustration.

However, unless this info is recorded in core dumps, this is all of course
broken for core file debugging ...

Do we _really_ need to know the sigtramp location?  What does the sigtramp
disassembly look like?  How about just detecting the sigtramp
like other platforms do, by recognizing the instructions?  On Linux, this
is just:

  mov $__NR_rt_sigreturn, %rax
  syscall

And is parsed in amd64_linux_sigtramp_p -> amd64_linux_sigtramp_start.

Looking at:

https://github.com/freebsd/freebsd/blob/master/sys/amd64/amd64/sigtramp.S

It looks pretty much the same.  That should make it always work correctly
for (cross) core and remote debugging.

-------------
From 3193c7b56d459d72d76031c299b939fee1afe265 Mon Sep 17 00:00:00 2001
From: Pedro Alves <palves@redhat.com>
Date: Tue, 10 Feb 2015 22:11:42 +0000
Subject: [PATCH] AMD64 FreeBSD: get sigtramp of the current inferior

instead of gdb's.
---
 gdb/amd64fbsd-nat.c    | 103 ++++++++++++++++++++++++++++---------------------
 gdb/amd64fbsd-tdep.c   |  27 ++++++++++---
 gdb/target-debug.h     |   8 ++++
 gdb/target-delegates.c |  33 ++++++++++++++++
 gdb/target.h           |  12 ++++++
 5 files changed, 132 insertions(+), 51 deletions(-)

diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index 762b13f..ca962e1 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -140,6 +140,62 @@ amd64fbsd_supply_pcb (struct regcache *regcache, struct pcb *pcb)
 }
 \f
 
+static int
+amd64fbsd_get_signal_trampoline (struct target_ops *ops,
+				 struct mem_range *range)
+{
+#ifdef KERN_PROC_SIGTRAMP
+  /* FreeBSD 9.2 and later provide a kern.proc.sigtramp.<pid>
+     sysctl that returns the location of the signal trampoline.  */
+  {
+    int mib[4];
+    struct kinfo_sigtramp kst;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = ptid_get_pid (inferior_ptid);
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
+      {
+	CORE_ADDR start_addr = (uintptr_t) kst.ksigtramp_start;
+	CORE_ADDR end_addr = (uintptr_t) kst.ksigtramp_end;
+
+	range->start = start_addr;
+	range->length = end_addr - start_addr;
+	return 1;
+      }
+  }
+#else
+  /* FreeBSD provides a kern.ps_strings sysctl that we can use to
+     locate the sigtramp.  That way we can still recognize a sigtramp
+     if its location is changed in a new kernel.  Of course this is
+     still based on the assumption that the sigtramp is placed
+     directly under the location where the program arguments and
+     environment can be found.  */
+  {
+    int mib[2];
+    long ps_strings;
+    size_t len;
+
+    mib[0] = CTL_KERN;
+    mib[1] = KERN_PS_STRINGS;
+    len = sizeof (ps_strings);
+    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
+      {
+	CORE_ADDR start_addr = ps_strings - 32;
+	CORE_ADDR end_addr = ps_strings;
+
+	range->start = start_addr;
+	range->length = end_addr - start_addr;
+	return 1;
+      }
+  }
+#endif
+  return 0;
+}
+
 static void (*super_mourn_inferior) (struct target_ops *ops);
 
 static void
@@ -166,6 +222,8 @@ _initialize_amd64fbsd_nat (void)
   /* Add some extra features to the common *BSD/i386 target.  */
   t = amd64bsd_target ();
 
+  t->to_get_signal_trampoline = amd64fbsd_get_signal_trampoline;
+
 #ifdef HAVE_PT_GETDBREGS
 
   x86_use_watchpoints (t);
@@ -244,49 +302,4 @@ Please report this to <bug-gdb@gnu.org>."),
     }
 
   SC_RBP_OFFSET = offset;
-
-#ifdef KERN_PROC_SIGTRAMP
-  /* FreeBSD 9.2 and later provide a kern.proc.sigtramp.<pid>
-     sysctl that returns the location of the signal trampoline.
-     Note that this fetches the address for the current (gdb) process.
-     This will be correct for other 64-bit processes, but the signal
-     trampoline location is not properly set for 32-bit processes.  */
-  {
-    int mib[4];
-    struct kinfo_sigtramp kst;
-    size_t len;
-
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PROC;
-    mib[2] = KERN_PROC_SIGTRAMP;
-    mib[3] = getpid ();
-    len = sizeof (kst);
-    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
-      {
-	amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
-	amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
-      }
-  }
-#else
-  /* FreeBSD provides a kern.ps_strings sysctl that we can use to
-     locate the sigtramp.  That way we can still recognize a sigtramp
-     if its location is changed in a new kernel.  Of course this is
-     still based on the assumption that the sigtramp is placed
-     directly under the location where the program arguments and
-     environment can be found.  */
-  {
-    int mib[2];
-    long ps_strings;
-    size_t len;
-
-    mib[0] = CTL_KERN;
-    mib[1] = KERN_PS_STRINGS;
-    len = sizeof (ps_strings);
-    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
-      {
-	amd64fbsd_sigtramp_start_addr = ps_strings - 32;
-	amd64fbsd_sigtramp_end_addr = ps_strings;
-      }
-  }
-#endif
 }
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index abb0cab..69cd186 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -87,10 +87,6 @@ static int amd64fbsd_r_reg_offset[] =
   -1				/* %gs */
 };
 
-/* Location of the signal trampoline.  */
-CORE_ADDR amd64fbsd_sigtramp_start_addr = 0x7fffffffffc0ULL;
-CORE_ADDR amd64fbsd_sigtramp_end_addr = 0x7fffffffffe0ULL;
-
 /* From <machine/signal.h>.  */
 int amd64fbsd_sc_reg_offset[] =
 {
@@ -182,6 +178,26 @@ amd64fbsd_collect_uthread (const struct regcache *regcache,
     }
 }
 
+/* Return whether THIS_FRAME corresponds to a NetBSD sigtramp
+   routine.  */
+
+static int
+amd64fbsd_sigtramp_p (struct frame_info *this_frame)
+{
+  struct mem_range range;
+  CORE_ADDR pc;
+
+  if (!target_get_signal_trampoline (&range))
+    {
+      /* Fallback to hardcoded location...  */
+      range.start = 0x7fffffffffc0ULL;
+      range.length = 0x7fffffffffe0ULL - range.start;
+    }
+
+  pc = get_frame_pc (this_frame);
+  return address_in_mem_range (pc, &range);
+}
+
 static void
 amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
@@ -199,8 +215,7 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   amd64_init_abi (info, gdbarch);
 
-  tdep->sigtramp_start = amd64fbsd_sigtramp_start_addr;
-  tdep->sigtramp_end = amd64fbsd_sigtramp_end_addr;
+  tdep->sigtramp_p = amd64fbsd_sigtramp_p;
   tdep->sigcontext_addr = amd64fbsd_sigcontext_addr;
   tdep->sc_reg_offset = amd64fbsd_sc_reg_offset;
   tdep->sc_num_regs = ARRAY_SIZE (amd64fbsd_sc_reg_offset);
diff --git a/gdb/target-debug.h b/gdb/target-debug.h
index 63ce12c..f114a07 100644
--- a/gdb/target-debug.h
+++ b/gdb/target-debug.h
@@ -193,4 +193,12 @@ target_debug_print_signals (unsigned char *sigs)
   fputs_unfiltered (" }", gdb_stdlog);
 }
 
+static void
+target_debug_print_struct_mem_range_p (struct mem_range *range)
+{
+  fprintf_unfiltered (gdb_stdlog, "[%s:%x]",
+		      paddress (target_gdbarch (), range->start),
+		      range->length);
+}
+
 #endif /* TARGET_DEBUG_H */
diff --git a/gdb/target-delegates.c b/gdb/target-delegates.c
index e026179..4f9cb72 100644
--- a/gdb/target-delegates.c
+++ b/gdb/target-delegates.c
@@ -3764,6 +3764,35 @@ debug_done_generating_core (struct target_ops *self)
   fputs_unfiltered (")\n", gdb_stdlog);
 }
 
+static int
+delegate_get_signal_trampoline (struct target_ops *self, struct mem_range *arg1)
+{
+  self = self->beneath;
+  return self->to_get_signal_trampoline (self, arg1);
+}
+
+static int
+tdefault_get_signal_trampoline (struct target_ops *self, struct mem_range *arg1)
+{
+  return 0;
+}
+
+static int
+debug_get_signal_trampoline (struct target_ops *self, struct mem_range *arg1)
+{
+  int result;
+  fprintf_unfiltered (gdb_stdlog, "-> %s->to_get_signal_trampoline (...)\n", debug_target.to_shortname);
+  result = debug_target.to_get_signal_trampoline (&debug_target, arg1);
+  fprintf_unfiltered (gdb_stdlog, "<- %s->to_get_signal_trampoline (", debug_target.to_shortname);
+  target_debug_print_struct_target_ops_p (&debug_target);
+  fputs_unfiltered (", ", gdb_stdlog);
+  target_debug_print_struct_mem_range_p (arg1);
+  fputs_unfiltered (") = ", gdb_stdlog);
+  target_debug_print_int (result);
+  fputs_unfiltered ("\n", gdb_stdlog);
+  return result;
+}
+
 static void
 install_delegators (struct target_ops *ops)
 {
@@ -4045,6 +4074,8 @@ install_delegators (struct target_ops *ops)
     ops->to_prepare_to_generate_core = delegate_prepare_to_generate_core;
   if (ops->to_done_generating_core == NULL)
     ops->to_done_generating_core = delegate_done_generating_core;
+  if (ops->to_get_signal_trampoline == NULL)
+    ops->to_get_signal_trampoline = delegate_get_signal_trampoline;
 }
 
 static void
@@ -4189,6 +4220,7 @@ install_dummy_methods (struct target_ops *ops)
   ops->to_decr_pc_after_break = default_target_decr_pc_after_break;
   ops->to_prepare_to_generate_core = tdefault_prepare_to_generate_core;
   ops->to_done_generating_core = tdefault_done_generating_core;
+  ops->to_get_signal_trampoline = tdefault_get_signal_trampoline;
 }
 
 static void
@@ -4333,4 +4365,5 @@ init_debug_target (struct target_ops *ops)
   ops->to_decr_pc_after_break = debug_decr_pc_after_break;
   ops->to_prepare_to_generate_core = debug_prepare_to_generate_core;
   ops->to_done_generating_core = debug_done_generating_core;
+  ops->to_get_signal_trampoline = debug_get_signal_trampoline;
 }
diff --git a/gdb/target.h b/gdb/target.h
index fb60123..e509e5e 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1141,6 +1141,15 @@ struct target_ops
     void (*to_done_generating_core) (struct target_ops *)
       TARGET_DEFAULT_IGNORE ();
 
+    /* Return the current target's signal trampoline address range.
+       Return true on success, false if the information isn't
+       available.  This is implemented on targets that need to query
+       the kernel for this information.  Most ports we get at this
+       information through gdbarch/osabi instead.  */
+    int (*to_get_signal_trampoline) (struct target_ops *ops,
+				     struct mem_range *range)
+      TARGET_DEFAULT_RETURN (0);
+
     int to_magic;
     /* Need sub-structure for target machine related rather than comm related?
      */
@@ -2055,6 +2064,9 @@ extern int simple_verify_memory (struct target_ops* ops,
 int target_verify_memory (const gdb_byte *data,
 			  CORE_ADDR memaddr, ULONGEST size);
 
+#define target_get_signal_trampoline(range)				\
+  (*current_target.to_get_signal_trampoline) (&current_target, range)
+
 /* Routines for maintenance of the target structures...
 
    complete_target_initialization: Finalize a target_ops by filling in
-- 
1.9.3


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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-10 23:34       ` Pedro Alves
@ 2015-02-11  0:01         ` Mark Kettenis
  2015-02-11 16:04         ` John Baldwin
  1 sibling, 0 replies; 13+ messages in thread
From: Mark Kettenis @ 2015-02-11  0:01 UTC (permalink / raw)
  To: jhb; +Cc: palves, gdb-patches

> Date: Tue, 10 Feb 2015 23:34:10 +0000
> From: Pedro Alves <palves@redhat.com>
> 
> Thanks, updated patch looks good.  Feel free to push.

Same here.  Although you guys should really make randomize the
location signal trampoline page.  In that case you should look at
amd64obsd-tdep.c:amd64obsd_sigtramp_p().

> On 02/10/2015 07:14 PM, John Baldwin wrote:
> > On Tuesday, February 10, 2015 05:08:14 PM Pedro Alves wrote:
> >> On 02/10/2015 02:50 PM, John Baldwin wrote:
> >>>> +     sysctl that returns the location of the signal trampoline.
> >>>> +     Note that this fetches the address for the current (gdb) process.
> >>>> +     This will be correct for other 64-bit processes, but the signal
> >>>> +     trampoline location is not properly set for 32-bit processes. */
> >>
> >> I'm not sure I understand what does "but the signal trampoline
> >> location is not properly set for 32-bit processes" means.  You mean
> >> it's not properly set because GDB is 64-bit; or it's not properly set
> >> in the kernel; or something else?
> > 
> > The sysctl is designed to be used against the target process, but I did not
> > see an easy way to hook into each run and ptrace attach to invoke the sysctl
> > against the inferior directly.  
> 
> You'd do something like the patch below, on top of yours.  Completely
> untested.  Just for illustration.
> 
> However, unless this info is recorded in core dumps, this is all of course
> broken for core file debugging ...
> 
> Do we _really_ need to know the sigtramp location?  What does the sigtramp
> disassembly look like?  How about just detecting the sigtramp
> like other platforms do, by recognizing the instructions?  On Linux, this
> is just:
> 
>   mov $__NR_rt_sigreturn, %rax
>   syscall
> 
> And is parsed in amd64_linux_sigtramp_p -> amd64_linux_sigtramp_start.
> 
> Looking at:
> 
> https://github.com/freebsd/freebsd/blob/master/sys/amd64/amd64/sigtramp.S
> 
> It looks pretty much the same.  That should make it always work correctly
> for (cross) core and remote debugging.
> 
> -------------

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-10 23:34       ` Pedro Alves
  2015-02-11  0:01         ` Mark Kettenis
@ 2015-02-11 16:04         ` John Baldwin
  2015-02-11 16:40           ` Pedro Alves
  1 sibling, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-11 16:04 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Tuesday, February 10, 2015 11:34:10 PM Pedro Alves wrote:
> Thanks, updated patch looks good.  Feel free to push.

Note that I do not have read/write access to git, so I believe I need someone 
to push this for me?

> On 02/10/2015 07:14 PM, John Baldwin wrote:
> > On Tuesday, February 10, 2015 05:08:14 PM Pedro Alves wrote:
> >> On 02/10/2015 02:50 PM, John Baldwin wrote:
> >>>> +     sysctl that returns the location of the signal trampoline.
> >>>> +     Note that this fetches the address for the current (gdb) process.
> >>>> +     This will be correct for other 64-bit processes, but the signal
> >>>> +     trampoline location is not properly set for 32-bit processes. */
> >> 
> >> I'm not sure I understand what does "but the signal trampoline
> >> location is not properly set for 32-bit processes" means.  You mean
> >> it's not properly set because GDB is 64-bit; or it's not properly set
> >> in the kernel; or something else?
> > 
> > The sysctl is designed to be used against the target process, but I did
> > not
> > see an easy way to hook into each run and ptrace attach to invoke the
> > sysctl against the inferior directly.
> 
> You'd do something like the patch below, on top of yours.  Completely
> untested.  Just for illustration.
> 
> However, unless this info is recorded in core dumps, this is all of course
> broken for core file debugging ...

Yes, it occurred to me that to make this really reliable I'd have to annotate 
it in core dumps instead.

> Do we _really_ need to know the sigtramp location?  What does the sigtramp
> disassembly look like?  How about just detecting the sigtramp
> like other platforms do, by recognizing the instructions?  On Linux, this
> is just:
> 
>   mov $__NR_rt_sigreturn, %rax
>   syscall
> 
> And is parsed in amd64_linux_sigtramp_p -> amd64_linux_sigtramp_start.

Actually, this does sound far simpler.  I was simply updating the sigtramp 
code that was already present.  I can certainly work on changing both i386
and amd64 to do this instead if that is the preferred method (and it seems to 
be from looking at other targets).

-- 
John Baldwin

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-11 16:04         ` John Baldwin
@ 2015-02-11 16:40           ` Pedro Alves
  2015-02-16 18:25             ` John Baldwin
  0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2015-02-11 16:40 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches

On 02/11/2015 03:32 PM, John Baldwin wrote:

> Actually, this does sound far simpler.  I was simply updating the sigtramp 
> code that was already present.  I can certainly work on changing both i386
> and amd64 to do this instead if that is the preferred method (and it seems to 
> be from looking at other targets).

Yep, that's the preferred method.  That'd be great.

Thanks,
Pedro Alves

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-11 16:40           ` Pedro Alves
@ 2015-02-16 18:25             ` John Baldwin
  2015-02-16 22:56               ` Pedro Alves
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-16 18:25 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On Wednesday, February 11, 2015 04:40:17 PM Pedro Alves wrote:
> On 02/11/2015 03:32 PM, John Baldwin wrote:
> > Actually, this does sound far simpler.  I was simply updating the sigtramp
> > code that was already present.  I can certainly work on changing both i386
> > and amd64 to do this instead if that is the preferred method (and it seems
> > to be from looking at other targets).
> 
> Yep, that's the preferred method.  That'd be great.

I've implemented this and attached the updated patch below.  I'm not quite
sure if the updated Changelog is correct however.  I ran into one hiccup
though which is that the signal trampoline code is not included in process
core dumps in recent FreeBSD versions (after it was moved off of the stack and
into a global shared page).  I've fixed this in FreeBSD so that future
versions will include the trampoline in core dumps, but I've retained the
change to use KERN_PROC_SIGTRAMP to support core dumps from the versions that
do not include it in the core.  I've removed the support for specifying a
signal trampoline location for older verions using either hardcoded offsets or
ps_strings as it is no longer needed.

ChangeLog:

2015-xx-xx  John Baldwin  <jhb@FreeBSD.org>

	* amd64fbsd-nat.c: Include sys/user.h.
	(_initialize_amd64fbsd_nat): Use the KERN_PROC_SIGTRAMP sysctl to
	locate the signal trampoline.
	* i386fbsd-nat.c (_initialize_i386fbsd_nat): Likewise.
	* amd64fbsd-tdep.c (amd64fbsd_sigcontext_addr): Use get_frame_register.
	(amd64fbsd_sigtramp_p): New.
	(amd64fbsd_init_abi): Set "sigtramp_p" to "amd64fbsd_sigtramp_p".
	* i386fbsd-tdep.c (i386fbsd_sigtramp_p): New.
	(i386fbsd_init_abi): Set "sigtramp_p" to "i386fbsd_sigtramp_p".

Diff:

diff --git a/gdb/amd64fbsd-nat.c b/gdb/amd64fbsd-nat.c
index 1c396e2..30c8e1e 100644
--- a/gdb/amd64fbsd-nat.c
+++ b/gdb/amd64fbsd-nat.c
@@ -26,6 +26,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 #include <machine/reg.h>
 
 #include "fbsd-nat.h"
@@ -244,24 +245,31 @@ Please report this to <bug-gdb@gnu.org>."),
 
   SC_RBP_OFFSET = offset;
 
-  /* FreeBSD provides a kern.ps_strings sysctl that we can use to
-     locate the sigtramp.  That way we can still recognize a sigtramp
-     if its location is changed in a new kernel.  Of course this is
-     still based on the assumption that the sigtramp is placed
-     directly under the location where the program arguments and
-     environment can be found.  */
+#ifdef KERN_PROC_SIGTRAMP
+  /* Normally signal frames are detected via amd64fbsd_sigtramp_p ().
+     However, FreeBSD 9.2 through 10.1 do not include the page holding
+     the signal code in core dumps.  These releases do provide a
+     kern.proc.sigtramp.<pid> sysctl that returns the location of the
+     signal trampoline for a running process.  We fetch the location of
+     the current (gdb) process and use this to identify signal frames
+     in core dumps from these releases.  Note that this only works for
+     core dumps of 64-bit (FreeBSD/amd64) processes and does not handle
+     core dumps of 32-bit (FreeBSD/i386) processes.  */
   {
-    int mib[2];
-    long ps_strings;
+    int mib[4];
+    struct kinfo_sigtramp kst;
     size_t len;
 
     mib[0] = CTL_KERN;
-    mib[1] = KERN_PS_STRINGS;
-    len = sizeof (ps_strings);
-    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid ();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
       {
-	amd64fbsd_sigtramp_start_addr = ps_strings - 32;
-	amd64fbsd_sigtramp_end_addr = ps_strings;
+	amd64fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
+	amd64fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
       }
   }
+#endif
 }
diff --git a/gdb/amd64fbsd-tdep.c b/gdb/amd64fbsd-tdep.c
index 2d49cdf..b6467aa 100644
--- a/gdb/amd64fbsd-tdep.c
+++ b/gdb/amd64fbsd-tdep.c
@@ -31,18 +31,49 @@
 
 /* Support for signal handlers.  */
 
+/* Return whether THIS_FRAME corresponds to a FreeBSD sigtramp
+   routine.  */
+
+static const gdb_byte amd64fbsd_sigtramp_code[] =
+{
+  0x48, 0x8d, 0x7c, 0x24, 0x10, /* lea     SIGF_UC(%rsp),%rdi */
+  0x6a, 0x00,			/* pushq   $0 */
+  0x48, 0xc7, 0xc0, 0xa1, 0x01, 0x00, 0x00,
+                                /* movq    $SYS_sigreturn,%rax */
+  0x0f, 0x05                    /* syscall */
+};
+
+static int
+amd64fbsd_sigtramp_p (struct frame_info *this_frame)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  gdb_byte buf[sizeof amd64fbsd_sigtramp_code];
+
+  if (!safe_frame_unwind_memory (this_frame, pc, buf, sizeof buf))
+    return 0;
+  if (memcmp (buf, amd64fbsd_sigtramp_code, sizeof amd64fbsd_sigtramp_code) !=
+      0)
+    return 0;
+
+  return 1;
+}
+
 /* Assuming THIS_FRAME is for a BSD sigtramp routine, return the
    address of the associated sigcontext structure.  */
 
 static CORE_ADDR
 amd64fbsd_sigcontext_addr (struct frame_info *this_frame)
 {
+  struct gdbarch *gdbarch = get_frame_arch (this_frame);
+  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   CORE_ADDR sp;
+  gdb_byte buf[8];
 
   /* The `struct sigcontext' (which really is an `ucontext_t' on
      FreeBSD/amd64) lives at a fixed offset in the signal frame.  See
      <machine/sigframe.h>.  */
-  sp = frame_unwind_register_unsigned (this_frame, AMD64_RSP_REGNUM);
+  get_frame_register (this_frame, AMD64_RSP_REGNUM, buf);
+  sp = extract_unsigned_integer (buf, 8, byte_order);
   return sp + 16;
 }
 \f
@@ -84,8 +115,8 @@ static int amd64fbsd_r_reg_offset[] =
 };
 
 /* Location of the signal trampoline.  */
-CORE_ADDR amd64fbsd_sigtramp_start_addr = 0x7fffffffffc0ULL;
-CORE_ADDR amd64fbsd_sigtramp_end_addr = 0x7fffffffffe0ULL;
+CORE_ADDR amd64fbsd_sigtramp_start_addr;
+CORE_ADDR amd64fbsd_sigtramp_end_addr;
 
 /* From <machine/signal.h>.  */
 int amd64fbsd_sc_reg_offset[] =
@@ -195,6 +226,7 @@ amd64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 
   amd64_init_abi (info, gdbarch);
 
+  tdep->sigtramp_p = amd64fbsd_sigtramp_p;
   tdep->sigtramp_start = amd64fbsd_sigtramp_start_addr;
   tdep->sigtramp_end = amd64fbsd_sigtramp_end_addr;
   tdep->sigcontext_addr = amd64fbsd_sigcontext_addr;
diff --git a/gdb/i386fbsd-nat.c b/gdb/i386fbsd-nat.c
index f4951d1..1d5e4fd 100644
--- a/gdb/i386fbsd-nat.c
+++ b/gdb/i386fbsd-nat.c
@@ -25,6 +25,7 @@
 #include <sys/types.h>
 #include <sys/ptrace.h>
 #include <sys/sysctl.h>
+#include <sys/user.h>
 
 #include "fbsd-nat.h"
 #include "i386-tdep.h"
@@ -148,25 +149,28 @@ _initialize_i386fbsd_nat (void)
   /* Support debugging kernel virtual memory images.  */
   bsd_kvm_add_target (i386fbsd_supply_pcb);
 
-  /* FreeBSD provides a kern.ps_strings sysctl that we can use to
-     locate the sigtramp.  That way we can still recognize a sigtramp
-     if its location is changed in a new kernel.  Of course this is
-     still based on the assumption that the sigtramp is placed
-     directly under the location where the program arguments and
-     environment can be found.  */
-#ifdef KERN_PS_STRINGS
+#ifdef KERN_PROC_SIGTRAMP
+  /* Normally signal frames are detected via i386fbsd_sigtramp_p ().
+     However, FreeBSD 9.2 through 10.1 do not include the page holding
+     the signal code in core dumps.  These releases do provide a
+     kern.proc.sigtramp.<pid> sysctl that returns the location of the
+     signal trampoline for a running process.  We fetch the location of
+     the current (gdb) process and use this to identify signal frames
+     in core dumps from these releases.  */
   {
-    int mib[2];
-    u_long ps_strings;
+    int mib[4];
+    struct kinfo_sigtramp kst;
     size_t len;
 
     mib[0] = CTL_KERN;
-    mib[1] = KERN_PS_STRINGS;
-    len = sizeof (ps_strings);
-    if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
+    mib[1] = KERN_PROC;
+    mib[2] = KERN_PROC_SIGTRAMP;
+    mib[3] = getpid ();
+    len = sizeof (kst);
+    if (sysctl (mib, 4, &kst, &len, NULL, 0) == 0)
       {
-	i386fbsd_sigtramp_start_addr = ps_strings - 128;
-	i386fbsd_sigtramp_end_addr = ps_strings;
+	i386fbsd_sigtramp_start_addr = (uintptr_t) kst.ksigtramp_start;
+	i386fbsd_sigtramp_end_addr = (uintptr_t) kst.ksigtramp_end;
       }
   }
 #endif
diff --git a/gdb/i386fbsd-tdep.c b/gdb/i386fbsd-tdep.c
index 8d237f0..113c7c5 100644
--- a/gdb/i386fbsd-tdep.c
+++ b/gdb/i386fbsd-tdep.c
@@ -29,6 +29,154 @@
 #include "fbsd-tdep.h"
 #include "solib-svr4.h"
 
+/* Support for signal handlers.  */
+
+/* Return whether THIS_FRAME corresponds to a FreeBSD sigtramp
+   routine.  */
+
+/* FreeBSD/i386 supports three different signal trampolines, one for
+   versions before 4.0, a second for 4.x, and a third for 5.0 and
+   later.  To complicate matters, FreeBSD/i386 binaries running under
+   an amd64 kernel use a different set of trampolines.  These
+   trampolines differ from the i386 kernel trampolines in that they
+   omit a middle section that conditionally restores %gs.  */
+
+static const gdb_byte i386fbsd_sigtramp_start[] =
+{
+  0x8d, 0x44, 0x24, 0x20,       /* lea     SIGF_UC(%esp),%eax */
+  0x50                          /* pushl   %eax */
+};
+
+static const gdb_byte i386fbsd_sigtramp_middle[] =
+{
+  0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x00,
+                                /* testl   $PSL_VM,UC_EFLAGS(%eax) */
+  0x75, 0x03,                   /* jne     +3 */
+  0x8e, 0x68, 0x14              /* mov     UC_GS(%eax),%gs */
+};
+
+static const gdb_byte i386fbsd_sigtramp_end[] =
+{
+  0xb8, 0xa1, 0x01, 0x00, 0x00, /* movl    $SYS_sigreturn,%eax */
+  0x50,                         /* pushl   %eax */
+  0xcd, 0x80                    /* int     $0x80 */
+};
+
+static const gdb_byte i386fbsd_freebsd4_sigtramp_start[] =
+{
+  0x8d, 0x44, 0x24, 0x14,       /* lea     SIGF_UC4(%esp),%eax */
+  0x50                          /* pushl   %eax */
+};
+
+static const gdb_byte i386fbsd_freebsd4_sigtramp_middle[] =
+{
+  0xf7, 0x40, 0x54, 0x00, 0x00, 0x02, 0x00,
+                                /* testl   $PSL_VM,UC4_EFLAGS(%eax) */
+  0x75, 0x03,                   /* jne     +3 */
+  0x8e, 0x68, 0x14              /* mov     UC4_GS(%eax),%gs */
+};
+
+static const gdb_byte i386fbsd_freebsd4_sigtramp_end[] =
+{
+  0xb8, 0x58, 0x01, 0x00, 0x00, /* movl    $344,%eax */
+  0x50,                         /* pushl   %eax */
+  0xcd, 0x80                    /* int     $0x80 */
+};
+
+static const gdb_byte i386fbsd_osigtramp_start[] =
+{
+  0x8d, 0x44, 0x24, 0x14,       /* lea     SIGF_SC(%esp),%eax */
+  0x50                          /* pushl   %eax */
+};
+
+static const gdb_byte i386fbsd_osigtramp_middle[] =
+{
+  0xf7, 0x40, 0x18, 0x00, 0x00, 0x02, 0x00,
+                                /* testl   $PSL_VM,SC_PS(%eax) */
+  0x75, 0x03,                   /* jne     +3 */
+  0x8e, 0x68, 0x44              /* mov     SC_GS(%eax),%gs */
+};
+
+static const gdb_byte i386fbsd_osigtramp_end[] =
+{
+  0xb8, 0x67, 0x00, 0x00, 0x00, /* movl    $103,%eax */
+  0x50,                         /* pushl   %eax */
+  0xcd, 0x80                    /* int     $0x80 */
+};
+
+/* The three different trampolines are all the same size. */
+gdb_static_assert (sizeof i386fbsd_sigtramp_start ==
+		   sizeof i386fbsd_freebsd4_sigtramp_start);
+gdb_static_assert (sizeof i386fbsd_sigtramp_start ==
+		   sizeof i386fbsd_osigtramp_start);
+gdb_static_assert (sizeof i386fbsd_sigtramp_middle ==
+		   sizeof i386fbsd_freebsd4_sigtramp_middle);
+gdb_static_assert (sizeof i386fbsd_sigtramp_middle ==
+		   sizeof i386fbsd_osigtramp_middle);
+gdb_static_assert (sizeof i386fbsd_sigtramp_end ==
+		   sizeof i386fbsd_freebsd4_sigtramp_end);
+gdb_static_assert (sizeof i386fbsd_sigtramp_end ==
+		   sizeof i386fbsd_osigtramp_end);
+
+/* We assume that the middle is the largest chunk below. */
+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >
+		   sizeof i386fbsd_sigtramp_start);
+gdb_static_assert (sizeof i386fbsd_sigtramp_middle >
+		   sizeof i386fbsd_sigtramp_end);
+
+static int
+i386fbsd_sigtramp_p (struct frame_info *this_frame)
+{
+  CORE_ADDR pc = get_frame_pc (this_frame);
+  gdb_byte buf[sizeof i386fbsd_sigtramp_middle];
+  const gdb_byte *middle, *end;
+
+  /* Look for a matching start. */
+  if (!safe_frame_unwind_memory (this_frame, pc, buf,
+				 sizeof i386fbsd_sigtramp_start))
+    return 0;
+  if (memcmp (buf, i386fbsd_sigtramp_start, sizeof i386fbsd_sigtramp_start) ==
+      0) {
+    middle = i386fbsd_sigtramp_middle;
+    end = i386fbsd_sigtramp_end;
+  } else if (memcmp (buf, i386fbsd_freebsd4_sigtramp_start,
+		     sizeof i386fbsd_freebsd4_sigtramp_start) == 0) {
+    middle = i386fbsd_freebsd4_sigtramp_middle;
+    end = i386fbsd_freebsd4_sigtramp_end;
+  } else if (memcmp (buf, i386fbsd_osigtramp_start,
+		     sizeof i386fbsd_osigtramp_start) == 0) {
+    middle = i386fbsd_osigtramp_middle;
+    end = i386fbsd_osigtramp_end;
+  } else
+    return 0;
+
+  /* Since the end is shorter than the middle, check for a matching end
+     next.  */
+  pc += sizeof i386fbsd_sigtramp_start;
+  if (!safe_frame_unwind_memory (this_frame, pc, buf,
+				 sizeof i386fbsd_sigtramp_end))
+    return 0;
+  if (memcmp (buf, end, sizeof i386fbsd_sigtramp_end) == 0)
+    return 1;
+
+  /* If the end didn't match, check for a matching middle.  */
+  if (!safe_frame_unwind_memory (this_frame, pc, buf,
+				 sizeof i386fbsd_sigtramp_middle))
+    return 0;
+  if (memcmp (buf, middle, sizeof i386fbsd_sigtramp_middle) != 0)
+    return 0;
+
+  /* The middle matched, check for a matching end.  */
+  pc += sizeof i386fbsd_sigtramp_middle;
+  if (!safe_frame_unwind_memory (this_frame, pc, buf,
+				 sizeof i386fbsd_sigtramp_end))
+    return 0;
+  if (memcmp (buf, end, sizeof i386fbsd_sigtramp_end) != 0)
+    return 0;
+
+  return 1;
+}
+
 /* FreeBSD 3.0-RELEASE or later.  */
 
 /* From <machine/reg.h>.  */
@@ -43,8 +191,8 @@ static int i386fbsd_r_reg_offset[] =
 };
 
 /* Sigtramp routine location.  */
-CORE_ADDR i386fbsd_sigtramp_start_addr = 0xbfbfdf20;
-CORE_ADDR i386fbsd_sigtramp_end_addr = 0xbfbfdff0;
+CORE_ADDR i386fbsd_sigtramp_start_addr;
+CORE_ADDR i386fbsd_sigtramp_end_addr;
 
 /* From <machine/signal.h>.  */
 int i386fbsd_sc_reg_offset[] =
@@ -139,6 +287,8 @@ i386fbsdaout_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* FreeBSD uses -freg-struct-return by default.  */
   tdep->struct_return = reg_struct_return;
 
+  tdep->sigtramp_p = i386fbsd_sigtramp_p;
+
   /* FreeBSD uses a different memory layout.  */
   tdep->sigtramp_start = i386fbsd_sigtramp_start_addr;
   tdep->sigtramp_end = i386fbsd_sigtramp_end_addr;

-- 
John Baldwin

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-16 18:25             ` John Baldwin
@ 2015-02-16 22:56               ` Pedro Alves
  2015-02-23 16:33                 ` John Baldwin
  0 siblings, 1 reply; 13+ messages in thread
From: Pedro Alves @ 2015-02-16 22:56 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches, Mark Kettenis

On 02/16/2015 04:37 PM, John Baldwin wrote:
> On Wednesday, February 11, 2015 04:40:17 PM Pedro Alves wrote:
>> On 02/11/2015 03:32 PM, John Baldwin wrote:
>>> Actually, this does sound far simpler.  I was simply updating the sigtramp
>>> code that was already present.  I can certainly work on changing both i386
>>> and amd64 to do this instead if that is the preferred method (and it seems
>>> to be from looking at other targets).
>>
>> Yep, that's the preferred method.  That'd be great.
> 
> I've implemented this and attached the updated patch below.  I'm not quite
> sure if the updated Changelog is correct however.  I ran into one hiccup
> though which is that the signal trampoline code is not included in process
> core dumps in recent FreeBSD versions (after it was moved off of the stack and
> into a global shared page).  I've fixed this in FreeBSD so that future
> versions will include the trampoline in core dumps, but I've retained the
> change to use KERN_PROC_SIGTRAMP to support core dumps from the versions that
> do not include it in the core.  I've removed the support for specifying a
> signal trampoline location for older verions using either hardcoded offsets or
> ps_strings as it is no longer needed.

Looks great to me!  Mark, any comments?

(I see a couple minor formatting issues, but I can fix them up
for you before pushing.)

Thanks,
Pedro Alves

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-16 22:56               ` Pedro Alves
@ 2015-02-23 16:33                 ` John Baldwin
  2015-02-23 16:56                   ` Pedro Alves
  0 siblings, 1 reply; 13+ messages in thread
From: John Baldwin @ 2015-02-23 16:33 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches, Mark Kettenis

On Monday, February 16, 2015 10:55:54 PM Pedro Alves wrote:
> On 02/16/2015 04:37 PM, John Baldwin wrote:
> > On Wednesday, February 11, 2015 04:40:17 PM Pedro Alves wrote:
> >> On 02/11/2015 03:32 PM, John Baldwin wrote:
> >>> Actually, this does sound far simpler.  I was simply updating the
> >>> sigtramp
> >>> code that was already present.  I can certainly work on changing both
> >>> i386
> >>> and amd64 to do this instead if that is the preferred method (and it
> >>> seems
> >>> to be from looking at other targets).
> >> 
> >> Yep, that's the preferred method.  That'd be great.
> > 
> > I've implemented this and attached the updated patch below.  I'm not quite
> > sure if the updated Changelog is correct however.  I ran into one hiccup
> > though which is that the signal trampoline code is not included in process
> > core dumps in recent FreeBSD versions (after it was moved off of the stack
> > and into a global shared page).  I've fixed this in FreeBSD so that
> > future versions will include the trampoline in core dumps, but I've
> > retained the change to use KERN_PROC_SIGTRAMP to support core dumps from
> > the versions that do not include it in the core.  I've removed the
> > support for specifying a signal trampoline location for older verions
> > using either hardcoded offsets or ps_strings as it is no longer needed.
> 
> Looks great to me!  Mark, any comments?
> 
> (I see a couple minor formatting issues, but I can fix them up
> for you before pushing.)

Just pinging about this (I haven't see a mail from Mark, so I assume you are
waiting on that?)

-- 
John Baldwin

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

* Re: [PATCH] Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
  2015-02-23 16:33                 ` John Baldwin
@ 2015-02-23 16:56                   ` Pedro Alves
  0 siblings, 0 replies; 13+ messages in thread
From: Pedro Alves @ 2015-02-23 16:56 UTC (permalink / raw)
  To: John Baldwin; +Cc: gdb-patches, Mark Kettenis

On 02/23/2015 04:32 PM, John Baldwin wrote:
> On Monday, February 16, 2015 10:55:54 PM Pedro Alves wrote:
>> On 02/16/2015 04:37 PM, John Baldwin wrote:
>>> On Wednesday, February 11, 2015 04:40:17 PM Pedro Alves wrote:
>>>> On 02/11/2015 03:32 PM, John Baldwin wrote:
>>>>> Actually, this does sound far simpler.  I was simply updating the
>>>>> sigtramp
>>>>> code that was already present.  I can certainly work on changing both
>>>>> i386
>>>>> and amd64 to do this instead if that is the preferred method (and it
>>>>> seems
>>>>> to be from looking at other targets).
>>>>
>>>> Yep, that's the preferred method.  That'd be great.
>>>
>>> I've implemented this and attached the updated patch below.  I'm not quite
>>> sure if the updated Changelog is correct however.  I ran into one hiccup
>>> though which is that the signal trampoline code is not included in process
>>> core dumps in recent FreeBSD versions (after it was moved off of the stack
>>> and into a global shared page).  I've fixed this in FreeBSD so that
>>> future versions will include the trampoline in core dumps, but I've
>>> retained the change to use KERN_PROC_SIGTRAMP to support core dumps from
>>> the versions that do not include it in the core.  I've removed the
>>> support for specifying a signal trampoline location for older verions
>>> using either hardcoded offsets or ps_strings as it is no longer needed.
>>
>> Looks great to me!  Mark, any comments?
>>
>> (I see a couple minor formatting issues, but I can fix them up
>> for you before pushing.)
> 
> Just pinging about this (I haven't see a mail from Mark, so I assume you are
> waiting on that?)
> 

I think we can go ahead and push.  We can always address Mark's comments later,
if any.

Could you send the patch in "git am"able form (that is, along with an
updated git commit log)?

Thanks,
Pedro Alves

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

* Re: Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64
       [not found] <2729970.x7obi12nSh@ralph.baldwin.cx>
@ 2015-02-06 20:37 ` Ed Maste
  0 siblings, 0 replies; 13+ messages in thread
From: Ed Maste @ 2015-02-06 20:37 UTC (permalink / raw)
  To: gdb-patches

On 6 February 2015 at 14:44, John Baldwin <jhb@freebsd.org> wrote:
> This patch fixes two issues with signal frame unwinding on recent FreeBSD/x86:

The changes look good to me.

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

end of thread, other threads:[~2015-02-23 16:56 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-04 15:47 Fix signal trampoline detection/unwinding on recent FreeBSD/i386 and FreeBSD/amd64 John Baldwin
2015-02-10 14:51 ` [PATCH] " John Baldwin
2015-02-10 17:08   ` Pedro Alves
2015-02-10 19:14     ` John Baldwin
2015-02-10 23:34       ` Pedro Alves
2015-02-11  0:01         ` Mark Kettenis
2015-02-11 16:04         ` John Baldwin
2015-02-11 16:40           ` Pedro Alves
2015-02-16 18:25             ` John Baldwin
2015-02-16 22:56               ` Pedro Alves
2015-02-23 16:33                 ` John Baldwin
2015-02-23 16:56                   ` Pedro Alves
     [not found] <2729970.x7obi12nSh@ralph.baldwin.cx>
2015-02-06 20:37 ` Ed Maste

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).