https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101598
Bug ID: 101598 Summary: [debug, ada] .loc generated for defs__struct1IP Product: gcc Version: 12.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: --- I. Consider test-case defs.adb/defs.ads from a gdb testcase ( https://sourceware.org/git/?p=binutils-gdb.git;a=tree;f=gdb/testsuite/gdb.ada/formatted_ref ). When compiled with trunk, we have a .loc in defs__struct1IP: ... $ ./install/bin/gcc defs.adb -c -save-temps -g $ more defs.s .file "defs.adb" .text .Ltext0: .file 0 "/home/vries/gcc_versions/devel" "defs.adb" .align 2 .globl defs__struct1IP .type defs__struct1IP, @function defs__struct1IP: .LFB2: .cfi_startproc .file 1 "defs.ads" .loc 1 18 9 pushq %rbp ... According to PR 101575 comment 7, that's something that needs to be fixed. II. Concretely, the .loc being there means that when stepping through defs___elabs, we'll step into defs__struct1IP: ... $ gdb -q formatted_ref -ex "b defs___elabs" -ex run Reading symbols from formatted_ref... Breakpoint 1 at 0x402bfe: file defs.ads, line 25. Starting program: formatted_ref Breakpoint 1, <defs___elabs> () at defs.ads:25 25 S1 : Struct1; (gdb) s 0x0000000000402bcc in defs__struct1IP () at defs.ads:18 18 type Struct1 is limited record (gdb) s <defs___elabs> () at defs.ads:27 27 end Defs; (gdb) ... OTOH, with gcc-11, we have no .loc: ... $ gcc-11 defs.adb -c -save-temps -g -gdwarf-5 $ more defs.s .file "defs.adb" .text .Ltext0: .file 0 "/home/vries/gcc_versions/devel" "defs.adb" .align 2 .globl defs__struct1IP .type defs__struct1IP, @function defs__struct1IP: .LFB2: .cfi_startproc pushq %rbp ... which means means we don't step into defs__struct1IP: ... $ gdb -q formatted_ref -ex "b defs___elabs" -ex run Reading symbols from formatted_ref... Breakpoint 1 at 0x402d1a: file defs.ads, line 25. Starting program: formatted_ref Breakpoint 1, <defs___elabs> () at defs.ads:25 25 S1 : Struct1; (gdb) s 27 end Defs; (gdb) ... III. The difference is caused by commit e69ac020372 ("Add line debug info for virtual thunks").