public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
@ 2024-03-29  7:00 vries at gcc dot gnu.org
  2024-03-29  7:24 ` [Bug testsuite/31573] " vries at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29  7:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

            Bug ID: 31573
           Summary: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype
                    linked list structure
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: testsuite
          Assignee: unassigned at sourceware dot org
          Reporter: vries at gcc dot gnu.org
  Target Milestone: ---

On opensuse leap 15.4, when using gcc 12 or 13 rather than the system gcc
7.5.0, the ctf test-cases are no longer unsupported, and I run into:
...
(gdb) PASS: gdb.base/ctf-ptype.exp: ptype v_t_struct_p->v_float_member
ptype struct link^M
type = struct link {^M
    link *next;^M
    link *(*linkfunc)(link *, int);^M
    t_struct stuff[3];^M
}^M
(gdb) FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
...

The failing test is:
...
gdb_test "ptype struct link" "type = struct link \{\[\r\n\]+\[ \t\]+struct link
\\*next;\[\r\n\]+\[ \t\]+struct link \
\\*\\(\\*linkfunc\\)\\((struct link \\*, int|void|)\\);\[\r\n\]+\[ \t\]+struct
t_struct stuff.3.;\[\r\n\]+\}.*" "ptyp\
e linked list structure"
...

So it looks like gdb is printing for instance "link * next;", while "struct
link* next" is expected.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
@ 2024-03-29  7:24 ` vries at gcc dot gnu.org
  2024-03-29  8:21 ` vries at gcc dot gnu.org
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29  7:24 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #1 from Tom de Vries <vries at gcc dot gnu.org> ---
A full run of the ctf test-cases:
...
rtf=$(cd src/gdb/testsuite; echo gdb.ctf/*.exp gdb.base/ctf*.exp)
...
shows more problems, some probably of the same type:
...
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/ctf-ptype.exp ...
FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
Running /data/vries/gdb/src/gdb/testsuite/gdb.base/ctf-constvars.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.ctf/multi.exp ...
FAIL: gdb.ctf/multi.exp: ptype structure A
FAIL: gdb.ctf/multi.exp: ptype structure B
FAIL: gdb.ctf/multi.exp: ptype structure C
Running /data/vries/gdb/src/gdb/testsuite/gdb.ctf/funcreturn.exp ...
FAIL: gdb.ctf/funcreturn.exp: print char function
FAIL: gdb.ctf/funcreturn.exp: print signed char function
FAIL: gdb.ctf/funcreturn.exp: print unsigned char function
FAIL: gdb.ctf/funcreturn.exp: print short function
FAIL: gdb.ctf/funcreturn.exp: print signed short function
FAIL: gdb.ctf/funcreturn.exp: print unsigned short function
FAIL: gdb.ctf/funcreturn.exp: print int function
FAIL: gdb.ctf/funcreturn.exp: print signed int function
FAIL: gdb.ctf/funcreturn.exp: print unsigned int function
FAIL: gdb.ctf/funcreturn.exp: print long function
FAIL: gdb.ctf/funcreturn.exp: print signed long function
FAIL: gdb.ctf/funcreturn.exp: print unsigned long function
FAIL: gdb.ctf/funcreturn.exp: print long long function
FAIL: gdb.ctf/funcreturn.exp: print signed long long function
FAIL: gdb.ctf/funcreturn.exp: print unsigned long long function
FAIL: gdb.ctf/funcreturn.exp: print float function
FAIL: gdb.ctf/funcreturn.exp: print double function
FAIL: gdb.ctf/funcreturn.exp: whatis char function
FAIL: gdb.ctf/funcreturn.exp: whatis signed char function
FAIL: gdb.ctf/funcreturn.exp: whatis unsigned char function
FAIL: gdb.ctf/funcreturn.exp: whatis short function
FAIL: gdb.ctf/funcreturn.exp: whatis signed short function
FAIL: gdb.ctf/funcreturn.exp: whatis unsigned short function
FAIL: gdb.ctf/funcreturn.exp: whatis int function
FAIL: gdb.ctf/funcreturn.exp: whatis signed int function
FAIL: gdb.ctf/funcreturn.exp: whatis unsigned int function
FAIL: gdb.ctf/funcreturn.exp: whatis long function
FAIL: gdb.ctf/funcreturn.exp: whatis signed long function
FAIL: gdb.ctf/funcreturn.exp: whatis unsigned long function
FAIL: gdb.ctf/funcreturn.exp: whatis long long function
FAIL: gdb.ctf/funcreturn.exp: whatis signed long long function
FAIL: gdb.ctf/funcreturn.exp: whatis unsigned long long function
FAIL: gdb.ctf/funcreturn.exp: whatis float function
FAIL: gdb.ctf/funcreturn.exp: whatis double function
Running /data/vries/gdb/src/gdb/testsuite/gdb.ctf/dwarf2-and-ctf.exp ...
Running /data/vries/gdb/src/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp ...
FAIL: gdb.ctf/cross-tu-cyclic.exp: ptype structure A
FAIL: gdb.ctf/cross-tu-cyclic.exp: ptype structure B
FAIL: gdb.ctf/cross-tu-cyclic.exp: ptype structure C
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
  2024-03-29  7:24 ` [Bug testsuite/31573] " vries at gcc dot gnu.org
