It would be very nice if gcc emitted debug information that allowed profilers and debuggers the option to extract a stack trace which included calls to inlined functions. This would allow developers much greater insight into the behavior of optimized code.
C++ programs would benefit disproportionately, especially those which use the STL heavily -- disabling inlining produces a very different executable which makes profiling worse than useless and can mask heisenbugs. Profiling would become significantly more accurate because it could determine how much of a function's overheads remain even after inlining, which is pretty much impossible right now. It would also allow profilers to generate "functional" call graphs which show all uses of a function, inlined or not. Debugging would also improve because the user would be able to navigate a stack trace which corresponds to the code they're trying to debug, even if the actual calls were optimized away. Questions like "which of this function's 10 calls to std::vector::begin seg faulted?" would suddenly be *much* easier to answer, and in an intuitive way. With some work it would probably even be possible to maintain mappings for local vars/params (assuming they exist at the time). All this "virtual stack trace" functionality would need to remain separate (and probably not the default) so as to not confuse (impede) folks who are used to (prefer) the current behavior. NOTE: I realize that full support for this would require changes to other projects like gdb and gprof, but gcc could solve the chicken-and-egg problem by emitting appropriate debug info as a first step; perhaps the new debug info changes introduced with 4.5.0 already do (some of) this? -- Summary: Emit debug info allowing inlined functions to show in stack traces Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: scovich at gmail dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43828