1 /* Native-dependent code for DragonFly/i386.
3 Copyright (C) 2001, 2002, 2003, 2004, 2007, 2008, 2009
4 Free Software Foundation, Inc.
6 This file is part of GDB.
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include <sys/types.h>
27 #include <sys/ptrace.h>
28 #include <sys/sysctl.h>
31 #include "i386-tdep.h"
33 #include "i386bsd-nat.h"
35 /* Prevent warning from -Wmissing-prototypes. */
36 void _initialize_i386dfly_nat (void);
39 _initialize_i386dfly_nat (void)
43 /* Add some extra features to the common *BSD/i386 target. */
44 t = i386bsd_target ();
46 #ifdef HAVE_PT_GETDBREGS
48 i386_use_watchpoints (t);
50 i386_dr_low.set_control = i386bsd_dr_set_control;
51 i386_dr_low.set_addr = i386bsd_dr_set_addr;
52 i386_dr_low.reset_addr = i386bsd_dr_reset_addr;
53 i386_dr_low.get_status = i386bsd_dr_get_status;
54 i386_set_debug_register_length (4);
56 #endif /* HAVE_PT_GETDBREGS */
59 t->to_pid_to_exec_file = fbsd_pid_to_exec_file;
60 t->to_find_memory_regions = fbsd_find_memory_regions;
61 t->to_make_corefile_notes = fbsd_make_corefile_notes;
64 /* DragonFly provides a kern.ps_strings sysctl that we can use to
65 locate the sigtramp. That way we can still recognize a sigtramp
66 if its location is changed in a new kernel. Of course this is
67 still based on the assumption that the sigtramp is placed
68 directly under the location where the program arguments and
69 environment can be found. */
70 #ifdef KERN_PS_STRINGS
77 mib[1] = KERN_PS_STRINGS;
78 len = sizeof (ps_strings);
79 if (sysctl (mib, 2, &ps_strings, &len, NULL, 0) == 0)
81 i386dfly_sigtramp_start_addr = ps_strings - 128;
82 i386dfly_sigtramp_end_addr = ps_strings;