[Lldb-commits] [lldb] [lldb][Process/FreeBSDKernel] Fix broken debugging on aarch64 (PR #180222)

David Spickett via lldb-commits lldb-commits at lists.llvm.org
Thu Feb 12 02:24:44 PST 2026


================
@@ -108,3 +161,39 @@ bool RegisterContextFreeBSDKernel_arm64::WriteRegister(
     const RegisterInfo *reg_info, const RegisterValue &value) {
   return false;
 }
+
+int RegisterContextFreeBSDKernel_arm64::GetOsreldate() {
+  ProcessSP process_sp = m_thread.GetProcess();
+  if (!process_sp)
+    return 0;
----------------
DavidSpickett wrote:

In fact I wonder if all failure paths should return the 14 version.

What you could do is make this return `std::optional<int>` and have it return nullopt on failure. Then have the caller do the default part, that way you only have one place to call the logging method.
```
// If we cannot find it, assume FreeBSD 14.
static const int osreldate = 1400084;
auto osreldate_or_null = GetOsreldate();
if (osreldate_or_null)
  osreldate = *osreldate_or_null;
else
  log("cannot find osreldate, assuming freebsd 14 (1400084)");
```


https://github.com/llvm/llvm-project/pull/180222


More information about the lldb-commits mailing list