public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] gdb/testsuite: skip gdb.cp/anon-struct.exp when using Clang
@ 2022-11-11  9:17 Bruno Larsen
  0 siblings, 0 replies; only message in thread
From: Bruno Larsen @ 2022-11-11  9:17 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=ad9421bb1532bfd6ff14c6d841177a6e6d07fd27

commit ad9421bb1532bfd6ff14c6d841177a6e6d07fd27
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Thu Sep 29 13:05:42 2022 +0200

    gdb/testsuite: skip gdb.cp/anon-struct.exp when using Clang
    
    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.
    
    Approved-by: Tom Tromey <tom@tromey.com>

Diff:
---
 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"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-11-11  9:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-11  9:17 [binutils-gdb] gdb/testsuite: skip gdb.cp/anon-struct.exp when using Clang Bruno Larsen

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).