aboutsummaryrefslogtreecommitdiff
path: root/tools/lldb-mi/MICmdCmdThread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/lldb-mi/MICmdCmdThread.cpp')
-rw-r--r--tools/lldb-mi/MICmdCmdThread.cpp23
1 files changed, 19 insertions, 4 deletions
diff --git a/tools/lldb-mi/MICmdCmdThread.cpp b/tools/lldb-mi/MICmdCmdThread.cpp
index 823a3748248c..9435655762a9 100644
--- a/tools/lldb-mi/MICmdCmdThread.cpp
+++ b/tools/lldb-mi/MICmdCmdThread.cpp
@@ -29,9 +29,10 @@
// Throws: None.
//--
CMICmdCmdThreadInfo::CMICmdCmdThreadInfo()
- : m_bSingleThread(false)
- , m_bThreadInvalid(true)
- , m_constStrArgNamedThreadId("thread-id")
+ : m_bSingleThread(false),
+ m_bThreadInvalid(true),
+ m_constStrArgNamedThreadId("thread-id"),
+ m_bHasCurrentThread(false)
{
// Command factory matches this name with that received from the stdin stream
m_strMiCmd = "thread-info";
@@ -124,6 +125,15 @@ CMICmdCmdThreadInfo::Execute()
}
}
+ // -thread-info with multiple threads ends with the current thread id if any
+ if (thread.IsValid())
+ {
+ const CMIUtilString strId(CMIUtilString::Format("%d", thread.GetIndexID()));
+ CMICmnMIValueConst miValueCurrThreadId(strId);
+ m_miValueCurrThreadId = miValueCurrThreadId;
+ m_bHasCurrentThread = true;
+ }
+
return MIstatus::success;
}
@@ -179,7 +189,12 @@ CMICmdCmdThreadInfo::Acknowledge()
++it;
}
- const CMICmnMIValueResult miValueResult("threads", miValueList);
+ CMICmnMIValueResult miValueResult("threads", miValueList);
+ if (m_bHasCurrentThread)
+ {
+ CMIUtilString strCurrThreadId = "current-thread-id";
+ miValueResult.Add(strCurrThreadId, m_miValueCurrThreadId);
+ }
const CMICmnMIResultRecord miRecordResult(m_cmdData.strMiCmdToken, CMICmnMIResultRecord::eResultClass_Done, miValueResult);
m_miResultRecord = miRecordResult;