summaryrefslogtreecommitdiff
path: root/devel/gdb/patches/patch-am
blob: fc85140717041c35d151fc2ce13a46104260580a (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
$NetBSD: patch-am,v 1.2 2007/07/11 13:12:01 lkundrak Exp $

--- gdb/i386bsd-nat.c.orig	2007-07-11 14:32:16.000000000 +0200
+++ gdb/i386bsd-nat.c
@@ -395,7 +395,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)
   extern int i386fbsd4_sc_pc_offset;
   extern int i386fbsd4_sc_sp_offset;
 #define SC_PC_OFFSET i386fbsd4_sc_pc_offset
@@ -419,26 +419,30 @@ _initialize_i386bsd_nat (void)
 
   /* Override the default value for the offset of the program counter
      in the sigcontext structure.  */
-  sc_pc_offset = offsetof (struct sigcontext, sc_pc);
+#if defined(__DragonFly__)
+  sc_pc_offset = offsetof (ucontext_t, uc_mcontext.mc_eip);
+#else
+  sc_pc_offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_EIP]);
+#endif
 
   if (SC_PC_OFFSET != sc_pc_offset)
     {
-      warning ("\
-offsetof (struct sigcontext, sc_pc) yields %d instead of %d.\n\
-Please report this to <bug-gdb@gnu.org>.",
+      warning ("sc_pc_offset is %d instead of %d.",
 	       sc_pc_offset, SC_PC_OFFSET);
     }
 
   SC_PC_OFFSET = sc_pc_offset;
 
   /* Likewise for the stack pointer.  */
-  sc_sp_offset = offsetof (struct sigcontext, sc_sp);
+#if defined(__DragonFly__)
+  sc_sp_offset = offsetof (ucontext_t, uc_mcontext.mc_esp);
+#else
+  sc_sp_offset = offsetof (ucontext_t, uc_mcontext.__gregs[_REG_UESP]);
+#endif
 
   if (SC_SP_OFFSET != sc_sp_offset)
     {
-      warning ("\
-offsetof (struct sigcontext, sc_sp) yields %d instead of %d.\n\
-Please report this to <bug-gdb@gnu.org>.",
+      warning ("sc_sp_offset is %d instead of %d.",
 	       sc_sp_offset, SC_SP_OFFSET);
     }