On 8/4/21 4:33 PM, Eric Botcazou wrote: >> The location of these ignored Ada decls looks completely sane to me. >> However, it was an unintentional side effect of the patch to allow >> minimal debugging of ignored decls. This means we can now step into >> those functions or set line breakpoints there, while previously that >> was not possible. And I guess it could be considered an improvement. >> >> So it's your choice, how you want these functions to be debugged. > > The requirement on the GDB side is that these functions *cannot* be stepped > into, i.e. that they be completely transparent for the GDB user. But we still > want to have location information in the compiler itself to debug it. > Well, I see. But it is okay that we can set a breakpoint on defs__struct1IP, in the test case of PR 101598. And the debugger shall only show assembler here. Right? Do you have an example where this location information is used in the compiler itself for debugging? Of course we could do something like diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b91a9b5..c0ff4c6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -28546,6 +28546,9 @@ dwarf2out_set_ignored_loc (unsigned int line, unsigned i { dw_fde_ref fde = cfun->fde; + if (is_ada ()) + return; + fde->ignored_debug = false; set_cur_line_info_table (function_section (fde->decl)); But it would regress the attached test case (the Ada-equivalent of PR 97937): $ gnatmake -O2 main.adb -g -save-temps -f produces line info for Test2: test__test2: .LFB8: .cfi_startproc .loc 1 8 4 view .LVU3 movl %edi, %eax ret .cfi_endproc while with the above patch we would get something like test__test2: .LFB8: .cfi_startproc movl %edi, %eax ret .cfi_endproc and, indeed it is impossible to step into test2 or get the source line if we insert a breakpoint at the label test__test2. I assume You would agree that having the location for Test2 is better than no debug info at all? So Maybe something like the following might work for You? diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index b91a9b5..c0ff4c6 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -28546,6 +28546,9 @@ dwarf2out_set_ignored_loc (unsigned int line, unsigned i { dw_fde_ref fde = cfun->fde; + if (is_ada () && DECL_ARTIFICIAL (cfun->decl)) + return; + fde->ignored_debug = false; set_cur_line_info_table (function_section (fde->decl)); This would remove the location info in the test case of PR 101598, and still have location info in the ada variant of PR 97937. What do you think? Thanks Bernd.