Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa] Use shared signals/signals.c in gdbserver
@ 2002-03-24 15:36 Daniel Jacobowitz
  2002-03-26 19:44 ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-03-24 15:36 UTC (permalink / raw)
  To: gdb-patches

Best version yet!  Get it while it's hot!

(OK? :)

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

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

	* gdbserver/server.c (main): Call target_signal_to_host_p
	and target_signal_to_host on signals received from the remote.
	* gdbserver/remote-utils.c (prepare_resume_reply): Call
	target_signal_from_host on signals sent to the remote.
	* gdbserver/server.h: Add prototypes.  Include "gdb/signals.h".
	* gdbserver/Makefile.in: Add signals.o.  Add -I${INCLUDE_DIR}.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/Makefile.in,v
retrieving revision 1.12
diff -u -p -r1.12 Makefile.in
--- Makefile.in	2002/02/28 16:58:13	1.12
+++ Makefile.in	2002/03/24 23:17:05
@@ -83,7 +83,7 @@ READLINE_DEP = $$(READLINE_DIR)
 # -I. for config files.
 # -I${srcdir} for our headers.
 # -I$(srcdir)/../regformats for regdef.h.
-INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats
+INCLUDE_CFLAGS = -I. -I${srcdir} -I$(srcdir)/../regformats -I$(INCLUDE_DIR)
 
 # M{H,T}_CFLAGS, if defined, has host- and target-dependent CFLAGS
 # from the config/ directory.
@@ -120,7 +120,7 @@ DEPFILES = @GDBSERVER_DEPFILES@
 SOURCES = $(SFILES)
 TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS} 
 
-OBS = utils.o $(DEPFILES) server.o remote-utils.o regcache.o
+OBS = utils.o $(DEPFILES) server.o remote-utils.o regcache.o signals.o
 
 # Prevent Sun make from putting in the machine type.  Setting
 # TARGET_ARCH to nothing works for SunOS 3, 4.0, but not for 4.1.
@@ -231,6 +231,9 @@ server.o: server.c $(server_h)
 remote-utils.o: remote-utils.c terminal.h $(server_h)
 utils.o: utils.c $(server_h)
 regcache.o: regcache.c $(server_h) $(regdef_h)
+
+signals.o: ../signals/signals.c $(server_h)
+	$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
 
 i387-fp.o: i387-fp.c $(server_h)
 
