public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: Re: [PATCH 3/3] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed
Date: Wed, 12 Oct 2022 17:11:09 +0200	[thread overview]
Message-ID: <7bd97764-d259-1147-d192-849eac478ea7@suse.de> (raw)
In-Reply-To: <20220922152042.21914-3-tdevries@suse.de>

On 9/22/22 17:20, Tom de Vries via Gdb-patches wrote:
> When running test-case gdb.base/ctf-constvars.exp on openSUSE Tumbleweed (with
> system gcc version 12, providing gcc -gctf support, enabling the ctf test-cases
> in the gdb testsuite), I run into:
> ...
> (gdb) print vox^M
> 'vox' has unknown type; cast it to its declared type^M
> (gdb) FAIL: gdb.base/ctf-constvars.exp: print vox
> ...
> 
> There are two causes for this:
> - the linker flags are missing --ctf-variables, so the information for variable
>    vox is missing (reported in PR29468), and
> - the executable contains some dwarf2 due to some linked-in glibc objects,
>    so the ctf info is ignored (reported in PR29160).
> 
> By using:
> - maint set symbol-read-order ctf, and
> - -Wl,--ctf-variable,
> we can make the test-case and some similar test-cases pass.
> 

I ended up committing 908a926ec4e ("[gdb/testsuite] Fix ctf test-cases 
on openSUSE Tumbleweed"), which uses -Wl,--strip-debug instead of "maint 
set symbol-read-order ctf".

> The expection is gdb.ctf/funcreturn.exp, which is still failing because the
> exec is also missing the function info.  A PR ld/29594 is open about that, so
> add an xfail.
> 

That test-case is now passing, so that xfail is not committed.

Thanks,
- Tom

> Tested on x86_64-linux.
> 
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29160
> Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=29468
> ---
>   gdb/testsuite/gdb.base/ctf-constvars.exp  | 14 ++++++++++----
>   gdb/testsuite/gdb.base/ctf-ptype.exp      | 15 ++++++++++-----
>   gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp | 16 +++++++++++-----
>   gdb/testsuite/gdb.ctf/funcreturn.exp      | 22 ++++++++++++++++------
>   gdb/testsuite/gdb.ctf/multi.exp           | 15 ++++++++++-----
>   5 files changed, 57 insertions(+), 25 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.base/ctf-constvars.exp b/gdb/testsuite/gdb.base/ctf-constvars.exp
> index 6255e9ed02b..f8d78acfcb5 100644
> --- a/gdb/testsuite/gdb.base/ctf-constvars.exp
> +++ b/gdb/testsuite/gdb.base/ctf-constvars.exp
> @@ -32,10 +32,16 @@ if [skip_ctf_tests] {
>   standard_testfile .c
>   
>   # Using `-gctf` generates full-fledged CTF debug information.
> -set opts "additional_flags=-gctf"
> -if { [prepare_for_testing "failed to prepare" ${testfile} \
> -	  [list $srcfile] [list $opts nowarnings]] } {
> -    return 0
> +set opts {}
> +lappend opts "additional_flags=-gctf"
> +lappend opts "additional_flags=-Wl,-ctf-variables"
> +lappend opts "nowarnings"
> +save_vars { GDBFLAGS } {
> +    append GDBFLAGS " -iex \"maint set symbol-read-order ctf\""
> +    if { [prepare_for_testing "failed to prepare" ${testfile} \
> +	      [list $srcfile] $opts] } {
> +	return 0
> +    }
>   }
>   
>   #
> diff --git a/gdb/testsuite/gdb.base/ctf-ptype.exp b/gdb/testsuite/gdb.base/ctf-ptype.exp
> index 48d39e56c7b..e9c5bce15c2 100644
> --- a/gdb/testsuite/gdb.base/ctf-ptype.exp
> +++ b/gdb/testsuite/gdb.base/ctf-ptype.exp
> @@ -26,11 +26,16 @@ set gcc_compiled [is_c_compiler_gcc]
>   standard_testfile .c
>   
>   # Using `-gctf` generates full-fledged CTF debug information.
> -set opts "additional_flags=-gctf"
> -
> -if { [prepare_for_testing "failed to prepare" ${testfile} \
> -	  [list $srcfile] [list $opts nowarnings]] } {
> -    return 0
> +set opts {}
> +lappend opts "additional_flags=-gctf"
> +lappend opts "additional_flags=-Wl,-ctf-variables"
> +lappend opts "nowarnings"
> +save_vars { GDBFLAGS } {
> +    append GDBFLAGS " -iex \"maint set symbol-read-order ctf\""
> +    if { [prepare_for_testing "failed to prepare" ${testfile} \
> +	      [list $srcfile] $opts] } {
> +	return 0
> +    }
>   }
>   
>   # Test ptype of unnamed enumeration members before any action causes
> diff --git a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
> index a43e36bbe68..d573e7d63ab 100644
> --- a/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
> +++ b/gdb/testsuite/gdb.ctf/cross-tu-cyclic.exp
> @@ -24,11 +24,17 @@ standard_testfile cross-tu-cyclic-1.c  cross-tu-cyclic-2.c \
>   	cross-tu-cyclic-3.c  cross-tu-cyclic-4.c
>   
>   # Using `-gctf` generates full-fledged CTF debug information.
> -set opts "additional_flags=-gctf -Wl,--export-dynamic"
> -if { [prepare_for_testing "failed to prepare" ${testfile} \
> -	  [list $srcfile $srcfile2 $srcfile3 $srcfile4] \
> -	  [list $opts nowarnings]] } {
> -    return 0
> +set opts {}
> +lappend opts "additional_flags=-gctf"
> +lappend opts "additional_flags=-Wl,--export-dynamic"
> +lappend opts "nowarnings"
> +save_vars { GDBFLAGS } {
> +    append GDBFLAGS " -iex \"maint set symbol-read-order ctf\""
> +    if { [prepare_for_testing "failed to prepare" ${testfile} \
> +	      [list $srcfile $srcfile2 $srcfile3 $srcfile4] \
> +	      $opts] } {
> +	return 0
> +    }
>   }
>   
>   # Same thing with struct and union.
> diff --git a/gdb/testsuite/gdb.ctf/funcreturn.exp b/gdb/testsuite/gdb.ctf/funcreturn.exp
> index ea01e860a84..ece2d013c07 100644
> --- a/gdb/testsuite/gdb.ctf/funcreturn.exp
> +++ b/gdb/testsuite/gdb.ctf/funcreturn.exp
> @@ -30,18 +30,28 @@ set gcc_compiled [is_c_compiler_gcc]
>   standard_testfile whatis.c
>   
>   # Using `-gctf` generates full-fledged CTF debug information.
> -set opts "additional_flags=-gctf -Wl,--export-dynamic"
> -
> +set opts {}
> +lappend opts "additional_flags=-gctf"
> +lappend opts "additional_flags=-Wl,--export-dynamic"
> +lappend opts "additional_flags=-Wl,-ctf-variables"
> +lappend opts "nowarnings"
>   if { [prepare_for_testing "failed to prepare" ${testfile} \
> -	  [list $srcfile] [list $opts nowarnings]] } {
> +	  [list $srcfile] $opts] } {
>       return 0
>   }
>   
>   # test print command with functions return type
>   set void "(void|)"
> -gdb_test "print v_char_func" \
> -    "$decimal = \{char \\(\\)\} 0x\[0-9a-z\]+ <v_char_func>.*" \
> -    "print char function"
> +gdb_test_multiple "print v_char_func" "print char function" {
> +    -re -wrap "$decimal = \{char \\(\\)\} 0x\[0-9a-z\]+ <v_char_func>.*" {
> +	pass $gdb_test_name
> +    }
> +    -re -wrap "$decimal = {<text variable, no debug info>} $hex <v_char_func>" {
> +	# The ld linker drops functions, see PR ld/29594.
> +	xfail $gdb_test_name
> +	return 0
> +    }
> +}
>   
>   gdb_test "print v_signed_char_func" \
>       "$decimal = \{signed char \\(\\)\} 0x\[0-9a-z\]+ <v_signed_char_func>.*" \
> diff --git a/gdb/testsuite/gdb.ctf/multi.exp b/gdb/testsuite/gdb.ctf/multi.exp
> index 07fd10a884c..ef37507d92b 100644
> --- a/gdb/testsuite/gdb.ctf/multi.exp
> +++ b/gdb/testsuite/gdb.ctf/multi.exp
> @@ -23,11 +23,16 @@ if [skip_ctf_tests] {
>   standard_testfile ctf-a.c ctf-b.c ctf-c.c
>   
>   # Using `-gctf` generates full-fledged CTF debug information.
> -set opts "additional_flags=-gctf -Wl,--export-dynamic"
> -if { [prepare_for_testing "failed to prepare" ${testfile} \
> -	  [list $srcfile $srcfile2 $srcfile3] \
> -	  [list $opts nowarnings]] } {
> -    return 0
> +set opts {}
> +lappend opts "additional_flags=-gctf"
> +lappend opts "additional_flags=-Wl,--export-dynamic"
> +lappend opts "nowarnings"
> +save_vars { GDBFLAGS } {
> +    append GDBFLAGS " -iex \"maint set symbol-read-order ctf\""
> +    if { [prepare_for_testing "failed to prepare" ${testfile} \
> +	      [list $srcfile $srcfile2 $srcfile3] $opts] } {
> +	return 0
> +    }
>   }
>   
>   # Same thing with struct and union.

  reply	other threads:[~2022-10-12 15:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-22 15:20 [PATCH 1/3] [gdb/symtab] Factor out elf_symfile_read_dwarf2 Tom de Vries
2022-09-22 15:20 ` [PATCH 2/3] [RFC][gdb/symtab] Add maint set symbol-read-order Tom de Vries
2022-09-26 10:43   ` Bruno Larsen
2023-02-24 12:42     ` Tom de Vries
2022-09-22 15:20 ` [PATCH 3/3] [gdb/testsuite] Fix ctf test-cases on openSUSE Tumbleweed Tom de Vries
2022-10-12 15:11   ` Tom de Vries [this message]
2022-10-12 15:08 ` [commited][PATCH 1/3] [gdb/symtab] Factor out elf_symfile_read_dwarf2 Tom de Vries

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7bd97764-d259-1147-d192-849eac478ea7@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).