[Lldb-commits] [lldb] f9ac13a - [lldb] Remove remaining calls to DataBufferLLVM::GetChars

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Apr 1 17:45:05 PDT 2022


Author: Jonas Devlieghere
Date: 2022-04-01T17:43:05-07:00
New Revision: f9ac13a8f1edcdc540491c5e917ac5d31e07ef3b

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

LOG: [lldb] Remove remaining calls to DataBufferLLVM::GetChars

Update the Linux and NetBSD Host libraries for 2165c36be445 which
removed DataBufferLLVM::GetChars. These files are compiled conditionally
based on the host platform.

Added: 
    

Modified: 
    lldb/source/Host/linux/Host.cpp
    lldb/source/Host/netbsd/HostNetBSD.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Host/linux/Host.cpp b/lldb/source/Host/linux/Host.cpp
index 26f523399706b..6342dee59532a 100644
--- a/lldb/source/Host/linux/Host.cpp
+++ b/lldb/source/Host/linux/Host.cpp
@@ -133,10 +133,10 @@ static ArchSpec GetELFProcessCPUType(llvm::StringRef exe_path) {
   if (!buffer_sp)
     return ArchSpec();
 
-  uint8_t exe_class =
-      llvm::object::getElfArchType(
-          {buffer_sp->GetChars(), size_t(buffer_sp->GetByteSize())})
-          .first;
+  uint8_t exe_class = llvm::object::getElfArchType(
+                          {reinterpret_cast<char *>(buffer_sp->GetBytes()),
+                           size_t(buffer_sp->GetByteSize())})
+                          .first;
 
   switch (exe_class) {
   case llvm::ELF::ELFCLASS32:

diff  --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp
index 60e7241e290c4..9168ed97b77e3 100644
--- a/lldb/source/Host/netbsd/HostNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostNetBSD.cpp
@@ -108,10 +108,10 @@ static bool GetNetBSDProcessCPUType(ProcessInstanceInfo &process_info) {
     auto buffer_sp = FileSystem::Instance().CreateDataBuffer(
         process_info.GetExecutableFile(), 0x20, 0);
     if (buffer_sp) {
-      uint8_t exe_class =
-          llvm::object::getElfArchType(
-              {buffer_sp->GetChars(), size_t(buffer_sp->GetByteSize())})
-              .first;
+      uint8_t exe_class = llvm::object::getElfArchType(
+                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
+                               size_t(buffer_sp->GetByteSize())})
+                              .first;
 
       switch (exe_class) {
       case llvm::ELF::ELFCLASS32:


        


More information about the lldb-commits mailing list