Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Lancelot SIX via Gdb-patches <gdb-patches@sourceware.org>
To: Carl Love <cel@us.ibm.com>
Cc: Ulrich Weigand <Ulrich.Weigand@de.ibm.com>,
	gdb-patches@sourceware.org, Rogerio Alves <rogealve@br.ibm.com>
Subject: Re: [PATCH] Fix gdb.cp/no-dmgl-verbose.exp test
Date: Fri, 29 Apr 2022 09:14:29 +0000	[thread overview]
Message-ID: <20220429091234.62xhprge74gfpgks@ubuntu.lan> (raw)
In-Reply-To: <5ee342cd5f5272da9970da8a077c2c5209b85d6c.camel@us.ibm.com>

Hi,

Thanks for looking into it.

On Thu, Apr 28, 2022 at 06:28:31PM -0700, Carl Love via Gdb-patches wrote:
> 
> GDB maintainers:
> 
> The gdb.cp/no-dmgl-verbose.exp test does a gdb_test which is not
> written correctly.  The test fails on both PowerPC and Intel.  The
> following patch update the gdb_test statement to the correct format. 
> The test now works correctly on PowerPC and Intel.
> 
> Please let me know if the patch is acceptable for mainline.  Thanks.
> 
>                      Carl Love
> 
> 
> -----------------------------------------------------------------------
> Fix gdb.cp/no-dmgl-verbose.exp test
> 
> The test tries to check that setting a break point on f (std::string) fails
> since the function is not defined.  The test is not syntactically correct.
> The test fails on both PowerPC and Intel.
> 
> This patch fixes the test to set the breakpoint and verify that it fails
> since the function is not defined.
> 
> The test now runs correctly on Power 10 and Intel x86_64.
> ---
>  gdb/testsuite/gdb.cp/no-dmgl-verbose.exp | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp b/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp
> index 14f11ddcf04..d4ec88f3b6d 100644
> --- a/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp
> +++ b/gdb/testsuite/gdb.cp/no-dmgl-verbose.exp
> @@ -28,8 +28,5 @@ clean_restart ${testfile}.o
>  
>  gdb_test_no_output "set breakpoint pending off"
>  
> -gdb_breakpoint {'f(std::string)'}
> -
> -gdb_test {break 'f(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)'} \
> -	 {Function ".*" not defined\.} \
> +gdb_test "break 'f(std::string)'" ".*Function.*not defined." \
                                                             ^

I guess here the last . should be escaped (\.) otherwise has a special
meaning for a regex.

>  	 "DMGL_VERBOSE-demangled f(std::string) is not defined"

Also looks like that the test was testing that we can break on
"f(std::string)", not "f($what_string_really_is)".  This is not GDB's
behaviour, as far as I can tell.  To me GDB does the opposite.  One can
break using the full name of std::string, not "std::string".

Also, on my system, std::string is in reality
"std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >",
not what is used in the test.

I can test such behaviour with something like:

    gdb_test "break 'f(std::string)'" ".*Function.*not defined\." \
        "f(std::string) is not defined"

    set realtype ""
    gdb_test_multiple "info types ^std::string$" "" {
        -re -wrap "typedef (\[^;\]*) std::string;" {
            set realtype $expect_out(1,string)
            pass $gdb_test_name
        }
    }

    if { $realtype != "" } {
        gdb_breakpoint "f($realtype)"
    }

That being said, it would be nice to be able to place a breakpoint using
"f(std::string)"…

Best,
Lancelot.

  reply	other threads:[~2022-04-29  9:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-29  1:28 Carl Love via Gdb-patches
2022-04-29  9:14 ` Lancelot SIX via Gdb-patches [this message]
2022-04-29 15:48   ` Carl Love via Gdb-patches
2022-04-29 16:45     ` Bruno Larsen via Gdb-patches
2022-04-29 16:57     ` Pedro Alves
2022-04-29 17:09       ` Keith Seitz via Gdb-patches
2022-04-29 17:20         ` Pedro Alves
2022-04-29 17:26           ` Pedro Alves
2022-04-29 18:40           ` Pedro Alves
2022-04-29 19:13             ` Carl Love via Gdb-patches
2022-04-30  0:56               ` [PATCH] Fix "b func(std::string)", use DMGL_VERBOSE (was: Re: [PATCH] Fix gdb.cp/no-dmgl-verbose.exp test) Pedro Alves
2022-04-30  2:54                 ` Carl Love via Gdb-patches
2022-04-30 21:11                 ` Lancelot SIX via Gdb-patches
2022-05-02 15:46                   ` Pedro Alves
2022-05-05 18:53                     ` Pedro Alves
2022-04-30  1:00             ` [PATCH] Fix gdb.cp/no-dmgl-verbose.exp test Pedro Alves
2022-04-29 17:23         ` Lancelot SIX via Gdb-patches

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=20220429091234.62xhprge74gfpgks@ubuntu.lan \
    --to=gdb-patches@sourceware.org \
    --cc=Ulrich.Weigand@de.ibm.com \
    --cc=cel@us.ibm.com \
    --cc=lsix@lancelotsix.com \
    --cc=rogealve@br.ibm.com \
    /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