aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Target/Thread.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Target/Thread.cpp')
-rw-r--r--lldb/source/Target/Thread.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index c5f16b4e6c1d..bde6dad554e7 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -13,6 +13,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Core/ValueObject.h"
+#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueProperties.h"
@@ -2005,3 +2006,26 @@ ThreadSP Thread::GetCurrentExceptionBacktrace() {
return ThreadSP();
}
+
+lldb::ValueObjectSP Thread::GetSiginfoValue() {
+ ProcessSP process_sp = GetProcess();
+ assert(process_sp);
+ Target &target = process_sp->GetTarget();
+ PlatformSP platform_sp = target.GetPlatform();
+ assert(platform_sp);
+ ArchSpec arch = target.GetArchitecture();
+
+ CompilerType type = platform_sp->GetSiginfoType(arch.GetTriple());
+ if (!type.IsValid())
+ return ValueObjectConstResult::Create(&target, Status("no siginfo_t for the platform"));
+
+ llvm::Optional<uint64_t> type_size = type.GetByteSize(nullptr);
+ assert(type_size);
+ llvm::Expected<std::unique_ptr<llvm::MemoryBuffer>> data = GetSiginfo(type_size.getValue());
+ if (!data)
+ return ValueObjectConstResult::Create(&target, Status(data.takeError()));
+
+ DataExtractor data_extractor{data.get()->getBufferStart(), data.get()->getBufferSize(),
+ process_sp->GetByteOrder(), arch.GetAddressByteSize()};
+ return ValueObjectConstResult::Create(&target, type, ConstString("__lldb_siginfo"), data_extractor);
+}