This is the mail archive of the gcc-bugs@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]

[Bug debug/14049] New: [regression tree-ssa] bad debug block info, dwarf-2, c++


Here is a small C++ function.

  int foobar (int x_1)
  {
    static int i_1;
    char c_1;

    marker1 ();
    c_1 = x_1;
    i_1++;

    return 0;
  }

I compile with gcc -S -gdwarf-2.

With gcc HEAD2 2004-02-01 15:37:18 UTC, the block info is fine:

  .LBB2:
  .LBB3:
    .loc 1 10 0
    call _Z7marker1v
    .loc 1 11 0
    movl 8(%ebp), %eax
    movb %al, -1(%ebp)
    .loc 1 12 0
    incl _ZZ6foobariE3i_1
    .loc 1 14 0
     movl $0, %eax
  .LBE3:
  .LBE2:
    .loc 1 15 0
    leave
    ret

With gcc tree-ssa-200206190-branch 2004-02-05 12:45:13 UTC, the call to marker1
is outside the block for the function:

    .loc 1 10 0
    call _Z7marker1v
  .LBB2:
  .LBB3:
    .loc 1 11 0
    movl 8(%ebp), %eax
    movb %al, -1(%ebp)
    .loc 1 12 0
    movl __ZZ6foobariE3i_1, %eax
    incl %eax
    movl %eax, __ZZ6foobariE3i_1
    .loc 1 14 0
    movl $0, %eax
  .LBE3:
  .LBE2:
    .loc 1 15 0
    leave
    ret

Later on, gcc emits a DW_TAG_lexical_block for LBB3/LBE3.  With gcc
tree-ssa-branch, this does not cover the call to marker1.  Here is what "readelf
-w" says:

  # gcc HEAD
  DW_TAG_subprogram foobar
  DW_TAG_formal_parameter x_1
  DW_TAG_lexical_block 0x8048340 0x8048356
  DW_TAG_variable i_1
  DW_TAG_variable c_1

  # gcc tree-ssa
  DW_TAG_subprogram foobar
  DW_TAG_formal_paramater x_1
  DW_TAG_lexical_block 0x8048345 0x804835b
  DW_TAG_variable i_1
  DW_TAG_variable c_1

So the local variables i_1 and c_1 are inside the lexical block, and the lexical
block does not cover the first statement of foobar.

So if I do this:

  (gdb) break foobar
  (gdb) run
  (gdb) info locals

Or this:

  (gdb) break marker1
  (gdb) run
  (gdb) up
  (gdb) info locals

... then gdb cannot find the locals.

-- 
           Summary: [regression tree-ssa] bad debug block info, dwarf-2, c++
           Product: gcc
           Version: tree-ssa
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: debug
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mec dot gnu at mindspring dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14049


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