public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Bruno Larsen <blarsen@redhat.com>
To: gdb-patches@sourceware.org
Cc: Bruno Larsen <blarsen@redhat.com>
Subject: [PATCH v2 6/9] gdb/testsuite: skip gdb.cp/anon-struct.exp when using Clang
Date: Mon,  7 Nov 2022 14:46:02 +0100	[thread overview]
Message-ID: <20221107134604.596986-7-blarsen@redhat.com> (raw)
In-Reply-To: <20221107134604.596986-1-blarsen@redhat.com>

When Clang compiles anonymous structures, it does not add linkage names in
their dwarf representations. This is compounded by Clang not adding linkage
names to subprograms of those anonymous structs (for instance, the
constructor). With these 2 things together, GDB is unable to refer to
any of them, so there is no way to pass any of the tests of
gdb.cp/anon-struct.exp

Since this isn't a bug on Clang or GDB according to the DWARF
specifications as DW_AT_name is optional for all DIEs, the test was marked
as untested.

Since I was already touching the file, I also added a comment at the top
of the file explaining what it is testing for.
---
 gdb/testsuite/gdb.cp/anon-struct.exp | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/gdb/testsuite/gdb.cp/anon-struct.exp b/gdb/testsuite/gdb.cp/anon-struct.exp
index 2c709ab9ecc..2113957fed0 100644
--- a/gdb/testsuite/gdb.cp/anon-struct.exp
+++ b/gdb/testsuite/gdb.cp/anon-struct.exp
@@ -14,12 +14,22 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
+# This test is used to verify GDB's ability to refer to linkage names
+# for types and functions within anonymous structures.
+
 standard_testfile .cc
 
 if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} {debug c++}] } {
      return -1
 }
 
+# Clang doesn't add any names for functions within anonymous structures,
+# so there is no way to try and refer to them inside GDB.
+if {[test_compiler_info clang-*-* c++]} {
+    untested "clang does not use linkage name in this case"
+    return
+}
+
 if { [is_aarch32_target] } {
     gdb_test "ptype t::t" "type = struct t {\r\n    C m;\r\n} \\*\\(t \\* const\\)" \
 	"print type of t::t"
-- 
2.37.3


  parent reply	other threads:[~2022-11-07 13:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-07 13:45 [PATCH v2 0/9] Cleanup gdb.cp tests when running with clang Bruno Larsen
2022-11-07 13:45 ` [PATCH v2 1/9] gdb/testsuite: ignore Non-C-typedefs for gdb.cp/class2.exp Bruno Larsen
2022-11-07 13:45 ` [PATCH v2 2/9] gdb/testsuite: enable running gdb.cp/classes.exp with clang Bruno Larsen
2022-11-07 13:45 ` [PATCH v2 3/9] gdb/testsuite: account for clang's nested destructor calls on gdb.cp/mb-ctor.exp Bruno Larsen
2022-11-07 13:46 ` [PATCH v2 4/9] gdb/testsuite: add XFAIL to gdb.cp/derivation.exp when using Clang Bruno Larsen
2022-11-07 13:46 ` [PATCH v2 5/9] gdb/testsuite: allow for Clang style destructors on gdb.cp/m-static.exp Bruno Larsen
2022-11-07 13:46 ` Bruno Larsen [this message]
2022-11-07 13:46 ` [PATCH v2 7/9] gdb/testsuite: disable some tests of gdb.cp/typeid.exp when using Clang Bruno Larsen
2022-11-07 13:46 ` [PATCH v2 8/9] gdb/testsuite: remove XFAIL on gdb.cp/temargs.exp Bruno Larsen
2022-11-10 18:21   ` Tom Tromey
2022-11-07 13:46 ` [PATCH v2 9/9] gdb/testsuite: disable gdb.cp/call-method-register.exp when not using gcc Bruno Larsen
2022-11-10 18:24 ` [PATCH v2 0/9] Cleanup gdb.cp tests when running with clang Tom Tromey
2022-11-11  8:38   ` Bruno Larsen

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=20221107134604.596986-7-blarsen@redhat.com \
    --to=blarsen@redhat.com \
    --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).