This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
The LTO early debug info prototype project has been completed. The provided patch against the debug-early branch shows that the general idea is sound and works. Now on to the details. What works? ----------- Simple C and C++ testcases (didn't test more), esp. now libstdc++ pretty-printers finally work! For example #include <string> #include <iostream> int main() { std::string s = "Hello"; std::cout << s << std::endl; } with GCC 5 and a -flto -g compile produces (gdb) start Temporary breakpoint 1, main () at t2.C:5 5 std::string s = "Hello"; (gdb) info locals s = <incomplete type> (gdb) ptype s type = struct basic_string { <incomplete type> } while the patched compiler produces (gdb) start Temporary breakpoint 1, main () at t2.C:5 5 std::string s = "Hello"; (gdb) info locals s = "" (gdb) n 6 std::cout << s << std::endl; (gdb) info locals s = "Hello" (gdb) ptype s type = std::string exactly the same as with non-LTO operation. What does not work? ------------------- Currently the simple "tooling" (driver support for linking in the .debug_info sections produced early at compile-time into the final executable) does not work for fat LTO objects (thus also when a linker plugin is not available). The tooling might also break automatic LTO linker plugin loading as the slim LTO files are not marked slim. You can run into new ICEs in dwarf2out.c (also for non-LTO operation). The libstdc++ testsuite doesn't get very far with -flto -g (we ICE building testsuite_abi.cc). VLAs don't work (see below). Somehow constructor invocations show duplicate parameters and no locations (but DWARF looks sane). Future work ----------- Make the WPA stage side more efficient (do not use DIEs to store/retrieve the tree <-> DIE symbol + offset info). Fix the tooling to support fat LTO objects (and make slim objects slim again). The only reasonable way to do this is to emit the early debug info into .gnu.lto_. prefixed sections (??? can/need we redirect relocations into separate LTO sections as well?), then at WPA (or unpartitioned LTO) time move all such sections from the LTO inputs to a (single?) temporary file which serves as additional output the linker can consume. We'd need to re-name the sections back at that time (does that work for a single file and the relocations? Otherwise we need unique section names or simply N files). In theory this should work with using simple-object and thus be not ELF specific(?). Fix all the ICEs. VLAs and stuff don't work (but gcc.dg/guality/vla-1.c also fails quite a bit on trunk). I've fixed it up somewhat but the issue is that the gimplified type size decls are not getting ignored and that they get location info. The DWARF looks good but gdb appearantly doesn't see it (yes, there seem to be some gdb issues as well). -- Looks like we have to pull up a type chain up to the point that can refer to the upper bound DIE for the artificial decl (also makes it unnecessary to output this early). Will be somewhat fun but not too difficult. We should re-think how we handle abstract origins for functions we currently output for inlines. The early debug can serve as abstract origin for example. Currently with LTO we get quite easily confused by having two DIEs for the same decl (also LTO streaming still drops abstract origins from early inlining, something no longer necessary with early debug). late dwarf generation should be refactored out of early dwarf generation. late dwarf for global variables should be created from where we output the variable (similar to functions), not from a loop in toplev.c And of course the attached patch needs to be split up, a changelog written and formally tested and submitted (after fixing all of the above ;)) Now looking forward to get debug-early merged to trunk (I'll do some LTO testing on the bare branch - I suspect some issues I ran into are pre-existing on the branch). Thanks, Richard.
Attachment:
early-lto-debug-day4
Description: patch
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |