1 /* Common target-dependent code for NetBSD systems.
3 Copyright (C) 2002-2020 Free Software Foundation, Inc.
5 Contributed by Wasabi Systems, Inc.
7 This file is part of GDB.
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 3 of the License, or
12 (at your option) any later version.
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.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
23 #include "solib-svr4.h"
24 #include "nbsd-tdep.h"
27 /* FIXME: kettenis/20060115: We should really eliminate the next two
28 functions completely. */
30 struct link_map_offsets
*
31 nbsd_ilp32_solib_svr4_fetch_link_map_offsets (void)
33 return svr4_ilp32_fetch_link_map_offsets ();
36 struct link_map_offsets
*
37 nbsd_lp64_solib_svr4_fetch_link_map_offsets (void)
39 return svr4_lp64_fetch_link_map_offsets ();
43 nbsd_pc_in_sigtramp (CORE_ADDR pc
, const char *func_name
)
45 /* Check for libc-provided signal trampoline. All such trampolines
46 have function names which begin with "__sigtramp". */
48 return (func_name
!= NULL
49 && startswith (func_name
, "__sigtramp"));
52 /* This enum is derived from NETBSD's <sys/signal.h>. */
92 /* Implement the "gdb_signal_from_target" gdbarch method. */
94 static enum gdb_signal
95 nbsd_gdb_signal_from_target (struct gdbarch
*gdbarch
, int signal
)
103 return GDB_SIGNAL_HUP
;
106 return GDB_SIGNAL_INT
;
109 return GDB_SIGNAL_QUIT
;
112 return GDB_SIGNAL_ILL
;
115 return GDB_SIGNAL_TRAP
;
118 return GDB_SIGNAL_ABRT
;
121 return GDB_SIGNAL_EMT
;
124 return GDB_SIGNAL_FPE
;
127 return GDB_SIGNAL_KILL
;
130 return GDB_SIGNAL_BUS
;
133 return GDB_SIGNAL_SEGV
;
136 return GDB_SIGNAL_SYS
;
139 return GDB_SIGNAL_PIPE
;
142 return GDB_SIGNAL_ALRM
;
145 return GDB_SIGNAL_TERM
;
148 return GDB_SIGNAL_URG
;
151 return GDB_SIGNAL_STOP
;
154 return GDB_SIGNAL_TSTP
;
157 return GDB_SIGNAL_CONT
;
160 return GDB_SIGNAL_CHLD
;
163 return GDB_SIGNAL_TTIN
;
166 return GDB_SIGNAL_TTOU
;
169 return GDB_SIGNAL_IO
;
172 return GDB_SIGNAL_XCPU
;
175 return GDB_SIGNAL_XFSZ
;
178 return GDB_SIGNAL_VTALRM
;
181 return GDB_SIGNAL_PROF
;
184 return GDB_SIGNAL_WINCH
;
187 return GDB_SIGNAL_INFO
;
190 return GDB_SIGNAL_USR1
;
193 return GDB_SIGNAL_USR2
;
196 return GDB_SIGNAL_PWR
;
198 /* SIGRTMIN and SIGRTMAX are not continuous in <gdb/signals.def>,
199 therefore we have to handle them here. */
201 return GDB_SIGNAL_REALTIME_33
;
204 return GDB_SIGNAL_REALTIME_63
;
207 if (signal
>= NBSD_SIGRTMIN
+ 1 && signal
<= NBSD_SIGRTMAX
- 1)
209 int offset
= signal
- NBSD_SIGRTMIN
+ 1;
211 return (enum gdb_signal
) ((int) GDB_SIGNAL_REALTIME_34
+ offset
);
214 return GDB_SIGNAL_UNKNOWN
;
217 /* Implement the "gdb_signal_to_target" gdbarch method. */
220 nbsd_gdb_signal_to_target (struct gdbarch
*gdbarch
,
221 enum gdb_signal signal
)
234 case GDB_SIGNAL_QUIT
:
240 case GDB_SIGNAL_TRAP
:
243 case GDB_SIGNAL_ABRT
:
252 case GDB_SIGNAL_KILL
:
258 case GDB_SIGNAL_SEGV
:
264 case GDB_SIGNAL_PIPE
:
267 case GDB_SIGNAL_ALRM
:
270 case GDB_SIGNAL_TERM
:
276 case GDB_SIGNAL_TSTP
:
279 case GDB_SIGNAL_CONT
:
282 case GDB_SIGNAL_CHLD
:
285 case GDB_SIGNAL_TTIN
:
288 case GDB_SIGNAL_TTOU
:
294 case GDB_SIGNAL_XCPU
:
297 case GDB_SIGNAL_XFSZ
:
300 case GDB_SIGNAL_VTALRM
:
301 return NBSD_SIGVTALRM
;
303 case GDB_SIGNAL_PROF
:
306 case GDB_SIGNAL_WINCH
:
307 return NBSD_SIGWINCH
;
309 case GDB_SIGNAL_INFO
:
312 case GDB_SIGNAL_USR1
:
315 case GDB_SIGNAL_USR2
:
321 /* GDB_SIGNAL_REALTIME_33 is not continuous in <gdb/signals.def>,
322 therefore we have to handle it here. */
323 case GDB_SIGNAL_REALTIME_33
:
324 return NBSD_SIGRTMIN
;
326 /* Same comment applies to _64. */
327 case GDB_SIGNAL_REALTIME_63
:
328 return NBSD_SIGRTMAX
;
331 if (signal
>= GDB_SIGNAL_REALTIME_34
332 && signal
<= GDB_SIGNAL_REALTIME_62
)
334 int offset
= signal
- GDB_SIGNAL_REALTIME_32
;
336 return NBSD_SIGRTMIN
+ 1 + offset
;
342 /* See nbsd-tdep.h. */
345 nbsd_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
347 set_gdbarch_gdb_signal_from_target (gdbarch
, nbsd_gdb_signal_from_target
);
348 set_gdbarch_gdb_signal_to_target (gdbarch
, nbsd_gdb_signal_to_target
);