jasonmolenda wrote:

Skimming DynamicLoaderPOSIXDYLD (as it is written today), it looks like 
attach/launch call `SetRendezvousBreakpoint()` which (1) loads ld.so into lldb 
if it isn't already there, and (2) sets the breakpoint to be notified about 
future binaries loading.  It loads ld.so via `LoadInterpreterModule` which 
Finds It somehow (I stopped reading), adds it to the Target, and sets the 
section load addresses, returns the module_sp.  Then it sets breakpoints on a 
half dozen notification function names in the ld.so Module.  This is all 
special-cased for ld.so, and we do not evaluate user breakpoints because we 
didn't call `Target::ModulesDidLoad` for ld.so.

The code path for other binaries goes through 
`DynamicLoaderPOSIXDYLD::RefreshModules` which does the normal approach of 
adding binaries to the Target, setting the load addresses, then calling 
ModulesDidLoad which will evaluate breakpoints that may need to be set in the 
new binaries.

It seems like a simpler fix would be to have 
`DynamicLoaderPOSIXDYLD::LoadInterpreterModule` create a ModuleList with the 
ModuleSP of ld.so that it has just added to Target and set its section load 
addresses, then call `ModulesDidLoad` on it so that user breakpoints are 
evaluated and inserted.  The patch as it is written right now is taking one 
part of ModulesDidLoad and putting it in a separate method that 
`DynamicLoaderPOSIXDYLD::LoadInterpreterModule` is calling -- why not just call 
ModulesDidLoad and delegate this (and possibly other binary-just-loaded) 
behaviors to it?

https://github.com/llvm/llvm-project/pull/88792
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to