http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32998

--- Comment #14 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-07-12 
16:26:10 UTC ---
Created attachment 24746
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=24746
gcc47-pr32998.patch

Untested patch to implement a new switch, -grecord-gcc-switches, which records
passed options as a string appended to DW_AT_producer attribute in .debug_info.
Apparently we aren't the first compiler to do that based on the dwarf2out.c
comments...
The main intent is to have the code generation options in there, as Roland
said, -D* etc. options should be investigable through -g3 .debug_macinfo
(especially if we manage to cut it down considerably), similarly -I/-i* etc.
options related to preprocessing are either in .debug_macinfo and/or in
.debug_line).  If possible I'd like not to see filenames and paths in the
string.

I'm not entirely happy with it this way, as if passed command line options
override each other, this approach will print all of them in the order
specified
(say -O2 -O3 -O0 inserts -O2 -O3 -O0 instead of just -O0) and due to the
overriding the options can't be sorted, which would increase the likelyhood
that the DW_AT_producer strings are mergeable between many object files.

Joseph, is there a way to instead iterate over the explicitly passed options
after override processing?  I see global_options_set, but not sure what exactly
to expect from it.

Reply via email to