<div dir="ltr">See <a href="https://bugs.llvm.org/show_bug.cgi?id=25806">https://bugs.llvm.org/show_bug.cgi?id=25806</a> for details about why we can't set breakpoint in the static initializer (it is an LLDB bug).<div><br></div><div>For your investigation a few pointers/guesses (assuming it is not some stdout displaying issue what I consider unlikely based on your description):</div><div>* Do your application calls dlopen? It can explain why you see stdout before some library load events and also I can imagine more issue in that code path.</div><div>* Are you sure <span style="color:rgb(33,33,33)">LoadModuleAtAdd</span><span style="color:rgb(33,33,33)">ress called from </span><span style="color:rgb(33,33,33)">LoadAl</span><span style="color:rgb(33,33,33)">lCurrentModules in all 4 cases? It can be called from </span><font color="#212121">RefreshModules as well what is used when we get notified about a new library and I expect it to be more likely based on the output (for the second 2 line).</font></div><div><font color="#212121">* I suggest to stop at libc.so'_start and see what libraries are loaded there (I expect it to be after the first 2 log and before the stdout). Verify that both shared-library-event breakpoint is resolved at this time (by "breakpoint list -i</font><span style="color:rgb(33,33,33)">") and also set a manual breakpoint there to see when it triggers. I expect you will hit that breakpoint just after your log lines are displayed. If that is the case you should get a stacktrace and see the callstack causing the event to be triggered.</span></div><div><span style="color:rgb(33,33,33)">* The libraries you should look out in the log is libc.so and </span><font color="#212121">ld-linux-x86-64.so (or similar). The dynamic loader integration should work only after these 2 libraries are loaded.</font><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Apr 11, 2017 at 3:56 PM Greg Clayton via lldb-dev <<a href="mailto:lldb-dev@lists.llvm.org">lldb-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg">On Apr 11, 2017, at 5:33 AM, Pavel Labath <<a href="mailto:labath@google.com" class="gmail_msg" target="_blank">labath@google.com</a>> wrote:</div><br class="m_-6156727319967022301Apple-interchange-newline gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg">Are you sure this is not just an artifact of stdio buffering? I tried the same experiment, but I placed a real log statement, and I could see that all the <span style="font-size:12.8px" class="gmail_msg">LoadModuleAtAddress calls happen between the $T and $c packets in the gdb-remote packet sequence. </span><div class="gmail_msg"><span style="font-size:12.8px" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:12.8px" class="gmail_msg">The module loading should be synchronous, so I think the problem lies elsewhere.</span></div><div class="gmail_msg"><span style="font-size:12.8px" class="gmail_msg"><br class="gmail_msg"></span></div><div class="gmail_msg"><span style="font-size:12.8px" class="gmail_msg">What is the nature of the breakpoint that is not getting hit? Can you provide a repro case? The only bug like this that I am aware of is that we fail to hit breakpoints in global constructors in shared libraries, but that hasn't worked even in 3.8..</span></div></div></div></blockquote><div class="gmail_msg"><br class="gmail_msg"></div></div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg">I unfortunately can't attach a repro case. I will be able to track this down, just need some pointers. I did notice that I wasn't able to hit breakpoints in global constructors though... Do we know why? On Mac, we get notified of shared libraries as they load so we never miss anything. Why are we not able to get the same thing with linux?</div></div><div style="word-wrap:break-word" class="gmail_msg"><div class="gmail_msg"><br class="gmail_msg"><blockquote type="cite" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_msg"><span style="font-size:12.8px" class="gmail_msg"><br class="gmail_msg"></span></div></div><div class="gmail_extra gmail_msg"><br class="gmail_msg"><div class="gmail_quote gmail_msg">On 10 April 2017 at 22:51, Greg Clayton via lldb-dev <span dir="ltr" class="gmail_msg"><<a href="mailto:lldb-dev@lists.llvm.org" class="gmail_msg" target="_blank">lldb-dev@lists.llvm.org</a>></span> wrote:<br class="gmail_msg"><blockquote class="gmail_quote gmail_msg" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I have added some logging to a program that is not hitting breakpoints with LLDB top of tree SVN. An older lldb 3.8 hits the breakpoint just fine. I placed some logging in LLDB:<br class="gmail_msg">
<br class="gmail_msg">
ModuleSP DynamicLoader::LoadModuleAtAddress(const FileSpec &file,<br class="gmail_msg">
                                            addr_t link_map_addr,<br class="gmail_msg">
                                            addr_t base_addr,<br class="gmail_msg">
                                            bool base_addr_is_offset) {<br class="gmail_msg">
  printf("%s: lma = 0x%16.16llx, ba = 0x%16.16llx, baio = %i\n", file.GetPath().c_str(), link_map_addr, base_addr, base_addr_is_offset);<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
This is called by DynamicLoaderPOSIXDYLD::LoadAllCurrentModules().<br class="gmail_msg">
<br class="gmail_msg">
My problem is I see:<br class="gmail_msg">
<br class="gmail_msg">
[vdso]: lma = 0xffffffffffffffff, ba = 0x00007ffff7ffa000, baio = 0<br class="gmail_msg">
linux-vdso.so.1: lma = 0x00007ffff7ffe6e0, ba = 0x00007ffff7ffa000, baio = 1<br class="gmail_msg">
/tmp/liba.so: lma = 0x00007ffff7ff66a8, ba = 0x00007ffff7e30000, baio = 1<br class="gmail_msg">
8 locations added to breakpoint 1<br class="gmail_msg">
/tmp/libb.so: lma = 0x00007ffff7e2f000, ba = 0x00007ffff7d43000, baio = 1<br class="gmail_msg">
[==========] Running 14 tests from 1 test case.<br class="gmail_msg">
[----------] Global test environment set-up.<br class="gmail_msg">
[----------] 14 tests from MyTest<br class="gmail_msg">
[ RUN      ] MyTest.Test1<br class="gmail_msg">
[       OK ] MyTest.Test1 (0 ms)<br class="gmail_msg">
/tmp/libc.so: lma = 0x00007ffff7e2f000, ba = 0x00007ffff7d43000, baio = 1<br class="gmail_msg">
/tmp/libd.so: lma = 0x00007ffff7e2f000, ba = 0x00007ffff7d43000, baio = 1<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Note that I see program output _during_ the messages that are showing that shared libraries are being loaded? I would assume we are loading shared libraries synchronously, but the log seems to indicated otherwise.<br class="gmail_msg">
<br class="gmail_msg">
If anyone knows anything on this subject please let me know...<br class="gmail_msg">
<br class="gmail_msg">
Greg Clayton<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
lldb-dev mailing list<br class="gmail_msg">
<a href="mailto:lldb-dev@lists.llvm.org" class="gmail_msg" target="_blank">lldb-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br class="gmail_msg">
</blockquote></div><br class="gmail_msg"></div>
</div></blockquote></div></div>_______________________________________________<br class="gmail_msg">
lldb-dev mailing list<br class="gmail_msg">
<a href="mailto:lldb-dev@lists.llvm.org" class="gmail_msg" target="_blank">lldb-dev@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev</a><br class="gmail_msg">
</blockquote></div>