diff options
author | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2015-02-06 21:38:51 +0000 |
commit | 205afe679855a4ce8149cdaa94d3f0868ce796dc (patch) | |
tree | 09bc83f73246ee3c7a779605cd0122093d2a8a19 /tools/lldb-mi/MICmdCmdExec.cpp | |
parent | 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (diff) |
Notes
Diffstat (limited to 'tools/lldb-mi/MICmdCmdExec.cpp')
-rw-r--r-- | tools/lldb-mi/MICmdCmdExec.cpp | 1341 |
1 files changed, 690 insertions, 651 deletions
diff --git a/tools/lldb-mi/MICmdCmdExec.cpp b/tools/lldb-mi/MICmdCmdExec.cpp index c0ec25d701b7e..9e1224363f5d1 100644 --- a/tools/lldb-mi/MICmdCmdExec.cpp +++ b/tools/lldb-mi/MICmdCmdExec.cpp @@ -8,22 +8,22 @@ //===----------------------------------------------------------------------===// //++ -// File: MICmdCmdExec.cpp +// File: MICmdCmdExec.cpp // -// Overview: CMICmdCmdExecRun implementation. -// CMICmdCmdExecContinue implementation. -// CMICmdCmdExecNext implementation. -// CMICmdCmdExecStep implementation. -// CMICmdCmdExecNextInstruction implementation. -// CMICmdCmdExecStepInstruction implementation. -// CMICmdCmdExecFinish implementation. -// CMICmdCmdExecInterrupt implementation. +// Overview: CMICmdCmdExecRun implementation. +// CMICmdCmdExecContinue implementation. +// CMICmdCmdExecNext implementation. +// CMICmdCmdExecStep implementation. +// CMICmdCmdExecNextInstruction implementation. +// CMICmdCmdExecStepInstruction implementation. +// CMICmdCmdExecFinish implementation. +// CMICmdCmdExecInterrupt implementation. // -// Environment: Compilers: Visual C++ 12. -// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 -// Libraries: See MIReadmetxt. +// Environment: Compilers: Visual C++ 12. +// gcc (Ubuntu/Linaro 4.8.1-10ubuntu9) 4.8.1 +// Libraries: See MIReadmetxt. // -// Copyright: None. +// Copyright: None. //-- // Third Party Headers: @@ -49,120 +49,122 @@ #include "MICmnMIOutOfBandRecord.h" //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecRun constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecRun constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecRun::CMICmdCmdExecRun( void ) +CMICmdCmdExecRun::CMICmdCmdExecRun(void) { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-run"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecRun::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-run"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecRun::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecRun destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecRun destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecRun::~CMICmdCmdExecRun( void ) +CMICmdCmdExecRun::~CMICmdCmdExecRun(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecRun::Execute( void ) +bool +CMICmdCmdExecRun::Execute(void) { - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); lldb::SBError error; lldb::SBStream errMsg; uint32_t launch_flags = lldb::LaunchFlags::eLaunchFlagDebug; - lldb::SBProcess process = rSessionInfo.m_lldbTarget.Launch (rSessionInfo.m_rLlldbListener, - nullptr, nullptr, nullptr, nullptr, nullptr, - nullptr, launch_flags, false, error); + lldb::SBProcess process = rSessionInfo.m_lldbTarget.Launch(rSessionInfo.m_rLlldbListener, nullptr, nullptr, nullptr, nullptr, nullptr, + nullptr, launch_flags, false, error); - if( (!process.IsValid()) || (error.Fail()) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_INVALID_PROCESS ), m_cmdData.strMiCmd.c_str(), errMsg.GetData() ) ); - return MIstatus::failure; - } + if ((!process.IsValid()) || (error.Fail())) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PROCESS), m_cmdData.strMiCmd.c_str(), errMsg.GetData())); + return MIstatus::failure; + } - // Save the process in the session info - rSessionInfo.m_lldbProcess = process; + // Save the process in the session info + rSessionInfo.m_lldbProcess = process; - if( !CMIDriver::Instance().SetDriverStateRunningDebugging() ) - { - const CMIUtilString & rErrMsg( CMIDriver::Instance().GetErrorDescription() ); - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_SET_NEW_DRIVER_STATE ), m_cmdData.strMiCmd.c_str(), rErrMsg.c_str() ) ); - return MIstatus::failure; - } - return MIstatus::success; + if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) + { + const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), m_cmdData.strMiCmd.c_str(), rErrMsg.c_str())); + return MIstatus::failure; + } + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecRun::Acknowledge( void ) +bool +CMICmdCmdExecRun::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) + if (m_lldbResult.GetErrorSize() > 0) { - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); m_miResultRecord = miRecordResult; } else { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); m_miResultRecord = miRecordResult; - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); - // Give the client '=thread-group-started,id="i1" pid="xyz"' - m_bHasResultRecordExtra = true; - const CMICmnMIValueConst miValueConst2( "i1" ); - const CMICmnMIValueResult miValueResult2( "id", miValueConst2 ); - const CMIUtilString strPid( CMIUtilString::Format( "%lld", pid ) ); - const CMICmnMIValueConst miValueConst( strPid ); - const CMICmnMIValueResult miValueResult( "pid", miValueConst ); - CMICmnMIOutOfBandRecord miOutOfBand( CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2 ); - miOutOfBand.Add( miValueResult ); - m_miResultRecordExtra = miOutOfBand.GetString(); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); + // Give the client '=thread-group-started,id="i1" pid="xyz"' + m_bHasResultRecordExtra = true; + const CMICmnMIValueConst miValueConst2("i1"); + const CMICmnMIValueResult miValueResult2("id", miValueConst2); + const CMIUtilString strPid(CMIUtilString::Format("%lld", pid)); + const CMICmnMIValueConst miValueConst(strPid); + const CMICmnMIValueResult miValueResult("pid", miValueConst); + CMICmnMIOutOfBandRecord miOutOfBand(CMICmnMIOutOfBandRecord::eOutOfBand_ThreadGroupStarted, miValueResult2); + miOutOfBand.Add(miValueResult); + m_miResultRecordExtra = miOutOfBand.GetString(); } - - return MIstatus::success; + + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecRun::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecRun::CreateSelf(void) { - return new CMICmdCmdExecRun(); + return new CMICmdCmdExecRun(); } //--------------------------------------------------------------------------------------- @@ -170,111 +172,114 @@ CMICmdBase * CMICmdCmdExecRun::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecContinue constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecContinue constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecContinue::CMICmdCmdExecContinue( void ) +CMICmdCmdExecContinue::CMICmdCmdExecContinue(void) { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-continue"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecContinue::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-continue"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecContinue::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecContinue destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecContinue destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecContinue::~CMICmdCmdExecContinue( void ) +CMICmdCmdExecContinue::~CMICmdCmdExecContinue(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecContinue::Execute( void ) +bool +CMICmdCmdExecContinue::Execute(void) { - const MIchar * pCmd = "continue"; - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - const lldb::ReturnStatus rtn = rSessionInfo.m_rLldbDebugger.GetCommandInterpreter().HandleCommand( pCmd, m_lldbResult ); MIunused( rtn ); - + const MIchar *pCmd = "continue"; + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + const lldb::ReturnStatus rtn = rSessionInfo.m_rLldbDebugger.GetCommandInterpreter().HandleCommand(pCmd, m_lldbResult); + MIunused(rtn); - if( m_lldbResult.GetErrorSize() == 0 ) - { - // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM - if( !CMIDriver::Instance().SetDriverStateRunningDebugging() ) - { - const CMIUtilString & rErrMsg( CMIDriver::Instance().GetErrorDescription() ); - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_SET_NEW_DRIVER_STATE ), m_cmdData.strMiCmd.c_str(), rErrMsg.c_str() ) ); - return MIstatus::failure; - } - } - else - { - // ToDo: Re-evaluate if this is required when application near finished as this is parsing LLDB error message - // which seems a hack and is code brittle - const MIchar * pLldbErr = m_lldbResult.GetError(); - const CMIUtilString strLldbMsg( CMIUtilString( pLldbErr ).StripCREndOfLine() ); - if( strLldbMsg == "error: Process must be launched." ) - { - CMIDriver::Instance().SetExitApplicationFlag( true ); - } - } + if (m_lldbResult.GetErrorSize() == 0) + { + // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM + if (!CMIDriver::Instance().SetDriverStateRunningDebugging()) + { + const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), m_cmdData.strMiCmd.c_str(), rErrMsg.c_str())); + return MIstatus::failure; + } + } + else + { + // ToDo: Re-evaluate if this is required when application near finished as this is parsing LLDB error message + // which seems a hack and is code brittle + const MIchar *pLldbErr = m_lldbResult.GetError(); + const CMIUtilString strLldbMsg(CMIUtilString(pLldbErr).StripCREndOfLine()); + if (strLldbMsg == "error: Process must be launched.") + { + CMIDriver::Instance().SetExitApplicationFlag(true); + } + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecContinue::Acknowledge( void ) +bool +CMICmdCmdExecContinue::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } - - return MIstatus::success; + if (m_lldbResult.GetErrorSize() > 0) + { + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } + + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecContinue::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecContinue::CreateSelf(void) { - return new CMICmdCmdExecContinue(); + return new CMICmdCmdExecContinue(); } //--------------------------------------------------------------------------------------- @@ -282,120 +287,126 @@ CMICmdBase * CMICmdCmdExecContinue::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecNext constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecNext constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecNext::CMICmdCmdExecNext( void ) -: m_constStrArgThread( "thread" ) -, m_constStrArgNumber( "number" ) +CMICmdCmdExecNext::CMICmdCmdExecNext(void) + : m_constStrArgThread("thread") + , m_constStrArgNumber("number") { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-next"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecNext::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-next"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecNext::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecNext destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecNext destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecNext::~CMICmdCmdExecNext( void ) +CMICmdCmdExecNext::~CMICmdCmdExecNext(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The parses the command line options -// arguments to extract values for each of those arguments. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNext::ParseArgs( void ) +bool +CMICmdCmdExecNext::ParseArgs(void) { - bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValNumber( m_constStrArgNumber, false, false ) ) ); - return (bOk && ParseValidateCmdOptions() ); + bool bOk = + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1))); + bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgNumber, false, false))); + return (bOk && ParseValidateCmdOptions()); } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNext::Execute( void ) +bool +CMICmdCmdExecNext::Execute(void) { - CMICMDBASE_GETOPTION( pArgThread, OptionLong, m_constStrArgThread ); + CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); - // Retrieve the --thread option's thread ID (only 1) - MIuint64 nThreadId = UINT64_MAX; - if( !pArgThread->GetExpectedOption< CMICmdArgValNumber, MIuint64 >( nThreadId ) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_THREAD_INVALID ), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str() ) ); - return MIstatus::failure; - } + // Retrieve the --thread option's thread ID (only 1) + MIuint64 nThreadId = UINT64_MAX; + if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_INVALID), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str())); + return MIstatus::failure; + } - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "thread step-over" ); - if( nThreadId != UINT64_MAX ) - strCmd += CMIUtilString::Format( " %llu", nThreadId ); - rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("thread step-over"); + if (nThreadId != UINT64_MAX) + strCmd += CMIUtilString::Format(" %llu", nThreadId); + rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNext::Acknowledge( void ) +bool +CMICmdCmdExecNext::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const MIchar * pLldbErr = m_lldbResult.GetError(); MIunused( pLldbErr ); - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } + if (m_lldbResult.GetErrorSize() > 0) + { + const MIchar *pLldbErr = m_lldbResult.GetError(); + MIunused(pLldbErr); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecNext::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecNext::CreateSelf(void) { - return new CMICmdCmdExecNext(); + return new CMICmdCmdExecNext(); } //--------------------------------------------------------------------------------------- @@ -403,120 +414,126 @@ CMICmdBase * CMICmdCmdExecNext::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecStep constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecStep constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecStep::CMICmdCmdExecStep( void ) -: m_constStrArgThread( "thread" ) -, m_constStrArgNumber( "number" ) +CMICmdCmdExecStep::CMICmdCmdExecStep(void) + : m_constStrArgThread("thread") + , m_constStrArgNumber("number") { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-step"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecStep::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-step"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecStep::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecStep destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecStep destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecStep::~CMICmdCmdExecStep( void ) +CMICmdCmdExecStep::~CMICmdCmdExecStep(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The parses the command line options -// arguments to extract values for each of those arguments. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStep::ParseArgs( void ) +bool +CMICmdCmdExecStep::ParseArgs(void) { - bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValNumber( m_constStrArgNumber, false, false ) ) ); - return (bOk && ParseValidateCmdOptions() ); + bool bOk = + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1))); + bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgNumber, false, false))); + return (bOk && ParseValidateCmdOptions()); } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStep::Execute( void ) +bool +CMICmdCmdExecStep::Execute(void) { - CMICMDBASE_GETOPTION( pArgThread, OptionLong, m_constStrArgThread ); + CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); - // Retrieve the --thread option's thread ID (only 1) - MIuint64 nThreadId = UINT64_MAX; - if( !pArgThread->GetExpectedOption< CMICmdArgValNumber, MIuint64 >( nThreadId ) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_OPTION_NOT_FOUND ), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str() ) ); - return MIstatus::failure; - } + // Retrieve the --thread option's thread ID (only 1) + MIuint64 nThreadId = UINT64_MAX; + if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str())); + return MIstatus::failure; + } - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "thread step-in" ); - if( nThreadId != UINT64_MAX ) - strCmd += CMIUtilString::Format( " %llu", nThreadId ); - rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("thread step-in"); + if (nThreadId != UINT64_MAX) + strCmd += CMIUtilString::Format(" %llu", nThreadId); + rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStep::Acknowledge( void ) +bool +CMICmdCmdExecStep::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const MIchar * pLldbErr = m_lldbResult.GetError(); MIunused( pLldbErr ); - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } + if (m_lldbResult.GetErrorSize() > 0) + { + const MIchar *pLldbErr = m_lldbResult.GetError(); + MIunused(pLldbErr); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecStep::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecStep::CreateSelf(void) { - return new CMICmdCmdExecStep(); + return new CMICmdCmdExecStep(); } //--------------------------------------------------------------------------------------- @@ -524,120 +541,126 @@ CMICmdBase * CMICmdCmdExecStep::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecNextInstruction constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecNextInstruction constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecNextInstruction::CMICmdCmdExecNextInstruction( void ) -: m_constStrArgThread( "thread" ) -, m_constStrArgNumber( "number" ) +CMICmdCmdExecNextInstruction::CMICmdCmdExecNextInstruction(void) + : m_constStrArgThread("thread") + , m_constStrArgNumber("number") { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-next-instruction"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecNextInstruction::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-next-instruction"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecNextInstruction::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecNextInstruction destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecNextInstruction destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecNextInstruction::~CMICmdCmdExecNextInstruction( void ) +CMICmdCmdExecNextInstruction::~CMICmdCmdExecNextInstruction(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The parses the command line options -// arguments to extract values for each of those arguments. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNextInstruction::ParseArgs( void ) +bool +CMICmdCmdExecNextInstruction::ParseArgs(void) { - bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValNumber( m_constStrArgNumber, false, false ) ) ); - return (bOk && ParseValidateCmdOptions() ); + bool bOk = + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1))); + bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgNumber, false, false))); + return (bOk && ParseValidateCmdOptions()); } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNextInstruction::Execute( void ) +bool +CMICmdCmdExecNextInstruction::Execute(void) { - CMICMDBASE_GETOPTION( pArgThread, OptionLong, m_constStrArgThread ); + CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); - // Retrieve the --thread option's thread ID (only 1) - MIuint64 nThreadId = UINT64_MAX; - if( !pArgThread->GetExpectedOption< CMICmdArgValNumber, MIuint64 >( nThreadId ) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_OPTION_NOT_FOUND ), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str() ) ); - return MIstatus::failure; - } + // Retrieve the --thread option's thread ID (only 1) + MIuint64 nThreadId = UINT64_MAX; + if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str())); + return MIstatus::failure; + } - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "thread step-inst-over" ); - if( nThreadId != UINT64_MAX ) - strCmd += CMIUtilString::Format( " %llu", nThreadId ); - rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("thread step-inst-over"); + if (nThreadId != UINT64_MAX) + strCmd += CMIUtilString::Format(" %llu", nThreadId); + rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecNextInstruction::Acknowledge( void ) +bool +CMICmdCmdExecNextInstruction::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const MIchar * pLldbErr = m_lldbResult.GetError(); MIunused( pLldbErr ); - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } + if (m_lldbResult.GetErrorSize() > 0) + { + const MIchar *pLldbErr = m_lldbResult.GetError(); + MIunused(pLldbErr); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecNextInstruction::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecNextInstruction::CreateSelf(void) { - return new CMICmdCmdExecNextInstruction(); + return new CMICmdCmdExecNextInstruction(); } //--------------------------------------------------------------------------------------- @@ -645,120 +668,126 @@ CMICmdBase * CMICmdCmdExecNextInstruction::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecStepInstruction constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecStepInstruction constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecStepInstruction::CMICmdCmdExecStepInstruction( void ) -: m_constStrArgThread( "thread" ) -, m_constStrArgNumber( "number" ) +CMICmdCmdExecStepInstruction::CMICmdCmdExecStepInstruction(void) + : m_constStrArgThread("thread") + , m_constStrArgNumber("number") { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-step-instruction"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecStepInstruction::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-step-instruction"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecStepInstruction::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecStepInstruction destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecStepInstruction destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecStepInstruction::~CMICmdCmdExecStepInstruction( void ) +CMICmdCmdExecStepInstruction::~CMICmdCmdExecStepInstruction(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The parses the command line options -// arguments to extract values for each of those arguments. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStepInstruction::ParseArgs( void ) +bool +CMICmdCmdExecStepInstruction::ParseArgs(void) { - bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValNumber( m_constStrArgNumber, false, false ) ) ); - return (bOk && ParseValidateCmdOptions() ); + bool bOk = + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1))); + bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgNumber, false, false))); + return (bOk && ParseValidateCmdOptions()); } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStepInstruction::Execute( void ) +bool +CMICmdCmdExecStepInstruction::Execute(void) { - CMICMDBASE_GETOPTION( pArgThread, OptionLong, m_constStrArgThread ); + CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); - // Retrieve the --thread option's thread ID (only 1) - MIuint64 nThreadId = UINT64_MAX; - if( !pArgThread->GetExpectedOption< CMICmdArgValNumber, MIuint64 >( nThreadId ) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_OPTION_NOT_FOUND ), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str() ) ); - return MIstatus::failure; - } + // Retrieve the --thread option's thread ID (only 1) + MIuint64 nThreadId = UINT64_MAX; + if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str())); + return MIstatus::failure; + } - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "thread step-inst" ); - if( nThreadId != UINT64_MAX ) - strCmd += CMIUtilString::Format( " %llu", nThreadId ); - rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("thread step-inst"); + if (nThreadId != UINT64_MAX) + strCmd += CMIUtilString::Format(" %llu", nThreadId); + rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecStepInstruction::Acknowledge( void ) +bool +CMICmdCmdExecStepInstruction::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const MIchar * pLldbErr = m_lldbResult.GetError(); MIunused( pLldbErr ); - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } + if (m_lldbResult.GetErrorSize() > 0) + { + const MIchar *pLldbErr = m_lldbResult.GetError(); + MIunused(pLldbErr); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecStepInstruction::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecStepInstruction::CreateSelf(void) { - return new CMICmdCmdExecStepInstruction(); + return new CMICmdCmdExecStepInstruction(); } //--------------------------------------------------------------------------------------- @@ -766,120 +795,127 @@ CMICmdBase * CMICmdCmdExecStepInstruction::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecFinish constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecFinish constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecFinish::CMICmdCmdExecFinish( void ) -: m_constStrArgThread( "thread" ) -, m_constStrArgFrame( "frame" ) +CMICmdCmdExecFinish::CMICmdCmdExecFinish(void) + : m_constStrArgThread("thread") + , m_constStrArgFrame("frame") { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-finish"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecFinish::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-finish"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecFinish::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecFinish destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecFinish destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecFinish::~CMICmdCmdExecFinish( void ) +CMICmdCmdExecFinish::~CMICmdCmdExecFinish(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The parses the command line options -// arguments to extract values for each of those arguments. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The parses the command line options +// arguments to extract values for each of those arguments. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecFinish::ParseArgs( void ) +bool +CMICmdCmdExecFinish::ParseArgs(void) { - bool bOk = m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - bOk = bOk && m_setCmdArgs.Add( *(new CMICmdArgValOptionLong( m_constStrArgFrame, false, false, CMICmdArgValListBase::eArgValType_Number, 1 ) ) ); - return (bOk && ParseValidateCmdOptions() ); + bool bOk = + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgThread, true, true, CMICmdArgValListBase::eArgValType_Number, 1))); + bOk = bOk && + m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgFrame, false, false, CMICmdArgValListBase::eArgValType_Number, 1))); + return (bOk && ParseValidateCmdOptions()); } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecFinish::Execute( void ) +bool +CMICmdCmdExecFinish::Execute(void) { - CMICMDBASE_GETOPTION( pArgThread, OptionLong, m_constStrArgThread ); + CMICMDBASE_GETOPTION(pArgThread, OptionLong, m_constStrArgThread); + + // Retrieve the --thread option's thread ID (only 1) + MIuint64 nThreadId = UINT64_MAX; + if (!pArgThread->GetExpectedOption<CMICmdArgValNumber, MIuint64>(nThreadId)) + { + SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_OPTION_NOT_FOUND), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str())); + return MIstatus::failure; + } - // Retrieve the --thread option's thread ID (only 1) - MIuint64 nThreadId = UINT64_MAX; - if( !pArgThread->GetExpectedOption< CMICmdArgValNumber, MIuint64 >( nThreadId ) ) - { - SetError( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_OPTION_NOT_FOUND ), m_cmdData.strMiCmd.c_str(), m_constStrArgThread.c_str() ) ); - return MIstatus::failure; - } - - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "thread step-out" ); - if( nThreadId != UINT64_MAX ) - strCmd += CMIUtilString::Format( " %llu", nThreadId ); - rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("thread step-out"); + if (nThreadId != UINT64_MAX) + strCmd += CMIUtilString::Format(" %llu", nThreadId); + rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecFinish::Acknowledge( void ) +bool +CMICmdCmdExecFinish::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) - { - const MIchar * pLldbErr = m_lldbResult.GetError(); MIunused( pLldbErr ); - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); - m_miResultRecord = miRecordResult; - } - else - { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running ); - m_miResultRecord = miRecordResult; - } + if (m_lldbResult.GetErrorSize() > 0) + { + const MIchar *pLldbErr = m_lldbResult.GetError(); + MIunused(pLldbErr); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); + m_miResultRecord = miRecordResult; + } + else + { + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Running); + m_miResultRecord = miRecordResult; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecFinish::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecFinish::CreateSelf(void) { - return new CMICmdCmdExecFinish(); + return new CMICmdCmdExecFinish(); } //--------------------------------------------------------------------------------------- @@ -887,96 +923,99 @@ CMICmdBase * CMICmdCmdExecFinish::CreateSelf( void ) //--------------------------------------------------------------------------------------- //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecInterrupt constructor. -// Type: Method. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecInterrupt constructor. +// Type: Method. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecInterrupt::CMICmdCmdExecInterrupt( void ) +CMICmdCmdExecInterrupt::CMICmdCmdExecInterrupt(void) { - // Command factory matches this name with that received from the stdin stream - m_strMiCmd = "exec-interrupt"; - - // Required by the CMICmdFactory when registering *this command - m_pSelfCreatorFn = &CMICmdCmdExecInterrupt::CreateSelf; + // Command factory matches this name with that received from the stdin stream + m_strMiCmd = "exec-interrupt"; + + // Required by the CMICmdFactory when registering *this command + m_pSelfCreatorFn = &CMICmdCmdExecInterrupt::CreateSelf; } //++ ------------------------------------------------------------------------------------ -// Details: CMICmdCmdExecInterrupt destructor. -// Type: Overrideable. -// Args: None. -// Return: None. -// Throws: None. +// Details: CMICmdCmdExecInterrupt destructor. +// Type: Overrideable. +// Args: None. +// Return: None. +// Throws: None. //-- -CMICmdCmdExecInterrupt::~CMICmdCmdExecInterrupt( void ) +CMICmdCmdExecInterrupt::~CMICmdCmdExecInterrupt(void) { } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command does work in this function. -// The command is likely to communicate with the LLDB SBDebugger in here. -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command does work in this function. +// The command is likely to communicate with the LLDB SBDebugger in here. +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecInterrupt::Execute( void ) +bool +CMICmdCmdExecInterrupt::Execute(void) { - CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - lldb::SBDebugger & rDebugger = rSessionInfo.m_rLldbDebugger; - CMIUtilString strCmd( "process interrupt" ); - const lldb::ReturnStatus status = rDebugger.GetCommandInterpreter().HandleCommand( strCmd.c_str(), m_lldbResult, false ); MIunused( status ); + CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance()); + lldb::SBDebugger &rDebugger = rSessionInfo.m_rLldbDebugger; + CMIUtilString strCmd("process interrupt"); + const lldb::ReturnStatus status = rDebugger.GetCommandInterpreter().HandleCommand(strCmd.c_str(), m_lldbResult, false); + MIunused(status); - // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM - if( !CMIDriver::Instance().SetDriverStateRunningNotDebugging() ) - { - const CMIUtilString & rErrMsg( CMIDriver::Instance().GetErrorDescription() ); - SetErrorDescription( CMIUtilString::Format( MIRSRC( IDS_CMD_ERR_SET_NEW_DRIVER_STATE ), strCmd.c_str(), rErrMsg.c_str() ) ); - return MIstatus::failure; - } + // CODETAG_DEBUG_SESSION_RUNNING_PROG_RECEIVED_SIGINT_PAUSE_PROGRAM + if (!CMIDriver::Instance().SetDriverStateRunningNotDebugging()) + { + const CMIUtilString &rErrMsg(CMIDriver::Instance().GetErrorDescription()); + SetErrorDescription(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_SET_NEW_DRIVER_STATE), strCmd.c_str(), rErrMsg.c_str())); + return MIstatus::failure; + } - return MIstatus::success; + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: The invoker requires this function. The command prepares a MI Record Result -// for the work carried out in the Execute(). -// Type: Overridden. -// Args: None. -// Return: MIstatus::success - Functional succeeded. -// MIstatus::failure - Functional failed. -// Throws: None. +// Details: The invoker requires this function. The command prepares a MI Record Result +// for the work carried out in the Execute(). +// Type: Overridden. +// Args: None. +// Return: MIstatus::success - Functional succeeded. +// MIstatus::failure - Functional failed. +// Throws: None. //-- -bool CMICmdCmdExecInterrupt::Acknowledge( void ) +bool +CMICmdCmdExecInterrupt::Acknowledge(void) { - if( m_lldbResult.GetErrorSize() > 0 ) + if (m_lldbResult.GetErrorSize() > 0) { - const CMICmnMIValueConst miValueConst( m_lldbResult.GetError() ); - const CMICmnMIValueResult miValueResult( "message", miValueConst ); - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult ); + const CMICmnMIValueConst miValueConst(m_lldbResult.GetError()); + const CMICmnMIValueResult miValueResult("message", miValueConst); + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Error, miValueResult); m_miResultRecord = miRecordResult; } else { - const CMICmnMIResultRecord miRecordResult( m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done ); - m_miResultRecord = miRecordResult; - } - - return MIstatus::success; + const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done); + m_miResultRecord = miRecordResult; + } + + return MIstatus::success; } //++ ------------------------------------------------------------------------------------ -// Details: Required by the CMICmdFactory when registering *this command. The factory -// calls this function to create an instance of *this command. -// Type: Static method. -// Args: None. -// Return: CMICmdBase * - Pointer to a new command. -// Throws: None. +// Details: Required by the CMICmdFactory when registering *this command. The factory +// calls this function to create an instance of *this command. +// Type: Static method. +// Args: None. +// Return: CMICmdBase * - Pointer to a new command. +// Throws: None. //-- -CMICmdBase * CMICmdCmdExecInterrupt::CreateSelf( void ) +CMICmdBase * +CMICmdCmdExecInterrupt::CreateSelf(void) { - return new CMICmdCmdExecInterrupt(); + return new CMICmdCmdExecInterrupt(); } - |