This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Major debugging breakage



Line number tracking is currently hosed in a big way in GCC.  This makes
debugging multi-line statements a real PITA.

Consider the following code:

1  main()
2  {
3    foo(1,2,3,4);
4  }
5
6  foo(a, b, c, d)
7  {
8    if (a
9        || b
10        || c
11        || d)
12      printf("Yow1\n");
13    else
14      printf("Yow2\n");
15    printf("Yow3\n");
16  }


If I were to put a breakpoint at "foo", then issue a series of "next"
commands, I would expect to stop at the following lines 8, 12, then 15.
Instead I stop at 11, 12 & 15.

Stopping at line 11 is insanely annoying.

Looking at the assembly code for "foo" we find:

foo
        .PROC
        .CALLINFO FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3
        .ENTRY
        stw %r2,-20(%r30)
        copy %r3,%r1
        copy %r30,%r3
        stwm %r1,64(%r30)
        stw %r26,-36(%r3)
        stw %r25,-40(%r3)
        stw %r24,-44(%r3)
        stw %r23,-48(%r3)
        .stabn 68,0,11,L$M5-foo

Note carefully that we've used line #11 in that .stabn statement.  The
correct value should be 8.

Similar problems happen for multi-line "while" conditional, and probably
lots of other stuff.

I don't have the foggest idea how the line number tracking code works, but
I do know it's broken.


This was tested on hppa1.1-hp-hpux11.00, but you can probably reproduce
this with just about any target.

jeff


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