<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 27, 2016, at 8:34 PM, Jeffrey Tan via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi,<div class=""><br class=""></div><div class="">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.</div><div class=""><br class=""></div><div class="">Questions:</div><div class="">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 class=""></div></div></div></blockquote><div><br class=""></div><div>From SBTarget.h:</div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(112, 61, 170);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>uint32_t</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> GetNumModulesFromEvent (<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">lldb</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">SBEvent</span> &event);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">static</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>lldb<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">::</span>SBModule</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""> GetModuleAtIndexFromEvent (<span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">uint32_t</span> idx, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">const</span> <span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">lldb</span>::<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">SBEvent</span> &event);</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class="">Note, you can also cause the process to stop with modules are loaded with the setting:</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><br class=""></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;" class=""><div style="margin: 0px; line-height: normal;" class="">target.process.stop-on-sharedlibrary-events</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">if that is more convenient for you.</div></div></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">2. Even though "image list" shows I have around 42 modules loaded in process, I only got two module load events. Why is that?</div></div></div></blockquote><div><br class=""></div><div>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.</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">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. </div></div></div></blockquote><div><br class=""></div><div>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.</div><div><br class=""></div><div>Jim</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><br class=""></div><div class="">This is tested on mac OSX lldb.</div><div class=""><br class=""></div><div class="">Jeffrey</div></div>
_______________________________________________<br class="">lldb-dev mailing list<br class=""><a href="mailto:lldb-dev@lists.llvm.org" class="">lldb-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev<br class=""></div></blockquote></div><br class=""></body></html>