[Lldb-commits] [lldb] r215658 - Fix 'pid' and 'executable' fields in the list-thread-group.
Hafiz Abid Qadeer
hafiz_abid at mentor.com
Thu Aug 14 09:45:50 PDT 2014
Author: abidh
Date: Thu Aug 14 11:45:50 2014
New Revision: 215658
URL: http://llvm.org/viewvc/llvm-project?rev=215658&view=rev
Log:
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.
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp?rev=215658&r1=215657&r2=215658&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdMiscellanous.cpp Thu Aug 14 11:45:50 2014
@@ -282,11 +282,14 @@ bool CMICmdCmdListThreadGroups::Acknowle
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::Acknowle
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::Acknowledg
CMICmdBase * CMICmdCmdInferiorTtySet::CreateSelf( void )
{
return new CMICmdCmdInferiorTtySet();
-}
\ No newline at end of file
+}
More information about the lldb-commits
mailing list