This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Should GCC tell GDB about its optimizations?


"Marty Leisner" <leisner@rochester.rr.com> writes:

|> Yes...!!!
|> 
|> I proposed something like this years ago...I almost hacked up
|> gcc to put this in (I think I started...)
|> 
|> It is incredibly useful in the real world to encapsulate what
|> compiler flags were used in the binary (essentially the gcc command
|> line with preprocessor flags).
|> 
|> I just compiled a trivial C program with -O3 to see..
|> 
|> The .s file has
|>   .ident  "GCC: (GNU) 2.95.2 19991024 (release)"
|> 
|> Is there a way for nm to decode this?  (strings can show it, 
|> but its pretty meaningless in the binary).
|> 
|> For example:
|> ...
|> GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
|> GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
|> GCC: (GNU) 2.95.2 19991024 (release)
|> GCC: (GNU) 2.95.2 19991024 (release)
|> GCC: (GNU) 2.95.2 19991024 (release)
|> GCC: (GNU) egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
|> ....
|> 
|> I don't know how to take apart elf binaries off the top
|> of my head, but I assume there is information someplace encoded
|> to match this up with specific files.

This information is concatenated in the .comment section.  It can be
listed with "objdump -sj.comment ....".  But there is no easy way to map
it back to the object modules apart from the fact that the order is the
same as the order of the modules linked in.

Andreas.

-- 
Andreas Schwab                                  "And now for something
SuSE Labs                                        completely different."
Andreas.Schwab@suse.de
SuSE GmbH, Schanzäckerstr. 10, D-90443 Nürnberg

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]