[Lldb-commits] [PATCH] D152842: [lldb] Improve corefile saving ergonomics

Med Ismail Bennani via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 13 11:00:04 PDT 2023


mib created this revision.
mib added reviewers: bulbazord, jasonmolenda.
mib added a project: LLDB.
Herald added a subscriber: JDevlieghere.
Herald added a project: All.
mib requested review of this revision.
Herald added a subscriber: lldb-commits.

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.

Signed-off-by: Med Ismail Bennani <ismail at bennani.ma>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152842

Files:
  lldb/source/API/SBProcess.cpp
  lldb/source/Commands/CommandObjectProcess.cpp


Index: lldb/source/Commands/CommandObjectProcess.cpp
===================================================================
--- lldb/source/Commands/CommandObjectProcess.cpp
+++ lldb/source/Commands/CommandObjectProcess.cpp
@@ -1306,6 +1306,13 @@
 
   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 @@
     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,
Index: lldb/source/API/SBProcess.cpp
===================================================================
--- lldb/source/API/SBProcess.cpp
+++ lldb/source/API/SBProcess.cpp
@@ -1183,6 +1183,7 @@
   }
 
   FileSpec core_file(file_name);
+  FileSystem::Instance().Resolve(core_file);
   error.ref() = PluginManager::SaveCore(process_sp, core_file, core_style,
                                         flavor);
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152842.530990.patch
Type: text/x-patch
Size: 1479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20230613/808d60da/attachment.bin>


More information about the lldb-commits mailing list