================
@@ -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
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to