[Lldb-commits] [lldb] [lldb] Fix build on NetBSD (PR #74190)

Brad Smith via lldb-commits lldb-commits at lists.llvm.org
Sat Dec 2 01:02:32 PST 2023


https://github.com/brad0 updated https://github.com/llvm/llvm-project/pull/74190

>From 33e60078b75b9e4e7b433219e9e158bdfd1ef046 Mon Sep 17 00:00:00 2001
From: Brad Smith <brad at comstyle.com>
Date: Sat, 2 Dec 2023 03:52:38 -0500
Subject: [PATCH] [lldb] Fix build on NetBSD

lldb/source/Host/netbsd/HostNetBSD.cpp:112:32: error: reinterpret_cast from 'const uint8_t *' (aka 'const unsigned char *') to 'char *' casts away qualifiers
                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
---
 lldb/source/Host/netbsd/HostNetBSD.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/lldb/source/Host/netbsd/HostNetBSD.cpp b/lldb/source/Host/netbsd/HostNetBSD.cpp
index c47b96a5ceda614..de8b2fd7cb0cc52 100644
--- a/lldb/source/Host/netbsd/HostNetBSD.cpp
+++ b/lldb/source/Host/netbsd/HostNetBSD.cpp
@@ -108,10 +108,11 @@ 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(
-                              {reinterpret_cast<char *>(buffer_sp->GetBytes()),
-                               size_t(buffer_sp->GetByteSize())})
-                              .first;
+      uint8_t exe_class =
+          llvm::object::getElfArchType(
+              {reinterpret_cast<const 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