[Lldb-commits] [lldb] [LLDB][SBSaveCore] Fix bug where default values are not propagated. (PR #101770)

Jacob Lalonde via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 2 16:48:13 PDT 2024


https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/101770

>From 11f8323bb40a537161c76b89d564c9ae96888d01 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Fri, 2 Aug 2024 15:44:17 -0700
Subject: [PATCH 1/4] Create copies in both minidump and mach-o so we can set a
 default value

---
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp        | 16 ++++++++++------
 .../ObjectFile/Minidump/ObjectFileMinidump.cpp   | 11 +++++++----
 .../macosx/skinny-corefile/TestSkinnyCorefile.py |  1 -
 3 files changed, 17 insertions(+), 11 deletions(-)

diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 4322bd7e2674f..d09eec0f9cb62 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6524,13 +6524,17 @@ struct page_object {
 bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
                                const lldb_private::SaveCoreOptions &options,
                                Status &error) {
-  auto core_style = options.GetStyle();
-  if (core_style == SaveCoreStyle::eSaveCoreUnspecified)
-    core_style = SaveCoreStyle::eSaveCoreDirtyOnly;
   // The FileSpec and Process are already checked in PluginManager::SaveCore.
   assert(options.GetOutputFile().has_value());
   assert(process_sp);
   const FileSpec outfile = options.GetOutputFile().value();
+    
+  // We have to make a local copy of the options, so that if we default
+  // the save core style, we can proprogate that when we pass options
+  // to process calculate save core ranges
+  lldb_private::SaveCoreOptions core_options = options;
+  if (core_options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
+    core_options.SetStyle(eSaveCoreDirtyOnly);
 
   Target &target = process_sp->GetTarget();
   const ArchSpec target_arch = target.GetArchitecture();
@@ -6561,7 +6565,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
 
     if (make_core) {
       Process::CoreFileMemoryRanges core_ranges;
-      error = process_sp->CalculateCoreFileSaveRanges(options, core_ranges);
+      error = process_sp->CalculateCoreFileSaveRanges(core_options, core_ranges);
       if (error.Success()) {
         const uint32_t addr_byte_size = target_arch.GetAddressByteSize();
         const ByteOrder byte_order = target_arch.GetByteOrder();
@@ -6733,7 +6737,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
         StructuredData::ArraySP threads(
             std::make_shared<StructuredData::Array>());
         for (const ThreadSP &thread_sp :
-             process_sp->CalculateCoreFileThreadList(options)) {
+             process_sp->CalculateCoreFileThreadList(core_options)) {
           StructuredData::DictionarySP thread(
               std::make_shared<StructuredData::Dictionary>());
           thread->AddIntegerItem("thread_id", thread_sp->GetID());
@@ -6756,7 +6760,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
         all_image_infos_lcnote_up->payload_file_offset = file_offset;
         file_offset = CreateAllImageInfosPayload(
             process_sp, file_offset, all_image_infos_lcnote_up->payload,
-            options);
+            core_options);
         lc_notes.push_back(std::move(all_image_infos_lcnote_up));
 
         // Add LC_NOTE load commands
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
index 2380ff4c00ca9..22f1323503115 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
@@ -62,10 +62,13 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
   assert(options.GetOutputFile().has_value());
   assert(process_sp);
 
+  // We have to make a local copy of the options, so that if we default
+  // the save core style, we can proprogate that when we pass options
+  // to process calculate save core ranges
+  lldb_private::SaveCoreOptions core_options = options;
   // Minidump defaults to stacks only.
-  SaveCoreStyle core_style = options.GetStyle();
-  if (core_style == SaveCoreStyle::eSaveCoreUnspecified)
-    core_style = SaveCoreStyle::eSaveCoreStackOnly;
+  if (core_options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
+    core_options.SetStyle(SaveCoreStyle::eSaveCoreStackOnly);
 
   llvm::Expected<lldb::FileUP> maybe_core_file = FileSystem::Instance().Open(
       options.GetOutputFile().value(),
@@ -75,7 +78,7 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
     return false;
   }
   MinidumpFileBuilder builder(std::move(maybe_core_file.get()), process_sp,
-                              options);
+                              core_options);
 
   Log *log = GetLog(LLDBLog::Object);
   error = builder.AddHeaderAndCalculateDirectories();
diff --git a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
index 138792d817dbf..56593c29f0579 100644
--- a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
+++ b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
@@ -17,7 +17,6 @@ class TestSkinnyCorefile(TestBase):
         debug_info=no_match(["dsym"]),
         bugnumber="This test is looking explicitly for a dSYM",
     )
-    @skipUnlessDarwin
     @skipIfRemote
     def test_lc_note(self):
         self.build()

>From 66a4b0986412692f513a7479c868aa9616bf34a7 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Fri, 2 Aug 2024 15:54:09 -0700
Subject: [PATCH 2/4] add new SBSaveCoreOptions based tests for minidump and
 mach-o

---
 .../process_save_core/TestProcessSaveCore.py  | 51 +++++++++++++++++++
 .../skinny-corefile/TestSkinnyCorefile.py     |  1 +
 2 files changed, 52 insertions(+)

diff --git a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
index 8573d15733927..eaab1004b6a5b 100644
--- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
@@ -10,6 +10,11 @@
 
 
 class ProcessSaveCoreTestCase(TestBase):
+    def validate_core_pid(self, pid, core_path):
+        target = self.dbg.CreateTarget(None)
+        process = target.LoadCore(core_path)
+        return process.GetProcessID() == pid
+
     @skipIfRemote
     @skipUnlessWindows
     def test_cannot_save_core_unless_process_stopped(self):
@@ -88,3 +93,49 @@ def test_save_core_via_process_plugin(self):
                 os.unlink(core)
             except OSError:
                 pass
+
+    @skipUnlessPlatform(["linux"])
+    def test_save_core_default_values_for_style_minidump(self):
+        """Test we can still save a core for minidump when no
+        core style is specified."""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+        core = self.getBuildArtifact("core.dmp")
+        target = self.dbg.CreateTarget(exe)
+        target.BreakpointCreateByName("bar")
+        process = target.LaunchSimple(
+            None, None, self.get_process_working_directory()
+        )
+        self.assertState(process.GetState(), lldb.eStateStopped)
+        pid = process.GetProcessID()
+        options = lldb.SBSaveCoreOptions()
+        minidump_path = core + ".minidump"
+        options.SetOutputFile(lldb.SBFileSpec(minidump_path))
+        options.SetPluginName("minidump")
+        error = process.SaveCore(options)
+        self.assertSuccess(error, error.GetCString())
+        self.assertTrue(os.path.isfile(minidump_path))
+        self.assertTrue(self.validate_core_pid(pid, minidump_path))
+
+    @skipUnlessDarwin
+    def test_save_core_default_values_for_style_mach_o(self):
+        """Test we can still save a core for minidump when no
+        core style is specified."""
+        self.build()
+        exe = self.getBuildArtifact("a.out")
+        core = self.getBuildArtifact("core.dmp")
+        target = self.dbg.CreateTarget(exe)
+        target.BreakpointCreateByName("bar")
+        process = target.LaunchSimple(
+            None, None, self.get_process_working_directory()
+        )
+        self.assertState(process.GetState(), lldb.eStateStopped)
+        pid = process.GetProcessID()
+        options = lldb.SBSaveCoreOptions()
+        
+        options.SetPluginName("mach-o")
+        mach_o_path = core + ".mach-o"
+        error = process.SaveCore(options)
+        self.assertSuccess(error, error.GetCString())
+        self.assertTrue(os.path.isfile(mach_o_path))
+        self.assertTrue(self.validate_core_pid(pid, mach_o_path))
diff --git a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
index 56593c29f0579..138792d817dbf 100644
--- a/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
+++ b/lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py
@@ -17,6 +17,7 @@ class TestSkinnyCorefile(TestBase):
         debug_info=no_match(["dsym"]),
         bugnumber="This test is looking explicitly for a dSYM",
     )
+    @skipUnlessDarwin
     @skipIfRemote
     def test_lc_note(self):
         self.build()

>From 9d105b25b2e0721d68db8dca60cb155d233d0933 Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Fri, 2 Aug 2024 16:03:03 -0700
Subject: [PATCH 3/4] Drop mach-o test as testskinnycore already covers case

---
 .../process_save_core/TestProcessSaveCore.py  | 23 -------------------
 1 file changed, 23 deletions(-)

diff --git a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
index eaab1004b6a5b..9876dd6e29f3a 100644
--- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
@@ -116,26 +116,3 @@ def test_save_core_default_values_for_style_minidump(self):
         self.assertSuccess(error, error.GetCString())
         self.assertTrue(os.path.isfile(minidump_path))
         self.assertTrue(self.validate_core_pid(pid, minidump_path))
-
-    @skipUnlessDarwin
-    def test_save_core_default_values_for_style_mach_o(self):
-        """Test we can still save a core for minidump when no
-        core style is specified."""
-        self.build()
-        exe = self.getBuildArtifact("a.out")
-        core = self.getBuildArtifact("core.dmp")
-        target = self.dbg.CreateTarget(exe)
-        target.BreakpointCreateByName("bar")
-        process = target.LaunchSimple(
-            None, None, self.get_process_working_directory()
-        )
-        self.assertState(process.GetState(), lldb.eStateStopped)
-        pid = process.GetProcessID()
-        options = lldb.SBSaveCoreOptions()
-        
-        options.SetPluginName("mach-o")
-        mach_o_path = core + ".mach-o"
-        error = process.SaveCore(options)
-        self.assertSuccess(error, error.GetCString())
-        self.assertTrue(os.path.isfile(mach_o_path))
-        self.assertTrue(self.validate_core_pid(pid, mach_o_path))

>From 78e09d72398e3460341d46fa6fcb1173309db2ea Mon Sep 17 00:00:00 2001
From: Jacob Lalonde <jalalonde at fb.com>
Date: Fri, 2 Aug 2024 16:41:11 -0700
Subject: [PATCH 4/4] Drop const reference so mutations can be pushed back to
 the user. Run formatter for C++, and Py

---
 lldb/include/lldb/Core/PluginManager.h        |  2 +-
 lldb/include/lldb/lldb-private-interfaces.h   |  2 +-
 lldb/source/Core/PluginManager.cpp            |  2 +-
 .../ObjectFile/Mach-O/ObjectFileMachO.cpp     | 21 ++++++++-----------
 .../ObjectFile/Mach-O/ObjectFileMachO.h       |  2 +-
 .../ObjectFile/Minidump/MinidumpFileBuilder.h |  2 +-
 .../Minidump/ObjectFileMinidump.cpp           | 12 ++++-------
 .../ObjectFile/Minidump/ObjectFileMinidump.h  |  2 +-
 .../ObjectFile/PECOFF/ObjectFilePECOFF.cpp    |  2 +-
 .../ObjectFile/PECOFF/ObjectFilePECOFF.h      |  2 +-
 .../ObjectFile/PECOFF/WindowsMiniDump.cpp     |  3 +--
 .../ObjectFile/PECOFF/WindowsMiniDump.h       |  3 +--
 .../process_save_core/TestProcessSaveCore.py  |  4 +---
 13 files changed, 24 insertions(+), 35 deletions(-)

diff --git a/lldb/include/lldb/Core/PluginManager.h b/lldb/include/lldb/Core/PluginManager.h
index a23f834f471fb..e4e0c3eea67f8 100644
--- a/lldb/include/lldb/Core/PluginManager.h
+++ b/lldb/include/lldb/Core/PluginManager.h
@@ -194,7 +194,7 @@ class PluginManager {
   GetObjectFileCreateMemoryCallbackForPluginName(llvm::StringRef name);
 
   static Status SaveCore(const lldb::ProcessSP &process_sp,
-                         const lldb_private::SaveCoreOptions &core_options);
+                         lldb_private::SaveCoreOptions &core_options);
 
   // ObjectContainer
   static bool RegisterPlugin(
diff --git a/lldb/include/lldb/lldb-private-interfaces.h b/lldb/include/lldb/lldb-private-interfaces.h
index 87c5ff8d22fb6..b3c8cda899b95 100644
--- a/lldb/include/lldb/lldb-private-interfaces.h
+++ b/lldb/include/lldb/lldb-private-interfaces.h
@@ -57,7 +57,7 @@ typedef ObjectFile *(*ObjectFileCreateMemoryInstance)(
     const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp,
     const lldb::ProcessSP &process_sp, lldb::addr_t offset);
 typedef bool (*ObjectFileSaveCore)(const lldb::ProcessSP &process_sp,
-                                   const lldb_private::SaveCoreOptions &options,
+                                   lldb_private::SaveCoreOptions &options,
                                    Status &error);
 typedef EmulateInstruction *(*EmulateInstructionCreateInstance)(
     const ArchSpec &arch, InstructionType inst_type);
diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp
index fbd78a7780578..f243807df509e 100644
--- a/lldb/source/Core/PluginManager.cpp
+++ b/lldb/source/Core/PluginManager.cpp
@@ -702,7 +702,7 @@ PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
 }
 
 Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
-                               const lldb_private::SaveCoreOptions &options) {
+                               lldb_private::SaveCoreOptions &options) {
   Status error;
   if (!options.GetOutputFile()) {
     error.SetErrorString("No output file specified");
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index d09eec0f9cb62..22ece4f4dacf7 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -6351,7 +6351,7 @@ static offset_t
 CreateAllImageInfosPayload(const lldb::ProcessSP &process_sp,
                            offset_t initial_file_offset,
                            StreamString &all_image_infos_payload,
-                           const lldb_private::SaveCoreOptions &options) {
+                           lldb_private::SaveCoreOptions &options) {
   Target &target = process_sp->GetTarget();
   ModuleList modules = target.GetImages();
 
@@ -6522,19 +6522,16 @@ struct page_object {
 };
 
 bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
-                               const lldb_private::SaveCoreOptions &options,
+                               lldb_private::SaveCoreOptions &options,
                                Status &error) {
   // The FileSpec and Process are already checked in PluginManager::SaveCore.
   assert(options.GetOutputFile().has_value());
   assert(process_sp);
   const FileSpec outfile = options.GetOutputFile().value();
-    
-  // We have to make a local copy of the options, so that if we default
-  // the save core style, we can proprogate that when we pass options
-  // to process calculate save core ranges
-  lldb_private::SaveCoreOptions core_options = options;
-  if (core_options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
-    core_options.SetStyle(eSaveCoreDirtyOnly);
+
+  // MachO defaults to dirty pages
+  if (options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
+    options.SetStyle(eSaveCoreDirtyOnly);
 
   Target &target = process_sp->GetTarget();
   const ArchSpec target_arch = target.GetArchitecture();
@@ -6565,7 +6562,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
 
     if (make_core) {
       Process::CoreFileMemoryRanges core_ranges;
-      error = process_sp->CalculateCoreFileSaveRanges(core_options, core_ranges);
+      error = process_sp->CalculateCoreFileSaveRanges(options, core_ranges);
       if (error.Success()) {
         const uint32_t addr_byte_size = target_arch.GetAddressByteSize();
         const ByteOrder byte_order = target_arch.GetByteOrder();
@@ -6737,7 +6734,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
         StructuredData::ArraySP threads(
             std::make_shared<StructuredData::Array>());
         for (const ThreadSP &thread_sp :
-             process_sp->CalculateCoreFileThreadList(core_options)) {
+             process_sp->CalculateCoreFileThreadList(options)) {
           StructuredData::DictionarySP thread(
               std::make_shared<StructuredData::Dictionary>());
           thread->AddIntegerItem("thread_id", thread_sp->GetID());
@@ -6760,7 +6757,7 @@ bool ObjectFileMachO::SaveCore(const lldb::ProcessSP &process_sp,
         all_image_infos_lcnote_up->payload_file_offset = file_offset;
         file_offset = CreateAllImageInfosPayload(
             process_sp, file_offset, all_image_infos_lcnote_up->payload,
-            core_options);
+            options);
         lc_notes.push_back(std::move(all_image_infos_lcnote_up));
 
         // Add LC_NOTE load commands
diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index e7af90e28bc4b..27bc237aaac48 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -62,7 +62,7 @@ class ObjectFileMachO : public lldb_private::ObjectFile {
                                         lldb_private::ModuleSpecList &specs);
 
   static bool SaveCore(const lldb::ProcessSP &process_sp,
-                       const lldb_private::SaveCoreOptions &options,
+                       lldb_private::SaveCoreOptions &options,
                        lldb_private::Status &error);
 
   static bool MagicBytesMatch(lldb::DataBufferSP data_sp, lldb::addr_t offset,
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
index c039492aa5c5a..fc1af24819e96 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/MinidumpFileBuilder.h
@@ -76,7 +76,7 @@ class MinidumpFileBuilder {
 public:
   MinidumpFileBuilder(lldb::FileUP &&core_file,
                       const lldb::ProcessSP &process_sp,
-                      const lldb_private::SaveCoreOptions &save_core_options)
+                      lldb_private::SaveCoreOptions &save_core_options)
       : m_process_sp(process_sp), m_core_file(std::move(core_file)),
         m_save_core_options(save_core_options){};
 
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
index 22f1323503115..0897895e6bc25 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.cpp
@@ -56,19 +56,15 @@ size_t ObjectFileMinidump::GetModuleSpecifications(
 }
 
 bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
-                                  const lldb_private::SaveCoreOptions &options,
+                                  lldb_private::SaveCoreOptions &options,
                                   lldb_private::Status &error) {
   // Output file and process_sp are both checked in PluginManager::SaveCore.
   assert(options.GetOutputFile().has_value());
   assert(process_sp);
 
-  // We have to make a local copy of the options, so that if we default
-  // the save core style, we can proprogate that when we pass options
-  // to process calculate save core ranges
-  lldb_private::SaveCoreOptions core_options = options;
   // Minidump defaults to stacks only.
-  if (core_options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
-    core_options.SetStyle(SaveCoreStyle::eSaveCoreStackOnly);
+  if (options.GetStyle() == SaveCoreStyle::eSaveCoreUnspecified)
+    options.SetStyle(SaveCoreStyle::eSaveCoreStackOnly);
 
   llvm::Expected<lldb::FileUP> maybe_core_file = FileSystem::Instance().Open(
       options.GetOutputFile().value(),
@@ -78,7 +74,7 @@ bool ObjectFileMinidump::SaveCore(const lldb::ProcessSP &process_sp,
     return false;
   }
   MinidumpFileBuilder builder(std::move(maybe_core_file.get()), process_sp,
-                              core_options);
+                              options);
 
   Log *log = GetLog(LLDBLog::Object);
   error = builder.AddHeaderAndCalculateDirectories();
diff --git a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
index 0cd31a0e482d5..b76fcd0052a8a 100644
--- a/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
+++ b/lldb/source/Plugins/ObjectFile/Minidump/ObjectFileMinidump.h
@@ -55,7 +55,7 @@ class ObjectFileMinidump : public lldb_private::PluginInterface {
 
   // Saves dump in Minidump file format
   static bool SaveCore(const lldb::ProcessSP &process_sp,
-                       const lldb_private::SaveCoreOptions &options,
+                       lldb_private::SaveCoreOptions &options,
                        lldb_private::Status &error);
 
 private:
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
index bda691ade8af0..9d01089745dfc 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp
@@ -355,7 +355,7 @@ size_t ObjectFilePECOFF::GetModuleSpecifications(
 }
 
 bool ObjectFilePECOFF::SaveCore(const lldb::ProcessSP &process_sp,
-                                const lldb_private::SaveCoreOptions &options,
+                                lldb_private::SaveCoreOptions &options,
                                 lldb_private::Status &error) {
   // Outfile and process_sp are validated by PluginManager::SaveCore
   assert(options.GetOutputFile().has_value());
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
index 2eb2b3b774538..8bccf3be3e5f6 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.h
@@ -82,7 +82,7 @@ class ObjectFilePECOFF : public lldb_private::ObjectFile {
                                         lldb_private::ModuleSpecList &specs);
 
   static bool SaveCore(const lldb::ProcessSP &process_sp,
-                       const lldb_private::SaveCoreOptions &options,
+                       lldb_private::SaveCoreOptions &options,
                        lldb_private::Status &error);
 
   static bool MagicBytesMatch(lldb::DataBufferSP data_sp);
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
index 61cd74da22223..a6462625fb5b5 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.cpp
@@ -21,8 +21,7 @@
 namespace lldb_private {
 
 bool SaveMiniDump(const lldb::ProcessSP &process_sp,
-                  const SaveCoreOptions &core_options,
-                  lldb_private::Status &error) {
+                  SaveCoreOptions &core_options, lldb_private::Status &error) {
   if (!process_sp)
     return false;
 #ifdef _WIN32
diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
index 03c0ece306143..2f8606d82c974 100644
--- a/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
+++ b/lldb/source/Plugins/ObjectFile/PECOFF/WindowsMiniDump.h
@@ -14,8 +14,7 @@
 namespace lldb_private {
 
 bool SaveMiniDump(const lldb::ProcessSP &process_sp,
-                  const SaveCoreOptions &core_options,
-                  lldb_private::Status &error);
+                  SaveCoreOptions &core_options, lldb_private::Status &error);
 
 } // namespace lldb_private
 
diff --git a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
index 9876dd6e29f3a..c933e01424f56 100644
--- a/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
+++ b/lldb/test/API/functionalities/process_save_core/TestProcessSaveCore.py
@@ -103,9 +103,7 @@ def test_save_core_default_values_for_style_minidump(self):
         core = self.getBuildArtifact("core.dmp")
         target = self.dbg.CreateTarget(exe)
         target.BreakpointCreateByName("bar")
-        process = target.LaunchSimple(
-            None, None, self.get_process_working_directory()
-        )
+        process = target.LaunchSimple(None, None, self.get_process_working_directory())
         self.assertState(process.GetState(), lldb.eStateStopped)
         pid = process.GetProcessID()
         options = lldb.SBSaveCoreOptions()



More information about the lldb-commits mailing list