diff options
Diffstat (limited to 'tools/lldb-mi/MIDriver.cpp')
-rw-r--r-- | tools/lldb-mi/MIDriver.cpp | 61 |
1 files changed, 5 insertions, 56 deletions
diff --git a/tools/lldb-mi/MIDriver.cpp b/tools/lldb-mi/MIDriver.cpp index cb8fb1c2c25f8..3bf888e303d41 100644 --- a/tools/lldb-mi/MIDriver.cpp +++ b/tools/lldb-mi/MIDriver.cpp @@ -1,9 +1,8 @@ //===-- MIDriver.cpp --------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// @@ -44,7 +43,6 @@ const CMIUtilString const CMIUtilString CMIDriver::ms_constAppNameLong(MIRSRC(IDS_MI_APPNAME_LONG)); //++ -//------------------------------------------------------------------------------------ // Details: CMIDriver constructor. // Type: Method. // Args: None. @@ -53,7 +51,7 @@ const CMIUtilString CMIDriver::ms_constAppNameLong(MIRSRC(IDS_MI_APPNAME_LONG)); //-- CMIDriver::CMIDriver() : m_bFallThruToOtherDriverEnabled(false), m_bDriverIsExiting(false), - m_handleMainThread(0), m_rStdin(CMICmnStreamStdin::Instance()), + m_handleMainThread(nullptr), m_rStdin(CMICmnStreamStdin::Instance()), m_rLldbDebugger(CMICmnLLDBDebugger::Instance()), m_rStdOut(CMICmnStreamStdout::Instance()), m_eCurrentDriverState(eDriverState_NotRunning), @@ -62,7 +60,6 @@ CMIDriver::CMIDriver() m_bHaveCommandFileNamePathOnCmdLine(false) {} //++ -//------------------------------------------------------------------------------------ // Details: CMIDriver destructor. // Type: Overridden. // Args: None. @@ -72,7 +69,6 @@ CMIDriver::CMIDriver() CMIDriver::~CMIDriver() {} //++ -//------------------------------------------------------------------------------------ // Details: Set whether *this driver (the parent) is enabled to pass a command // to its // fall through (child) driver to interpret the command and do work @@ -91,7 +87,6 @@ bool CMIDriver::SetEnableFallThru(const bool vbYes) { } //++ -//------------------------------------------------------------------------------------ // Details: Get whether *this driver (the parent) is enabled to pass a command // to its // fall through (child) driver to interpret the command and do work @@ -107,7 +102,6 @@ bool CMIDriver::GetEnableFallThru() const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve MI's application name of itself. // Type: Method. // Args: None. @@ -119,7 +113,6 @@ const CMIUtilString &CMIDriver::GetAppNameShort() const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve MI's application name of itself. // Type: Method. // Args: None. @@ -131,7 +124,6 @@ const CMIUtilString &CMIDriver::GetAppNameLong() const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve MI's version description of itself. // Type: Method. // Args: None. @@ -143,7 +135,6 @@ const CMIUtilString &CMIDriver::GetVersionDescription() const { } //++ -//------------------------------------------------------------------------------------ // Details: Initialize setup *this driver ready for use. // Type: Method. // Args: None. @@ -192,7 +183,6 @@ bool CMIDriver::Initialize() { } //++ -//------------------------------------------------------------------------------------ // Details: Unbind detach or release resources used by *this driver. // Type: Method. // Args: None. @@ -239,7 +229,6 @@ bool CMIDriver::Shutdown() { } //++ -//------------------------------------------------------------------------------------ // Details: Work function. Client (the driver's user) is able to append their // own message // in to the MI's Log trace file. @@ -256,7 +245,6 @@ bool CMIDriver::WriteMessageToLog(const CMIUtilString &vMessage) { } //++ -//------------------------------------------------------------------------------------ // Details: CDriverMgr calls *this driver initialize setup ready for use. // Type: Overridden. // Args: None. @@ -267,7 +255,6 @@ bool CMIDriver::WriteMessageToLog(const CMIUtilString &vMessage) { bool CMIDriver::DoInitialize() { return CMIDriver::Instance().Initialize(); } //++ -//------------------------------------------------------------------------------------ // Details: CDriverMgr calls *this driver to unbind detach or release resources // used by // *this driver. @@ -280,7 +267,6 @@ bool CMIDriver::DoInitialize() { return CMIDriver::Instance().Initialize(); } bool CMIDriver::DoShutdown() { return CMIDriver::Instance().Shutdown(); } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve the name for *this driver. // Type: Overridden. // Args: None. @@ -297,7 +283,6 @@ const CMIUtilString &CMIDriver::GetName() const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve *this driver's last error condition. // Type: Overridden. // Args: None. @@ -307,7 +292,6 @@ const CMIUtilString &CMIDriver::GetName() const { CMIUtilString CMIDriver::GetError() const { return GetErrorDescription(); } //++ -//------------------------------------------------------------------------------------ // Details: Call *this driver to return it's debugger. // Type: Overridden. // Args: None. @@ -319,7 +303,6 @@ lldb::SBDebugger &CMIDriver::GetTheDebugger() { } //++ -//------------------------------------------------------------------------------------ // Details: Specify another driver *this driver can call should this driver not // be able // to handle the client data input. DoFallThruToAnotherDriver() makes @@ -337,7 +320,6 @@ bool CMIDriver::SetDriverToFallThruTo(const CMIDriverBase &vrOtherDriver) { } //++ -//------------------------------------------------------------------------------------ // Details: Proxy function CMIDriverMgr IDriver interface implementation. *this // driver's // implementation called from here to match the existing function name @@ -374,7 +356,6 @@ lldb::SBError CMIDriver::DoParseArgs(const int argc, const char *argv[], } //++ -//------------------------------------------------------------------------------------ // Details: Check the arguments that were passed to this program to make sure // they are // valid and to get their argument values (if any). The following are @@ -484,7 +465,6 @@ lldb::SBError CMIDriver::ParseArgs(const int argc, const char *argv[], } //++ -//------------------------------------------------------------------------------------ // Details: A client can ask if *this driver is GDB/MI compatible. // Type: Overridden. // Args: None. @@ -495,7 +475,6 @@ lldb::SBError CMIDriver::ParseArgs(const int argc, const char *argv[], bool CMIDriver::GetDriverIsGDBMICompatibleDriver() const { return true; } //++ -//------------------------------------------------------------------------------------ // Details: Start worker threads for the driver. // Type: Method. // Args: None. @@ -522,7 +501,6 @@ bool CMIDriver::StartWorkerThreads() { } //++ -//------------------------------------------------------------------------------------ // Details: Stop worker threads for the driver. // Type: Method. // Args: None. @@ -536,7 +514,6 @@ bool CMIDriver::StopWorkerThreads() { } //++ -//------------------------------------------------------------------------------------ // Details: Call this function puts *this driver to work. // This function is used by the application's main thread. // Type: Overridden. @@ -611,7 +588,6 @@ bool CMIDriver::DoMainLoop() { } //++ -//------------------------------------------------------------------------------------ // Details: Set things in motion, set state etc that brings *this driver (and // the // application) to a tidy shutdown. @@ -635,7 +611,6 @@ bool CMIDriver::DoAppQuit() { } //++ -//------------------------------------------------------------------------------------ // Details: *this driver passes text commands to a fall through driver is it // does not // understand them (the LLDB driver). @@ -687,7 +662,6 @@ bool CMIDriver::InterpretCommandFallThruDriver(const CMIUtilString &vTextLine, } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve the name for *this driver. // Type: Overridden. // Args: None. @@ -697,7 +671,6 @@ bool CMIDriver::InterpretCommandFallThruDriver(const CMIUtilString &vTextLine, const CMIUtilString &CMIDriver::GetDriverName() const { return GetName(); } //++ -//------------------------------------------------------------------------------------ // Details: Get the unique ID for *this driver. // Type: Overridden. // Args: None. @@ -707,7 +680,6 @@ const CMIUtilString &CMIDriver::GetDriverName() const { return GetName(); } const CMIUtilString &CMIDriver::GetDriverId() const { return GetId(); } //++ -//------------------------------------------------------------------------------------ // Details: This function allows *this driver to call on another driver to // perform work // should this driver not be able to handle the client data input. @@ -732,7 +704,6 @@ bool CMIDriver::DoFallThruToAnotherDriver(const CMIUtilString &vCmd, } //++ -//------------------------------------------------------------------------------------ // Details: *this driver provides a file stream to other drivers on which *this // driver // write's out to and they read as expected input. *this driver is @@ -753,7 +724,6 @@ FILE *CMIDriver::GetStdin() const { } //++ -//------------------------------------------------------------------------------------ // Details: *this driver provides a file stream to other pass through assigned // drivers // so they know what to write to. @@ -767,11 +737,10 @@ FILE *CMIDriver::GetStdout() const { // available before *this driver has been initialized! Flaw? // Do not want to pass through driver to write to stdout - return NULL; + return nullptr; } //++ -//------------------------------------------------------------------------------------ // Details: *this driver provides a error file stream to other pass through // assigned drivers // so they know what to write to. @@ -790,7 +759,6 @@ FILE *CMIDriver::GetStderr() const { } //++ -//------------------------------------------------------------------------------------ // Details: Set a unique ID for *this driver. It cannot be empty. // Type: Overridden. // Args: vId - (R) Text description. @@ -810,7 +778,6 @@ bool CMIDriver::SetId(const CMIUtilString &vId) { } //++ -//------------------------------------------------------------------------------------ // Details: Get the unique ID for *this driver. // Type: Overridden. // Args: None. @@ -820,7 +787,6 @@ bool CMIDriver::SetId(const CMIUtilString &vId) { const CMIUtilString &CMIDriver::GetId() const { return m_strDriverId; } //++ -//------------------------------------------------------------------------------------ // Details: Interpret the text data and match against current commands to see if // there // is a match. If a match then the command is issued and actioned on. @@ -850,7 +816,6 @@ bool CMIDriver::InterpretCommand(const CMIUtilString &vTextLine) { } //++ -//------------------------------------------------------------------------------------ // Details: Helper function for CMIDriver::InterpretCommandThisDriver. // Convert a CLI command to MI command (just wrap any CLI command // into "<tokens>-interpreter-exec command \"<CLI command>\""). @@ -926,7 +891,6 @@ CMIDriver::WrapCLICommandIntoMICommand(const CMIUtilString &vTextLine) const { } //++ -//------------------------------------------------------------------------------------ // Details: Interpret the text data and match against current commands to see if // there // is a match. If a match then the command is issued and actioned on. @@ -999,7 +963,6 @@ bool CMIDriver::InterpretCommandThisDriver(const CMIUtilString &vTextLine, } //++ -//------------------------------------------------------------------------------------ // Details: Having previously had the potential command validated and found // valid now // get the command executed. @@ -1016,7 +979,6 @@ bool CMIDriver::ExecuteCommand(const SMICmdData &vCmdData) { } //++ -//------------------------------------------------------------------------------------ // Details: Set the MI Driver's exit application flag. The application checks // this flag // after every stdin line is read so the exit may not be instantaneous. @@ -1049,7 +1011,6 @@ void CMIDriver::SetExitApplicationFlag(const bool vbForceExit) { } //++ -//------------------------------------------------------------------------------------ // Details: Get the MI Driver's exit exit application flag. // This is related to the running state of the MI driver. // Type: Method. @@ -1061,7 +1022,6 @@ void CMIDriver::SetExitApplicationFlag(const bool vbForceExit) { bool CMIDriver::GetExitApplicationFlag() const { return m_bExitApp; } //++ -//------------------------------------------------------------------------------------ // Details: Get the current running state of the MI Driver. // Type: Method. // Args: None. @@ -1073,7 +1033,6 @@ CMIDriver::DriverState_e CMIDriver::GetCurrentDriverState() const { } //++ -//------------------------------------------------------------------------------------ // Details: Set the current running state of the MI Driver to running and // currently not in // a debug session. @@ -1120,7 +1079,6 @@ bool CMIDriver::SetDriverStateRunningNotDebugging() { } //++ -//------------------------------------------------------------------------------------ // Details: Set the current running state of the MI Driver to running and // currently not in // a debug session. The driver's state must in the state running and in @@ -1169,7 +1127,6 @@ bool CMIDriver::SetDriverStateRunningDebugging() { } //++ -//------------------------------------------------------------------------------------ // Details: Prepare the client IDE so it will start working/communicating with // *this MI // driver. @@ -1185,7 +1142,6 @@ bool CMIDriver::InitClientIDEToMIDriver() const { } //++ -//------------------------------------------------------------------------------------ // Details: The IDE Eclipse when debugging locally expects "(gdb)\n" character // sequence otherwise it refuses to communicate and times out. This // should be @@ -1201,7 +1157,6 @@ bool CMIDriver::InitClientIDEEclipse() const { } //++ -//------------------------------------------------------------------------------------ // Details: Ask *this driver whether it found an executable in the MI Driver's // list of // arguments which to open and debug. If so instigate commands to set @@ -1220,7 +1175,6 @@ bool CMIDriver::HaveExecutableFileNamePathOnCmdLine() const { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve from *this driver executable file name path to start a // debug session // with (if present see HaveExecutableFileNamePathOnCmdLine()). @@ -1234,7 +1188,6 @@ const CMIUtilString &CMIDriver::GetExecutableFileNamePathOnCmdLine() const { } //++ -//------------------------------------------------------------------------------------ // Details: Execute commands (by injecting them into the stdin line queue // container) and // other code to set up the MI Driver such that is can take the @@ -1257,7 +1210,6 @@ bool CMIDriver::LocalDebugSessionStartupExecuteCommands() { } //++ -//------------------------------------------------------------------------------------ // Details: Set the MI Driver into "its debugging an executable passed as an // argument" // mode as against running via a client like Eclipse. @@ -1271,7 +1223,6 @@ void CMIDriver::SetDriverDebuggingArgExecutable() { } //++ -//------------------------------------------------------------------------------------ // Details: Retrieve the MI Driver state indicating if it is operating in "its // debugging // an executable passed as an argument" mode as against running via a @@ -1287,7 +1238,6 @@ bool CMIDriver::IsDriverDebuggingArgExecutable() const { } //++ -//------------------------------------------------------------------------------------ // Details: Execute commands from command source file in specified mode, and // set exit-flag if needed. // Type: Method. @@ -1353,7 +1303,6 @@ bool CMIDriver::ExecuteCommandFile(const bool vbAsyncMode) { } //++ -//------------------------------------------------------------------------------------ // Details: Gets called when lldb-mi gets a signal. Stops the process if it was // SIGINT. // |