aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorDaniel Jacobowitz <drow@false.org>2002-03-27 05:15:49 +0000
committerDaniel Jacobowitz <drow@false.org>2002-03-27 05:15:49 +0000
commit0e98d0a7510d45111a189ecd2baed6d15c61a11b (patch)
tree9e94d65be10c79416b88871a817df0092db5c8a7 /gdb
parent3130066b6cbb3de4f8f8d00b33c70accaca0f68b (diff)
downloadgdb-0e98d0a7510d45111a189ecd2baed6d15c61a11b.zip
gdb-0e98d0a7510d45111a189ecd2baed6d15c61a11b.tar.gz
gdb-0e98d0a7510d45111a189ecd2baed6d15c61a11b.tar.bz2
2002-03-27 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}.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog9
-rw-r--r--gdb/gdbserver/Makefile.in7
-rw-r--r--gdb/gdbserver/remote-utils.c12
-rw-r--r--gdb/gdbserver/server.c12
-rw-r--r--gdb/gdbserver/server.h5
5 files changed, 34 insertions, 11 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index e442c30..2c023b5 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,14 @@
2002-03-27 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}.
+
+2002-03-27 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
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 9ed226eb..c553d92 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -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.
@@ -232,6 +232,9 @@ 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)
linux_low_h = $(srcdir)/linux-low.h
diff --git a/gdb/gdbserver/remote-utils.c b/gdb/gdbserver/remote-utils.c
index 2746f9a..adf5299 100644
--- a/gdb/gdbserver/remote-utils.c
+++ b/gdb/gdbserver/remote-utils.c
@@ -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')
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index d845422..adaabac 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -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;
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index 6202b0f..7f22041 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -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_ADDR * mem_addr_ptr,
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 */