aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/API/SBProcess.cpp
diff options
context:
space:
mode:
authorMed Ismail Bennani <medismail.bennani@gmail.com>2020-02-24 10:04:16 -0500
committerMed Ismail Bennani <medismail.bennani@gmail.com>2020-02-24 23:37:04 +0100
commiteefda18227a2faeacbd5420cb482fa8b5836283b (patch)
tree197807b5585d8eb5682d626657ef6dd8661644e5 /lldb/source/API/SBProcess.cpp
parent698078257285a044110620d7dab2fb4451a3fa29 (diff)
downloadllvm-eefda18227a2faeacbd5420cb482fa8b5836283b.zip
llvm-eefda18227a2faeacbd5420cb482fa8b5836283b.tar.gz
llvm-eefda18227a2faeacbd5420cb482fa8b5836283b.tar.bz2
[lldb/Plugins] Move SBTarget::GetExtendedCrashInformation to SBProcess
This patch moves the SB API method GetExtendedCrashInformation from SBTarget to SBProcess since it only makes sense to call this method on a sane process which might not be the case on a SBTarget object. It also addresses some feedbacks received after landing the first patch for the 'crash-info' feature. Differential Revision: https://reviews.llvm.org/D75049 Signed-off-by: Med Ismail Bennani <medismail.bennani@gmail.com>
Diffstat (limited to 'lldb/source/API/SBProcess.cpp')
-rw-r--r--lldb/source/API/SBProcess.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp
index 1a93950..ab21601 100644
--- a/lldb/source/API/SBProcess.cpp
+++ b/lldb/source/API/SBProcess.cpp
@@ -18,6 +18,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/StreamFile.h"
+#include "lldb/Core/StructuredDataImpl.h"
#include "lldb/Target/MemoryRegionInfo.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/RegisterContext.h"
@@ -1010,6 +1011,30 @@ bool SBProcess::GetDescription(SBStream &description) {
return true;
}
+SBStructuredData SBProcess::GetExtendedCrashInformation() {
+ LLDB_RECORD_METHOD_NO_ARGS(lldb::SBStructuredData, SBProcess,
+ GetExtendedCrashInformation);
+ SBStructuredData data;
+ ProcessSP process_sp(GetSP());
+ if (!process_sp)
+ return LLDB_RECORD_RESULT(data);
+
+ PlatformSP platform_sp = process_sp->GetTarget().GetPlatform();
+
+ if (!platform_sp)
+ return LLDB_RECORD_RESULT(data);
+
+ auto expected_data =
+ platform_sp->FetchExtendedCrashInformation(*process_sp.get());
+
+ if (!expected_data)
+ return LLDB_RECORD_RESULT(data);
+
+ StructuredData::ObjectSP fetched_data = *expected_data;
+ data.m_impl_up->SetObjectSP(fetched_data);
+ return LLDB_RECORD_RESULT(data);
+}
+
uint32_t
SBProcess::GetNumSupportedHardwareWatchpoints(lldb::SBError &sb_error) const {
LLDB_RECORD_METHOD_CONST(uint32_t, SBProcess,
@@ -1385,6 +1410,8 @@ void RegisterMethods<SBProcess>(Registry &R) {
LLDB_REGISTER_METHOD(lldb::addr_t, SBProcess, ReadPointerFromMemory,
(lldb::addr_t, lldb::SBError &));
LLDB_REGISTER_METHOD(bool, SBProcess, GetDescription, (lldb::SBStream &));
+ LLDB_REGISTER_METHOD(lldb::SBStructuredData, SBProcess,
+ GetExtendedCrashInformation, ());
LLDB_REGISTER_METHOD_CONST(uint32_t, SBProcess,
GetNumSupportedHardwareWatchpoints,
(lldb::SBError &));