Index: lldb/trunk/tools/driver/Driver.cpp =================================================================== --- lldb/trunk/tools/driver/Driver.cpp +++ lldb/trunk/tools/driver/Driver.cpp @@ -1310,11 +1310,13 @@ SBHostOS::ThreadCreated (""); + 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. Index: lldb/trunk/tools/driver/Platform.h =================================================================== --- lldb/trunk/tools/driver/Platform.h +++ lldb/trunk/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 #if defined( _MSC_VER ) #include + #include #endif #include #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 Index: lldb/trunk/tools/driver/Platform.cpp =================================================================== --- lldb/trunk/tools/driver/Platform.cpp +++ lldb/trunk/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 @@ 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 Index: lldb/trunk/tools/lldb-mi/CMakeLists.txt =================================================================== --- lldb/trunk/tools/lldb-mi/CMakeLists.txt +++ lldb/trunk/tools/lldb-mi/CMakeLists.txt @@ -73,7 +73,6 @@ MIUtilString.cpp MIUtilThreadBaseStd.cpp MIUtilVariant.cpp - Platform.cpp ) if ( CMAKE_SYSTEM_NAME MATCHES "Windows" OR CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) Index: lldb/trunk/tools/lldb-mi/Platform.h =================================================================== --- lldb/trunk/tools/lldb-mi/Platform.h +++ lldb/trunk/tools/lldb-mi/Platform.h @@ -10,12 +10,10 @@ #if defined(_MSC_VER) -// this will stop signal.h being included -#define _INC_SIGNAL - #include #include #include +#include #include #include @@ -73,7 +71,6 @@ // 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 @@ #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 Index: lldb/trunk/tools/lldb-mi/Platform.cpp =================================================================== --- lldb/trunk/tools/lldb-mi/Platform.cpp +++ lldb/trunk/tools/lldb-mi/Platform.cpp @@ -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 -#include - -#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