I have question regarding adding host-side modules when attaching to already running applications. Some details:
- The module on the target is already loaded. But, this would apply to the main module as well, so, the main module is assumed from here on.
- LLDB 18 series.
- Debug Client is all implemented through the C++ SB API. Built unchanged for Windows.
- SBPlatform created as
remote-linux
- Remote server is custom, but, generally emulates Linux enough for this platform.
- The steps are as follows:
SBDebugger::Create
- ā
Platform Select + Connect
- ā
SBDebugger::CreateTarget(nullptr)
- ā
SBPlatform::Attach(attach_info)
- ā
SBTarget::AddModule("path/to/elf", triple, nullptr, "path/to/elf")
At this point everything largely works, and I want to scan through the sections+segments of the ELF to see the Load Address of the remote module itself (again, this is the main ELF in this case), and if I wait to to find the Code Section (currently just sleeping for 800-1200milliseconds) I get the expected Load Address, however, if I just immediately dump the module sections after adding it, I get MAXUINT_64 for the load address of the code section.
My main question is, what is the prescribed method for determining whether or not the module is loaded on the host in this scenario? SBTarget::AddModule
doesnāt block, and I donāt see any Target Events coming through, which I suppose only happen when the remote target modules are loaded/unloaded? I could see possibly trying to busy wait on SBModule::GetNumCompileUnits() > 0
or something along those lines? Though, this isnāt necessarily indicative that the Host<->Remote communication to determine the Load Address has occurred.
Thanks so much for any help!
Note: I posted this to Discord as well, apologies if asking in both places is wrong.