diff options
author | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2014-08-14 16:45:50 +0000 |
---|---|---|
committer | Hafiz Abid Qadeer <hafiz_abid@mentor.com> | 2014-08-14 16:45:50 +0000 |
commit | eba7eb7b3f83b56f7650e65be90885a868b80f2d (patch) | |
tree | 2f7f058e0e0bf692a3326e1eee9ac6d98b1e348a | |
parent | d2dee16c27c13d20d1dc97db308fb9145a3e9607 (diff) | |
download | bcm5719-llvm-eba7eb7b3f83b56f7650e65be90885a868b80f2d.tar.gz bcm5719-llvm-eba7eb7b3f83b56f7650e65be90885a868b80f2d.zip |
Fix 'pid' and 'executable' fields in the list-thread-group.
The documentation says that these fields should be generated when
we have proper process or target file. Current implementation did not
check for this. Eclipse seem to use list-thread-group command even
before setting the executable in which case current implementation
can return garbage data.
llvm-svn: 215658
-rw-r--r-- | lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp | 47 |
1 files changed, 28 insertions, 19 deletions
diff --git a/lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp b/lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp index c3e9507d109..b09f585598a 100644 --- a/lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp +++ b/lldb/tools/lldb-mi/MICmdCmdMiscellanous.cpp @@ -282,11 +282,14 @@ bool CMICmdCmdListThreadGroups::Acknowledge( void ) miTuple.Add( miValueResult2 ); CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); - const CMIUtilString strPid( CMIUtilString::Format( "%lld", pid ) ); - const CMICmnMIValueConst miValueConst3( strPid ); - const CMICmnMIValueResult miValueResult3( "pid", miValueConst3 ); - miTuple.Add( miValueResult3 ); + if (rSessionInfo.m_lldbProcess.IsValid ()) + { + const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); + const CMIUtilString strPid( CMIUtilString::Format( "%lld", pid ) ); + const CMICmnMIValueConst miValueConst3( strPid ); + const CMICmnMIValueResult miValueResult3( "pid", miValueConst3 ); + miTuple.Add( miValueResult3 ); + } const CMICmnMIValueConst miValueConst4( MIRSRC( IDS_WORD_NOT_IMPLEMENTED_BRKTS ) ); const CMICmnMIValueResult miValueResult4( "num_children", miValueConst4 ); @@ -315,19 +318,25 @@ bool CMICmdCmdListThreadGroups::Acknowledge( void ) miTuple.Add( miValueResult2 ); CMICmnLLDBDebugSessionInfo & rSessionInfo( CMICmnLLDBDebugSessionInfo::Instance() ); - const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); - const CMIUtilString strPid( CMIUtilString::Format( "%lld", pid ) ); - const CMICmnMIValueConst miValueConst3( strPid ); - const CMICmnMIValueResult miValueResult3( "pid", miValueConst3 ); - miTuple.Add( miValueResult3 ); - - lldb::SBTarget & rTrgt = rSessionInfo.m_lldbTarget; - const MIchar * pDir = rTrgt.GetExecutable().GetDirectory(); - const MIchar * pFileName = rTrgt.GetExecutable().GetFilename(); - const CMIUtilString strFile( CMIUtilString::Format( "%s/%s", pDir, pFileName ) ); - const CMICmnMIValueConst miValueConst4( strFile ); - const CMICmnMIValueResult miValueResult4( "executable", miValueConst4 ); - miTuple.Add( miValueResult4 ); + if (rSessionInfo.m_lldbProcess.IsValid ()) + { + const lldb::pid_t pid = rSessionInfo.m_lldbProcess.GetProcessID(); + const CMIUtilString strPid( CMIUtilString::Format( "%lld", pid ) ); + const CMICmnMIValueConst miValueConst3( strPid ); + const CMICmnMIValueResult miValueResult3( "pid", miValueConst3 ); + miTuple.Add( miValueResult3 ); + } + + if (rSessionInfo.m_lldbTarget.IsValid ()) + { + lldb::SBTarget & rTrgt = rSessionInfo.m_lldbTarget; + const MIchar * pDir = rTrgt.GetExecutable().GetDirectory(); + const MIchar * pFileName = rTrgt.GetExecutable().GetFilename(); + const CMIUtilString strFile( CMIUtilString::Format( "%s/%s", pDir, pFileName ) ); + const CMICmnMIValueConst miValueConst4( strFile ); + const CMICmnMIValueResult miValueResult4( "executable", miValueConst4 ); + miTuple.Add( miValueResult4 ); + } const CMICmnMIValueList miValueList( miTuple ); const CMICmnMIValueResult miValueResult5( "groups", miValueList ); @@ -576,4 +585,4 @@ bool CMICmdCmdInferiorTtySet::Acknowledge( void ) CMICmdBase * CMICmdCmdInferiorTtySet::CreateSelf( void ) { return new CMICmdCmdInferiorTtySet(); -}
\ No newline at end of file +} |