<div dir="ltr">Greg, missed your reply. Yeah, the problem is that I only looked at the python API(which is what I am using) doc which does not contain these APIs. </div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Feb 29, 2016 at 12:43 PM, Greg Clayton <span dir="ltr"><<a href="mailto:gclayton@apple.com" target="_blank">gclayton@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">In general where you see the event bits defined like SBTarget.h for your case, the class that contains the event bit definitions:<br>
<br>
class SBTarget<br>
{<br>
public:<br>
//------------------------------------------------------------------<br>
// Broadcaster bits.<br>
//------------------------------------------------------------------<br>
enum<br>
{<br>
eBroadcastBitBreakpointChanged = (1 << 0),<br>
eBroadcastBitModulesLoaded = (1 << 1),<br>
eBroadcastBitModulesUnloaded = (1 << 2),<br>
eBroadcastBitWatchpointChanged = (1 << 3),<br>
eBroadcastBitSymbolsLoaded = (1 << 4)<br>
};<br>
...<br>
<br>
<br>
Also contains all of the static functions that can extract data from those events:<br>
<br>
<br>
class SBTarget<br>
{<br>
public:<br>
...<br>
static bool<br>
EventIsTargetEvent (const lldb::SBEvent &event);<br>
<br>
static lldb::SBTarget<br>
GetTargetFromEvent (const lldb::SBEvent &event);<br>
<span class="im HOEnZb"><br>
static uint32_t<br>
GetNumModulesFromEvent (const lldb::SBEvent &event);<br>
<br>
static lldb::SBModule<br>
GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);<br>
<br>
<br>
</span><span class="HOEnZb"><font color="#888888">Greg Clayton<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
> On Feb 29, 2016, at 11:59 AM, Jeffrey Tan via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
><br>
> This is very useful, thanks for the info!<br>
><br>
> On Mon, Feb 29, 2016 at 10:36 AM, Jim Ingham <<a href="mailto:jingham@apple.com">jingham@apple.com</a>> wrote:<br>
><br>
>> On Feb 27, 2016, at 8:34 PM, Jeffrey Tan via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br>
>><br>
>> Hi,<br>
>><br>
>> I am trying to listen for module/symbol load/unload events and display them in output UI so that debugger users can have a basic clue what is debugger busy doing while launching a big executable linking many shared libraries.<br>
>><br>
>> Questions:<br>
>> 1. I did not find an API to get current load/unload module during module events. I was expecting some static API like lldb.SBModule(or SBTarget).GetModuleFromEvent(SBEvent), but this does not exists. I tried to treat current PC's module as loading module in module load/unload events. But that does not work too(I think because process is not stopped in module load/unload events). Do I miss something here?<br>
><br>
> From SBTarget.h:<br>
><br>
> static uint32_t<br>
> GetNumModulesFromEvent (const lldb::SBEvent &event);<br>
><br>
> static lldb::SBModule<br>
> GetModuleAtIndexFromEvent (const uint32_t idx, const lldb::SBEvent &event);<br>
><br>
> Note, you can also cause the process to stop with modules are loaded with the setting:<br>
><br>
> target.process.stop-on-sharedlibrary-events<br>
><br>
> if that is more convenient for you.<br>
><br>
>><br>
>> 2. Even though "image list" shows I have around 42 modules loaded in process, I only got two module load events. Why is that?<br>
><br>
> On OS X the loader loads the closure of modules for whatever it is loading, and only stops and informs the debugger when this is all done. So it is quite usual to see only a few load events even though many modules get loaded.<br>
><br>
><br>
>><br>
>> 3. Even though I added lldb.SBTarget.eBroadcastBitSymbolsLoaded, there is no event of type eBroadcastBitSymbolsLoaded generated. Is it expected? Apparently I have the symbols next to the binary.<br>
><br>
> That event gets sent when symbols are added to an already loaded module. It is so a UI will know to refresh the backtrace, local variables, source view, etc when code goes from having no symbols to having some symbols. Those actions are not needed if the library & its symbols get loaded simultaneously, so it isn’t sent in that case.<br>
><br>
> Jim<br>
><br>
><br>
>><br>
>> This is tested on mac OSX lldb.<br>
>><br>
>> Jeffrey<br>
>> _______________________________________________<br>
>> lldb-dev mailing list<br>
>> <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
><br>
><br>
> _______________________________________________<br>
> lldb-dev mailing list<br>
> <a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a><br>
> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br>
<br>
</div></div></blockquote></div><br></div>