[Lldb-commits] [PATCH] D125325: Pass plugin_name in SBProcess::SaveCore
Levon Ter-Grigoryan via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Fri May 13 01:19:40 PDT 2022
PatriosTheGreat updated this revision to Diff 429160.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D125325/new/
https://reviews.llvm.org/D125325
Files:
lldb/bindings/interface/SBProcess.i
lldb/include/lldb/API/SBProcess.h
lldb/source/API/SBProcess.cpp
lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
Index: lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
===================================================================
--- lldb/test/API/functionalities/process_save_core_minidump/TestProcessSaveCoreMinidump.py
+++ 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", "stack")
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)
Index: lldb/source/API/SBProcess.cpp
===================================================================
--- lldb/source/API/SBProcess.cpp
+++ lldb/source/API/SBProcess.cpp
@@ -1138,6 +1138,13 @@
lldb::SBError SBProcess::SaveCore(const char *file_name) {
LLDB_INSTRUMENT_VA(this, file_name);
+ return SaveCore(file_name, "", SaveCoreStyle::eSaveCoreFull);
+}
+
+lldb::SBError SBProcess::SaveCore(const char *file_name,
+ const char *flavor,
+ SaveCoreStyle core_style) {
+ LLDB_INSTRUMENT_VA(this, file_name, flavor);
lldb::SBError error;
ProcessSP process_sp(GetSP());
@@ -1155,8 +1162,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,
+ flavor);
return error;
}
Index: lldb/include/lldb/API/SBProcess.h
===================================================================
--- lldb/include/lldb/API/SBProcess.h
+++ lldb/include/lldb/API/SBProcess.h
@@ -337,7 +337,22 @@
bool IsInstrumentationRuntimePresent(InstrumentationRuntimeType type);
- /// Save the state of the process in a core file (or mini dump on Windows).
+ /// Save the state of the process in a core file.
+ ///
+ /// \param[in] file_name - The name of the file to save the core file to.
+ ///
+ /// \param[in] flavor - Specify the flavor of a core file plug-in to save.
+ /// Currently supported flavors include "mach-o" and "minidump"
+ ///
+ /// \param[in] core_style - Specify the style of a core file to save.
+ /// "minidump" plug-in supports only "eSaveCoreStackOnly".
+ lldb::SBError SaveCore(const char *file_name, const char *flavor,
+ SaveCoreStyle core_style);
+
+ /// Save the state of the process with the a flavor that matches the
+ /// current process' main executable (if supported).
+ ///
+ /// \param[in] file_name - The name of the file to save the core file to.
lldb::SBError SaveCore(const char *file_name);
/// Query the address load_addr and store the details of the memory
Index: lldb/bindings/interface/SBProcess.i
===================================================================
--- lldb/bindings/interface/SBProcess.i
+++ lldb/bindings/interface/SBProcess.i
@@ -397,6 +397,9 @@
bool
IsInstrumentationRuntimePresent(lldb::InstrumentationRuntimeType type);
+ lldb::SBError
+ SaveCore(const char *file_name, const char *flavor, lldb::SaveCoreStyle core_style);
+
lldb::SBError
SaveCore(const char *file_name);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D125325.429160.patch
Type: text/x-patch
Size: 4116 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220513/012e386e/attachment.bin>
More information about the lldb-commits
mailing list