[Lldb-commits] [lldb] [lldb][DynamicLoader] Fix lldb unable to stop at _dl_debug_state if user set it before the process launched. (PR #88792)

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Wed Apr 17 05:31:28 PDT 2024


labath wrote:

> > > > why not just call ModulesDidLoad and delegate this (and possibly other binary-just-loaded) behaviors to it?
> > > 
> > > 
> > > That's what I did first, but it breaks the test `TestModuleLoadedNotifys.ModuleLoadedNotifysTestCase.test_launch_notifications` because of extra broadcaster event. So, I moved out the part just updating breakpoints.
> > 
> > 
> > The point of the test is to ensure you don't get a hundred notifications, one for each module. Having one notification for ld.so, and 99 for the rest of the modules is ok. It should be fine to just update the test to match new reality.
> 
> Updated to use `Target::ModulesDisLoad` and the test.

Oh, so the problem is that the loaded event gets sent twice (and not that it gets sent as a separate event, as I originally thought). While it's not the end of the world (it appears the mac loaded does something similar as well), this does seem like something that we could prevent. Can you check where does the second event get sent from? Is it by any chance when we go through [this](https://github.com/llvm/llvm-project/blob/main/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp#L460) place ? If so, it should be fairly easy to refactor that code to avoid putting the interpreter module into the event list when it is already loaded.

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


More information about the lldb-commits mailing list