Message ID | 20160225094803.GN3017@tucnak.redhat.com |
---|---|
State | New |
Headers | show |
On 02/25/2016 10:48 AM, Jakub Jelinek wrote: > Unfortunately, this broke the DW_OP_GNU_implicit_pointer support, on vast > majority of binaries and libraries gcc now emits invalid DWARF (which both > gdb and dwz complain about and dwz refuses to optimize because of that). Arg, sorry about this! > I'm attaching two possible patches, so far untested. Thanks, I’m having a look as we speak. > So, Pierre-Marie, can I ask you to run whatever Ada debug info testsuite > you have with the second patch? And for GCC 7 really please consider adding > gnat.dg/guality/ and fill it with tests. Testing in progress… I have a tiny Python/pyelftools-based testsuite that checks the DIE patterns GCC emits for several Ada types. I really wish I could somehow integrate them to the GCC testsuite, but right now I don’t know how I could do similar things, there. As I said at the end of a message in another thread (https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01078.html), I always feel uncomfortable writing brittle dg-scan testcases, hence the current lack of testcases for those DWARF changes.
On Thu, Feb 25, 2016 at 11:35:07AM +0100, Pierre-Marie de Rodat wrote: > As I said at the end of a message in another thread > (https://gcc.gnu.org/ml/gcc-patches/2016-01/msg01078.html), I always feel > uncomfortable writing brittle dg-scan testcases, hence the current lack of > testcases for those DWARF changes. I agree that catching this in scan-assembler test is hard, but guality test would catch this. It is true that some guality tests (mostly the ones that test behaviour of optimized code, which differs a lot between different architectures) have known FAILs (or known XFAILs), because the target, compilation options and gdb version matrix is too large to catch all cases. But, if one just looks at test_summary output before/after a change, one can detect regressions and fix them. Perhaps in some cases you could just limit to -O0 guality if it is something you want to just check if the debug info is represented properly and don't need to test -fvar-tracking-assignments etc. handling - you can just dg-skip-if the tests except for -O0 etc. Similarly, it shouldn't be hard to add tcl function to check for gdb version, and limit some tests only to a particular version of gdb or newer. Jakub
> I agree that catching this in scan-assembler test is hard, but guality test > would catch this. It is true that some guality tests (mostly the ones that > test behaviour of optimized code, which differs a lot between different > architectures) have known FAILs (or known XFAILs), because the target, > compilation options and gdb version matrix is too large to catch all cases. IMO the guality testsuite is not really appropriate for debug info issues, it's too brittle, has a low signal-over-noise ratio and nobody really cares about it. And, given that most people already don't care about the regular gnat.dg testsuite, I think that literally nobody will about gnat.dg/guality. Given that only AdaCore's folks work on Ada debug info issues in practice and that they run the GDB testsuite, I don't see any real need for it.
On Thu, Feb 25, 2016 at 11:35:07AM +0100, Pierre-Marie de Rodat wrote: > On 02/25/2016 10:48 AM, Jakub Jelinek wrote: > >Unfortunately, this broke the DW_OP_GNU_implicit_pointer support, on vast > >majority of binaries and libraries gcc now emits invalid DWARF (which both > >gdb and dwz complain about and dwz refuses to optimize because of that). > > Arg, sorry about this! > > >I'm attaching two possible patches, so far untested. > > Thanks, I’m having a look as we speak. > > >So, Pierre-Marie, can I ask you to run whatever Ada debug info testsuite > >you have with the second patch? And for GCC 7 really please consider adding > >gnat.dg/guality/ and fill it with tests. > > Testing in progress… > > I have a tiny Python/pyelftools-based testsuite that checks the DIE patterns > GCC emits for several Ada types. I really wish I could somehow integrate > them to the GCC testsuite, but right now I don’t know how I could do similar > things, there. Do you have some short Ada testcase where the DW_OP_call4 referring to DW_TAG_dwarf_procedure is supposed to be emitted? I believe you must be getting there the .Ldebug_info0+0 invalid reference in the DW_OP_call4 operand. Jakub
On 02/25/2016 04:51 PM, Jakub Jelinek wrote: > Do you have some short Ada testcase where the DW_OP_call4 referring to > DW_TAG_dwarf_procedure is supposed to be emitted? I believe you must be > getting there the .Ldebug_info0+0 invalid reference in the DW_OP_call4 > operand. Sure! Here’s one: > $ gcc -S -g -fgnat-encodings=minimal -dA foo.adb && grep DW_OP_call4 foo.s > foo.s:313: .byte 0x99 # DW_OP_call4
--- gcc/dwarf2out.c.jj 2016-02-24 23:03:32.000000000 +0100 +++ gcc/dwarf2out.c 2016-02-25 10:08:46.688716691 +0100 @@ -26288,6 +26288,7 @@ string_cst_pool_decl (tree t) l->dw_loc_oprnd2.v.val_vec.elt_size = 1; l->dw_loc_oprnd2.v.val_vec.array = array; add_AT_loc (ref, DW_AT_location, l); + ref->die_perennial_p = 1; equate_decl_number_to_die (decl, ref); } return rtl; --- gcc/testsuite/gcc.dg/guality/pr69947.c.jj 2016-02-25 10:00:25.503608176 +0100 +++ gcc/testsuite/gcc.dg/guality/pr69947.c 2016-02-25 10:05:20.446552599 +0100 @@ -0,0 +1,22 @@ +/* PR debug/69947 */ +/* { dg-do run } */ +/* { dg-options "-g" } */ + +#include "../nop.h" + +static const char *c = "foobar"; + +__attribute__((noinline, noclone)) void +foo (void) +{ + static const char a[] = "abcdefg"; + const char *b = a; /* { dg-final { gdb-test 14 "c\[2\]" "'o'" } } */ + asm (NOP : : : "memory"); /* { dg-final { gdb-test 14 "b\[4\]" "'e'" } } */ +} + +int +main () +{ + foo (); + return 0; +}