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