@ 2024-03-29  8:21 ` vries at gcc dot gnu.org
  2024-03-29  8:31 ` vries at gcc dot gnu.org
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29  8:21 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, if I use the readnow board, all fails except for the ones in
gdb.ctf/multi.exp and gdb.ctf/cross-tu-cyclic.exp are gone.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
  2024-03-29  7:24 ` [Bug testsuite/31573] " vries at gcc dot gnu.org
  2024-03-29  8:21 ` vries at gcc dot gnu.org
@ 2024-03-29  8:31 ` vries at gcc dot gnu.org
  2024-03-29  9:00 ` vries at gcc dot gnu.org
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29  8:31 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #3 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> (gdb) FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure

This passes on debian, where the exec only has ctf info and no dwarf info.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2024-03-29  8:31 ` vries at gcc dot gnu.org
@ 2024-03-29  9:00 ` vries at gcc dot gnu.org
  2024-03-29 11:52 ` vries at gcc dot gnu.org
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29  9:00 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> ---
I build gdb at commit 9c2c346137e ("[gdb/testsuite] Use set always-read-ctf on
instead of --strip-debug"), to see if there was a regression.

At that commit, I only see the fails for gdb.ctf/funcreturn.exp.

I tried to use readnow to see if that would fix those, but instead I got fails
in gdb.ctf/multi.exp and gdb.ctf/cross-tu-cyclic.exp.

I investigated why -readnow doesn't fix the gdb.ctf/funcreturn.exp fails, and
found that the failure looks like this:
...
(gdb) print v_char_func^M
expression parsing not implemented for language "Auto"^M
(gdb) FAIL: gdb.ctf/funcreturn.exp: print char function
...
due to:
...
$ gdb -q -batch -ex "set always-read-ctf on" -ex "file
outputs/gdb.ctf/funcreturn/funcreturn" -ex "show lang"
The current source language is "auto; currently c".
...
vs:
...
$ gdb -readnow -q -batch -ex "set always-read-ctf on" -ex "file
outputs/gdb.ctf/funcreturn/funcreturn" -ex "show lang"
The current source language is "auto; currently auto".
...

Hm, language auto/auto.  Haven't seen that one before.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2024-03-29  9:00 ` vries at gcc dot gnu.org
@ 2024-03-29 11:52 ` vries at gcc dot gnu.org
  2024-03-29 15:34 ` vries at gcc dot gnu.org
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29 11:52 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |tromey at sourceware dot org

--- Comment #5 from Tom de Vries <vries at gcc dot gnu.org> ---
Bisected this FAIL:
...
FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
...

Bisects to:
...
commit 33c6eaaefcedd45e86d564d014f14cce2620f933 (HEAD, refs/bisect/bad)
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Mar 24 23:35:02 2023 -0600

    Do more DWARF reading in the background
...

Adding a gdb_test "show lang" shows the relevant difference.

Before the commit:
...
(gdb) show language^M
The current source language is "auto; currently c".^M
...
and after the commit:
...
(gdb) show language^M
The current source language is "auto; currently asm".^M
(gdb) PASS: gdb.base/ctf-ptype.exp: show language
...

