[Lldb-commits] [lldb] e3921b8 - [lldb][NFCI] Remove use of ConstString from ProcessElfCore

Alex Langford via lldb-commits lldb-commits at lists.llvm.org
Mon Jul 3 11:14:51 PDT 2023


Author: Alex Langford
Date: 2023-07-03T11:13:50-07:00
New Revision: e3921b8bff693649602760a6221cd1150420a287

URL: https://github.com/llvm/llvm-project/commit/e3921b8bff693649602760a6221cd1150420a287
DIFF: https://github.com/llvm/llvm-project/commit/e3921b8bff693649602760a6221cd1150420a287.diff

LOG: [lldb][NFCI] Remove use of ConstString from ProcessElfCore

I'm not convinced that it makes sense for the paths to be ConstStrings. We're
going to be putting them into FileSpecs (which are backed by
ConstStrings, for now) but otherwise there's no need to store them as
ConstStrings upfront.

Differential Revision: https://reviews.llvm.org/D153827

Added: 
    

Modified: 
    lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
    lldb/source/Plugins/Process/elf-core/ProcessElfCore.h

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 9c1b30d5f8024c..bfb59eceb2d025 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -258,8 +258,8 @@ Status ProcessElfCore::DoLoadCore() {
     if (!m_nt_file_entries.empty()) {
       ModuleSpec exe_module_spec;
       exe_module_spec.GetArchitecture() = arch;
-      exe_module_spec.GetFileSpec().SetFile(
-          m_nt_file_entries[0].path.GetCString(), FileSpec::Style::native);
+      exe_module_spec.GetFileSpec().SetFile(m_nt_file_entries[0].path,
+                                            FileSpec::Style::native);
       if (exe_module_spec.GetFileSpec()) {
         exe_module_sp = GetTarget().GetOrCreateModule(exe_module_spec, 
                                                       true /* notify */);
@@ -938,7 +938,7 @@ llvm::Error ProcessElfCore::parseLinuxNotes(llvm::ArrayRef<CoreNote> notes) {
       for (uint64_t i = 0; i < count; ++i) {
         const char *path = note.data.GetCStr(&offset);
         if (path && path[0])
-          m_nt_file_entries[i].path.SetCString(path);
+          m_nt_file_entries[i].path.assign(path);
       }
       break;
     }

diff  --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
index 03c23378e3c165..1454e8735a677b 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -20,7 +20,6 @@
 #include <vector>
 
 #include "lldb/Target/PostMortemProcess.h"
-#include "lldb/Utility/ConstString.h"
 #include "lldb/Utility/Status.h"
 
 #include "Plugins/ObjectFile/ELF/ELFHeader.h"
@@ -117,7 +116,7 @@ class ProcessElfCore : public lldb_private::PostMortemProcess {
     lldb::addr_t start;
     lldb::addr_t end;
     lldb::addr_t file_ofs;
-    lldb_private::ConstString path;
+    std::string path;
   };
 
   // For ProcessElfCore only


        


More information about the lldb-commits mailing list