diff options
| author | Greg Clayton <gclayton@apple.com> | 2013-03-25 22:40:51 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2013-03-25 22:40:51 +0000 |
| commit | 4d8ad55c782f7e4e43a72e62d55b48cca57acbf6 (patch) | |
| tree | c458075309987db8d23f4ff0efbecec3f65e71eb | |
| parent | cd3d440b827cb47e16e9ada47cf58948d8a1df34 (diff) | |
| download | bcm5719-llvm-4d8ad55c782f7e4e43a72e62d55b48cca57acbf6.tar.gz bcm5719-llvm-4d8ad55c782f7e4e43a72e62d55b48cca57acbf6.zip | |
Modified patch from Prabhat Verma to enable loading core files through the SBTarget API.
llvm-svn: 177932
| -rw-r--r-- | lldb/include/lldb/API/SBTarget.h | 3 | ||||
| -rw-r--r-- | lldb/scripts/Python/interface/SBTarget.i | 20 | ||||
| -rw-r--r-- | lldb/source/API/SBTarget.cpp | 20 |
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, |

