Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] signals/signals.c
@ 2002-03-24 15:25 Daniel Jacobowitz
  2002-03-24 15:34 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-24 15:25 UTC (permalink / raw)
  To: gdb-patches

As the best suggestion I've heard yet, let's try gdb/signals.c.  I'd like
to, in two commits:

  - move signals.c to its own directory
  - prepare it for use with gdbserver

And then use it in gdbserver (patch in next message).  Look good?

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-03-24  Daniel Jacobowitz  <drow@mvista.com>

	* signals/signals.c: Include "server.h" in gdbserver build.
	(target_signal_from_name): Don't use STREQ.
	(_initialize_signals): Likewise.  Don't include function in
	gdbserver build.

2002-03-24  Daniel Jacobowitz  <drow@mvista.com>

	* signals.c: Moved to...
	* signals/signals.c: Here.
	* Makefile (signals.o): Update.

Index: signals.c
===================================================================
RCS file: /cvs/src/src/gdb/signals.c,v
retrieving revision 1.3
diff -u -p -r1.3 signals.c
--- signals.c	2002/01/13 21:58:16	1.3
+++ signals.c	2002/03/24 23:18:01
@@ -1,6 +1,6 @@
 /* Target signal translation functions for GDB.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001 Free Software Foundation, Inc.
+   2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
    This file is part of GDB.
@@ -20,8 +20,13 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifdef GDBSERVER
+#include "server.h"
+#else
 #include "defs.h"
 #include "target.h"
+#endif
+
 #include <signal.h>
 
 /* This table must match in order and size the signals in enum target_signal
@@ -234,7 +239,7 @@ target_signal_from_name (char *name)
   for (sig = TARGET_SIGNAL_HUP;
        signals[sig].name != NULL;
        sig = (enum target_signal) ((int) sig + 1))
-    if (STREQ (name, signals[sig].name))
+    if (strcmp (name, signals[sig].name) == 0)
       return sig;
   return TARGET_SIGNAL_UNKNOWN;
 }
@@ -829,9 +834,11 @@ target_signal_from_command (int num)
 Use \"info signals\" for a list of symbolic signals.");
 }
 
+#ifndef GDBSERVER
 void
 _initialize_signals (void)
 {
-  if (!STREQ (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC"))
+  if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
     internal_error (__FILE__, __LINE__, "failed internal consistency check");
 }
+#endif
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.164
diff -u -p -r1.164 Makefile.in
--- Makefile.in	2002/03/11 00:01:07	1.164
+++ Makefile.in	2002/03/24 23:24:51
@@ -534,7 +534,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c 
 	memattr.c mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \
 	p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \
 	printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
-	scm-valprint.c signals.c source.c stabsread.c stack.c symfile.c \
+	scm-valprint.c source.c stabsread.c stack.c symfile.c \
 	symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \
 	typeprint.c utils.c valarith.c valops.c valprint.c values.c \
 	serial.c ser-unix.c mdebugread.c os9kread.c \
@@ -2008,7 +2008,7 @@ sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_
 	$(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(arch_utils_h) \
 	$(regcache_h)
 
-signals.o: signals.c $(defs_h) $(target_h)
+signals.o: signals/signals.c $(defs_h) $(target_h)
 
 mon960-rom.o: mon960-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \
 	$(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] signals/signals.c
  2002-03-24 15:25 [rfa] signals/signals.c Daniel Jacobowitz
@ 2002-03-24 15:34 ` Daniel Jacobowitz
  2002-03-25  9:55   ` Andrew Cagney
  0 siblings, 1 reply; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-24 15:34 UTC (permalink / raw)
  To: gdb-patches

On Sun, Mar 24, 2002 at 06:25:37PM -0500, Daniel Jacobowitz wrote:
> As the best suggestion I've heard yet, let's try gdb/signals.c.  I'd like
> to, in two commits:
> 
>   - move signals.c to its own directory
>   - prepare it for use with gdbserver
> 
> And then use it in gdbserver (patch in next message).  Look good?

Fnord.  Look at this one instead, it actually works :)

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer

2002-03-24  Daniel Jacobowitz  <drow@mvista.com>

	* signals/signals.c: Include "server.h" in gdbserver build.
	(target_signal_from_name): Don't use STREQ.
	(_initialize_signals): Likewise.  Don't include function in
	gdbserver build.

2002-03-24  Daniel Jacobowitz  <drow@mvista.com>

	* signals.c: Moved to...
	* signals/signals.c: Here.
	* Makefile (signals.o): Update.

Index: signals/signals.c
===================================================================
RCS file: /cvs/src/src/gdb/signals.c,v
retrieving revision 1.3
diff -u -p -r1.3 signals.c
--- signals/signals.c	2002/01/13 21:58:16	1.3
+++ signals/signals.c	2002/03/24 23:18:01
@@ -1,6 +1,6 @@
 /* Target signal translation functions for GDB.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001 Free Software Foundation, Inc.
+   2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Cygnus Support.
 
    This file is part of GDB.
@@ -20,8 +20,13 @@
    Foundation, Inc., 59 Temple Place - Suite 330,
    Boston, MA 02111-1307, USA.  */
 
+#ifdef GDBSERVER
+#include "server.h"
+#else
 #include "defs.h"
 #include "target.h"