Index: remote-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/remote-utils.c,v
retrieving revision 1.10
diff -u -p -r1.10 remote-utils.c
--- remote-utils.c	2002/03/21 02:11:03	1.10
+++ remote-utils.c	2002/03/24 23:17:05
@@ -463,17 +463,15 @@ outreg (int regno, char *buf)
 void
 prepare_resume_reply (char *buf, char status, unsigned char signo)
 {
-  int nib;
+  int nib, sig;
 
   *buf++ = status;
 
-  /* FIXME!  Should be converting this signal number (numbered
-     according to the signal numbering of the system we are running on)
-     to the signal numbers used by the gdb protocol (see enum target_signal
-     in gdb/target.h).  */
-  nib = ((signo & 0xf0) >> 4);
+  sig = (int)target_signal_from_host (signo);
+
+  nib = ((sig & 0xf0) >> 4);
   *buf++ = tohex (nib);
-  nib = signo & 0x0f;
+  nib = sig & 0x0f;
   *buf++ = tohex (nib);
 
   if (status == 'T')
Index: server.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.c,v
retrieving revision 1.6
diff -u -p -r1.6 server.c
--- server.c	2002/02/14 06:21:22	1.6
+++ server.c	2002/03/24 23:17:05
@@ -190,13 +190,21 @@ main (int argc, char *argv[])
 	      break;
 	    case 'C':
 	      convert_ascii_to_int (own_buf + 1, &sig, 1);
-	      myresume (0, sig);
+	      if (target_signal_to_host_p (sig))
+		signal = target_signal_to_host (sig);
+	      else
+		signal = 0;
+	      myresume (0, signal);
 	      signal = mywait (&status);
 	      prepare_resume_reply (own_buf, status, signal);
 	      break;
 	    case 'S':
 	      convert_ascii_to_int (own_buf + 1, &sig, 1);
-	      myresume (1, sig);
+	      if (target_signal_to_host_p (sig))
+		signal = target_signal_to_host (sig);
+	      else
+		signal = 0;
+	      myresume (1, signal);
 	      signal = mywait (&status);
 	      prepare_resume_reply (own_buf, status, signal);
 	      break;
Index: server.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/server.h,v
retrieving revision 1.4
diff -u -p -r1.4 server.h
--- server.h	2002/02/14 06:21:22	1.4
+++ server.h	2002/03/24 23:17:05
@@ -34,6 +34,7 @@
 typedef long long CORE_ADDR;
 
 #include "regcache.h"
+#include "gdb/signals.h"
 
 #include <setjmp.h>
 
@@ -84,6 +85,10 @@ void decode_m_packet (char *from, CORE_A
 void decode_M_packet (char *from, CORE_ADDR * mem_addr_ptr,
 		      unsigned int *len_ptr, char *to);
 
+/* 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);
 
 /* Functions from utils.c */
 


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

* Re: [rfa] Use shared signals/signals.c in gdbserver
  2002-03-24 15:36 [rfa] Use shared signals/signals.c in gdbserver Daniel Jacobowitz
@ 2002-03-26 19:44 ` Andrew Cagney
  2002-03-26 19:53   ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-03-26 19:44 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> 2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> 
> * gdbserver/server.c (main): Call target_signal_to_host_p
> 	and target_signal_to_host on signals received from the remote.
> 	* gdbserver/remote-utils.c (prepare_resume_reply): Call
> 	target_signal_from_host on signals sent to the remote.
> 	* gdbserver/server.h: Add prototypes.  Include "gdb/signals.h".
> 	* gdbserver/Makefile.in: Add signals.o.  Add -I${INCLUDE_DIR}.
> 

yep, by me.
Andrew




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

* Re: [rfa] Use shared signals/signals.c in gdbserver
  2002-03-26 19:44 ` Andrew Cagney
@ 2002-03-26 19:53   ` Daniel Jacobowitz
  2002-03-26 20:34     ` Andrew Cagney
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-03-26 19:53 UTC (permalink / raw)
  To: Andrew Cagney; +Cc: gdb-patches

On Tue, Mar 26, 2002 at 10:42:49PM -0500, Andrew Cagney wrote:
> >2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> >
> >* gdbserver/server.c (main): Call target_signal_to_host_p
> >	and target_signal_to_host on signals received from the remote.
> >	* gdbserver/remote-utils.c (prepare_resume_reply): Call
> >	target_signal_from_host on signals sent to the remote.
> >	* gdbserver/server.h: Add prototypes.  Include "gdb/signals.h".
> >	* gdbserver/Makefile.in: Add signals.o.  Add -I${INCLUDE_DIR}.
> >
> 
> yep, by me.

Thanks!

Two questions go with that:
  - OK for branch also, if I just add the two new files
(signals/signals.c and include/gdb/signals.h) and don't
change GDB to use them?  In a few days, perhaps.

  - Was:
      http://sources.redhat.com/ml/gdb-patches/2002-03/msg00464.html
    an approval?  This patch depends on that one.

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


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

* Re: [rfa] Use shared signals/signals.c in gdbserver
  2002-03-26 19:53   ` Daniel Jacobowitz
@ 2002-03-26 20:34     ` Andrew Cagney
  2002-03-26 21:16       ` Daniel Jacobowitz
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Cagney @ 2002-03-26 20:34 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

> On Tue, Mar 26, 2002 at 10:42:49PM -0500, Andrew Cagney wrote:
> 
>> >2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
>> >
>> >* gdbserver/server.c (main): Call target_signal_to_host_p
>> > and target_signal_to_host on signals received from the remote.
>> > * gdbserver/remote-utils.c (prepare_resume_reply): Call
>> > target_signal_from_host on signals sent to the remote.
>> > * gdbserver/server.h: Add prototypes.  Include "gdb/signals.h".
>> > * gdbserver/Makefile.in: Add signals.o.  Add -I${INCLUDE_DIR}.
>> >
> 
>> 
>> yep, by me.
> 
> 
> Thanks!
> 
> Two questions go with that:
>   - OK for branch also, if I just add the two new files
> (signals/signals.c and include/gdb/signals.h) and don't
> change GDB to use them?  In a few days, perhaps.

Yes.

>   - Was:
>       http://sources.redhat.com/ml/gdb-patches/2002-03/msg00464.html
> an approval?  This patch depends on that one.

No, but it could have been :-)  As far as I know you're drumming your 
fingers for a few days while waiting to see if there were any other 
comments (before committing).

Andrew



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

* Re: [rfa] Use shared signals/signals.c in gdbserver
  2002-03-26 20:34     ` Andrew Cagney
@ 2002-03-26 21:16       ` Daniel Jacobowitz
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Jacobowitz @ 2002-03-26 21:16 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 26, 2002 at 11:33:04PM -0500, Andrew Cagney wrote:
> >On Tue, Mar 26, 2002 at 10:42:49PM -0500, Andrew Cagney wrote:
> >
> >>>2002-03-24  Daniel Jacobowitz  <drow@mvista.com>
> >>>
> >>>* gdbserver/server.c (main): Call target_signal_to_host_p
> >>> and target_signal_to_host on signals received from the remote.
> >>> * gdbserver/remote-utils.c (prepare_resume_reply): Call
> >>> target_signal_from_host on signals sent to the remote.
> >>> * gdbserver/server.h: Add prototypes.  Include "gdb/signals.h".
> >>> * gdbserver/Makefile.in: Add signals.o.  Add -I${INCLUDE_DIR}.
> >>>
> >
> >>
> >>yep, by me.

Checked in.

> >
> >
> >Thanks!
> >
> >Two questions go with that:
> >  - OK for branch also, if I just add the two new files
> >(signals/signals.c and include/gdb/signals.h) and don't
> >change GDB to use them?  In a few days, perhaps.
> 
> Yes.

OK.  If no one reports a problem on the trunk in three or four days,
I'll move it over.

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


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

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-24 15:36 [rfa] Use shared signals/signals.c in gdbserver Daniel Jacobowitz
2002-03-26 19:44 ` Andrew Cagney
2002-03-26 19:53   ` Daniel Jacobowitz
2002-03-26 20:34     ` Andrew Cagney
2002-03-26 21:16       ` Daniel Jacobowitz

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