================
@@ -939,15 +941,16 @@ uint32_t PlatformPOSIX::DoLoadImage(lldb_private::Process 
*process,
     
   // We got an error, lets read in the error string:
   std::string dlopen_error_str;
-  lldb::addr_t error_addr 
-    = process->ReadPointerFromMemory(return_addr + addr_size, utility_error);
-  if (utility_error.Fail()) {
+  llvm::Expected<lldb::addr_t> error_addr_or_err =
+      process->ReadPointerFromMemory(return_addr + addr_size);
+  if (!error_addr_or_err) {
     error = Status::FromErrorStringWithFormat(
         "dlopen error: could not read error string: %s",
-        utility_error.AsCString());
+        llvm::toString(error_addr_or_err.takeError()).c_str());
----------------
felipepiovezan wrote:

is this safe? the rules around lifetime extension are pretty tricky, but to be 
safe I'd change this to the `WithFormatv` variant and pass the `std::string` 
directly instead of the `c_str()`.

https://github.com/llvm/llvm-project/pull/216389
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to