diff options
author | Andrej Korman <andrejkorman@google.com> | 2021-09-01 15:13:56 +0200 |
---|---|---|
committer | Andy Yankovsky <werat@google.com> | 2021-09-01 15:14:29 +0200 |
commit | eee687a66d76bf0b6e3746f7b8d09b0d871bff27 (patch) | |
tree | 714f81c6ed63a05811f3aba7a93e71cf2b4435bc /lldb/source/Commands/CommandObjectProcess.cpp | |
parent | 42ae7eb581ff6abf77524f4c9e4333262c95aa4b (diff) | |
download | llvm-eee687a66d76bf0b6e3746f7b8d09b0d871bff27.zip llvm-eee687a66d76bf0b6e3746f7b8d09b0d871bff27.tar.gz llvm-eee687a66d76bf0b6e3746f7b8d09b0d871bff27.tar.bz2 |
[lldb] Add minidump save-core functionality to ELF object files
This change adds save-core functionality into the ObjectFileELF that enables
saving minidump of a stopped process. This change is mainly targeting Linux
running on x86_64 machines. Minidump should contain basic information needed
to examine state of threads, local variables and stack traces. Full support
for other platforms is not so far implemented. API tests are using LLDB's
MinidumpParser.
This relands commit aafa05e, reverted in 1f986f6.
Failed tests were fixed.
Reviewed By: clayborg
Differential Revision: https://reviews.llvm.org/D108233
Diffstat (limited to 'lldb/source/Commands/CommandObjectProcess.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectProcess.cpp | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index bb6220a..b3e2f6a 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1180,12 +1180,13 @@ static constexpr OptionEnumValues SaveCoreStyles() { class CommandObjectProcessSaveCore : public CommandObjectParsed { public: CommandObjectProcessSaveCore(CommandInterpreter &interpreter) - : CommandObjectParsed(interpreter, "process save-core", - "Save the current process as a core file using an " - "appropriate file type.", - "process save-core [-s corefile-style] FILE", - eCommandRequiresProcess | eCommandTryTargetAPILock | - eCommandProcessMustBeLaunched) {} + : CommandObjectParsed( + interpreter, "process save-core", + "Save the current process as a core file using an " + "appropriate file type.", + "process save-core [-s corefile-style -p plugin-name] FILE", + eCommandRequiresProcess | eCommandTryTargetAPILock | + eCommandProcessMustBeLaunched) {} ~CommandObjectProcessSaveCore() override = default; @@ -1208,6 +1209,9 @@ public: Status error; switch (short_option) { + case 'p': + m_requested_plugin_name.SetString(option_arg); + break; case 's': m_requested_save_core_style = (lldb::SaveCoreStyle)OptionArgParser::ToOptionEnum( @@ -1223,10 +1227,12 @@ public: void OptionParsingStarting(ExecutionContext *execution_context) override { m_requested_save_core_style = eSaveCoreUnspecified; + m_requested_plugin_name.Clear(); } // Instance variables to hold the values for command options. SaveCoreStyle m_requested_save_core_style; + ConstString m_requested_plugin_name; }; protected: @@ -1237,7 +1243,8 @@ protected: FileSpec output_file(command.GetArgumentAtIndex(0)); SaveCoreStyle corefile_style = m_options.m_requested_save_core_style; Status error = - PluginManager::SaveCore(process_sp, output_file, corefile_style); + PluginManager::SaveCore(process_sp, output_file, corefile_style, + m_options.m_requested_plugin_name); if (error.Success()) { if (corefile_style == SaveCoreStyle::eSaveCoreDirtyOnly || corefile_style == SaveCoreStyle::eSaveCoreStackOnly) { |