[Lldb-commits] [lldb] Don't crash reloading a corefile saved from a live process (PR #224324)

Yao Qi via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 30 03:26:06 PDT 2026


qiyao wrote:

@delcypher 
> 1. Why are we even loading instrumentation runtime plugins on a corefile? The process isn't live so it doesn't sound useful to load these plugins at all.

nothing gates them: `Process::ModulesDidLoad` calls the hook unconditionally for every Process subclass.
 https://github.com/llvm/llvm-project/blob/4081877baec460d025db656d8057b0a4f5687fbe/lldb/source/Target/Process.cpp#L6367-L6372 

`PostMortemProcess` already declares itself non-live (`IsLiveDebugSession() { return false; }`) and other subsystems consult it: DynamicLoader, AppleObjCRuntimeV2, etc.  The instrumentation-runtime path just never did.  I thought about something like this,
 ```cpp
     // Instrumentation runtimes report from breakpoint callbacks, so they have
     // nothing to do without execution.
     if (IsLiveDebugSession()) {
       InstrumentationRuntime::ModulesDidLoad(module_list, this,
                                              m_instrumentation_runtimes);
       for (auto &runtime : m_instrumentation_runtimes)
         runtime.second->ModulesDidLoad(module_list);
     }
 ```
to not activate these instrumentation plugins in case of core file debugging, but it is useful to have these plugins  provide custom stop reason in core file debugging  (not sure lldb is doing so though).

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


More information about the lldb-commits mailing list