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