The test passes after adding "set lang c".

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2024-03-29 11:52 ` vries at gcc dot gnu.org
@ 2024-03-29 15:34 ` vries at gcc dot gnu.org
  2024-03-30  8:41 ` vries at gcc dot gnu.org
  2024-03-30 12:16 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-29 15:34 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #6 from Tom de Vries <vries at gcc dot gnu.org> ---
Hmm, actually, that seems to be right.

Looking in the object, we have both ctf and dwarf info, with dwarf info:
...
$ readelf -wi outputs/gdb.base/ctf-ptype/ctf-ptype0.o 
Contents of the .debug_info section:

  Compilation Unit @ offset 0:
   Length:        0x36 (32-bit)
   Version:       4
   Abbrev Offset: 0
   Pointer Size:  8
 <0><b>: Abbrev Number: 1 (DW_TAG_compile_unit)
    <c>   DW_AT_stmt_list   : 0
    <10>   DW_AT_low_pc      : 0
    <18>   DW_AT_high_pc     : 563
    <1a>   DW_AT_name        : (indirect string, offset: 0): /tmp/ccGk1NDi.s
    <1e>   DW_AT_comp_dir    : (indirect string, offset: 0x10):
/data/vries/gdb/leap-15-4/build/gdb/testsuite
    <22>   DW_AT_producer    : (indirect string, offset: 0x3e): GNU AS 2.41.0
    <26>   DW_AT_language    : 32769    (MIPS assembler)
 <1><28>: Abbrev Number: 2 (DW_TAG_subprogram)
    <29>   DW_AT_name        : (indirect string, offset: 0x4c): main
    <2d>   DW_AT_external    : 1
    <2d>   DW_AT_type        : <0x38>
    <2e>   DW_AT_low_pc      : 0
    <36>   DW_AT_high_pc     : 563
 <1><38>: Abbrev Number: 3 (DW_TAG_unspecified_type)
 <1><39>: Abbrev Number: 0
...

So, why is gas generating dwarf info for main when we're using -gctf?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2024-03-29 15:34 ` vries at gcc dot gnu.org
@ 2024-03-30  8:41 ` vries at gcc dot gnu.org
  2024-03-30 12:16 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-30  8:41 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #7 from Tom de Vries <vries at gcc dot gnu.org> ---
Passes with:
...
diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp
b/gdb/testsuite/gdb.base/ctf-ptype.exp
index 25e31fc8a66..48d6e66542a 100644
--- a/gdb/testsuite/gdb.base/ctf-ptype.exp
+++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
@@ -25,6 +25,7 @@ standard_testfile .c
 # Using `-gctf` generates full-fledged CTF debug information.
 set opts {}
 lappend opts additional_flags=-gctf
+lappend opts "additional_flags=-B/home/vries/binutils/install/bin"
 lappend opts ldflags=-Wl,--ctf-variables
 lappend opts nowarnings

...
and patch applied on trunk:
...
diff --git a/gas/dwarf2dbg.c b/gas/dwarf2dbg.c
index 0871c3c10c9..f75f4fd5368 100644
--- a/gas/dwarf2dbg.c
+++ b/gas/dwarf2dbg.c
@@ -3159,6 +3159,13 @@ dwarf2_finish (void)
       return;
     }

+  segT ctf_seg = bfd_get_section_by_name (stdoutput, ".ctf");
+  if (ctf_seg != NULL && seg_not_empty_p (ctf_seg))
+    {
+      dwarf2_cleanup ();
+      return;
+    }
+  
   /* Calculate the size of an address for the target machine.  */
   sizeof_address = DWARF2_ADDR_SIZE (stdoutput);

...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug testsuite/31573] [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure
  2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2024-03-30  8:41 ` vries at gcc dot gnu.org
@ 2024-03-30 12:16 ` vries at gcc dot gnu.org
  7 siblings, 0 replies; 9+ messages in thread
From: vries at gcc dot gnu.org @ 2024-03-30 12:16 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=31573

--- Comment #8 from Tom de Vries <vries at gcc dot gnu.org> ---
First let's note that:
- gcc defaults to dwarf5 starting gcc 11 (with some exceptions, which do not
  include linux)
- gcc supports -gctf starting gcc 12.

The compiler I'm using is a bit different, because:
- it's gcc 12 so it supports gtcf, but 
- it also defaults to dwarf4 instead of dwarf5.

I investigated on another system, where the gcc both supports gctf and defaults
to dwarf5, found that no dwarf info is generated in that case, and investigated
why.

It's because in the dwarf4 default case, there's only:
...
        .file   "ctf-ptype.c"
...
which does not active this code in dwarf2_directive_filename:
...
  /* A .file directive implies compiler generated debug information is          
     being supplied.  Turn off gas generated debug info.  */
  if (debug_type == DEBUG_DWARF2)
    purge_generated_debug (false);
  debug_type = DEBUG_NONE;
...
while with the dwarf5 default case, there's also:
...
        .file 0 "/home/vries/gdb"
"/data/vries/gdb/src/gdb/testsuite/gdb.base/ctf-ptype.c"
...
which does active that bit of code, setting debug_type to DEBUG_NONE, which
means no dwarf is generated.

So, another way of dealing with this would be to set debug_type to DEBUG_NONE
also for the simple .file directive.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2024-03-30 12:16 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-29  7:00 [Bug testsuite/31573] New: [gdb/testsuite] FAIL: gdb.base/ctf-ptype.exp: ptype linked list structure vries at gcc dot gnu.org
2024-03-29  7:24 ` [Bug testsuite/31573] " vries at gcc dot gnu.org
2024-03-29  8:21 ` vries at gcc dot gnu.org
2024-03-29  8:31 ` vries at gcc dot gnu.org
2024-03-29  9:00 ` vries at gcc dot gnu.org
2024-03-29 11:52 ` vries at gcc dot gnu.org
2024-03-29 15:34 ` vries at gcc dot gnu.org
2024-03-30  8:41 ` vries at gcc dot gnu.org
2024-03-30 12:16 ` 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).