diff options
Diffstat (limited to 'lldb')
-rw-r--r-- | lldb/tools/driver/Driver.cpp | 4 | ||||
-rw-r--r-- | lldb/tools/driver/Platform.cpp | 40 | ||||
-rw-r--r-- | lldb/tools/driver/Platform.h | 15 | ||||
-rw-r--r-- | lldb/tools/lldb-mi/CMakeLists.txt | 1 | ||||
-rw-r--r-- | lldb/tools/lldb-mi/Platform.cpp | 49 | ||||
-rw-r--r-- | lldb/tools/lldb-mi/Platform.h | 9 |
6 files changed, 5 insertions, 113 deletions
diff --git a/lldb/tools/driver/Driver.cpp b/lldb/tools/driver/Driver.cpp index 71cefbd305b..ddade913c9a 100644 --- a/lldb/tools/driver/Driver.cpp +++ b/lldb/tools/driver/Driver.cpp @@ -1310,11 +1310,13 @@ main (int argc, char const *argv[], const char *envp[]) SBHostOS::ThreadCreated ("<lldb.driver.main-thread>"); + signal(SIGINT, sigint_handler); +#ifndef _MSC_VER signal (SIGPIPE, SIG_IGN); signal (SIGWINCH, sigwinch_handler); - signal (SIGINT, sigint_handler); signal (SIGTSTP, sigtstp_handler); signal (SIGCONT, sigcont_handler); +#endif // Create a scope for driver so that the driver object will destroy itself // before SBDebugger::Terminate() is called. diff --git a/lldb/tools/driver/Platform.cpp b/lldb/tools/driver/Platform.cpp index a4916154087..88c0aa1e95c 100644 --- a/lldb/tools/driver/Platform.cpp +++ b/lldb/tools/driver/Platform.cpp @@ -16,21 +16,6 @@ #include "Platform.h" -// the control handler or SIGINT handler -static sighandler_t _ctrlHandler = NULL; - -// the default console control handler -BOOL -WINAPI CtrlHandler (DWORD ctrlType) -{ - if ( _ctrlHandler != NULL ) - { - _ctrlHandler( 0 ); - return TRUE; - } - return FALSE; -} - int ioctl (int d, int request, ...) { @@ -84,29 +69,4 @@ tcgetattr (int fildes, struct termios *termios_p) return -1; } -#ifdef _MSC_VER -sighandler_t -signal (int sig, sighandler_t sigFunc) -{ - switch ( sig ) - { - case ( SIGINT ): - { - _ctrlHandler = sigFunc; - SetConsoleCtrlHandler( CtrlHandler, TRUE ); - } - break; - case ( SIGPIPE ): - case ( SIGWINCH ): - case ( SIGTSTP ): - case ( SIGCONT ): - // ignore these for now - break; - default: - assert( !"Not implemented!" ); - } - return 0; -} -#endif - #endif diff --git a/lldb/tools/driver/Platform.h b/lldb/tools/driver/Platform.h index c42d7e3da9d..15e21f143bb 100644 --- a/lldb/tools/driver/Platform.h +++ b/lldb/tools/driver/Platform.h @@ -12,12 +12,11 @@ #if defined( _WIN32 ) - // this will stop signal.h being included - #define _INC_SIGNAL #include "lldb/Host/HostGetOpt.h" #include <io.h> #if defined( _MSC_VER ) #include <eh.h> + #include <signal.h> #endif #include <inttypes.h> #include "lldb/Host/windows/windows.h" @@ -37,17 +36,6 @@ // ioctls.h #define TIOCGWINSZ 0x5413 - - // signal handler function pointer type - typedef void(*sighandler_t)(int); - - // signal.h - #define SIGINT 2 - // default handler - #define SIG_DFL ( (sighandler_t) -1 ) - // ignored - #define SIG_IGN ( (sighandler_t) -2 ) - // signal.h #define SIGPIPE 13 #define SIGCONT 18 @@ -80,7 +68,6 @@ }; typedef long pid_t; #define snprintf _snprintf - extern sighandler_t signal( int sig, sighandler_t ); #define PATH_MAX MAX_PATH #endif diff --git a/lldb/tools/lldb-mi/CMakeLists.txt b/lldb/tools/lldb-mi/CMakeLists.txt index 7fd6ed199e9..ee6f3c7f480 100644 --- a/lldb/tools/lldb-mi/CMakeLists.txt +++ b/lldb/tools/lldb-mi/CMakeLists.txt @@ -73,7 +73,6 @@ set(LLDB_MI_SOURCES MIUtilString.cpp MIUtilThreadBaseStd.cpp MIUtilVariant.cpp - Platform.cpp ) if ( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) diff --git a/lldb/tools/lldb-mi/Platform.cpp b/lldb/tools/lldb-mi/Platform.cpp deleted file mode 100644 index 7e2eabf51b4..00000000000 --- a/lldb/tools/lldb-mi/Platform.cpp +++ /dev/null @@ -1,49 +0,0 @@ -//===-- Platform.cpp --------------------------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// - -// this file is only relevant for Visual C++ -#if defined(_MSC_VER) - -#include <process.h> -#include <assert.h> - -#include "Platform.h" - -// the control handler or SIGINT handler -static sighandler_t _ctrlHandler = NULL; - -// the default console control handler -BOOL WINAPI CtrlHandler(DWORD ctrlType) -{ - if (_ctrlHandler != NULL) - { - _ctrlHandler(SIGINT); - return TRUE; - } - return FALSE; -} - -sighandler_t -signal(int sig, sighandler_t sigFunc) -{ - switch (sig) - { - case (SIGINT): - { - _ctrlHandler = sigFunc; - SetConsoleCtrlHandler(CtrlHandler, TRUE); - } - break; - default: - assert(!"Not implemented!"); - } - return 0; -} - -#endif diff --git a/lldb/tools/lldb-mi/Platform.h b/lldb/tools/lldb-mi/Platform.h index 093ceac0fb9..556f8010798 100644 --- a/lldb/tools/lldb-mi/Platform.h +++ b/lldb/tools/lldb-mi/Platform.h @@ -10,12 +10,10 @@ #if defined(_MSC_VER) -// this will stop signal.h being included -#define _INC_SIGNAL - #include <io.h> #include <eh.h> #include <inttypes.h> +#include <signal.h> #include <lldb/Host/windows/Windows.h> #include <lldb/Host/HostGetOpt.h> @@ -73,7 +71,6 @@ typedef void (*sighandler_t)(int); // CODETAG_IOR_SIGNALS // signal.h -#define SIGINT 2 // Terminal interrupt signal #define SIGQUIT 3 // Terminal quit signal #define SIGKILL 9 // Kill (cannot be caught or ignored) #define SIGPIPE 13 // Write on a pipe with no one to read it @@ -81,10 +78,6 @@ typedef void (*sighandler_t)(int); #define SIGTSTP 20 // Terminal stop signal #define SIGSTOP 23 // Stop executing (cannot be caught or ignored) #define SIGWINCH 28 // (== SIGVTALRM) -#define SIG_DFL ((sighandler_t)-1) // Default handler -#define SIG_IGN ((sighandler_t)-2) // Ignored - -extern sighandler_t signal(int sig, sighandler_t); #else |