+#endif
+
 #include <signal.h>
 
 /* This table must match in order and size the signals in enum target_signal
@@ -234,7 +239,7 @@ target_signal_from_name (char *name)
   for (sig = TARGET_SIGNAL_HUP;
        signals[sig].name != NULL;
        sig = (enum target_signal) ((int) sig + 1))
-    if (STREQ (name, signals[sig].name))
+    if (strcmp (name, signals[sig].name) == 0)
       return sig;
   return TARGET_SIGNAL_UNKNOWN;
 }
@@ -829,9 +834,11 @@ target_signal_from_command (int num)
 Use \"info signals\" for a list of symbolic signals.");
 }
 
+#ifndef GDBSERVER
 void
 _initialize_signals (void)
 {
-  if (!STREQ (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC"))
+  if (strcmp (signals[TARGET_SIGNAL_LAST].string, "TARGET_SIGNAL_MAGIC") != 0)
     internal_error (__FILE__, __LINE__, "failed internal consistency check");
 }
+#endif
Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.164
diff -u -p -r1.164 Makefile.in
--- Makefile.in	2002/03/11 00:01:07	1.164
+++ Makefile.in	2002/03/24 23:33:35
@@ -534,7 +534,7 @@ SFILES = ax-general.c ax-gdb.c bcache.c 
 	memattr.c mem-break.c minsyms.c mipsread.c nlmread.c objfiles.c \
 	p-exp.y p-lang.c p-typeprint.c p-valprint.c parse.c \
 	printcmd.c remote.c remote-nrom.c scm-exp.c scm-lang.c \
-	scm-valprint.c signals.c source.c stabsread.c stack.c symfile.c \
+	scm-valprint.c source.c stabsread.c stack.c symfile.c \
 	symmisc.c symtab.c linespec.c target.c thread.c top.c tracepoint.c \
 	typeprint.c utils.c valarith.c valops.c valprint.c values.c \
 	serial.c ser-unix.c mdebugread.c os9kread.c \
@@ -839,6 +839,7 @@ init.c: $(INIT_FILES)
 	    -e '/^[a-z0-9A-Z_]*_[SU].o/d' \
 	    -e '/[a-z0-9A-Z_]*-exp.tab.o/d' \
 	    -e 's/\.o/.c/' \
+	    -e 's,signals\.c,signals/signals\.c,' \
 	    -e 's|\([^  ][^     ]*\)|$(srcdir)/\1|g' | \
 	while read f; do grep '^_initialize_[a-z_0-9A-Z]* *(' $$f 2>/dev/null; done | \
 	sed -e 's/^.*://' -e 's/^\([a-z_0-9A-Z]*\).*/\1/' > init.l-tmp
@@ -2008,7 +2009,8 @@ sh3-rom.o: sh3-rom.c $(monitor_h) $(bfd_
 	$(inferior_h) $(target_h) $(serial_h) $(terminal_h) $(arch_utils_h) \
 	$(regcache_h)
 
-signals.o: signals.c $(defs_h) $(target_h)
+signals.o: signals/signals.c $(defs_h) $(target_h)
+	$(CC) -c $(INTERNAL_CFLAGS) $<
 
 mon960-rom.o: mon960-rom.c $(monitor_h) $(bfd_h) gdb_wait.h $(defs_h) \
 	$(gdbcmd_h) $(inferior_h) $(target_h) $(serial_h) $(terminal_h)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] signals/signals.c
  2002-03-24 15:34 ` Daniel Jacobowitz
@ 2002-03-25  9:55   ` Andrew Cagney
  2002-03-26 21:12     ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Cagney @ 2002-03-25  9:55 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> 2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> 
> * signals/signals.c: Include "server.h" in gdbserver build.
> 	(target_signal_from_name): Don't use STREQ.
> 	(_initialize_signals): Likewise.  Don't include function in
> 	gdbserver build.
> 
> 2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> 
> * signals.c: Moved to...
> 	* signals/signals.c: Here.
> 	* Makefile (signals.o): Update.
> 
> 

If anyone is wondering, there is a likely follow on patch.  Split 
signals.c into several smaller files: a string convertion file; a 
gdb2host convert; and a host2gdb convert.

(gdb2 and 2gdb as the ``target_signal'' needs that rename as well :-).

enjoy,
Andrew



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [rfa] signals/signals.c
  2002-03-25  9:55   ` Andrew Cagney
@ 2002-03-26 21:12     ` Daniel Jacobowitz
  0 siblings, 0 replies; 4+ messages in thread
From: Daniel Jacobowitz @ 2002-03-26 21:12 UTC (permalink / raw)
  To: gdb-patches

On Mon, Mar 25, 2002 at 12:53:54PM -0500, Andrew Cagney wrote:
> >2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> >
> >* signals/signals.c: Include "server.h" in gdbserver build.
> >	(target_signal_from_name): Don't use STREQ.
> >	(_initialize_signals): Likewise.  Don't include function in
> >	gdbserver build.
> >
> >2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> >
> >* signals.c: Moved to...
> >	* signals/signals.c: Here.
> >	* Makefile (signals.o): Update.
> >
> >
> 
> If anyone is wondering, there is a likely follow on patch.  Split 
> signals.c into several smaller files: a string convertion file; a 
> gdb2host convert; and a host2gdb convert.
> 
> (gdb2 and 2gdb as the ``target_signal'' needs that rename as well :-).

This bit committed to trunk.

-- 
Daniel Jacobowitz                           Carnegie Mellon University
MontaVista Software                         Debian GNU/Linux Developer


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2002-03-27  5:12 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-24 15:25 [rfa] signals/signals.c Daniel Jacobowitz
2002-03-24 15:34 ` Daniel Jacobowitz
2002-03-25  9:55   ` Andrew Cagney
2002-03-26 21:12     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox