summaryrefslogtreecommitdiff
path: root/devel/gdb6/patches/patch-aa
blob: 35c29f16e678c1cfc13cd68f840623981edb0d18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
$NetBSD: patch-aa,v 1.2 2006/03/14 00:47:50 joerg Exp $

--- gdb/i386bsd-nat.c.orig	2004-05-31 11:20:41.000000000 +0000
+++ gdb/i386bsd-nat.c
@@ -33,6 +33,19 @@
 
 #include "i386-tdep.h"
 #include "i387-tdep.h"
+#ifdef HAVE_SYS_PROCFS_H
+#include <sys/procfs.h>
+#endif
+
+#ifndef HAVE_GREGSET_T
+typedef struct reg gregset_t;
+#endif
+
+#ifndef HAVE_FPREGSET_T
+typedef struct fpreg fpregset_t;
+#endif
+
+#include "gregset.h"
 
 
 /* In older BSD versions we cannot get at some of the segment
@@ -349,7 +362,7 @@ _initialize_i386bsd_nat (void)
      system header files and sysctl(3) to get at the relevant
      information.  */
 
-#if defined (__FreeBSD_version) && __FreeBSD_version >= 400011
+#if defined(__DragonFly__) || (defined (__FreeBSD_version) && __FreeBSD_version >= 400011)
 #define SC_REG_OFFSET i386fbsd4_sc_reg_offset
 #elif defined (__FreeBSD_version) && __FreeBSD_version >= 300005
 #define SC_REG_OFFSET i386fbsd_sc_reg_offset
@@ -373,7 +386,11 @@ _initialize_i386bsd_nat (void)
 
   /* Override the default value for the offset of the program counter
      in the sigcontext structure.  */
-  offset = offsetof (struct sigcontext, sc_pc);
+#if defined(__DragonFly__)
+  offset = offsetof (ucontext_t, uc_mcontext.mc_eip);
+#else
+  offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_EIP]);
+#endif
 
   if (SC_PC_OFFSET != offset)
     {
@@ -386,7 +403,11 @@ Please report this to <bug-gdb@gnu.org>.
   SC_PC_OFFSET = offset;
 
   /* Likewise for the stack pointer.  */
-  offset = offsetof (struct sigcontext, sc_sp);
+#if defined(__DragonFly__)
+  offset = offsetof (ucontext_t, uc_mcontext.mc_esp);
+#else
+  offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_UESP]);
+#endif
 
   if (SC_SP_OFFSET != offset)
     {
@@ -399,7 +420,7 @@ Please report this to <bug-gdb@gnu.org>.
   SC_SP_OFFSET = offset;
 
   /* And the frame pointer.  */
-  offset = offsetof (struct sigcontext, sc_fp);
+  offset = offsetof (ucontext_t, uc_stack);
 
   if (SC_FP_OFFSET != offset)
     {