Inaccurate function parameter location in debug info with gcc 3.x and 4.0

Yi Feng ericyifeng@gmail.com
Thu May 11 00:56:00 GMT 2006


Hi,

I have encountered a problem with the DWARF debug info when compiling
the kernel with gcc 3.x and 4.0 with optimization flags of either -O1
or -O2. When looking at the parameter locations of, for example,
sys_read, the debug info says they are all in EAX while these
parameters are in fact only read into EAX temporarily in the function
body. Using this inaccurate information, SystemTap looks at EAX at the
function entry when it's told to instrument the function parameters.
Obviously the returned value is bogus.

I'm wondering if people have noticed this problem before. Using gcc
3.x/4.0 with -Os or gcc 4.1 (with either -O2 or -Os) would generate
accurate debug info which gives the correct stack locations of the
parameters. Therefore SystemTap works correctly to get the parameter
value.

This happens with all the 2.6.1x kernels I've tested. Thanks very much
for any information you may have.


Yi Feng



More information about the Systemtap mailing list