25 Jun 2012 18:15
Regression: incorrect line numbers in debug info since 4.5+
Peter A. Felvegi <petschy <at> praire-chicken.com>
2012-06-25 16:15:55 GMT
2012-06-25 16:15:55 GMT
Hello,
I found out while single stepping a new template function in gdb that
gcc generates bad/inaccurate line numbers in the debug info.
Optimization was turned off, but the execution jumped strangely, see
below. gcc-4.4 and the current clang produced the expected results, gcc
4.5, 4.6, 4.7, 4.8 all had problems. The code was factored out from a
proof-of-concept hack.
Here is the trace that was produced in gdb by single stepping the
program with 'n'. The program was compiled w/ gcc 4.8.0 git commit e7ae865c:
COLLECT_GCC=gcc-4.8.0
COLLECT_LTO_WRAPPER=/home/usr-local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.8.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ./configure --enable-languages=c,c++
--program-suffix=-4.8.0
Thread model: posix
gcc version 4.8.0 20120605 (experimental) (GCC)
g++-4.8.0 -g -O0 -Wall -Wextra -o dbginfobug.o -c dbginfobug.cpp
g++-4.8.0 -g -o dbginfobug dbginfobug.o
11 while (C c = *f++) {
12 if (c == '$') {
56 if (o < e) {
57 *o = c;
59 ++o;
// the first anomaly: the line printed is AFTER the loop, while we're
still in the loop
(Continue reading)
RSS Feed