Author: Med Ismail Bennani Date: 2023-06-13T13:44:51-07:00 New Revision: ec05cf50daece35e0b01d3761e64ae54efe8a78e
URL: https://github.com/llvm/llvm-project/commit/ec05cf50daece35e0b01d3761e64ae54efe8a78e DIFF: https://github.com/llvm/llvm-project/commit/ec05cf50daece35e0b01d3761e64ae54efe8a78e.diff LOG: [lldb] Improve corefile saving ergonomics This patch improves the way the user can save the process state into a corefile by adding completion handler that would provide tab completion for the corefile path and also resolves the corefile path to expand relative path. Differential Revision: https://reviews.llvm.org/D152842 Signed-off-by: Med Ismail Bennani <ism...@bennani.ma> Added: Modified: lldb/source/API/SBProcess.cpp lldb/source/Commands/CommandObjectProcess.cpp Removed: ################################################################################ diff --git a/lldb/source/API/SBProcess.cpp b/lldb/source/API/SBProcess.cpp index a5491c6fa6997..6050628a2e1f3 100644 --- a/lldb/source/API/SBProcess.cpp +++ b/lldb/source/API/SBProcess.cpp @@ -1183,6 +1183,7 @@ lldb::SBError SBProcess::SaveCore(const char *file_name, } FileSpec core_file(file_name); + FileSystem::Instance().Resolve(core_file); error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style, flavor); diff --git a/lldb/source/Commands/CommandObjectProcess.cpp b/lldb/source/Commands/CommandObjectProcess.cpp index 82d11687d377a..ab047ee926c99 100644 --- a/lldb/source/Commands/CommandObjectProcess.cpp +++ b/lldb/source/Commands/CommandObjectProcess.cpp @@ -1306,6 +1306,13 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed { Options *GetOptions() override { return &m_options; } + void + HandleArgumentCompletion(CompletionRequest &request, + OptionElementVector &opt_element_vector) override { + CommandCompletions::InvokeCommonCompletionCallbacks( + GetCommandInterpreter(), lldb::eDiskFileCompletion, request, nullptr); + } + class CommandOptions : public Options { public: CommandOptions() = default; @@ -1354,6 +1361,7 @@ class CommandObjectProcessSaveCore : public CommandObjectParsed { if (process_sp) { if (command.GetArgumentCount() == 1) { FileSpec output_file(command.GetArgumentAtIndex(0)); + FileSystem::Instance().Resolve(output_file); SaveCoreStyle corefile_style = m_options.m_requested_save_core_style; Status error = PluginManager::SaveCore(process_sp, output_file, corefile_style, _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits