[C++/mingw] gdbserver: gdb/host signal mixup
authorPedro Alves <palves@redhat.com>
Tue, 17 Nov 2015 15:17:45 +0000 (15:17 +0000)
committerPedro Alves <palves@redhat.com>
Tue, 17 Nov 2015 15:21:13 +0000 (15:21 +0000)
Building in C++ caught a buglet here:

../../../src/gdb/gdbserver/win32-low.c: In function 'void win32_resume(thread_resume*, size_t)':
../../../src/gdb/gdbserver/win32-low.c:929:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
       sig = resume_info[0].sig;
           ^
../../../src/gdb/gdbserver/win32-low.c:934:11: error: invalid conversion from 'int' to 'gdb_signal' [-fpermissive]
       sig = 0;
           ^

Signals in the "struct thread_resume" structure are host signals, not
gdb signals.  The current code happens to work because the only
signals that the Windows port supports have the same number as the gdb
equivalent (see handle_exception for the win32 exception -> gdb signal
mapping).

gdb/gdbserver/ChangeLog:
2015-11-17  Pedro Alves  <palves@redhat.com>

* win32-low.c (win32_resume): Use gdb_signal_from_host,
GDB_SIGNAL_0 and gdb_signal_to_string.

gdb/gdbserver/ChangeLog
gdb/gdbserver/win32-low.c

index 589897de2bb5c421f8527d3b40ffb80fc34388f3..a919a087f464a67e6487885cf21836d9f60aeb78 100644 (file)
@@ -1,3 +1,8 @@
+2015-11-17  Pedro Alves  <palves@redhat.com>
+
+       * win32-low.c (win32_resume): Use gdb_signal_from_host,
+       GDB_SIGNAL_0 and gdb_signal_to_string.
+
 2015-11-17  Pedro Alves  <palves@redhat.com>
 
        * win32-low.c (handle_output_debug_string): Remove parameter.
index b1a2e56bf465212e670a46233c73819d5d6fd16e..b1de139cac7028c9a709a966bcce3deae944a0e6 100644 (file)
@@ -926,12 +926,12 @@ win32_resume (struct thread_resume *resume_info, size_t n)
 
   if (!ptid_equal (resume_info[0].thread, minus_one_ptid))
     {
-      sig = resume_info[0].sig;
+      sig = gdb_signal_from_host (resume_info[0].sig);
       step = resume_info[0].kind == resume_step;
     }
   else
     {
-      sig = 0;
+      sig = GDB_SIGNAL_0;
       step = 0;
     }
 
@@ -939,12 +939,14 @@ win32_resume (struct thread_resume *resume_info, size_t n)
     {
       if (current_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
        {
-         OUTMSG (("Cannot continue with signal %d here.\n", sig));
+         OUTMSG (("Cannot continue with signal %s here.\n",
+                  gdb_signal_to_string (sig)));
        }
       else if (sig == last_sig)
        continue_status = DBG_EXCEPTION_NOT_HANDLED;
       else
-       OUTMSG (("Can only continue with recieved signal %d.\n", last_sig));
+       OUTMSG (("Can only continue with received signal %s.\n",
+                gdb_signal_to_string (last_sig)));
     }
 
   last_sig = GDB_SIGNAL_0;
This page took 0.033793 seconds and 4 git commands to generate.