Issue 140226.1: Add hashes over source and header files to debug symbols

Author: Martin Runge
Date submitted: 2014-02-26
Date revised:
Date closed:
Type: Enhancement
Status: Rejected.
DWARF Version: 5
Section .debug_line, pg 

Every debugger will confuse its user if the source files it is looking at do
not match those used to build the binary under inspection. This can easily 
happen by accident if for example someone modifiers the source, forgets to 
recompile and starts debugging. He looks at the modified code, but the 
program doesn't behave like expected from the code.

Generally speaking: If you do everything right, debugging works fine. But
if some kinds of mistakes happen, debugging misbehaves and it afterwards 
is very difficult to tell people what they did wrong. Do a fresh rebuild 
and debugging is fine again, but what exactly was the mistake?

All C/C++ source and header (I call both "C/C++ source" in this context) 
files are listed in the debug symbols of the binary. Size and timestamp 
are also listed, but size and timestamp are unused and they do not solve 
this problem in all cases of code generation.  With a code generator used
(Qt's moc, uic, UML, flex, bison, ....) the hand-written and version-
controlled source is not the C/C++ souce. Instead the C/C++ source is 
generated at build time and therefore always will have the build timestamp. 
If the debug symbols would provide hashes or checksum over the content of 
all C/C++ source and header files from the inspected binary, a debugger 
could check if the C/C++ sources presented to the user matches those 
used in the build much better. 

Another kind of error, that could be detected using such information is:
Using two different versions of the same source file to build two 
libraries and link both of them them into one process.

3/19/2014 -- Rejected, duplicates 130701.1.