diff options
Diffstat (limited to 'lldb/source/API/SBThread.cpp')
| -rw-r--r-- | lldb/source/API/SBThread.cpp | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp index bd316ddf54a9..fa4c80e59d97 100644 --- a/lldb/source/API/SBThread.cpp +++ b/lldb/source/API/SBThread.cpp @@ -12,6 +12,7 @@ #include "lldb/API/SBDebugger.h" #include "lldb/API/SBEvent.h" #include "lldb/API/SBFileSpec.h" +#include "lldb/API/SBFormat.h" #include "lldb/API/SBFrame.h" #include "lldb/API/SBProcess.h" #include "lldb/API/SBStream.h" @@ -22,7 +23,6 @@ #include "lldb/API/SBValue.h" #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Debugger.h" -#include "lldb/Core/StreamFile.h" #include "lldb/Core/StructuredDataImpl.h" #include "lldb/Core/ValueObject.h" #include "lldb/Interpreter/CommandInterpreter.h" @@ -181,7 +181,7 @@ size_t SBThread::GetStopReasonDataCount() { exe_ctx.GetProcessPtr()->GetBreakpointSiteList().FindByID( site_id)); if (bp_site_sp) - return bp_site_sp->GetNumberOfOwners() * 2; + return bp_site_sp->GetNumberOfConstituents() * 2; else return 0; // Breakpoint must have cleared itself... } break; @@ -241,7 +241,7 @@ uint64_t SBThread::GetStopReasonDataAtIndex(uint32_t idx) { if (bp_site_sp) { uint32_t bp_index = idx / 2; BreakpointLocationSP bp_loc_sp( - bp_site_sp->GetOwnerAtIndex(bp_index)); + bp_site_sp->GetConstituentAtIndex(bp_index)); if (bp_loc_sp) { if (idx & 1) { // Odd idx, return the breakpoint location ID @@ -1224,17 +1224,41 @@ bool SBThread::GetDescription(SBStream &description, bool stop_format) const { ExecutionContext exe_ctx(m_opaque_sp.get(), lock); if (exe_ctx.HasThreadScope()) { - exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat(strm, - LLDB_INVALID_THREAD_ID, - stop_format); - // strm.Printf("SBThread: tid = 0x%4.4" PRIx64, - // exe_ctx.GetThreadPtr()->GetID()); + exe_ctx.GetThreadPtr()->DumpUsingSettingsFormat( + strm, LLDB_INVALID_THREAD_ID, stop_format); } else strm.PutCString("No value"); return true; } +SBError SBThread::GetDescriptionWithFormat(const SBFormat &format, + SBStream &output) { + Stream &strm = output.ref(); + + SBError error; + if (!format) { + error.SetErrorString("The provided SBFormat object is invalid"); + return error; + } + + std::unique_lock<std::recursive_mutex> lock; + ExecutionContext exe_ctx(m_opaque_sp.get(), lock); + + if (exe_ctx.HasThreadScope()) { + if (exe_ctx.GetThreadPtr()->DumpUsingFormat( + strm, LLDB_INVALID_THREAD_ID, format.GetFormatEntrySP().get())) { + return error; + } + } + + error.SetErrorStringWithFormat( + "It was not possible to generate a thread description with the given " + "format string '%s'", + format.GetFormatEntrySP()->string.c_str()); + return error; +} + SBThread SBThread::GetExtendedBacktraceThread(const char *type) { LLDB_INSTRUMENT_VA(this, type); |
