e2fdb27dbb52f5c7c877cbfdb4b9003523c29e30
[dragonfly.git] / gnu / usr.bin / gdb / gdb / nm-fbsd.h
1 /* $DragonFly: src/gnu/usr.bin/gdb/gdb/Attic/nm-fbsd.h,v 1.1 2004/10/23 17:02:38 joerg Exp $ */
2 /* Native-dependent definitions for FreeBSD/i386.
3
4    Copyright 1986, 1987, 1989, 1992, 1994, 1996, 1997, 2000, 2001, 2004
5    Free Software Foundation, Inc.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 2 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program; if not, write to the Free Software
21    Foundation, Inc., 59 Temple Place - Suite 330,
22    Boston, MA 02111-1307, USA.  */
23
24 #ifndef NM_FBSD_H
25 #define NM_FBSD_H
26
27 #ifdef HAVE_PT_GETDBREGS
28 #define I386_USE_GENERIC_WATCHPOINTS
29 #endif
30
31 #include "i386/nm-i386.h"
32
33 #ifdef HAVE_SYS_PARAM_H
34 #include <sys/param.h>
35 #endif
36
37 extern int kernel_debugging;
38 extern int kernel_writablecore;
39
40 /* Provide access to the i386 hardware debugging registers.  */
41
42 #define I386_DR_LOW_SET_CONTROL(control) \
43   i386bsd_dr_set_control (control)
44 extern void i386bsd_dr_set_control (unsigned long control);
45
46 #define I386_DR_LOW_SET_ADDR(regnum, addr) \
47   i386bsd_dr_set_addr (regnum, addr)
48 extern void i386bsd_dr_set_addr (int regnum, CORE_ADDR addr);
49
50 #define I386_DR_LOW_RESET_ADDR(regnum) \
51   i386bsd_dr_reset_addr (regnum)
52 extern void i386bsd_dr_reset_addr (int regnum);
53
54 #define I386_DR_LOW_GET_STATUS() \
55   i386bsd_dr_get_status ()
56 extern unsigned long i386bsd_dr_get_status (void);
57 \f
58
59 /* Get generic BSD native definitions.  */
60 #include "config/nm-bsd.h"
61
62 /* Override child_resume in `infptrace.c' to work around a kernel bug.  */
63 #define CHILD_RESUME
64
65 /* Override child_pid_to_exec_file in 'inftarg.c'.  */
66 #define CHILD_PID_TO_EXEC_FILE
67 \f
68
69 /* Support for the user struct.  */
70
71 /* Return the size of the user struct.  */
72
73 #define KERNEL_U_SIZE kernel_u_size ()
74 extern int kernel_u_size (void);
75
76 /* This is the amount to subtract from u.u_ar0
77    to get the offset in the core file of the register values.  */
78
79 #include <machine/vmparam.h>
80 #define KERNEL_U_ADDR USRSTACK
81
82 #define REGISTER_U_ADDR(addr, blockend, regno) \
83   (addr) = register_u_addr ((blockend), (regno))
84 extern CORE_ADDR register_u_addr (CORE_ADDR blockend, int regno);
85 \f
86
87 /* Shared library support.  */
88
89 #include "solib.h"
90
91 /* Make structure definitions match up with those expected in
92    `solib-sunos.c'.  */
93
94 #define link_object     sod
95 #define lo_name         sod_name
96 #define lo_library      sod_library
97 #define lo_unused       sod_reserved
98 #define lo_major        sod_major
99 #define lo_minor        sod_minor
100 #define lo_next         sod_next
101
102 #define link_map        so_map
103 #define lm_addr         som_addr
104 #define lm_name         som_path
105 #define lm_next         som_next
106 #define lm_lop          som_sod
107 #define lm_lob          som_sodbase
108 #define lm_rwt          som_write
109 #define lm_ld           som_dynamic
110 #define lm_lpd          som_spd
111
112 #define link_dynamic_2  section_dispatch_table
113 #define ld_loaded       sdt_loaded
114 #define ld_need         sdt_sods
115 #define ld_rules        sdt_filler1
116 #define ld_got          sdt_got
117 #define ld_plt          sdt_plt
118 #define ld_rel          sdt_rel
119 #define ld_hash         sdt_hash
120 #define ld_stab         sdt_nzlist
121 #define ld_stab_hash    sdt_filler2
122 #define ld_buckets      sdt_buckets
123 #define ld_symbols      sdt_strings
124 #define ld_symb_size    sdt_str_sz
125 #define ld_text         sdt_text_sz
126 #define ld_plt_sz       sdt_plt_sz
127
128 #define rtc_symb        rt_symbol
129 #define rtc_sp          rt_sp
130 #define rtc_next        rt_next
131
132 #define ld_debug        so_debug
133 #define ldd_version     dd_version
134 #define ldd_in_debugger dd_in_debugger
135 #define ldd_sym_loaded  dd_sym_loaded
136 #define ldd_bp_addr     dd_bpt_addr
137 #define ldd_bp_inst     dd_bpt_shadow
138 #define ldd_cp          dd_cc
139
140 #define link_dynamic    _dynamic
141 #define ld_version      d_version
142 #define ldd             d_debug
143 #define ld_un           d_un
144 #define ld_2            d_sdt
145
146 /* kgdb hooks */
147 #define KGDB 1
148 #define ADDITIONAL_OPTIONS \
149        {"kernel", no_argument, &kernel_debugging, 1}, \
150        {"k", no_argument, &kernel_debugging, 1}, \
151        {"wcore", no_argument, &kernel_writablecore, 1}, \
152        {"w", no_argument, &kernel_writablecore, 1},
153
154 #define ADDITIONAL_OPTION_HELP \
155        "\
156   --kernel           Enable kernel debugging.\n\
157   --wcore            Make core file writable (only works for /dev/mem).\n\
158                      This option only works while debugging a kernel !!\n\
159 "
160
161 #define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) "
162
163 /* misuse START_PROGRESS to test whether we're running as kgdb */   
164 /* START_PROGRESS is called at the top of main */
165 #undef START_PROGRESS
166 #define START_PROGRESS(STR,N) \
167   if (!strcmp (STR, "kgdb")) \
168      kernel_debugging = 1;
169
170 #endif /* nm-fbsd.h */