From patchwork Mon Jul 10 16:27:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 72434 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1F5B63857706 for ; Mon, 10 Jul 2023 16:28:09 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1F5B63857706 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1689006489; bh=Ugkk79VtgmdWIMdZcA+At4UzwJt6KlsOhdEtZi9NZus=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=JFAy8w/O2YKQLXHLIqQnvhp9XZ5cQZS0SyjU91b0kKCI6kqCbU294T8axLL+Kv/EG 9Vbh0YtmaqtCgzl/6EqjwZju+E3H/QdVaTzZoz+ccIhWyEwJsZmu/Tph0SzNpC0iFl VNhxUCYG83ibduNWhDn++wd0jyEMAXebOVXhl/rc= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) by sourceware.org (Postfix) with ESMTPS id 81FD43858D32 for ; Mon, 10 Jul 2023 16:27:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81FD43858D32 Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-7837329a00aso149486839f.2 for ; Mon, 10 Jul 2023 09:27:44 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689006463; x=1691598463; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Ugkk79VtgmdWIMdZcA+At4UzwJt6KlsOhdEtZi9NZus=; b=fbYZhnd8LOLtcucotaA0OAb0qR2feJuEJMy8LDkWt74fqIrAbkacxcS7E35Z7vChxQ KsVxBWbiTRzTx4HM1WrB7BFi0n0mWXFAahRcieDdlOXNUWoKNTQUD0TRgUjcu3FwDWS7 b0ceBBbcIqzGcpW+gmGAGhzMOMoh8HM9doqgLmlICZRYqpIW1FGwVpoZXsUma2VfGDQg OaqxN/NJDhNSV58AslXRAXX5gPlukIcsZzJMqh1ZOYgPmqPd5KEkYu7v9rI04rGVrFTC E5sxdF1ItLEkpVYYySmZbFkW2W539ew3UnuePUZ5woLn233JRlMzhUNoYdZT6klTa1k3 73ew== X-Gm-Message-State: ABy/qLZ86VjbCIigsar6vU1czPyrG+Fo31ku1LbAKgjmQyzij//3Blzs +cvt9zNnqoT6kni0NDARxr3wKAz/QiR48VyEXTm+rA== X-Google-Smtp-Source: APBJJlFkWFvge5TfIv+61rbczONRZbivo4npirR6DkpzIHYceDbSrX4vDLPS60a56FSueR0CDJkiRg== X-Received: by 2002:a5d:954a:0:b0:783:56f2:e733 with SMTP id a10-20020a5d954a000000b0078356f2e733mr12771436ios.4.1689006463569; Mon, 10 Jul 2023 09:27:43 -0700 (PDT) Received: from localhost.localdomain (75-166-135-140.hlrn.qwest.net. [75.166.135.140]) by smtp.gmail.com with ESMTPSA id ep20-20020a0566384e1400b0042bbfe3dc42sm532005jab.173.2023.07.10.09.27.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 09:27:42 -0700 (PDT) To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Remove some TODOs from gdb.cp tests Date: Mon, 10 Jul 2023 10:27:36 -0600 Message-Id: <20230710162736.1695116-1-tromey@adacore.com> X-Mailer: git-send-email 2.40.1 MIME-Version: 1.0 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Tom Tromey via Gdb-patches From: Tom Tromey Reply-To: Tom Tromey Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" This patch removes many TODOs from the gdb.cp tests. Going through the patch: * bs15503.exp - these have been commented out forever and rely on libstdc++ debuginfo. It's better to just remove these. * classes.exp - the test is wrong, I think, according to the C++ ABI that gdb understands; and the test can be fixed and comments removed with a simple change to the code. * ctti.exp - there's no need to bail out any more, as the test works. * exception.exp - the code relying on the line numbers can't work, because gdb never prints that message anyway. Reviewed-By: Bruno Larsen --- gdb/testsuite/gdb.cp/bs15503.exp | 32 ------------------- gdb/testsuite/gdb.cp/classes.cc | 7 ++-- gdb/testsuite/gdb.cp/classes.exp | 7 +--- gdb/testsuite/gdb.cp/ctti.exp | 17 ---------- gdb/testsuite/gdb.cp/exception.exp | 51 +++++++----------------------- 5 files changed, 15 insertions(+), 99 deletions(-) diff --git a/gdb/testsuite/gdb.cp/bs15503.exp b/gdb/testsuite/gdb.cp/bs15503.exp index 29118629d24..a9f043c4f9e 100644 --- a/gdb/testsuite/gdb.cp/bs15503.exp +++ b/gdb/testsuite/gdb.cp/bs15503.exp @@ -50,35 +50,3 @@ gdb_test "print s\[0\]" "\\$\[0-9\]+ =.* 'I'" gdb_test "print s\[s.length()-1\]" "\\$\[0-9\]+ =.* 'g'" gdb_test "print (const char *) s" \ "\\$\[0-9\]+ = $hex \"I am a short stringand now a longer string\"" - -# TODO: tests that do not work with gcc 2.95.3 -# -- chastain 2004-01-07 -# -# gdb_test "print s.compare(s)" "\\$\[0-9\]+ = 0" -# gdb_test "print s.compare(\"AAA\")" "\\$\[0-9\]+ = 1" -# gdb_test "print s.compare(\"ZZZ\")" "\\$\[0-9\]+ = -1" - -# TODO: tests that do not work with gcc 2.95.3 and gcc 3.3.2. -# cannot call overloaded non-member operator. -- chastain 2004-01-07 -# -# gdb_test "print s == s" "\\$\[0-9\]+ = true" -# gdb_test "print s > "AAA" "\\$\[0-9\]+ = true" -# gdb_test "print s < "ZZZ" "\\$\[0-9\]+ = true" - -# TODO: GDB doesn't know to convert the string to a const char *, and -# instead tries to use the string as a structure initializer. -# -# gdb_test "print s == \"I am a short stringand now a longer string\"" \ -# "\\$\[0-9\]+ = true" - -gdb_test "print (const char *) s.substr(0,4)" "\\$\[0-9\]+ = $hex \"I am\"" -gdb_test "print (const char *) (s=s.substr(0,4))" \ - "\\$\[0-9\]+ = $hex \"I am\"" - -# TODO: cannot call overloaded non-member operator again. -# -- chastain 2004-01-07 -# -# gdb_test "print (const char *) (s + s)" \ -# "\\$\[0-9\]+ = $hex \"I amI am\"" -# gdb_test "print (const char *) (s + \" \" + s)" \ -# "\\$\[0-9\]+ = $hex \"I am I am\"" diff --git a/gdb/testsuite/gdb.cp/classes.cc b/gdb/testsuite/gdb.cp/classes.cc index fdd1a9b4afa..bf5879e403c 100644 --- a/gdb/testsuite/gdb.cp/classes.cc +++ b/gdb/testsuite/gdb.cp/classes.cc @@ -646,16 +646,13 @@ Outer Outer::instance; int main() { + int Foo::* pmi = &Foo::y; + dummy(); inheritance1 (); inheritance3 (); enums1 (); - /* FIXME: pmi gets optimized out. Need to do some more computation with - it or something. (No one notices, because the test is xfail'd anyway, - but that probably won't always be true...). */ - int Foo::* pmi = &Foo::y; - /* Make sure the AIX linker doesn't remove the variable. */ v_tagless.one = 5; diff --git a/gdb/testsuite/gdb.cp/classes.exp b/gdb/testsuite/gdb.cp/classes.exp index 4b1b01df383..ed37daecac7 100644 --- a/gdb/testsuite/gdb.cp/classes.exp +++ b/gdb/testsuite/gdb.cp/classes.exp @@ -601,12 +601,7 @@ proc test_pointers_to_class_members {} { gdb_test "ptype Bar::z" "type = int" gdb_test "ptype &Bar::z" "type = int Bar::\\*" - # TODO: this is a bogus test. It's looking at a variable that - # has not even been declared yet, so it's accessing random junk - # on the stack and comparing that it's NOT equal to a specific - # value. It's been like this since gdb 4.10 in 1993! - # -- chastain 2004-01-01 - gdb_test "print (int)pmi == sizeof(int)" ".* = false" + gdb_test "print (int)pmi == sizeof(int)" ".* = true" } # Test static members. diff --git a/gdb/testsuite/gdb.cp/ctti.exp b/gdb/testsuite/gdb.cp/ctti.exp index 0c02085cec6..4d117618a75 100644 --- a/gdb/testsuite/gdb.cp/ctti.exp +++ b/gdb/testsuite/gdb.cp/ctti.exp @@ -41,17 +41,11 @@ gdb_test "print c" "\\$\[0-9\]+ = 194 .*" gdb_test "print f" "\\$\[0-9\]+ = 9" gdb_test "print i" "\\$\[0-9\]+ = 4" -# TODO: this needs more work before actually deploying it. -# So bail out here. - -if {[test_compiler_info gcc-*]} { return } - gdb_test_multiple "print add(2,2)" "print add(2,2)" { -re "\\$\[0-9\]+ = 4\r\n$gdb_prompt $" { pass "print add(2,2)" } -re "No symbol \"add\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add(2,2)" } } @@ -62,7 +56,6 @@ gdb_test_multiple "print add(2.25,2.25)" "print add(2.25,2.25)" { pass "print add(2.25,2.25)" } -re "No symbol \"add\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add(2.25,2.25)" } } @@ -72,7 +65,6 @@ gdb_test_multiple "print add('A','A')" "print add( pass "print add('A','A')" } -re "No symbol \"add\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add('A','A')" } } @@ -82,7 +74,6 @@ gdb_test_multiple "print add2(2,2)" "print add2(2,2)" { pass "print add2(2,2)" } -re "No symbol \"add2\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add2(2,2)" } } @@ -92,7 +83,6 @@ gdb_test_multiple "print add2(2.25,2.25)" "print add2(2.25,2.25)" pass "print add2(2.25,2.25)" } -re "No symbol \"add2\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add2(2.25,2.25)" } } @@ -102,7 +92,6 @@ gdb_test_multiple "print add2('A','A')" "print add2('A','A')" } -re "No symbol \"add2\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add2('A','A')" } } @@ -112,7 +101,6 @@ gdb_test_multiple "print add3(2,2)" "print add3(2,2)" { pass "print add3(2,2)" } -re "No symbol \"add3\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add3(2,2)" } } @@ -122,7 +110,6 @@ gdb_test_multiple "print add3(2.25,2.25)" "print add3(2.25,2.25)" pass "print add3(2.25,2.25)" } -re "No symbol \"add3\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add3(2.25,2.25)" } } @@ -132,7 +119,6 @@ gdb_test_multiple "print add3('A','A')" "print add3('A','A')" } -re "No symbol \"add3\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add3('A','A')" } } @@ -142,7 +128,6 @@ gdb_test_multiple "print add4(2,2)" "print add4(2,2)" { pass "print add4(2,2)" } -re "No symbol \"add4\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add4(2,2)" } } @@ -152,7 +137,6 @@ gdb_test_multiple "print add4(2.25,2.25)" "print add4(2.25,2.25)" pass "print add4(2.25,2.25)" } -re "No symbol \"add4\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add4(2.25,2.25)" } } @@ -162,7 +146,6 @@ gdb_test_multiple "print add4('A','A')" "print add4('A','A')" } -re "No symbol \"add4\" in current context.\r\n$gdb_prompt $" { - # TODO: kfail or xfail this fail "print add4('A','A')" } } diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index 4308d327da3..2c7ef7793ee 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -27,9 +27,6 @@ # Static-linked executables use a different mechanism to get the # address of the notification hook in the C++ support library. -# TODO: this file has many absolute line numbers. -# Replace them with gdb_get_line_number. - set ws "\[\r\n\t \]+" set nl "\[\r\n\]+" @@ -105,15 +102,9 @@ gdb_test "break catcher" "Breakpoint \[0-9\]+ at.*" # Get the first exception thrown -set name "continue to first throw" -gdb_test_multiple "continue" $name { - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { - pass $name - } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" { - pass $name - } -} +gdb_test "continue" \ + "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*" \ + "continue to first throw" # Backtrace from the throw point. # This should get to user code. @@ -129,15 +120,9 @@ gdb_test_multiple "backtrace" $name { # Continue to the catch. -set name "continue to first catch" -gdb_test_multiple "continue" $name { - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:50\r\n$gdb_prompt $" { - pass $name - } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*\r\n$gdb_prompt $" { - pass $name - } -} +gdb_test "continue" \ + "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*" \ + "continue to first catch" # Backtrace from the catch point. # This should get to user code. @@ -154,15 +139,9 @@ gdb_test "continue" ".*catcher \\(x=13\\).*" "continue to catcher for the first # Continue to second throw. -set name "continue to second throw" -gdb_test_multiple "continue" $name { - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { - pass $name - } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*\r\n$gdb_prompt $" { - pass $name - } -} +gdb_test "continue" \ + "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception thrown\\).*" \ + "continue to second throw" # Backtrace from the throw point. # This should get to user code. @@ -176,15 +155,9 @@ gdb_test_multiple "backtrace" $name { # Continue to second catch. -set name "continue to second catch" -gdb_test_multiple "continue" $name { - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\), throw location.*${srcfile}:30, catch location .*${srcfile}:58\r\n$gdb_prompt $" { - pass $name - } - -re "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*\r\n$gdb_prompt $" { - pass $name - } -} +gdb_test "continue" \ + "Continuing.${ws}Catchpoint \[0-9\]+ \\(exception caught\\).*" \ + "continue to second catch" # Backtrace from the catch point. # This should get to user code.