1 /* Target-dependent code for OpenBSD.
3 Copyright (C) 2005-2021 Free Software Foundation, Inc.
5 This file is part of GDB.
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 3 of the License, or
10 (at your option) any later version.
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.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
26 #include "obsd-tdep.h"
29 obsd_skip_solib_resolver (struct gdbarch *gdbarch, CORE_ADDR pc)
31 struct bound_minimal_symbol msym;
33 msym = lookup_minimal_symbol("_dl_bind", NULL, NULL);
34 if (msym.minsym && BMSYMBOL_VALUE_ADDRESS (msym) == pc)
35 return frame_unwind_caller_pc (get_current_frame ());
37 return find_solib_trampoline_target (get_current_frame (), pc);
40 /* OpenBSD signal numbers. From <sys/signal.h>. */
78 /* Implement the "gdb_signal_from_target" gdbarch method. */
80 static enum gdb_signal
81 obsd_gdb_signal_from_target (struct gdbarch *gdbarch, int signal)
89 return GDB_SIGNAL_HUP;
92 return GDB_SIGNAL_INT;
95 return GDB_SIGNAL_QUIT;
98 return GDB_SIGNAL_ILL;
101 return GDB_SIGNAL_TRAP;
104 return GDB_SIGNAL_ABRT;
107 return GDB_SIGNAL_EMT;
110 return GDB_SIGNAL_FPE;
113 return GDB_SIGNAL_KILL;
116 return GDB_SIGNAL_BUS;
119 return GDB_SIGNAL_SEGV;
122 return GDB_SIGNAL_SYS;
125 return GDB_SIGNAL_PIPE;
128 return GDB_SIGNAL_ALRM;
131 return GDB_SIGNAL_TERM;
134 return GDB_SIGNAL_URG;
137 return GDB_SIGNAL_STOP;
140 return GDB_SIGNAL_TSTP;
143 return GDB_SIGNAL_CONT;
146 return GDB_SIGNAL_CHLD;
149 return GDB_SIGNAL_TTIN;
152 return GDB_SIGNAL_TTOU;
155 return GDB_SIGNAL_IO;
158 return GDB_SIGNAL_XCPU;
161 return GDB_SIGNAL_XFSZ;
164 return GDB_SIGNAL_VTALRM;
167 return GDB_SIGNAL_PROF;
170 return GDB_SIGNAL_WINCH;
173 return GDB_SIGNAL_INFO;
176 return GDB_SIGNAL_USR1;
179 return GDB_SIGNAL_USR2;
182 return GDB_SIGNAL_UNKNOWN;
185 /* Implement the "gdb_signal_to_target" gdbarch method. */
188 obsd_gdb_signal_to_target (struct gdbarch *gdbarch,
189 enum gdb_signal signal)
202 case GDB_SIGNAL_QUIT:
208 case GDB_SIGNAL_TRAP:
211 case GDB_SIGNAL_ABRT:
220 case GDB_SIGNAL_KILL:
226 case GDB_SIGNAL_SEGV:
232 case GDB_SIGNAL_PIPE:
235 case GDB_SIGNAL_ALRM:
238 case GDB_SIGNAL_TERM:
244 case GDB_SIGNAL_STOP:
247 case GDB_SIGNAL_TSTP:
250 case GDB_SIGNAL_CONT:
253 case GDB_SIGNAL_CHLD:
256 case GDB_SIGNAL_TTIN:
259 case GDB_SIGNAL_TTOU:
265 case GDB_SIGNAL_XCPU:
268 case GDB_SIGNAL_XFSZ:
271 case GDB_SIGNAL_VTALRM:
272 return OBSD_SIGVTALRM;
274 case GDB_SIGNAL_PROF:
277 case GDB_SIGNAL_WINCH:
278 return OBSD_SIGWINCH;
280 case GDB_SIGNAL_USR1:
283 case GDB_SIGNAL_USR2:
286 case GDB_SIGNAL_INFO:
294 obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
296 set_gdbarch_gdb_signal_from_target (gdbarch,
297 obsd_gdb_signal_from_target);
298 set_gdbarch_gdb_signal_to_target (gdbarch,
299 obsd_gdb_signal_to_target);
301 set_gdbarch_auxv_parse (gdbarch, svr4_auxv_parse);