summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBTarget.h3
-rw-r--r--lldb/scripts/Python/interface/SBTarget.i20
-rw-r--r--lldb/source/API/SBTarget.cpp20
3 files changed, 43 insertions, 0 deletions
diff --git a/lldb/include/lldb/API/SBTarget.h b/lldb/include/lldb/API/SBTarget.h
index 7985da218ac..1f6595ba089 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -366,6 +366,9 @@ public:
SBProcess
Launch (SBLaunchInfo &launch_info, SBError& error);
+
+ SBProcess
+ LoadCore (const char *core_file);
SBProcess
Attach (SBAttachInfo &attach_info, SBError& error);
diff --git a/lldb/scripts/Python/interface/SBTarget.i b/lldb/scripts/Python/interface/SBTarget.i
index 8f9ea2ee639..b60a8dba84f 100644
--- a/lldb/scripts/Python/interface/SBTarget.i
+++ b/lldb/scripts/Python/interface/SBTarget.i
@@ -389,6 +389,26 @@ public:
lldb::SBProcess
Launch (lldb::SBLaunchInfo &launch_info, lldb::SBError& error);
+
+ %feature("docstring", "
+ //------------------------------------------------------------------
+ /// Load a core file
+ ///
+ /// @param[in] core_file
+ /// File path of the core dump.
+ ///
+ /// @return
+ /// A process object for the newly created core file.
+ //------------------------------------------------------------------
+
+ For example,
+
+ process = target.LoadCore('./a.out.core')
+
+ loads a new core file and returns the process object.
+ ") LoadCore;
+ lldb::SBProcess
+ LoadCore(const char *core_file);
lldb::SBProcess
Attach (lldb::SBAttachInfo &attach_info, lldb::SBError& error);
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 8cddd0968b9..383f7012bca 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -557,6 +557,26 @@ SBTarget::GetDebugger () const
}
SBProcess
+SBTarget::LoadCore (const char *core_file)
+{
+ SBProcess sb_process;
+ TargetSP target_sp(GetSP());
+ if (target_sp)
+ {
+ FileSpec filespec(core_file, true);
+ ProcessSP process_sp (target_sp->CreateProcess(target_sp->GetDebugger().GetListener(),
+ NULL,
+ &filespec));
+ if (process_sp)
+ {
+ process_sp->LoadCore();
+ sb_process.SetSP (process_sp);
+ }
+ }
+ return sb_process;
+}
+
+SBProcess
SBTarget::LaunchSimple
(
char const **argv,
OpenPOWER on IntegriCloud