<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Oct 6, 2016 at 2:59 AM George Rimar <<a href="mailto:grimar@accesssoftek.com">grimar@accesssoftek.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg">
<div class="gmail_msg">> I think Eric's point is that the gdb_index isn't required for or only useful for Fission. You could have a gdb_index in a non-fission build (to speed up the debugger so it > doesn't have to read all the DWARF at load time) or skip the index in a fission
 build (to reduce executable size at the expense of slower gdb startup time)<br class="gmail_msg">
  <br class="gmail_msg">
</div>
</div></div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">I see. I did not think about such cases. How will this work ?<br class="gmail_msg">
</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">1) <span style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)" class="gmail_msg">
I supposed that if gdb</span><span style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)" class="gmail_msg"> see .gdb_index section then it </span><span style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)" class="gmail_msg">should
 try to locate .dwo files to read info from.</span></div></div></div></div></div></div></blockquote><div><br>The gdb_index doesn't talk about .dwo files, just about compilation units where certain names/entities are available. If the compilation unit happens to be a skeleton compilation unit, then the debugger would use the info found there to discover the .dwo file to load. (but this is an implementation detail of the CU/skeleton CU/etc - gdb_index is independent of this detail, it just says which CU to look at)<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg">
<div class="gmail_msg">     If I have gdb_index in a non-fission executable binary, will debugger read <span style="color:rgb(33,33,33);font-family:Calibri,Arial,Helvetica,sans-serif;font-size:16px;background-color:rgb(255,255,255)" class="gmail_msg">gdb_index</span> and start
 up fast and later read debug info from debug sections of executable when will need it ?<br class="gmail_msg"></div></div></div></div></div></div></blockquote><div><br></div><div>Right - it'd know which CUs to read, rather than having to read them all to form its name lookup tables, etc.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">
</div>
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">2) If we skip gdb_index in a fission build then there should be very little amount of debug information in binary and I supposed that debugger will not try to locate .dwo <span style="font-size:12pt" class="gmail_msg">when there is no .gdb_index section. </span><span style="font-size:12pt" class="gmail_msg">So
 it should be almost useless to debug such build, what I am missing ?</span></div></div></div></div></div></div></blockquote><div><br></div><div>The absence of an index would lead GDB to conclude that a name could be in any CU - so it would look at all of them. If fission was used, then the CUs would be skeleton CUs and contain the info necessary to find the .dwo file and the debugger would load those to look for names/entities. This would be slow because it would load all the .dwos.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">And finally, since this file has functionality of creating .gdb_index and linker option is also called --gdb-index, what about GdbIndex.cpp/h name ?<br class="gmail_msg"></div></div></div></div></div></div></blockquote><div><br>Seems like a reasonable name.<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">
</div></div></div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">> It would possibly be better to make the common implementation in LLVM more flexible to this use case and more efficient - this could have benefits for other LLVM >tools (like LLDB, llvm-dsymutil, and llvm-dwp)<br class="gmail_msg">
>If that means splitting up parts of the API so they can be used independently, providing ways to provide the contents of sections already available through other >means, etc, - those seem like reasonable changes to make to the common APIs.<br class="gmail_msg">
><br class="gmail_msg">
>- Dave</div>
<div class="gmail_msg"> <br class="gmail_msg">
</div>
</div></div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg">Yes, probably. But that is also can be separate and large task itself. I think we can work on changing common API and switch lld to use it later,</div></div></div></div></div></div></blockquote><div><br></div><div>If other projects are anything to go by, that rarely, if ever, happens. So we tend to like to frontload some of this work to avoid divergence which makes the cost more expensive over time and less likely to be done.<br><br>(see LLDB's use of a fork of the LLVM DWARF parsing logic (well, I think LLVM maybe forked LLDB's, but either way) as a cautionary tale)</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg"><div class="gmail_msg"> when whole functionality of .gdb_index be landed (since it is probably complete in D24267). Then we will have
 full picture of what exactly we want to have from API from linker side and also probably should be able to swich step by step and perform benchmarks to compare common llvm implementation with what we may have in LLD.<br class="gmail_msg">
</div></div></div></div></div></div><div dir="ltr" style="font-size:12pt;color:#000000;background-color:#ffffff;font-family:Calibri,Arial,Helvetica,sans-serif" class="gmail_msg"><div style="color:rgb(33,33,33)" class="gmail_msg"><div class="gmail_msg"><div dir="ltr" class="gmail_msg"><div class="gmail_quote gmail_msg">
<div class="gmail_msg"><br class="gmail_msg">
</div>
<div class="gmail_msg">George.<br class="gmail_msg">
</div>
</div></div></div></div></div></blockquote></div></div>