<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Apr 12, 2019, at 11:05 AM, <a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a> wrote:</div><br class="Apple-interchange-newline"><div class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class="">-----Original Message-----<br class="">From: David Blaikie [<a href="mailto:dblaikie@gmail.com" class="">mailto:dblaikie@gmail.com</a>]<br class="">Sent: Friday, April 12, 2019 1:40 PM<br class="">To: Robinson, Paul<br class="">Cc: Adrian Prantl; Clang Dev; Douglas Katzman<br class="">Subject: Re: Make standalone-debug default based on glldb tuning<br class=""><br class="">On Fri, Apr 12, 2019 at 10:30 AM <<a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">-----Original Message-----<br class="">From: David Blaikie [<a href="mailto:dblaikie@gmail.com" class="">mailto:dblaikie@gmail.com</a>]<br class="">Sent: Friday, April 12, 2019 12:43 PM<br class="">To: Robinson, Paul<br class="">Cc: Adrian Prantl; Clang Dev; Douglas Katzman<br class="">Subject: Re: Make standalone-debug default based on glldb tuning<br class=""><br class="">On Fri, Apr 12, 2019 at 9:38 AM <<a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">-----Original Message-----<br class="">From: David Blaikie [<a href="mailto:dblaikie@gmail.com" class="">mailto:dblaikie@gmail.com</a>]<br class="">Sent: Friday, April 12, 2019 12:06 PM<br class="">To: Robinson, Paul<br class="">Cc: Adrian Prantl; Clang Dev; Douglas Katzman<br class="">Subject: Re: Make standalone-debug default based on glldb tuning<br class=""><br class="">On Fri, Apr 12, 2019 at 8:45 AM <<a href="mailto:paul.robinson@sony.com" class="">paul.robinson@sony.com</a>> wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">-----Original Message-----<br class="">From: <a href="mailto:aprantl@apple.com" class="">aprantl@apple.com</a> [<a href="mailto:aprantl@apple.com" class="">mailto:aprantl@apple.com</a>]<br class="">Sent: Friday, April 12, 2019 11:21 AM<br class="">To: David Blaikie<br class="">Cc: Clang Dev; Robinson, Paul; Douglas Katzman<br class="">Subject: Re: Make standalone-debug default based on glldb<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>tuning<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class=""><br class=""><br class=""><blockquote type="cite" class="">On Apr 12, 2019, at 8:18 AM, David Blaikie<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote><<a href="mailto:dblaikie@gmail.com" class="">dblaikie@gmail.com</a>><br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">I realized recently (as folks at Google have started<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote>experimenting<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">with LLDB) that the platform default for debugger tuning and<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>the<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">default for -fstandalone-debug are both independent. This<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>seems<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">a<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">bit<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">wrong to me because enabling -glldb doesn't enable -<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>fstandalone-<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">debug.<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">I'm wondering if everyone's on board with removing<br class="">ToolChain::GetDefaultStandaloneDebug, and using<br class="">ToolChain::getDefaultDebuggerTuning() to select the default<br class=""></blockquote></blockquote></blockquote>standalone<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">debug state?<br class=""><br class="">Then on the command line, I'd kind of expect one to override<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>the<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">other, so things like "-glldb -fno-standalone-debug" is<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote>respected<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">(when it comes to hopefully fixing LLDB to cope with<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>standalone<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">debug<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">input).<br class=""><br class="">Sound good to everyone? If so I'll make a patch & send it<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>for<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">review.<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">(well, I'll probably work on the patch now anyway)<br class=""></blockquote><br class="">Since this doesn't change anything for platforms that default<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote></blockquote>to -<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">glldb,<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">I'm fine with this change.<br class=""><br class="">-- adrian<br class=""></blockquote><br class="">I'm somewhat surprised LLDB would want -fstandalone-debug,<br class=""></blockquote></blockquote></blockquote>independent<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">of the target.  It would be a source of unnecessary bloat on<br class=""></blockquote></blockquote></blockquote></blockquote></blockquote>ELF-<br class=""><blockquote type="cite" class=""><blockquote type="cite" class="">using<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">targets, no?<br class=""></blockquote><br class="">LLDB fundamentally (at the moment) doesn't support -fstandalone-<br class=""></blockquote></blockquote></blockquote></blockquote>debug,<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">no matter the file format.<br class=""><br class="">As far as I understand it: LLDB constructs ASTs from DWARF on a<br class="">per-binary level (so, .so or executable). -fstandalone-debug<br class=""></blockquote></blockquote></blockquote></blockquote>creates<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">"impossible" DWARF (eg: if one base class's vtable (& thus DWARF<br class="">definition) is in one .so, but a derived class is in another .so -<br class="">then the DWARF in the second .so contains a definition that<br class=""></blockquote></blockquote></blockquote></blockquote>derives<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">from a declaration (& the DWARF consumer would have to go look in<br class=""></blockquote></blockquote></blockquote></blockquote>the<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">other .so to stitch it up to a definition).<br class=""></blockquote><br class="">Uh. Am I misunderstanding? Somehow I thought -fstandalone-debug<br class=""></blockquote></blockquote></blockquote>meant<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">"full" which means the base class ought not to be a declaration in<br class="">the second .so?  Or is that pruning not based on the full/limited<br class="">distinction?<br class=""></blockquote><br class="">Sorry, I misspoke - the default ("no standalone debug") creates the<br class="">DWARF that doesn't correspond to source in that you can see classes<br class="">derived from declarations and the like. LLDB won't go searching for a<br class="">definition that matches the declaration outside the scope of a single<br class="">blob of DWARF (either a single object or single dsym, I guess).<br class="">Turning on standalone debug avoids LLDB encountering these<br class="">"impossible" situations.<br class=""></blockquote><br class=""></blockquote><br class="">(bonus data: oh, apparently FreeBSD still defaults to GDB tuning - but<br class="">also want to opt-in to -fstandalone-debug so FreeBSD binaries are<br class="">usable with LLDB out of the box, even if it's not the default - and<br class="">they mention in ToolChains/FreeBSD.h that 'dtrace' has some issues<br class="">with this kind of DWARF too - non-specific as to what those issues<br class="">are)<br class=""><br class=""><blockquote type="cite" class="">Okay then! So the story is, LLDB doesn't want to chase after things<br class="">in other objects, which on Darwin is either expensive (in a .o case)<br class="">or moot (when dsymutil has done it all ahead of time).  Which leaves<br class="">me wondering about the ELF case; LLDB also doesn't want to troll<br class="">through other CUs even when they are in the same executable?<br class=""></blockquote><br class="">As I gave in the example/Adrian reiterated - it's cross-file (so<br class="">crossing a binary boundary, from one .so to another, for instance -<br class="">where the DWARF isn't merged across that boundary) rather than<br class="">cross-object, that's the issue.<br class=""></blockquote><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Building everything -fstandalone-debug still feels like it would be</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">a big size hit to compensate for this, unless you also use type units.<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">Which have their own size issues... but if LLDB is resisting the<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">cross-loadfile fix, I guess it's a relatively small change to the<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">compiler and users have the full set of options to undo it if they<span class="Apple-converted-space"> </span></span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">prefer.</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""></div></blockquote><div><br class=""></div><div>I wouldn't necessarily phrase it as "LLDB is resisting the fix". AFAIK, thus far just nobody submitted a patch.</div><div><br class=""></div><div>-- adrian</div><br class=""><blockquote type="cite" class=""><div class=""><span style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;" class="">--paulr</span><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br style="caret-color: rgb(0, 0, 0); font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><blockquote type="cite" style="font-family: Menlo-Regular; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; text-decoration: none;" class=""><br class=""><blockquote type="cite" class="">That<br class="">strikes me as a real inadequacy in LLDB, not something that the<br class="">compiler should compensate for. Especially once you upgrade to v5<br class="">and get the spiffy new index (thanks to Pavel).<br class=""></blockquote><br class="">I still think it's a significant inadequacy in LLDB & mentioned this<br class="">at the time it was discovered/worked around. But it's stuck around for<br class="">a while and means using -fno-standalone-debug with LLDB is not<br class="">practical on any platform. So tuning for LLDB should imply<br class="">-fstandalone-debug, which it currently doesn't.<br class=""><br class="">(that said, tuning for other debuggers shouldn't turn it off if a user<br class="">opted into it (eg: "-fstandalone-debug -ggdb" should still produce<br class="">standalone debug info) because there are other reasons (as the name<br class="">implies - if you're really only building a subset of objects with<br class="">debug info) you might have enabled it, so -ggdb shouldn't override<br class="">that choice)<br class=""><br class="">So my current proposed patch is quite small:<br class=""><br class="">-  bool NeedFullDebug = Args.hasFlag(options::OPT_fstandalone_debug,<br class="">-                                    options::OPT_fno_standalone_debug,<br class="">-                                    TC.GetDefaultStandaloneDebug());<br class="">+  bool NeedFullDebug = Args.hasFlag(<br class="">+      options::OPT_fstandalone_debug, options::OPT_fno_standalone_debug,<br class="">+      DebuggerTuning == llvm::DebuggerKind::LLDB ||<br class="">+          TC.GetDefaultStandaloneDebug());<br class=""><br class=""><blockquote type="cite" class="">So I'm unconvinced that the basis of the -fstandalone-debug default<br class="">should be changed.<br class=""></blockquote><br class="">Seems reasonable to change the default when -glldb is specified, given<br class="">LLDB can't cope with that DWARF (& has made that an explicit choice<br class="">for years now). I still hope the bug will be addressed (likely as<br class="">Google starts to look at transitioning to LLDB but not wanting to take<br class="">the object size hit of disabling -fstandalone-debug).<br class=""><br class=""><blockquote type="cite" class="">FTR, I completely get the scenario Adrian describes where some<br class="">library has no debug info and the normal (limited) case fails to<br class="">provide a full definition. We've had complaints about not being<br class="">able to debug some STL-derived classes.<br class=""></blockquote><br class="">Have you considered shipping STL binaries with debug info? (that's<br class="">what I use on Ubuntu - there's separate -dbg variant packages for<br class="">libstdc++ that include the DWARF for the library) - GCC has the same<br class="">issue, though in a lesser form (it's not as aggressive as LLVM is -<br class="">for LLVM, it'll home/assume std::basic_string<char> (using an explicit<br class="">instantiation declaration/definition) is available elsewhere, GCC<br class="">won't - but both will assume that std::basic_ifstream<char> is 'homed'<br class="">(using the vtable location)).<br class=""><br class=""><blockquote type="cite" class="">Licensees are not too<br class="">happy about the extra size with the full-info workaround.<br class="">--paulr<br class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class=""><br class=""><blockquote type="cite" class=""><br class="">(FreeBSD defaults to -fstandalone-debug because it defaults to<br class=""></blockquote></blockquote></blockquote></blockquote>LLDB as<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><blockquote type="cite" class="">the debugger - Adrian's reply makes me wonder if that's clear, so<br class="">figured I'd mention that)<br class=""><br class=""><blockquote type="cite" class="">--paulr</blockquote></blockquote></blockquote></blockquote></blockquote></blockquote></div></blockquote></div><br class=""></body></html>