Merge from vendor branch GDB:
[dragonfly.git] / gnu / usr.bin / binutils214 / gdb / i386 / nm.h
1 /*
2  * $FreeBSD: src/gnu/usr.bin/binutils/gdb/i386/nm.h,v 1.9.4.1 2000/08/22 12:28:19 joerg Exp $
3  * $DragonFly: src/gnu/usr.bin/binutils214/gdb/i386/Attic/nm.h,v 1.1 2004/02/01 08:53:04 dillon Exp $
4  */
5 /* Native-dependent definitions for Intel 386 running BSD Unix, for GDB.
6    Copyright 1986, 1987, 1989, 1992, 1996 Free Software Foundation, Inc.
7
8 This file is part of GDB.
9
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
23
24 #ifndef NM_FREEBSD_H
25 #define NM_FREEBSD_H
26
27 #define ATTACH_DETACH
28
29 /* Be shared lib aware */
30 #include "solib.h"
31 #ifdef FREEBSD_ELF
32 #define SVR4_SHARED_LIBS
33 #endif
34
35 /* This is the amount to subtract from u.u_ar0
36    to get the offset in the core file of the register values.  */
37
38 #include <machine/vmparam.h>
39 #define KERNEL_U_ADDR USRSTACK
40
41 #define REGISTER_U_ADDR(addr, blockend, regno) \
42         (addr) = i386_register_u_addr ((blockend),(regno));
43
44 /* We define our own fetch/store methods */
45 #define FETCH_INFERIOR_REGISTERS
46
47 extern int
48 i386_register_u_addr PARAMS ((int, int));
49
50 #define PTRACE_ARG3_TYPE char*
51
52 #ifndef FREEBSD_ELF
53
54 /* make structure definitions match up with those expected in solib.c */
55 #define link_object     sod
56 #define lo_name         sod_name
57 #define lo_library      sod_library
58 #define lo_unused       sod_reserved
59 #define lo_major        sod_major
60 #define lo_minor        sod_minor
61 #define lo_next         sod_next
62
63 #define link_map        so_map
64 #define lm_addr         som_addr
65 #define lm_name         som_path
66 #define lm_next         som_next
67 #define lm_lop          som_sod
68 #define lm_lob          som_sodbase
69 #define lm_rwt          som_write
70 #define lm_ld           som_dynamic
71 #define lm_lpd          som_spd
72
73 #define link_dynamic_2  section_dispatch_table
74 #define ld_loaded       sdt_loaded
75 #define ld_need         sdt_sods
76 #define ld_rules        sdt_filler1
77 #define ld_got          sdt_got
78 #define ld_plt          sdt_plt
79 #define ld_rel          sdt_rel
80 #define ld_hash         sdt_hash
81 #define ld_stab         sdt_nzlist
82 #define ld_stab_hash    sdt_filler2
83 #define ld_buckets      sdt_buckets
84 #define ld_symbols      sdt_strings
85 #define ld_symb_size    sdt_str_sz
86 #define ld_text         sdt_text_sz
87 #define ld_plt_sz       sdt_plt_sz
88
89 #define rtc_symb        rt_symbol
90 #define rtc_sp          rt_sp
91 #define rtc_next        rt_next
92
93 #define ld_debug        so_debug
94 #define ldd_version     dd_version
95 #define ldd_in_debugger dd_in_debugger
96 #define ldd_sym_loaded  dd_sym_loaded
97 #define ldd_bp_addr     dd_bpt_addr
98 #define ldd_bp_inst     dd_bpt_shadow
99 #define ldd_cp          dd_cc
100
101 #define link_dynamic    _dynamic
102 #define ld_version      d_version
103 #define ldd             d_debug
104 #define ld_un           d_un
105 #define ld_2            d_sdt
106
107 #endif
108
109 /* Return sizeof user struct to callers in less machine dependent routines */
110
111 #define KERNEL_U_SIZE kernel_u_size()
112 extern int kernel_u_size PARAMS ((void));
113
114 #define ADDITIONAL_OPTIONS \
115         {"kernel", no_argument, &kernel_debugging, 1}, \
116         {"k", no_argument, &kernel_debugging, 1}, \
117         {"wcore", no_argument, &kernel_writablecore, 1}, \
118         {"w", no_argument, &kernel_writablecore, 1},
119
120 #define ADDITIONAL_OPTION_HELP \
121         "\
122   --kernel           Enable kernel debugging.\n\
123   --wcore            Make core file writable (only works for /dev/mem).\n\
124                      This option only works while debugging a kernel !!\n\
125 "
126
127 extern int kernel_debugging;
128 extern int kernel_writablecore;
129
130 #define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) "
131
132 /* misuse START_PROGRESS to test whether we're running as kgdb */
133 /* START_PROGRESS is called at the top of main */
134 #undef START_PROGRESS
135 #define START_PROGRESS(STR,N) \
136   if (!strcmp(STR, "kgdb")) \
137      kernel_debugging = 1;
138
139 #include <sys/types.h>
140 #include <sys/ptrace.h>
141
142 #ifdef PT_GETDBREGS
143 #define TARGET_HAS_HARDWARE_WATCHPOINTS
144
145 extern int can_watch PARAMS((int type, int cnt, int othertype));
146 extern int stopped_by_watchpoint PARAMS((void));
147 extern int insert_watchpoint PARAMS((int addr, int len, int type));
148 extern int remove_watchpoint PARAMS((int addr, int len, int type));
149
150 #define TARGET_CAN_USE_HARDWARE_WATCHPOINT(type, cnt, ot) \
151         can_watch(type, cnt, ot)
152
153 /* After a watchpoint trap, the PC points to the instruction after
154    the one that caused the trap.  Therefore we don't need to step over it.
155    But we do need to reset the status register to avoid another trap.  */
156 #define HAVE_CONTINUABLE_WATCHPOINT
157
158 #define STOPPED_BY_WATCHPOINT(W)  \
159         stopped_by_watchpoint()
160
161 /* Use these macros for watchpoint insertion/removal.  */
162
163 #define target_insert_watchpoint(addr, len, type)  \
164         insert_watchpoint(addr, len, type)
165
166 #define target_remove_watchpoint(addr, len, type)  \
167         remove_watchpoint(addr, len, type)
168
169 #endif /* PT_GETDBREGS */
170
171 #endif /* NM_FREEBSD_H */