================
@@ -520,11 +522,16 @@ bool DynamicLoaderFreeBSDKernel::ReadKmodsListHeader() {
 
   if (m_linker_file_list_struct_addr.IsValid()) {
     // Get tqh_first struct element from linker_files
-    Status error;
-    addr_t address = m_process->ReadPointerFromMemory(
-        m_linker_file_list_struct_addr.GetLoadAddress(&m_process->GetTarget()),
-        error);
-    if (address != LLDB_INVALID_ADDRESS && error.Success()) {
+    addr_t address = LLDB_INVALID_ADDRESS;
+    if (llvm::Expected<lldb::addr_t> address_or_err =
+            m_process->ReadPointerFromMemory(
+                m_linker_file_list_struct_addr.GetLoadAddress(
+                    &m_process->GetTarget())))
+      address = *address_or_err;
+    else
+      llvm::consumeError(address_or_err.takeError());
+
+    if (address != LLDB_INVALID_ADDRESS) {
----------------
felipepiovezan wrote:

I understand we still have that line `return 
scalar.ULongLong(LLDB_INVALID_ADDRESS);`, but that path should be unreachable 
(have a look inside `Scalar`). We can either take that for granted, or add a 
`Scalar` method that asserts on failure.

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