Lines 1-6
Link Here
|
1 |
--- gdb/amd64fbsd-nat.c.orig 2012-02-09 17:06:44.000000000 +0100 |
1 |
--- gdb/amd64fbsd-nat.c.orig 2014-06-11 18:34:41.000000000 +0200 |
2 |
+++ gdb/amd64fbsd-nat.c 2012-08-30 10:58:55.000000000 +0200 |
2 |
+++ gdb/amd64fbsd-nat.c 2014-09-24 18:27:50.618458853 +0200 |
3 |
@@ -21,11 +21,13 @@ |
3 |
@@ -21,13 +21,17 @@ |
4 |
#include "inferior.h" |
4 |
#include "inferior.h" |
5 |
#include "regcache.h" |
5 |
#include "regcache.h" |
6 |
#include "target.h" |
6 |
#include "target.h" |
Lines 13-20
Link Here
|
13 |
+#include <sys/procfs.h> |
13 |
+#include <sys/procfs.h> |
14 |
#include <sys/ptrace.h> |
14 |
#include <sys/ptrace.h> |
15 |
#include <sys/sysctl.h> |
15 |
#include <sys/sysctl.h> |
|
|
16 |
+#include <sys/user.h> |
17 |
+#include <sys/param.h> |
16 |
#include <machine/reg.h> |
18 |
#include <machine/reg.h> |
17 |
@@ -93,6 +95,46 @@ |
19 |
|
|
|
20 |
#include "fbsd-nat.h" |
21 |
@@ -93,6 +97,46 @@ |
18 |
}; |
22 |
}; |
19 |
|
23 |
|
20 |
|
24 |
|
Lines 60-63
Link Here
|
60 |
+ |
64 |
+ |
61 |
/* Support for debugging kernel virtual memory images. */ |
65 |
/* Support for debugging kernel virtual memory images. */ |
62 |
|
66 |
|
63 |
#include <sys/types.h> |
67 |
#include <machine/pcb.h> |
|
|
68 |
@@ -247,6 +291,10 @@ |
69 |
|
70 |
SC_RBP_OFFSET = offset; |
71 |
|
72 |
+// Newer versions of FreeBSD provide a better way to locate the signtramp |
73 |
+#if ( __FreeBSD_version/100000 < 9 ) \ |
74 |
+ || ( ( __FreeBSD_version/100000 == 9 ) && ( __FreeBSD_version < 902505 ) ) \ |
75 |
+ || ( ( __FreeBSD_version/100000 == 10 ) && ( __FreeBSD_version < 1000700 ) ) |
76 |
/* FreeBSD provides a kern.ps_strings sysctl that we can use to |
77 |
locate the sigtramp. That way we can still recognize a sigtramp |
78 |
if its location is changed in a new kernel. Of course this is |
79 |
@@ -267,4 +315,25 @@ |
80 |
amd64fbsd_sigtramp_end_addr = ps_strings; |
81 |
} |
82 |
} |
83 |
+#else |
84 |
+ /* FreeBSD provides a kern.proc.sigtramp sysctl that we can use to |
85 |
+ locate the sigtramp. That way we can still recognize a sigtramp |
86 |
+ if its location is changed in a new kernel. */ |
87 |
+ { |
88 |
+ int mib[4]; |
89 |
+ struct kinfo_sigtramp kst; |
90 |
+ size_t len; |
91 |
+ |
92 |
+ mib[0] = CTL_KERN; |
93 |
+ mib[1] = KERN_PROC; |
94 |
+ mib[2] = KERN_PROC_SIGTRAMP; |
95 |
+ mib[3] = getpid(); |
96 |
+ len = sizeof (kst); |
97 |
+ if (sysctl (mib, sizeof(mib)/sizeof(mib[0]), &kst, &len, NULL, 0) == 0) |
98 |
+ { |
99 |
+ amd64fbsd_sigtramp_start_addr = kst.ksigtramp_start; |
100 |
+ amd64fbsd_sigtramp_end_addr = kst.ksigtramp_end; |
101 |
+ } |
102 |
+ } |
103 |
+#endif |
104 |
} |