diff --git a/lldb/bindings/interface/SBProcess.i b/lldb/bindings/interface/SBProcess.i --- a/lldb/bindings/interface/SBProcess.i +++ b/lldb/bindings/interface/SBProcess.i @@ -398,7 +398,7 @@ IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type); lldb::SBError - SaveCore(const char *file_name); + SaveCore(const char *file_name, const char *plugin_name); lldb::SBError GetMemoryRegionInfo(lldb::addr_t load_addr, lldb::SBMemoryRegionInfo ®ion_info); diff --git a/lldb/include/lldb/API/SBProcess.h b/lldb/include/lldb/API/SBProcess.h --- a/lldb/include/lldb/API/SBProcess.h +++ b/lldb/include/lldb/API/SBProcess.h @@ -338,7 +338,8 @@ bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type); /// Save the state of the process in a core file (or mini dump on Windows). - lldb::SBError SaveCore(const char *file_name); + lldb::SBError SaveCore(const char *file_name, + const char *plugin_name = ""); /// Query the address load_addr and store the details of the memory /// region that contains it in the supplied SBMemoryRegionInfo object. diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -1136,8 +1136,9 @@ return runtime_sp->IsActive(); } -lldb::SBError SBProcess::SaveCore(const char *file_name) { - LLDB_INSTRUMENT_VA(this, file_name); +lldb::SBError SBProcess::SaveCore(const char *file_name, + const char *plugin_name) { + LLDB_INSTRUMENT_VA(this, file_name, plugin_name); lldb::SBError error; ProcessSP process_sp(GetSP()); @@ -1156,7 +1157,8 @@ FileSpec core_file(file_name); SaveCoreStyle core_style = SaveCoreStyle::eSaveCoreFull; - error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style, ""); + error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style, + plugin_name); return error; } diff --git a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py --- a/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py +++ b/lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py @@ -21,6 +21,7 @@ self.build() exe = self.getBuildArtifact("a.out") core = self.getBuildArtifact("core.dmp") + core_sb = self.getBuildArtifact("core_sb.dmp") try: target = self.dbg.CreateTarget(exe) process = target.LaunchSimple( @@ -42,7 +43,10 @@ # save core and, kill process and verify corefile existence self.runCmd("process save-core --plugin-name=minidump --style=stack " + core) + # validate savinig via SBProcess + lldb.SBProcess().SaveCore(core_sb, "minidump") self.assertTrue(os.path.isfile(core)) + self.assertTrue(os.path.isfile(core_sb)) self.assertSuccess(process.Kill()) # To verify, we'll launch with the mini dump @@ -77,3 +81,5 @@ self.assertTrue(self.dbg.DeleteTarget(target)) if (os.path.isfile(core)): os.unlink(core) + if (os.path.isfile(core_sb)): + os.unlink(core_sb)