summaryrefslogtreecommitdiffstats
path: root/lldb/tools/lldb-mi/MIDriverMain.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/tools/lldb-mi/MIDriverMain.cpp')
-rw-r--r--lldb/tools/lldb-mi/MIDriverMain.cpp203
1 files changed, 0 insertions, 203 deletions
diff --git a/lldb/tools/lldb-mi/MIDriverMain.cpp b/lldb/tools/lldb-mi/MIDriverMain.cpp
index d08e8947acb..8b4d901905d 100644
--- a/lldb/tools/lldb-mi/MIDriverMain.cpp
+++ b/lldb/tools/lldb-mi/MIDriverMain.cpp
@@ -41,43 +41,11 @@
#include "MIUtilDebug.h"
#include "MICmnLog.h"
-#if MICONFIG_COMPILE_MIDRIVER_VERSION
#if defined(_MSC_VER)
#pragma warning(once : 4530) // Warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc
#endif // _MSC_VER
-// ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
-// CODETAG_IOR_SIGNALS
-//++ ------------------------------------------------------------------------------------
-// Details: The SIGWINCH signal is sent to a process when its controlling terminal
-// changes its size (a window change).
-// Type: Function.
-// Args: vSigno - (R) Signal number.
-// Return: None.
-// Throws: None.
-//--
-void
-sigwinch_handler(int vSigno)
-{
-#ifdef _WIN32 // Restore handler as it is not persistent on Windows
- signal(SIGWINCH, sigwinch_handler);
-#endif
- MIunused(vSigno);
-
- struct winsize window_size;
- if (::isatty(STDIN_FILENO) && ::ioctl(STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
- {
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- if (window_size.ws_col > 0)
- {
- rDriverMgr.DriverResizeWindow((uint32_t)window_size.ws_col);
- }
- }
-
- CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGWINCH", vSigno));
-}
-
// CODETAG_IOR_SIGNALS
//++ ------------------------------------------------------------------------------------
// Details: The SIGINT signal is sent to a process by its controlling terminal when a
@@ -115,69 +83,6 @@ sigint_handler(int vSigno)
rDriverMgr.DeliverSignal (vSigno);
}
-// ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
-// CODETAG_IOR_SIGNALS
-//++ ------------------------------------------------------------------------------------
-// Details: The SIGTSTP signal is sent to a process by its controlling terminal to
-// request it to stop temporarily. It is commonly initiated by the user pressing
-// Control-Z. Unlike SIGSTOP, the process can register a signal handler for or
-// ignore the signal.
-// *** The function does not behave ATM like the UNIX equivalent ***
-// Type: Function.
-// Args: vSigno - (R) Signal number.
-// Return: None.
-// Throws: None.
-//--
-void
-sigtstp_handler(int vSigno)
-{
-#ifdef _WIN32 // Restore handler as it is not persistent on Windows
- signal(SIGTSTP, sigtstp_handler);
-#endif
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
- if (pDebugger != nullptr)
- {
- pDebugger->SaveInputTerminalState();
- }
-
- CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGTSTP", vSigno));
-
- // Send signal to driver so that it can take suitable action
- rDriverMgr.DeliverSignal (vSigno);
-}
-
-// ToDo: Reevaluate if this function needs to be implemented like the UNIX equivalent
-// CODETAG_IOR_SIGNALS
-//++ ------------------------------------------------------------------------------------
-// Details: The SIGCONT signal instructs the operating system to continue (restart) a
-// process previously paused by the SIGSTOP or SIGTSTP signal. One important use
-// of this signal is in job control in the UNIX shell.
-// *** The function does not behave ATM like the UNIX equivalent ***
-// Type: Function.
-// Args: vSigno - (R) Signal number.
-// Return: None.
-// Throws: None.
-//--
-void
-sigcont_handler(int vSigno)
-{
-#ifdef _WIN32 // Restore handler as it is not persistent on Windows
- signal(SIGCONT, sigcont_handler);
-#endif
- CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
- lldb::SBDebugger *pDebugger = rDriverMgr.DriverGetTheDebugger();
- if (pDebugger != nullptr)
- {
- pDebugger->RestoreInputTerminalState();
- }
-
- CMICmnLog::Instance().WriteLog(CMIUtilString::Format(MIRSRC(IDS_PROCESS_SIGNAL_RECEIVED), "SIGCONT", vSigno));
-
- // Send signal to driver so that it can take suitable action
- rDriverMgr.DeliverSignal (vSigno);
-}
-
//++ ------------------------------------------------------------------------------------
// Details: Init the MI driver system. Initialize the whole driver system which includes
// both the original LLDB driver and the MI driver.
@@ -191,13 +96,6 @@ bool
DriverSystemInit(void)
{
bool bOk = MIstatus::success;
-
-#if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
- Driver *pDriver = Driver::CreateSelf();
- if (pDriver == nullptr)
- return MIstatus::failure;
-#endif // MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-
CMIDriver &rMIDriver = CMIDriver::Instance();
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
bOk = rDriverMgr.Initialize();
@@ -226,66 +124,9 @@ DriverSystemShutdown(const bool vbAppExitOk)
// *** Order is important here ***
CMIDriverMgr::Instance().Shutdown();
-
-#if MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
- delete g_driver;
- g_driver = nullptr;
-#endif // MICONFIG_COMPILE_MIDRIVER_WITH_LLDBDRIVER
-
return bOk;
}
-#else
-void
-sigwinch_handler(int signo)
-{
- struct winsize window_size;
- if (isatty(STDIN_FILENO) && ::ioctl(STDIN_FILENO, TIOCGWINSZ, &window_size) == 0)
- {
- if ((window_size.ws_col > 0) && g_driver != NULL)
- {
- g_driver->ResizeWindow(window_size.ws_col);
- }
- }
-}
-
-void
-sigint_handler(int signo)
-{
- static bool g_interrupt_sent = false;
- if (g_driver)
- {
- if (!g_interrupt_sent)
- {
- g_interrupt_sent = true;
- g_driver->GetDebugger().DispatchInputInterrupt();
- g_interrupt_sent = false;
- return;
- }
- }
-
- exit(signo);
-}
-
-void
-sigtstp_handler(int signo)
-{
- g_driver->GetDebugger().SaveInputTerminalState();
- signal(signo, SIG_DFL);
- kill(getpid(), signo);
- signal(signo, sigtstp_handler);
-}
-
-void
-sigcont_handler(int signo)
-{
- g_driver->GetDebugger().RestoreInputTerminalState();
- signal(signo, SIG_DFL);
- kill(getpid(), signo);
- signal(signo, sigcont_handler);
-}
-#endif // #if MICONFIG_COMPILE_MIDRIVER_VERSION
-
//++ ------------------------------------------------------------------------------------
// Details: MI's application start point of execution. The applicaton runs in two modes.
// An LLDB native driver mode where it acts no different from the LLDB driver.
@@ -306,7 +147,6 @@ sigcont_handler(int signo)
// -1000 = Program failed did not initailize successfully.
// Throws: None.
//--
-#if MICONFIG_COMPILE_MIDRIVER_VERSION
int
main(int argc, char const *argv[])
{
@@ -327,11 +167,7 @@ main(int argc, char const *argv[])
}
// CODETAG_IOR_SIGNALS
- signal(SIGPIPE, SIG_IGN);
- signal(SIGWINCH, sigwinch_handler);
signal(SIGINT, sigint_handler);
- signal(SIGTSTP, sigtstp_handler);
- signal(SIGCONT, sigcont_handler);
bool bExiting = false;
CMIDriverMgr &rDriverMgr = CMIDriverMgr::Instance();
@@ -348,42 +184,3 @@ main(int argc, char const *argv[])
return appResult;
}
-#else // Operate the lldb Driver only version of the code
-int
-main(int argc, char const *argv[], char *envp[])
-{
- MIunused(envp);
- using namespace lldb;
- SBDebugger::Initialize();
-
- SBHostOS::ThreadCreated("<lldb.driver.main-thread>");
-
- signal(SIGPIPE, SIG_IGN);
- signal(SIGWINCH, sigwinch_handler);
- signal(SIGINT, sigint_handler);
- signal(SIGTSTP, sigtstp_handler);
- signal(SIGCONT, sigcont_handler);
-
- // Create a scope for driver so that the driver object will destroy itself
- // before SBDebugger::Terminate() is called.
- {
- Driver driver;
-
- bool exiting = false;
- SBError error(driver.ParseArgs(argc, argv, stdout, exiting));
- if (error.Fail())
- {
- const char *error_cstr = error.GetCString();
- if (error_cstr)
- ::fprintf(stderr, "error: %s\n", error_cstr);
- }
- else if (!exiting)
- {
- driver.MainLoop();
- }
- }
-
- SBDebugger::Terminate();
- return 0;
-}
-#endif // MICONFIG_COMPILE_MIDRIVER_VERSION
OpenPOWER on IntegriCloud