Restore gdb-server cleanup handlers for MinGW
authorOlivier Gay <olivier.gay@gmail.com>
Sun, 27 Oct 2013 15:17:08 +0000 (16:17 +0100)
committerOlivier Gay <olivier.gay@gmail.com>
Sun, 27 Oct 2013 15:17:09 +0000 (16:17 +0100)
There were removed in my previous commit 5851dee due
to compilation errors. It actually appears these signals
are supported in MinGW but there was an include error for
MinGW, this commit fixes it.

gdbserver/gdb-server.c

index a6de1b20d2db8f68fc6f2891e2b5e1f338ce809e..69eadda497a8f95176e0609f26c277116dfaf5fd 100644 (file)
@@ -7,6 +7,7 @@
 */
 
 #include <getopt.h>
+#include <signal.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -18,7 +19,6 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include <arpa/inet.h>
-#include <signal.h>
 #endif
 
 #include <stlink-common.h>
@@ -57,7 +57,6 @@ typedef struct _st_state_t {
 int serve(stlink_t *sl, st_state_t *st);
 char* make_memory_map(stlink_t *sl);
 
-#ifndef __MINGW32__
 static void cleanup(int signal __attribute__((unused))) {
     if (connected_stlink) {
         /* Switch back to mass storage mode before closing. */
@@ -68,7 +67,6 @@ static void cleanup(int signal __attribute__((unused))) {
 
     exit(1);
 }
-#endif
 
 
 
@@ -198,10 +196,8 @@ int main(int argc, char** argv) {
     }
 
     connected_stlink = sl;
-#ifndef __MINGW32__
     signal(SIGINT, &cleanup);
     signal(SIGTERM, &cleanup);
-#endif
 
     if (state.reset) {
                stlink_reset(sl);