From 2aecd87f56afd1168356ad2d2efbbc7bd1bc31db Mon Sep 17 00:00:00 2001 From: Doug Evans Date: Mon, 2 Mar 2009 00:45:13 +0000 Subject: [PATCH] * Makefile.in (GDB_CFLAGS): Add -I$(srcdir)/common. (init.c): signals/ -> common/. (signals.o): Update. * target.h (target_signal_to_string,target_signal_to_string) (target_signal_from_name,target_signal_to_host_p) (target_signal_from_host,target_signal_to_host): Move to ... * common/gdb_signals.h: ... here. New file. * common/signals.c: Moved here from signals/signals.c. #include gdb_signals.h, remove #include of target.h in gdb case. (target_signal_from_command,default_target_signal_to_host) (default_target_signal_from_host): Move inside #ifndef GDBSERVER. * gdbserver/Makefile.in (INCLUDE_CFLAGS): Add -I$(srcdir)/../common. (server_h): Add gdb_signals.h. (signals.o): Update. * server.h (target_signal_from_host,target_signal_to_host_p) (target_signal_to_host,target_signal_to_name): Moved to gdb_signals.h. --- gdb/ChangeLog | 12 +++++++ gdb/Makefile.in | 11 +++--- gdb/common/gdb_signals.h | 56 +++++++++++++++++++++++++++++++ gdb/{signals => common}/signals.c | 9 +++-- gdb/gdbserver/ChangeLog | 8 +++++ gdb/gdbserver/Makefile.in | 7 ++-- gdb/gdbserver/server.h | 8 +---- gdb/target.h | 34 ++----------------- 8 files changed, 96 insertions(+), 49 deletions(-) create mode 100644 gdb/common/gdb_signals.h rename gdb/{signals => common}/signals.c (99%) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 07f1729c012..8385e4884fd 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2009-03-01 Doug Evans + * Makefile.in (GDB_CFLAGS): Add -I$(srcdir)/common. + (init.c): signals/ -> common/. + (signals.o): Update. + * target.h (target_signal_to_string,target_signal_to_string) + (target_signal_from_name,target_signal_to_host_p) + (target_signal_from_host,target_signal_to_host): Move to ... + * common/gdb_signals.h: ... here. New file. + * common/signals.c: Moved here from signals/signals.c. + #include gdb_signals.h, remove #include of target.h in gdb case. + (target_signal_from_command,default_target_signal_to_host) + (default_target_signal_from_host): Move inside #ifndef GDBSERVER. + Include thread ID in target_wait debugging output. * infrun.c (print_target_wait_results): New function. (wait_for_inferior,fetch_inferior_event): Call it. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index af3f534b845..e82f542d503 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -365,7 +365,8 @@ CONFIG_UNINSTALL = @CONFIG_UNINSTALL@ # your system doesn't have fcntl.h in /usr/include (which is where it # should be according to Posix). DEFS = @DEFS@ -GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/config -DLOCALEDIR="\"$(localedir)\"" $(DEFS) +GDB_CFLAGS = -I. -I$(srcdir) -I$(srcdir)/common -I$(srcdir)/config \ + -DLOCALEDIR="\"$(localedir)\"" $(DEFS) # MH_CFLAGS, if defined, has host-dependent CFLAGS from the config directory. GLOBAL_CFLAGS = $(MH_CFLAGS) @@ -1033,7 +1034,7 @@ init.c: $(INIT_FILES) -e '/^[a-z0-9A-Z_]*_[SU].[co]$$/d' \ -e '/[a-z0-9A-Z_]*-exp.tab.[co]$$/d' \ -e 's/\.[co]$$/.c/' \ - -e 's,signals\.c,signals/signals\.c,' \ + -e 's,signals\.c,common/signals\.c,' \ -e 's|^\([^ /][^ ]*\)|$(srcdir)/\1|g' | \ while read f; do \ sed -n -e 's/^_initialize_\([a-z_0-9A-Z]*\).*/\1/p' $$f 2>/dev/null; \ @@ -1743,13 +1744,13 @@ mi-common.o: $(srcdir)/mi/mi-common.c $(POSTCOMPILE) # -# gdb/signals/ dependencies +# gdb/common/ dependencies # # Need to explicitly specify the compile rule as make will do nothing # or try to compile the object file into the sub-directory. -signals.o: $(srcdir)/signals/signals.c - $(COMPILE) $(srcdir)/signals/signals.c +signals.o: $(srcdir)/common/signals.c + $(COMPILE) $(srcdir)/common/signals.c $(POSTCOMPILE) # diff --git a/gdb/common/gdb_signals.h b/gdb/common/gdb_signals.h new file mode 100644 index 00000000000..b517b1be18d --- /dev/null +++ b/gdb/common/gdb_signals.h @@ -0,0 +1,56 @@ +/* Target signal translation functions for GDB. + Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, + 2000, 2001, 2002, 2003, 2006, 2007, 2008, 2009 + 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 . */ + +#ifndef COMMON_GDB_SIGNALS_H +#define COMMON_GDB_SIGNALS_H + +#include "gdb/signals.h" + +/* Predicate to target_signal_to_host(). Return non-zero if the enum + targ_signal SIGNO has an equivalent ``host'' representation. */ +/* FIXME: cagney/1999-11-22: The name below was chosen in preference + to the shorter target_signal_p() because it is far less ambigious. + In this context ``target_signal'' refers to GDB's internal + representation of the target's set of signals while ``host signal'' + refers to the target operating system's signal. Confused? */ +extern int target_signal_to_host_p (enum target_signal signo); + +/* Convert between host signal numbers and enum target_signal's. + target_signal_to_host() returns 0 and prints a warning() on GDB's + console if SIGNO has no equivalent host representation. */ +/* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is + refering to the target operating system's signal numbering. + Similarly, ``enum target_signal'' is named incorrectly, ``enum + gdb_signal'' would probably be better as it is refering to GDB's + internal representation of a target operating system's signal. */ +extern enum target_signal target_signal_from_host (int); +extern int target_signal_to_host (enum target_signal); + +/* Return the string for a signal. */ +extern const char *target_signal_to_string (enum target_signal); + +/* Return the name (SIGHUP, etc.) for a signal. */ +extern const char *target_signal_to_name (enum target_signal); + +/* Given a name (SIGHUP, etc.), return its signal. */ +enum target_signal target_signal_from_name (const char *); + +#endif /* COMMON_GDB_SIGNALS_H */ diff --git a/gdb/signals/signals.c b/gdb/common/signals.c similarity index 99% rename from gdb/signals/signals.c rename to gdb/common/signals.c index af1b92ec169..ae8032f3c01 100644 --- a/gdb/signals/signals.c +++ b/gdb/common/signals.c @@ -23,7 +23,6 @@ #include "server.h" #else #include "defs.h" -#include "target.h" #include "gdb_string.h" #endif @@ -31,6 +30,8 @@ #include #endif +#include "gdb_signals.h" + struct gdbarch; /* Always use __SIGRTMIN if it's available. SIGRTMIN is the lowest @@ -807,6 +808,8 @@ target_signal_to_host (enum target_signal oursig) return targ_signo; } +#ifndef GDBSERVER + /* In some circumstances we allow a command to specify a numeric signal. The idea is to keep these circumstances limited so that users (and scripts) develop portable habits. For comparison, @@ -824,7 +827,6 @@ target_signal_from_command (int num) Use \"info signals\" for a list of symbolic signals."); } -#ifndef GDBSERVER extern initialize_file_ftype _initialize_signals; /* -Wmissing-prototype */ void @@ -833,7 +835,6 @@ _initialize_signals (void) if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0) internal_error (__FILE__, __LINE__, "failed internal consistency check"); } -#endif int default_target_signal_to_host (struct gdbarch *gdbarch, enum target_signal ts) @@ -846,3 +847,5 @@ default_target_signal_from_host (struct gdbarch *gdbarch, int signo) { return target_signal_from_host (signo); } + +#endif /* ! GDBSERVER */ diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 70cc4d53232..1f3752ea282 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,11 @@ +2009-03-01 Doug Evans + + * gdbserver/Makefile.in (INCLUDE_CFLAGS): Add -I$(srcdir)/../common. + (server_h): Add gdb_signals.h. + (signals.o): Update. + * server.h (target_signal_from_host,target_signal_to_host_p) + (target_signal_to_host,target_signal_to_name): Moved to gdb_signals.h. + 2009-02-14 Pierre Muller * remote-utils.c (getpkt): Also generate remote-debug diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in index 520b63e06e7..27878c20fe9 100644 --- a/gdb/gdbserver/Makefile.in +++ b/gdb/gdbserver/Makefile.in @@ -74,7 +74,8 @@ INCLUDE_DEP = $$(INCLUDE_DIR) # -I. for config files. # -I${srcdir} for our headers. # -I$(srcdir)/../regformats for regdef.h. -INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR) +INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../common \ + -I$(srcdir)/../regformats -I$(INCLUDE_DIR) # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS # from the config/ directory. @@ -263,7 +264,7 @@ regdat_sh = $(srcdir)/../regformats/regdat.sh regdef_h = $(srcdir)/../regformats/regdef.h regcache_h = $(srcdir)/regcache.h server_h = $(srcdir)/server.h $(regcache_h) config.h $(srcdir)/target.h \ - $(srcdir)/mem-break.h + $(srcdir)/mem-break.h $(srcdir)/../common/gdb_signals.h hostio.o: hostio.c $(server_h) hostio-errno.o: hostio-errno.c $(server_h) @@ -278,7 +279,7 @@ thread-db.o: thread-db.c $(server_h) $(gdb_proc_service_h) utils.o: utils.c $(server_h) gdbreplay.o: gdbreplay.c config.h -signals.o: ../signals/signals.c $(server_h) +signals.o: ../common/signals.c $(server_h) $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER memmem.o: ../gnulib/memmem.c diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h index 6e4dfd8fd13..db750bdd206 100644 --- a/gdb/gdbserver/server.h +++ b/gdb/gdbserver/server.h @@ -110,7 +110,7 @@ struct dll_info #include "regcache.h" #include "gdb/signals.h" - +#include "gdb_signals.h" #include "target.h" #include "mem-break.h" @@ -265,12 +265,6 @@ void buffer_xml_printf (struct buffer *buffer, const char *format, ...) #define buffer_grow_str0(BUFFER,STRING) \ buffer_grow (BUFFER, STRING, strlen (STRING) + 1) -/* Functions from ``signals.c''. */ -enum target_signal target_signal_from_host (int hostsig); -int target_signal_to_host_p (enum target_signal oursig); -int target_signal_to_host (enum target_signal oursig); -const char *target_signal_to_name (enum target_signal); - /* Functions from utils.c */ void *xmalloc (size_t) ATTR_MALLOC; diff --git a/gdb/target.h b/gdb/target.h index 276af1d3f39..7f4cd8fae8a 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -55,6 +55,7 @@ struct regcache; #include "dcache.h" #include "memattr.h" #include "vec.h" +#include "gdb_signals.h" enum strata { @@ -176,15 +177,6 @@ enum inferior_event_type 'step n' like commands. */ INF_EXEC_CONTINUE }; - -/* Return the string for a signal. */ -extern const char *target_signal_to_string (enum target_signal); - -/* Return the name (SIGHUP, etc.) for a signal. */ -extern const char *target_signal_to_name (enum target_signal); - -/* Given a name (SIGHUP, etc.), return its signal. */ -enum target_signal target_signal_from_name (const char *); /* Target objects which can be transfered using target_read, target_write, et cetera. */ @@ -1290,28 +1282,7 @@ extern int remote_timeout; /* This is for native targets which use a unix/POSIX-style waitstatus. */ extern void store_waitstatus (struct target_waitstatus *, int); -/* Predicate to target_signal_to_host(). Return non-zero if the enum - targ_signal SIGNO has an equivalent ``host'' representation. */ -/* FIXME: cagney/1999-11-22: The name below was chosen in preference - to the shorter target_signal_p() because it is far less ambigious. - In this context ``target_signal'' refers to GDB's internal - representation of the target's set of signals while ``host signal'' - refers to the target operating system's signal. Confused? */ - -extern int target_signal_to_host_p (enum target_signal signo); - -/* Convert between host signal numbers and enum target_signal's. - target_signal_to_host() returns 0 and prints a warning() on GDB's - console if SIGNO has no equivalent host representation. */ -/* FIXME: cagney/1999-11-22: Here ``host'' is used incorrectly, it is - refering to the target operating system's signal numbering. - Similarly, ``enum target_signal'' is named incorrectly, ``enum - gdb_signal'' would probably be better as it is refering to GDB's - internal representation of a target operating system's signal. */ - -extern enum target_signal target_signal_from_host (int); -extern int target_signal_to_host (enum target_signal); - +/* These are in common/signals.c, but they're only used by gdb. */ extern enum target_signal default_target_signal_from_host (struct gdbarch *, int); extern int default_target_signal_to_host (struct gdbarch *, @@ -1319,6 +1290,7 @@ extern int default_target_signal_to_host (struct gdbarch *, /* Convert from a number used in a GDB command to an enum target_signal. */ extern enum target_signal target_signal_from_command (int); +/* End of files in common/signals.c. */ /* Set the show memory breakpoints mode to show, and installs a cleanup to restore it back to the current value. */ -- 2.30.2