[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)

Jonas Devlieghere via lldb-commits lldb-commits at lists.llvm.org
Fri Jun 27 12:54:26 PDT 2025


================
@@ -70,27 +77,49 @@ lldb::RegisterContextSP ThreadMachCore::GetRegisterContext() {
 
 lldb::RegisterContextSP
 ThreadMachCore::CreateRegisterContextForFrame(StackFrame *frame) {
-  lldb::RegisterContextSP reg_ctx_sp;
   uint32_t concrete_frame_idx = 0;
 
   if (frame)
     concrete_frame_idx = frame->GetConcreteFrameIndex();
+  if (concrete_frame_idx > 0)
+    return GetUnwinder().CreateRegisterContextForFrame(frame);
+
+  if (m_thread_reg_ctx_sp)
+    return m_thread_reg_ctx_sp;
 
-  if (concrete_frame_idx == 0) {
-    if (!m_thread_reg_ctx_sp) {
-      ProcessSP process_sp(GetProcess());
+  ProcessSP process_sp(GetProcess());
----------------
JDevlieghere wrote:

The old code didn't check either, but let's assert that you must have a process at this point.
```suggestion
  ProcessSP process_sp(GetProcess());
  assert(process_sp);
```

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


More information about the lldb-commits mailing list