[Lldb-commits] [lldb] r177932 - Modified patch from Prabhat Verma to enable loading core files through the SBTarget API.

Greg Clayton gclayton at apple.com
Mon Mar 25 15:40:51 PDT 2013


Author: gclayton
Date: Mon Mar 25 17:40:51 2013
New Revision: 177932

URL: http://llvm.org/viewvc/llvm-project?rev=177932&view=rev
Log:
Modified patch from Prabhat Verma to enable loading core files through the SBTarget API.

Modified:
    lldb/trunk/include/lldb/API/SBTarget.h
    lldb/trunk/scripts/Python/interface/SBTarget.i
    lldb/trunk/source/API/SBTarget.cpp

Modified: lldb/trunk/include/lldb/API/SBTarget.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBTarget.h?rev=177932&r1=177931&r2=177932&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBTarget.h (original)
+++ lldb/trunk/include/lldb/API/SBTarget.h Mon Mar 25 17:40:51 2013
@@ -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);

Modified: lldb/trunk/scripts/Python/interface/SBTarget.i
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/interface/SBTarget.i?rev=177932&r1=177931&r2=177932&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/interface/SBTarget.i (original)
+++ lldb/trunk/scripts/Python/interface/SBTarget.i Mon Mar 25 17:40:51 2013
@@ -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);

Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=177932&r1=177931&r2=177932&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Mon Mar 25 17:40:51 2013
@@ -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,





More information about the lldb-commits mailing list