On Wed, Aug 10, 2016 at 10:16 AM, Jakub Jelinek <ja...@redhat.com> wrote: > On Tue, Aug 09, 2016 at 07:10:34PM +0200, Richard Biener wrote: >> >In some cases like location of file scope vars, or this >> >DW_AT_string_length, >> >you really need to adjust late the debug info created early, there is >> >no >> >workaround for that. >> >> I suppose the workaround is to fix/extend DWARF... (DW_AT_GNU_string_length >> that allows us to refer to another DIE?) > > Introducing another attribute that does the same thing as existing attribute > would be way too ugly. In theory the reference class could be added to > DW_AT_string_length, I can ask on DWARF workgroup (but it might be too late > for DWARF 5), but that still doesn't solve the issue of the indirect params. > > How do you want to handle the debug info without ammending the early-generated > DWARF though? Just by using it as abstract origins of everything and > ammending in copies?
Yes. > That would be a total mess for all the consumers... > Parsing DWARF and rewriting it isn't all that hard. It may be not hard but it takes time and bloats debug info. You'd need to do it N times (each LTRANS unit would need to parse all early generated debug, pickle the "interesting" pieces, annotate it and then hopefully write out a lot less than parsed). Or you do what I do, annotate via abstract origins. A clever DWARF optimizer might then do what you suggest on the final executable (smash all copies with their abstract origin). I'm not objecting to the latter, but that's not my primary objective. My primary objective is to make C++ debugging reasonable even when you use LTO - with my prototype patches now all libstdc++ pretty-printer tests PASS while the currently just FAIL. Yes, I do have some DWARF consumer issues - VLAs don't work, but I got no answer from a mail to gdb last year or the bug I filed a few weeks ago. Yes, lldb immediately crashes when trying to parse the DWARF. Those are the only consumers I have access to. That said, I don't see a way to do scalable "better" debug for LTO. Richard. > > Jakub