mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-07 16:13:03 +00:00
This removes gdb_string.h. This patch is purely mechanical. I
created it by running the two commands:
git rm common/gdb_string.h
perl -pi -e's/"gdb_string.h"/<string.h>/;' *.[chyl] */*.[chyl]
2013-11-18 Tom Tromey <tromey@redhat.com>
* common/gdb_string.h: Remove.
* aarch64-tdep.c: Use string.h, not gdb_string.h.
* ada-exp.y: Use string.h, not gdb_string.h.
* ada-lang.c: Use string.h, not gdb_string.h.
* ada-lex.l: Use string.h, not gdb_string.h.
* ada-typeprint.c: Use string.h, not gdb_string.h.
* ada-valprint.c: Use string.h, not gdb_string.h.
* aix-thread.c: Use string.h, not gdb_string.h.
* alpha-linux-tdep.c: Use string.h, not gdb_string.h.
* alpha-mdebug-tdep.c: Use string.h, not gdb_string.h.
* alpha-nat.c: Use string.h, not gdb_string.h.
* alpha-osf1-tdep.c: Use string.h, not gdb_string.h.
* alpha-tdep.c: Use string.h, not gdb_string.h.
* alphanbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64-dicos-tdep.c: Use string.h, not gdb_string.h.
* amd64-linux-nat.c: Use string.h, not gdb_string.h.
* amd64-linux-tdep.c: Use string.h, not gdb_string.h.
* amd64-nat.c: Use string.h, not gdb_string.h.
* amd64-sol2-tdep.c: Use string.h, not gdb_string.h.
* amd64fbsd-tdep.c: Use string.h, not gdb_string.h.
* amd64obsd-tdep.c: Use string.h, not gdb_string.h.
* arch-utils.c: Use string.h, not gdb_string.h.
* arm-linux-nat.c: Use string.h, not gdb_string.h.
* arm-linux-tdep.c: Use string.h, not gdb_string.h.
* arm-tdep.c: Use string.h, not gdb_string.h.
* arm-wince-tdep.c: Use string.h, not gdb_string.h.
* armbsd-tdep.c: Use string.h, not gdb_string.h.
* armnbsd-nat.c: Use string.h, not gdb_string.h.
* armnbsd-tdep.c: Use string.h, not gdb_string.h.
* armobsd-tdep.c: Use string.h, not gdb_string.h.
* avr-tdep.c: Use string.h, not gdb_string.h.
* ax-gdb.c: Use string.h, not gdb_string.h.
* ax-general.c: Use string.h, not gdb_string.h.
* bcache.c: Use string.h, not gdb_string.h.
* bfin-tdep.c: Use string.h, not gdb_string.h.
* breakpoint.c: Use string.h, not gdb_string.h.
* build-id.c: Use string.h, not gdb_string.h.
* buildsym.c: Use string.h, not gdb_string.h.
* c-exp.y: Use string.h, not gdb_string.h.
* c-lang.c: Use string.h, not gdb_string.h.
* c-typeprint.c: Use string.h, not gdb_string.h.
* c-valprint.c: Use string.h, not gdb_string.h.
* charset.c: Use string.h, not gdb_string.h.
* cli-out.c: Use string.h, not gdb_string.h.
* cli/cli-cmds.c: Use string.h, not gdb_string.h.
* cli/cli-decode.c: Use string.h, not gdb_string.h.
* cli/cli-dump.c: Use string.h, not gdb_string.h.
* cli/cli-interp.c: Use string.h, not gdb_string.h.
* cli/cli-logging.c: Use string.h, not gdb_string.h.
* cli/cli-script.c: Use string.h, not gdb_string.h.
* cli/cli-setshow.c: Use string.h, not gdb_string.h.
* cli/cli-utils.c: Use string.h, not gdb_string.h.
* coffread.c: Use string.h, not gdb_string.h.
* common/common-utils.c: Use string.h, not gdb_string.h.
* common/filestuff.c: Use string.h, not gdb_string.h.
* common/linux-procfs.c: Use string.h, not gdb_string.h.
* common/linux-ptrace.c: Use string.h, not gdb_string.h.
* common/signals.c: Use string.h, not gdb_string.h.
* common/vec.h: Use string.h, not gdb_string.h.
* core-regset.c: Use string.h, not gdb_string.h.
* corefile.c: Use string.h, not gdb_string.h.
* corelow.c: Use string.h, not gdb_string.h.
* cp-abi.c: Use string.h, not gdb_string.h.
* cp-support.c: Use string.h, not gdb_string.h.
* cp-valprint.c: Use string.h, not gdb_string.h.
* cris-tdep.c: Use string.h, not gdb_string.h.
* d-lang.c: Use string.h, not gdb_string.h.
* dbxread.c: Use string.h, not gdb_string.h.
* dcache.c: Use string.h, not gdb_string.h.
* demangle.c: Use string.h, not gdb_string.h.
* dicos-tdep.c: Use string.h, not gdb_string.h.
* disasm.c: Use string.h, not gdb_string.h.
* doublest.c: Use string.h, not gdb_string.h.
* dsrec.c: Use string.h, not gdb_string.h.
* dummy-frame.c: Use string.h, not gdb_string.h.
* dwarf2-frame.c: Use string.h, not gdb_string.h.
* dwarf2loc.c: Use string.h, not gdb_string.h.
* dwarf2read.c: Use string.h, not gdb_string.h.
* elfread.c: Use string.h, not gdb_string.h.
* environ.c: Use string.h, not gdb_string.h.
* eval.c: Use string.h, not gdb_string.h.
* event-loop.c: Use string.h, not gdb_string.h.
* exceptions.c: Use string.h, not gdb_string.h.
* exec.c: Use string.h, not gdb_string.h.
* expprint.c: Use string.h, not gdb_string.h.
* f-exp.y: Use string.h, not gdb_string.h.
* f-lang.c: Use string.h, not gdb_string.h.
* f-typeprint.c: Use string.h, not gdb_string.h.
* f-valprint.c: Use string.h, not gdb_string.h.
* fbsd-nat.c: Use string.h, not gdb_string.h.
* findcmd.c: Use string.h, not gdb_string.h.
* findvar.c: Use string.h, not gdb_string.h.
* fork-child.c: Use string.h, not gdb_string.h.
* frame.c: Use string.h, not gdb_string.h.
* frv-linux-tdep.c: Use string.h, not gdb_string.h.
* frv-tdep.c: Use string.h, not gdb_string.h.
* gdb.c: Use string.h, not gdb_string.h.
* gdb_bfd.c: Use string.h, not gdb_string.h.
* gdbarch.c: Use string.h, not gdb_string.h.
* gdbtypes.c: Use string.h, not gdb_string.h.
* gnu-nat.c: Use string.h, not gdb_string.h.
* gnu-v2-abi.c: Use string.h, not gdb_string.h.
* gnu-v3-abi.c: Use string.h, not gdb_string.h.
* go-exp.y: Use string.h, not gdb_string.h.
* go-lang.c: Use string.h, not gdb_string.h.
* go32-nat.c: Use string.h, not gdb_string.h.
* hppa-hpux-tdep.c: Use string.h, not gdb_string.h.
* hppa-linux-nat.c: Use string.h, not gdb_string.h.
* hppanbsd-tdep.c: Use string.h, not gdb_string.h.
* hppaobsd-tdep.c: Use string.h, not gdb_string.h.
* i386-cygwin-tdep.c: Use string.h, not gdb_string.h.
* i386-dicos-tdep.c: Use string.h, not gdb_string.h.
* i386-linux-nat.c: Use string.h, not gdb_string.h.
* i386-linux-tdep.c: Use string.h, not gdb_string.h.
* i386-nto-tdep.c: Use string.h, not gdb_string.h.
* i386-sol2-tdep.c: Use string.h, not gdb_string.h.
* i386-tdep.c: Use string.h, not gdb_string.h.
* i386bsd-tdep.c: Use string.h, not gdb_string.h.
* i386gnu-nat.c: Use string.h, not gdb_string.h.
* i386nbsd-tdep.c: Use string.h, not gdb_string.h.
* i386obsd-tdep.c: Use string.h, not gdb_string.h.
* i387-tdep.c: Use string.h, not gdb_string.h.
* ia64-libunwind-tdep.c: Use string.h, not gdb_string.h.
* ia64-linux-nat.c: Use string.h, not gdb_string.h.
* inf-child.c: Use string.h, not gdb_string.h.
* inf-ptrace.c: Use string.h, not gdb_string.h.
* inf-ttrace.c: Use string.h, not gdb_string.h.
* infcall.c: Use string.h, not gdb_string.h.
* infcmd.c: Use string.h, not gdb_string.h.
* inflow.c: Use string.h, not gdb_string.h.
* infrun.c: Use string.h, not gdb_string.h.
* interps.c: Use string.h, not gdb_string.h.
* iq2000-tdep.c: Use string.h, not gdb_string.h.
* irix5-nat.c: Use string.h, not gdb_string.h.
* jv-exp.y: Use string.h, not gdb_string.h.
* jv-lang.c: Use string.h, not gdb_string.h.
* jv-typeprint.c: Use string.h, not gdb_string.h.
* jv-valprint.c: Use string.h, not gdb_string.h.
* language.c: Use string.h, not gdb_string.h.
* linux-fork.c: Use string.h, not gdb_string.h.
* linux-nat.c: Use string.h, not gdb_string.h.
* lm32-tdep.c: Use string.h, not gdb_string.h.
* m2-exp.y: Use string.h, not gdb_string.h.
* m2-typeprint.c: Use string.h, not gdb_string.h.
* m32c-tdep.c: Use string.h, not gdb_string.h.
* m32r-linux-nat.c: Use string.h, not gdb_string.h.
* m32r-linux-tdep.c: Use string.h, not gdb_string.h.
* m32r-rom.c: Use string.h, not gdb_string.h.
* m32r-tdep.c: Use string.h, not gdb_string.h.
* m68hc11-tdep.c: Use string.h, not gdb_string.h.
* m68k-tdep.c: Use string.h, not gdb_string.h.
* m68kbsd-tdep.c: Use string.h, not gdb_string.h.
* m68klinux-nat.c: Use string.h, not gdb_string.h.
* m68klinux-tdep.c: Use string.h, not gdb_string.h.
* m88k-tdep.c: Use string.h, not gdb_string.h.
* macrocmd.c: Use string.h, not gdb_string.h.
* main.c: Use string.h, not gdb_string.h.
* mdebugread.c: Use string.h, not gdb_string.h.
* mem-break.c: Use string.h, not gdb_string.h.
* memattr.c: Use string.h, not gdb_string.h.
* memory-map.c: Use string.h, not gdb_string.h.
* mep-tdep.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-break.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-disas.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-env.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-stack.c: Use string.h, not gdb_string.h.
* mi/mi-cmd-var.c: Use string.h, not gdb_string.h.
* mi/mi-cmds.c: Use string.h, not gdb_string.h.
* mi/mi-console.c: Use string.h, not gdb_string.h.
* mi/mi-getopt.c: Use string.h, not gdb_string.h.
* mi/mi-interp.c: Use string.h, not gdb_string.h.
* mi/mi-main.c: Use string.h, not gdb_string.h.
* mi/mi-parse.c: Use string.h, not gdb_string.h.
* microblaze-rom.c: Use string.h, not gdb_string.h.
* microblaze-tdep.c: Use string.h, not gdb_string.h.
* mingw-hdep.c: Use string.h, not gdb_string.h.
* minidebug.c: Use string.h, not gdb_string.h.
* minsyms.c: Use string.h, not gdb_string.h.
* mips-irix-tdep.c: Use string.h, not gdb_string.h.
* mips-linux-tdep.c: Use string.h, not gdb_string.h.
* mips-tdep.c: Use string.h, not gdb_string.h.
* mips64obsd-tdep.c: Use string.h, not gdb_string.h.
* mipsnbsd-tdep.c: Use string.h, not gdb_string.h.
* mipsread.c: Use string.h, not gdb_string.h.
* mn10300-linux-tdep.c: Use string.h, not gdb_string.h.
* mn10300-tdep.c: Use string.h, not gdb_string.h.
* monitor.c: Use string.h, not gdb_string.h.
* moxie-tdep.c: Use string.h, not gdb_string.h.
* mt-tdep.c: Use string.h, not gdb_string.h.
* nbsd-tdep.c: Use string.h, not gdb_string.h.
* nios2-linux-tdep.c: Use string.h, not gdb_string.h.
* nto-procfs.c: Use string.h, not gdb_string.h.
* nto-tdep.c: Use string.h, not gdb_string.h.
* objc-lang.c: Use string.h, not gdb_string.h.
* objfiles.c: Use string.h, not gdb_string.h.
* opencl-lang.c: Use string.h, not gdb_string.h.
* osabi.c: Use string.h, not gdb_string.h.
* osdata.c: Use string.h, not gdb_string.h.
* p-exp.y: Use string.h, not gdb_string.h.
* p-lang.c: Use string.h, not gdb_string.h.
* p-typeprint.c: Use string.h, not gdb_string.h.
* parse.c: Use string.h, not gdb_string.h.
* posix-hdep.c: Use string.h, not gdb_string.h.
* ppc-linux-nat.c: Use string.h, not gdb_string.h.
* ppc-sysv-tdep.c: Use string.h, not gdb_string.h.
* ppcfbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcnbsd-tdep.c: Use string.h, not gdb_string.h.
* ppcobsd-tdep.c: Use string.h, not gdb_string.h.
* printcmd.c: Use string.h, not gdb_string.h.
* procfs.c: Use string.h, not gdb_string.h.
* prologue-value.c: Use string.h, not gdb_string.h.
* python/py-auto-load.c: Use string.h, not gdb_string.h.
* python/py-gdb-readline.c: Use string.h, not gdb_string.h.
* ravenscar-thread.c: Use string.h, not gdb_string.h.
* regcache.c: Use string.h, not gdb_string.h.
* registry.c: Use string.h, not gdb_string.h.
* remote-fileio.c: Use string.h, not gdb_string.h.
* remote-m32r-sdi.c: Use string.h, not gdb_string.h.
* remote-mips.c: Use string.h, not gdb_string.h.
* remote-sim.c: Use string.h, not gdb_string.h.
* remote.c: Use string.h, not gdb_string.h.
* reverse.c: Use string.h, not gdb_string.h.
* rs6000-aix-tdep.c: Use string.h, not gdb_string.h.
* ser-base.c: Use string.h, not gdb_string.h.
* ser-go32.c: Use string.h, not gdb_string.h.
* ser-mingw.c: Use string.h, not gdb_string.h.
* ser-pipe.c: Use string.h, not gdb_string.h.
* ser-tcp.c: Use string.h, not gdb_string.h.
* ser-unix.c: Use string.h, not gdb_string.h.
* serial.c: Use string.h, not gdb_string.h.
* sh-tdep.c: Use string.h, not gdb_string.h.
* sh64-tdep.c: Use string.h, not gdb_string.h.
* shnbsd-tdep.c: Use string.h, not gdb_string.h.
* skip.c: Use string.h, not gdb_string.h.
* sol-thread.c: Use string.h, not gdb_string.h.
* solib-dsbt.c: Use string.h, not gdb_string.h.
* solib-frv.c: Use string.h, not gdb_string.h.
* solib-osf.c: Use string.h, not gdb_string.h.
* solib-spu.c: Use string.h, not gdb_string.h.
* solib-target.c: Use string.h, not gdb_string.h.
* solib.c: Use string.h, not gdb_string.h.
* somread.c: Use string.h, not gdb_string.h.
* source.c: Use string.h, not gdb_string.h.
* sparc-nat.c: Use string.h, not gdb_string.h.
* sparc-sol2-tdep.c: Use string.h, not gdb_string.h.
* sparc-tdep.c: Use string.h, not gdb_string.h.
* sparc64-tdep.c: Use string.h, not gdb_string.h.
* sparc64fbsd-tdep.c: Use string.h, not gdb_string.h.
* sparc64nbsd-tdep.c: Use string.h, not gdb_string.h.
* sparcnbsd-tdep.c: Use string.h, not gdb_string.h.
* spu-linux-nat.c: Use string.h, not gdb_string.h.
* spu-multiarch.c: Use string.h, not gdb_string.h.
* spu-tdep.c: Use string.h, not gdb_string.h.
* stabsread.c: Use string.h, not gdb_string.h.
* stack.c: Use string.h, not gdb_string.h.
* std-regs.c: Use string.h, not gdb_string.h.
* symfile.c: Use string.h, not gdb_string.h.
* symmisc.c: Use string.h, not gdb_string.h.
* symtab.c: Use string.h, not gdb_string.h.
* target.c: Use string.h, not gdb_string.h.
* thread.c: Use string.h, not gdb_string.h.
* tilegx-linux-nat.c: Use string.h, not gdb_string.h.
* tilegx-tdep.c: Use string.h, not gdb_string.h.
* top.c: Use string.h, not gdb_string.h.
* tracepoint.c: Use string.h, not gdb_string.h.
* tui/tui-command.c: Use string.h, not gdb_string.h.
* tui/tui-data.c: Use string.h, not gdb_string.h.
* tui/tui-disasm.c: Use string.h, not gdb_string.h.
* tui/tui-file.c: Use string.h, not gdb_string.h.
* tui/tui-layout.c: Use string.h, not gdb_string.h.
* tui/tui-out.c: Use string.h, not gdb_string.h.
* tui/tui-regs.c: Use string.h, not gdb_string.h.
* tui/tui-source.c: Use string.h, not gdb_string.h.
* tui/tui-stack.c: Use string.h, not gdb_string.h.
* tui/tui-win.c: Use string.h, not gdb_string.h.
* tui/tui-windata.c: Use string.h, not gdb_string.h.
* tui/tui-winsource.c: Use string.h, not gdb_string.h.
* typeprint.c: Use string.h, not gdb_string.h.
* ui-file.c: Use string.h, not gdb_string.h.
* ui-out.c: Use string.h, not gdb_string.h.
* user-regs.c: Use string.h, not gdb_string.h.
* utils.c: Use string.h, not gdb_string.h.
* v850-tdep.c: Use string.h, not gdb_string.h.
* valarith.c: Use string.h, not gdb_string.h.
* valops.c: Use string.h, not gdb_string.h.
* valprint.c: Use string.h, not gdb_string.h.
* value.c: Use string.h, not gdb_string.h.
* varobj.c: Use string.h, not gdb_string.h.
* vax-tdep.c: Use string.h, not gdb_string.h.
* vaxnbsd-tdep.c: Use string.h, not gdb_string.h.
* vaxobsd-tdep.c: Use string.h, not gdb_string.h.
* windows-nat.c: Use string.h, not gdb_string.h.
* xcoffread.c: Use string.h, not gdb_string.h.
* xml-support.c: Use string.h, not gdb_string.h.
* xstormy16-tdep.c: Use string.h, not gdb_string.h.
* xtensa-linux-nat.c: Use string.h, not gdb_string.h.
661 lines
15 KiB
C
661 lines
15 KiB
C
/* Target signal translation functions for GDB.
|
||
Copyright (C) 1990-2013 Free Software Foundation, Inc.
|
||
Contributed by Cygnus Support.
|
||
|
||
This file is part of GDB.
|
||
|
||
This program is free software; you can redistribute it and/or modify
|
||
it under the terms of the GNU General Public License as published by
|
||
the Free Software Foundation; either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
This program is distributed in the hope that it will be useful,
|
||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
GNU General Public License for more details.
|
||
|
||
You should have received a copy of the GNU General Public License
|
||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||
|
||
#ifdef GDBSERVER
|
||
#include "server.h"
|
||
#else
|
||
#include "defs.h"
|
||
#include <string.h>
|
||
#endif
|
||
|
||
#ifdef HAVE_SIGNAL_H
|
||
#include <signal.h>
|
||
#endif
|
||
|
||
#include "gdb_signals.h"
|
||
#include "gdb_assert.h"
|
||
|
||
struct gdbarch;
|
||
|
||
/* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest
|
||
_available_ realtime signal, not the lowest supported; glibc takes
|
||
several for its own use. */
|
||
|
||
#ifndef REALTIME_LO
|
||
# if defined(__SIGRTMIN)
|
||
# define REALTIME_LO __SIGRTMIN
|
||
# define REALTIME_HI (__SIGRTMAX + 1)
|
||
# elif defined(SIGRTMIN)
|
||
# define REALTIME_LO SIGRTMIN
|
||
# define REALTIME_HI (SIGRTMAX + 1)
|
||
# endif
|
||
#endif
|
||
|
||
/* This table must match in order and size the signals in enum
|
||
gdb_signal. */
|
||
|
||
static const struct {
|
||
const char *symbol;
|
||
const char *name;
|
||
const char *string;
|
||
} signals [] =
|
||
{
|
||
#define SET(symbol, constant, name, string) { #symbol, name, string },
|
||
#include "gdb/signals.def"
|
||
#undef SET
|
||
};
|
||
|
||
const char *
|
||
gdb_signal_to_symbol_string (enum gdb_signal sig)
|
||
{
|
||
gdb_assert ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST);
|
||
|
||
return signals[sig].symbol;
|
||
}
|
||
|
||
/* Return the string for a signal. */
|
||
const char *
|
||
gdb_signal_to_string (enum gdb_signal sig)
|
||
{
|
||
if ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST)
|
||
return signals[sig].string;
|
||
else
|
||
return signals[GDB_SIGNAL_UNKNOWN].string;
|
||
}
|
||
|
||
/* Return the name for a signal. */
|
||
const char *
|
||
gdb_signal_to_name (enum gdb_signal sig)
|
||
{
|
||
if ((int) sig >= GDB_SIGNAL_FIRST && (int) sig <= GDB_SIGNAL_LAST
|
||
&& signals[sig].name != NULL)
|
||
return signals[sig].name;
|
||
else
|
||
/* I think the code which prints this will always print it along
|
||
with the string, so no need to be verbose (very old comment). */
|
||
return "?";
|
||
}
|
||
|
||
/* Given a name, return its signal. */
|
||
enum gdb_signal
|
||
gdb_signal_from_name (const char *name)
|
||
{
|
||
enum gdb_signal sig;
|
||
|
||
/* It's possible we also should allow "SIGCLD" as well as "SIGCHLD"
|
||
for GDB_SIGNAL_SIGCHLD. SIGIOT, on the other hand, is more
|
||
questionable; seems like by now people should call it SIGABRT
|
||
instead. */
|
||
|
||
/* This ugly cast brought to you by the native VAX compiler. */
|
||
for (sig = GDB_SIGNAL_HUP;
|
||
sig < GDB_SIGNAL_LAST;
|
||
sig = (enum gdb_signal) ((int) sig + 1))
|
||
if (signals[sig].name != NULL
|
||
&& strcmp (name, signals[sig].name) == 0)
|
||
return sig;
|
||
return GDB_SIGNAL_UNKNOWN;
|
||
}
|
||
|
||
/* The following functions are to help certain targets deal
|
||
with the signal/waitstatus stuff. They could just as well be in
|
||
a file called native-utils.c or unixwaitstatus-utils.c or whatever. */
|
||
|
||
/* Convert host signal to our signals. */
|
||
enum gdb_signal
|
||
gdb_signal_from_host (int hostsig)
|
||
{
|
||
/* A switch statement would make sense but would require special kludges
|
||
to deal with the cases where more than one signal has the same number. */
|
||
|
||
if (hostsig == 0)
|
||
return GDB_SIGNAL_0;
|
||
|
||
#if defined (SIGHUP)
|
||
if (hostsig == SIGHUP)
|
||
return GDB_SIGNAL_HUP;
|
||
#endif
|
||
#if defined (SIGINT)
|
||
if (hostsig == SIGINT)
|
||
return GDB_SIGNAL_INT;
|
||
#endif
|
||
#if defined (SIGQUIT)
|
||
if (hostsig == SIGQUIT)
|
||
return GDB_SIGNAL_QUIT;
|
||
#endif
|
||
#if defined (SIGILL)
|
||
if (hostsig == SIGILL)
|
||
return GDB_SIGNAL_ILL;
|
||
#endif
|
||
#if defined (SIGTRAP)
|
||
if (hostsig == SIGTRAP)
|
||
return GDB_SIGNAL_TRAP;
|
||
#endif
|
||
#if defined (SIGABRT)
|
||
if (hostsig == SIGABRT)
|
||
return GDB_SIGNAL_ABRT;
|
||
#endif
|
||
#if defined (SIGEMT)
|
||
if (hostsig == SIGEMT)
|
||
return GDB_SIGNAL_EMT;
|
||
#endif
|
||
#if defined (SIGFPE)
|
||
if (hostsig == SIGFPE)
|
||
return GDB_SIGNAL_FPE;
|
||
#endif
|
||
#if defined (SIGKILL)
|
||
if (hostsig == SIGKILL)
|
||
return GDB_SIGNAL_KILL;
|
||
#endif
|
||
#if defined (SIGBUS)
|
||
if (hostsig == SIGBUS)
|
||
return GDB_SIGNAL_BUS;
|
||
#endif
|
||
#if defined (SIGSEGV)
|
||
if (hostsig == SIGSEGV)
|
||
return GDB_SIGNAL_SEGV;
|
||
#endif
|
||
#if defined (SIGSYS)
|
||
if (hostsig == SIGSYS)
|
||
return GDB_SIGNAL_SYS;
|
||
#endif
|
||
#if defined (SIGPIPE)
|
||
if (hostsig == SIGPIPE)
|
||
return GDB_SIGNAL_PIPE;
|
||
#endif
|
||
#if defined (SIGALRM)
|
||
if (hostsig == SIGALRM)
|
||
return GDB_SIGNAL_ALRM;
|
||
#endif
|
||
#if defined (SIGTERM)
|
||
if (hostsig == SIGTERM)
|
||
return GDB_SIGNAL_TERM;
|
||
#endif
|
||
#if defined (SIGUSR1)
|
||
if (hostsig == SIGUSR1)
|
||
return GDB_SIGNAL_USR1;
|
||
#endif
|
||
#if defined (SIGUSR2)
|
||
if (hostsig == SIGUSR2)
|
||
return GDB_SIGNAL_USR2;
|
||
#endif
|
||
#if defined (SIGCLD)
|
||
if (hostsig == SIGCLD)
|
||
return GDB_SIGNAL_CHLD;
|
||
#endif
|
||
#if defined (SIGCHLD)
|
||
if (hostsig == SIGCHLD)
|
||
return GDB_SIGNAL_CHLD;
|
||
#endif
|
||
#if defined (SIGPWR)
|
||
if (hostsig == SIGPWR)
|
||
return GDB_SIGNAL_PWR;
|
||
#endif
|
||
#if defined (SIGWINCH)
|
||
if (hostsig == SIGWINCH)
|
||
return GDB_SIGNAL_WINCH;
|
||
#endif
|
||
#if defined (SIGURG)
|
||
if (hostsig == SIGURG)
|
||
return GDB_SIGNAL_URG;
|
||
#endif
|
||
#if defined (SIGIO)
|
||
if (hostsig == SIGIO)
|
||
return GDB_SIGNAL_IO;
|
||
#endif
|
||
#if defined (SIGPOLL)
|
||
if (hostsig == SIGPOLL)
|
||
return GDB_SIGNAL_POLL;
|
||
#endif
|
||
#if defined (SIGSTOP)
|
||
if (hostsig == SIGSTOP)
|
||
return GDB_SIGNAL_STOP;
|
||
#endif
|
||
#if defined (SIGTSTP)
|
||
if (hostsig == SIGTSTP)
|
||
return GDB_SIGNAL_TSTP;
|
||
#endif
|
||
#if defined (SIGCONT)
|
||
if (hostsig == SIGCONT)
|
||
return GDB_SIGNAL_CONT;
|
||
#endif
|
||
#if defined (SIGTTIN)
|
||
if (hostsig == SIGTTIN)
|
||
return GDB_SIGNAL_TTIN;
|
||
#endif
|
||
#if defined (SIGTTOU)
|
||
if (hostsig == SIGTTOU)
|
||
return GDB_SIGNAL_TTOU;
|
||
#endif
|
||
#if defined (SIGVTALRM)
|
||
if (hostsig == SIGVTALRM)
|
||
return GDB_SIGNAL_VTALRM;
|
||
#endif
|
||
#if defined (SIGPROF)
|
||
if (hostsig == SIGPROF)
|
||
return GDB_SIGNAL_PROF;
|
||
#endif
|
||
#if defined (SIGXCPU)
|
||
if (hostsig == SIGXCPU)
|
||
return GDB_SIGNAL_XCPU;
|
||
#endif
|
||
#if defined (SIGXFSZ)
|
||
if (hostsig == SIGXFSZ)
|
||
return GDB_SIGNAL_XFSZ;
|
||
#endif
|
||
#if defined (SIGWIND)
|
||
if (hostsig == SIGWIND)
|
||
return GDB_SIGNAL_WIND;
|
||
#endif
|
||
#if defined (SIGPHONE)
|
||
if (hostsig == SIGPHONE)
|
||
return GDB_SIGNAL_PHONE;
|
||
#endif
|
||
#if defined (SIGLOST)
|
||
if (hostsig == SIGLOST)
|
||
return GDB_SIGNAL_LOST;
|
||
#endif
|
||
#if defined (SIGWAITING)
|
||
if (hostsig == SIGWAITING)
|
||
return GDB_SIGNAL_WAITING;
|
||
#endif
|
||
#if defined (SIGCANCEL)
|
||
if (hostsig == SIGCANCEL)
|
||
return GDB_SIGNAL_CANCEL;
|
||
#endif
|
||
#if defined (SIGLWP)
|
||
if (hostsig == SIGLWP)
|
||
return GDB_SIGNAL_LWP;
|
||
#endif
|
||
#if defined (SIGDANGER)
|
||
if (hostsig == SIGDANGER)
|
||
return GDB_SIGNAL_DANGER;
|
||
#endif
|
||
#if defined (SIGGRANT)
|
||
if (hostsig == SIGGRANT)
|
||
return GDB_SIGNAL_GRANT;
|
||
#endif
|
||
#if defined (SIGRETRACT)
|
||
if (hostsig == SIGRETRACT)
|
||
return GDB_SIGNAL_RETRACT;
|
||
#endif
|
||
#if defined (SIGMSG)
|
||
if (hostsig == SIGMSG)
|
||
return GDB_SIGNAL_MSG;
|
||
#endif
|
||
#if defined (SIGSOUND)
|
||
if (hostsig == SIGSOUND)
|
||
return GDB_SIGNAL_SOUND;
|
||
#endif
|
||
#if defined (SIGSAK)
|
||
if (hostsig == SIGSAK)
|
||
return GDB_SIGNAL_SAK;
|
||
#endif
|
||
#if defined (SIGPRIO)
|
||
if (hostsig == SIGPRIO)
|
||
return GDB_SIGNAL_PRIO;
|
||
#endif
|
||
|
||
/* Mach exceptions. Assumes that the values for EXC_ are positive! */
|
||
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_BAD_ACCESS)
|
||
return GDB_EXC_BAD_ACCESS;
|
||
#endif
|
||
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_BAD_INSTRUCTION)
|
||
return GDB_EXC_BAD_INSTRUCTION;
|
||
#endif
|
||
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_ARITHMETIC)
|
||
return GDB_EXC_ARITHMETIC;
|
||
#endif
|
||
#if defined (EXC_EMULATION) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_EMULATION)
|
||
return GDB_EXC_EMULATION;
|
||
#endif
|
||
#if defined (EXC_SOFTWARE) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_SOFTWARE)
|
||
return GDB_EXC_SOFTWARE;
|
||
#endif
|
||
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
|
||
if (hostsig == _NSIG + EXC_BREAKPOINT)
|
||
return GDB_EXC_BREAKPOINT;
|
||
#endif
|
||
|
||
#if defined (SIGINFO)
|
||
if (hostsig == SIGINFO)
|
||
return GDB_SIGNAL_INFO;
|
||
#endif
|
||
|
||
#if defined (REALTIME_LO)
|
||
if (hostsig >= REALTIME_LO && hostsig < REALTIME_HI)
|
||
{
|
||
/* This block of GDB_SIGNAL_REALTIME value is in order. */
|
||
if (33 <= hostsig && hostsig <= 63)
|
||
return (enum gdb_signal)
|
||
(hostsig - 33 + (int) GDB_SIGNAL_REALTIME_33);
|
||
else if (hostsig == 32)
|
||
return GDB_SIGNAL_REALTIME_32;
|
||
else if (64 <= hostsig && hostsig <= 127)
|
||
return (enum gdb_signal)
|
||
(hostsig - 64 + (int) GDB_SIGNAL_REALTIME_64);
|
||
else
|
||
error (_("GDB bug: target.c (gdb_signal_from_host): "
|
||
"unrecognized real-time signal"));
|
||
}
|
||
#endif
|
||
|
||
return GDB_SIGNAL_UNKNOWN;
|
||
}
|
||
|
||
/* Convert a OURSIG (an enum gdb_signal) to the form used by the
|
||
target operating system (refered to as the ``host'') or zero if the
|
||
equivalent host signal is not available. Set/clear OURSIG_OK
|
||
accordingly. */
|
||
|
||
static int
|
||
do_gdb_signal_to_host (enum gdb_signal oursig,
|
||
int *oursig_ok)
|
||
{
|
||
int retsig;
|
||
/* Silence the 'not used' warning, for targets that
|
||
do not support signals. */
|
||
(void) retsig;
|
||
|
||
*oursig_ok = 1;
|
||
switch (oursig)
|
||
{
|
||
case GDB_SIGNAL_0:
|
||
return 0;
|
||
|
||
#if defined (SIGHUP)
|
||
case GDB_SIGNAL_HUP:
|
||
return SIGHUP;
|
||
#endif
|
||
#if defined (SIGINT)
|
||
case GDB_SIGNAL_INT:
|
||
return SIGINT;
|
||
#endif
|
||
#if defined (SIGQUIT)
|
||
case GDB_SIGNAL_QUIT:
|
||
return SIGQUIT;
|
||
#endif
|
||
#if defined (SIGILL)
|
||
case GDB_SIGNAL_ILL:
|
||
return SIGILL;
|
||
#endif
|
||
#if defined (SIGTRAP)
|
||
case GDB_SIGNAL_TRAP:
|
||
return SIGTRAP;
|
||
#endif
|
||
#if defined (SIGABRT)
|
||
case GDB_SIGNAL_ABRT:
|
||
return SIGABRT;
|
||
#endif
|
||
#if defined (SIGEMT)
|
||
case GDB_SIGNAL_EMT:
|
||
return SIGEMT;
|
||
#endif
|
||
#if defined (SIGFPE)
|
||
case GDB_SIGNAL_FPE:
|
||
return SIGFPE;
|
||
#endif
|
||
#if defined (SIGKILL)
|
||
case GDB_SIGNAL_KILL:
|
||
return SIGKILL;
|
||
#endif
|
||
#if defined (SIGBUS)
|
||
case GDB_SIGNAL_BUS:
|
||
return SIGBUS;
|
||
#endif
|
||
#if defined (SIGSEGV)
|
||
case GDB_SIGNAL_SEGV:
|
||
return SIGSEGV;
|
||
#endif
|
||
#if defined (SIGSYS)
|
||
case GDB_SIGNAL_SYS:
|
||
return SIGSYS;
|
||
#endif
|
||
#if defined (SIGPIPE)
|
||
case GDB_SIGNAL_PIPE:
|
||
return SIGPIPE;
|
||
#endif
|
||
#if defined (SIGALRM)
|
||
case GDB_SIGNAL_ALRM:
|
||
return SIGALRM;
|
||
#endif
|
||
#if defined (SIGTERM)
|
||
case GDB_SIGNAL_TERM:
|
||
return SIGTERM;
|
||
#endif
|
||
#if defined (SIGUSR1)
|
||
case GDB_SIGNAL_USR1:
|
||
return SIGUSR1;
|
||
#endif
|
||
#if defined (SIGUSR2)
|
||
case GDB_SIGNAL_USR2:
|
||
return SIGUSR2;
|
||
#endif
|
||
#if defined (SIGCHLD) || defined (SIGCLD)
|
||
case GDB_SIGNAL_CHLD:
|
||
#if defined (SIGCHLD)
|
||
return SIGCHLD;
|
||
#else
|
||
return SIGCLD;
|
||
#endif
|
||
#endif /* SIGCLD or SIGCHLD */
|
||
#if defined (SIGPWR)
|
||
case GDB_SIGNAL_PWR:
|
||
return SIGPWR;
|
||
#endif
|
||
#if defined (SIGWINCH)
|
||
case GDB_SIGNAL_WINCH:
|
||
return SIGWINCH;
|
||
#endif
|
||
#if defined (SIGURG)
|
||
case GDB_SIGNAL_URG:
|
||
return SIGURG;
|
||
#endif
|
||
#if defined (SIGIO)
|
||
case GDB_SIGNAL_IO:
|
||
return SIGIO;
|
||
#endif
|
||
#if defined (SIGPOLL)
|
||
case GDB_SIGNAL_POLL:
|
||
return SIGPOLL;
|
||
#endif
|
||
#if defined (SIGSTOP)
|
||
case GDB_SIGNAL_STOP:
|
||
return SIGSTOP;
|
||
#endif
|
||
#if defined (SIGTSTP)
|
||
case GDB_SIGNAL_TSTP:
|
||
return SIGTSTP;
|
||
#endif
|
||
#if defined (SIGCONT)
|
||
case GDB_SIGNAL_CONT:
|
||
return SIGCONT;
|
||
#endif
|
||
#if defined (SIGTTIN)
|
||
case GDB_SIGNAL_TTIN:
|
||
return SIGTTIN;
|
||
#endif
|
||
#if defined (SIGTTOU)
|
||
case GDB_SIGNAL_TTOU:
|
||
return SIGTTOU;
|
||
#endif
|
||
#if defined (SIGVTALRM)
|
||
case GDB_SIGNAL_VTALRM:
|
||
return SIGVTALRM;
|
||
#endif
|
||
#if defined (SIGPROF)
|
||
case GDB_SIGNAL_PROF:
|
||
return SIGPROF;
|
||
#endif
|
||
#if defined (SIGXCPU)
|
||
case GDB_SIGNAL_XCPU:
|
||
return SIGXCPU;
|
||
#endif
|
||
#if defined (SIGXFSZ)
|
||
case GDB_SIGNAL_XFSZ:
|
||
return SIGXFSZ;
|
||
#endif
|
||
#if defined (SIGWIND)
|
||
case GDB_SIGNAL_WIND:
|
||
return SIGWIND;
|
||
#endif
|
||
#if defined (SIGPHONE)
|
||
case GDB_SIGNAL_PHONE:
|
||
return SIGPHONE;
|
||
#endif
|
||
#if defined (SIGLOST)
|
||
case GDB_SIGNAL_LOST:
|
||
return SIGLOST;
|
||
#endif
|
||
#if defined (SIGWAITING)
|
||
case GDB_SIGNAL_WAITING:
|
||
return SIGWAITING;
|
||
#endif
|
||
#if defined (SIGCANCEL)
|
||
case GDB_SIGNAL_CANCEL:
|
||
return SIGCANCEL;
|
||
#endif
|
||
#if defined (SIGLWP)
|
||
case GDB_SIGNAL_LWP:
|
||
return SIGLWP;
|
||
#endif
|
||
#if defined (SIGDANGER)
|
||
case GDB_SIGNAL_DANGER:
|
||
return SIGDANGER;
|
||
#endif
|
||
#if defined (SIGGRANT)
|
||
case GDB_SIGNAL_GRANT:
|
||
return SIGGRANT;
|
||
#endif
|
||
#if defined (SIGRETRACT)
|
||
case GDB_SIGNAL_RETRACT:
|
||
return SIGRETRACT;
|
||
#endif
|
||
#if defined (SIGMSG)
|
||
case GDB_SIGNAL_MSG:
|
||
return SIGMSG;
|
||
#endif
|
||
#if defined (SIGSOUND)
|
||
case GDB_SIGNAL_SOUND:
|
||
return SIGSOUND;
|
||
#endif
|
||
#if defined (SIGSAK)
|
||
case GDB_SIGNAL_SAK:
|
||
return SIGSAK;
|
||
#endif
|
||
#if defined (SIGPRIO)
|
||
case GDB_SIGNAL_PRIO:
|
||
return SIGPRIO;
|
||
#endif
|
||
|
||
/* Mach exceptions. Assumes that the values for EXC_ are positive! */
|
||
#if defined (EXC_BAD_ACCESS) && defined (_NSIG)
|
||
case GDB_EXC_BAD_ACCESS:
|
||
return _NSIG + EXC_BAD_ACCESS;
|
||
#endif
|
||
#if defined (EXC_BAD_INSTRUCTION) && defined (_NSIG)
|
||
case GDB_EXC_BAD_INSTRUCTION:
|
||
return _NSIG + EXC_BAD_INSTRUCTION;
|
||
#endif
|
||
#if defined (EXC_ARITHMETIC) && defined (_NSIG)
|
||
case GDB_EXC_ARITHMETIC:
|
||
return _NSIG + EXC_ARITHMETIC;
|
||
#endif
|
||
#if defined (EXC_EMULATION) && defined (_NSIG)
|
||
case GDB_EXC_EMULATION:
|
||
return _NSIG + EXC_EMULATION;
|
||
#endif
|
||
#if defined (EXC_SOFTWARE) && defined (_NSIG)
|
||
case GDB_EXC_SOFTWARE:
|
||
return _NSIG + EXC_SOFTWARE;
|
||
#endif
|
||
#if defined (EXC_BREAKPOINT) && defined (_NSIG)
|
||
case GDB_EXC_BREAKPOINT:
|
||
return _NSIG + EXC_BREAKPOINT;
|
||
#endif
|
||
|
||
#if defined (SIGINFO)
|
||
case GDB_SIGNAL_INFO:
|
||
return SIGINFO;
|
||
#endif
|
||
|
||
default:
|
||
#if defined (REALTIME_LO)
|
||
retsig = 0;
|
||
|
||
if (oursig >= GDB_SIGNAL_REALTIME_33
|
||
&& oursig <= GDB_SIGNAL_REALTIME_63)
|
||
{
|
||
/* This block of signals is continuous, and
|
||
GDB_SIGNAL_REALTIME_33 is 33 by definition. */
|
||
retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_33 + 33;
|
||
}
|
||
else if (oursig == GDB_SIGNAL_REALTIME_32)
|
||
{
|
||
/* GDB_SIGNAL_REALTIME_32 isn't contiguous with
|
||
GDB_SIGNAL_REALTIME_33. It is 32 by definition. */
|
||
retsig = 32;
|
||
}
|
||
else if (oursig >= GDB_SIGNAL_REALTIME_64
|
||
&& oursig <= GDB_SIGNAL_REALTIME_127)
|
||
{
|
||
/* This block of signals is continuous, and
|
||
GDB_SIGNAL_REALTIME_64 is 64 by definition. */
|
||
retsig = (int) oursig - (int) GDB_SIGNAL_REALTIME_64 + 64;
|
||
}
|
||
|
||
if (retsig >= REALTIME_LO && retsig < REALTIME_HI)
|
||
return retsig;
|
||
#endif
|
||
|
||
*oursig_ok = 0;
|
||
return 0;
|
||
}
|
||
}
|
||
|
||
int
|
||
gdb_signal_to_host_p (enum gdb_signal oursig)
|
||
{
|
||
int oursig_ok;
|
||
do_gdb_signal_to_host (oursig, &oursig_ok);
|
||
return oursig_ok;
|
||
}
|
||
|
||
int
|
||
gdb_signal_to_host (enum gdb_signal oursig)
|
||
{
|
||
int oursig_ok;
|
||
int targ_signo = do_gdb_signal_to_host (oursig, &oursig_ok);
|
||
if (!oursig_ok)
|
||
{
|
||
/* The user might be trying to do "signal SIGSAK" where this system
|
||
doesn't have SIGSAK. */
|
||
warning (_("Signal %s does not exist on this system."),
|
||
gdb_signal_to_name (oursig));
|
||
return 0;
|
||
}
|
||
else
|
||
return targ_signo;
|
||
}
|