public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug debug/97774] New: Incorrect line info for try/catch
@ 2020-11-10  9:34 vries at gcc dot gnu.org
  2020-11-10  9:42 ` [Bug debug/97774] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2020-11-10  9:34 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97774

            Bug ID: 97774
           Summary: Incorrect line info for try/catch
           Product: gcc
           Version: 7.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: debug
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

[ This PR is FTR, it's already fixed. ]

Consider this test-case, minimized from gdb.cp/gdb9593.cc (
https://src.fedoraproject.org/rpms/gdb/blob/master/f/gdb-archer-vla-tests.patch
):
...
$ cat -n test.cc
     1  void
     2  function1 (void)
     3  {
     4    throw 20;
     5  }
     6
     7  int
     8  main (void)
     9  { 
    10    try
    11      {
    12        function1 ();
    13      }
    14    catch (int x)
    15      {
    16      }
    17
    18    return 0;
    19  }
...

We compile using gcc 7.5.0:
...
$ g++ -g test.cc -save-temps -dA
...

When trying to step over function1 using next, we end up on line 18, and not at
the start of line 18 (given the $hex prefix):
...
$ gdb a.out -ex start -ex next
Reading symbols from a.out...
Temporary breakpoint 1 at 0x4007b5: file test.cc, line 12.
Starting program: a.out 

Temporary breakpoint 1, main () at test.cc:12
12            function1 ();
0x00000000004007c1      18        return 0;
(gdb) 
...

This is caused by the following.

There's a .loc for line 18 after the call to function1, but then we jump away
to label .L9:
...
        # test.cc:12
        .loc 1 12 0
        call    _Z9function1v
.LEHE0:
# BLOCK 3 seq:1
# PRED: 2 (FALLTHRU) 6 [100.0%]
.L7:
        # test.cc:18
        .loc 1 18 0
        movl    $0, %eax
# SUCC: 7 [100.0%]
        jmp     .L9
# BLOCK 4 seq:2
# PRED: 2 (ABNORMAL,ABNORMAL_CALL,EH)
.L8:
        cmpq    $1, %rdx
...
Since there's no other loc before the insn at .L8, it's considered to be part
of line 18.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-11-10  9:42 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-10  9:34 [Bug debug/97774] New: Incorrect line info for try/catch vries at gcc dot gnu.org
2020-11-10  9:42 ` [Bug debug/97774] " vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).