From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id 8E521386F430 for ; Tue, 26 May 2020 09:35:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8E521386F430 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tdevries@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 6A86BAC11 for ; Tue, 26 May 2020 09:35:59 +0000 (UTC) Date: Tue, 26 May 2020 11:35:55 +0200 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Add test-case gold-gdb-index.exp Message-ID: <20200526093553.GA6964@delia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Tue, 26 May 2020 09:35:59 -0000 Hi, There's a PR binutils/15646 - "gold-generated .gdb_index has duplicated symbols that gdb-generated index doesn't", and gdb contains a workaround, added in commit 8943b87476 "Work around gold/15646". Add a test-case testing this workaround. Tested on x86_64-linux. Committed to trunk. Thanks, - Tom [gdb/testsuite] Add test-case gold-gdb-index.exp gdb/testsuite/ChangeLog: 2020-05-26 Tom de Vries * gdb.base/gold-gdb-index-2.c: New test. * gdb.base/gold-gdb-index.c: New test. * gdb.base/gold-gdb-index.exp: New file. * gdb.base/gold-gdb-index.h: New test. --- gdb/testsuite/gdb.base/gold-gdb-index-2.c | 23 +++++++++++++++ gdb/testsuite/gdb.base/gold-gdb-index.c | 29 +++++++++++++++++++ gdb/testsuite/gdb.base/gold-gdb-index.exp | 48 +++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/gold-gdb-index.h | 25 ++++++++++++++++ 4 files changed, 125 insertions(+) diff --git a/gdb/testsuite/gdb.base/gold-gdb-index-2.c b/gdb/testsuite/gdb.base/gold-gdb-index-2.c new file mode 100644 index 0000000000..2df637b554 --- /dev/null +++ b/gdb/testsuite/gdb.base/gold-gdb-index-2.c @@ -0,0 +1,23 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2020 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "gold-gdb-index.h" + +namespace N1 +{ + void bar () { C1::baz (); } +} diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.c b/gdb/testsuite/gdb.base/gold-gdb-index.c new file mode 100644 index 0000000000..e0f8c2e419 --- /dev/null +++ b/gdb/testsuite/gdb.base/gold-gdb-index.c @@ -0,0 +1,29 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2020 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#include "gold-gdb-index.h" + +namespace N1 +{ + void foo () { C1::baz (); } +} + +int +main () +{ + return 0; +} diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.exp b/gdb/testsuite/gdb.base/gold-gdb-index.exp new file mode 100644 index 0000000000..e42bf439dd --- /dev/null +++ b/gdb/testsuite/gdb.base/gold-gdb-index.exp @@ -0,0 +1,48 @@ +# Copyright 2020 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . */ + +# This tests the gdb workaround for PR binutils/15646. + +standard_testfile .c gold-gdb-index-2.c + +if {[prepare_for_testing "failed to prepare" $testfile "$srcfile $srcfile2" \ + {debug c++ additional_flags=-fuse-ld=gold \ + additional_flags=-Wl,--gdb-index \ + additional_flags=-ggnu-pubnames}]} { + return -1 +} + +if { [readnow] } { + return -1 +} + +gdb_test_no_output "set auto-solib-add off" + +if ![runto_main] then { + fail "can't run to main" + return 0 +} + +gdb_test_no_output "set breakpoint pending off" +gdb_test "break N1::misspelled" "Function \"N1::misspelled\" not defined\." + +gdb_test_multiple "maint info symtabs" "" { + -re -wrap "\{ symtab \[^\r\n\]*gold-gdb-index-2.c.*" { + fail $gdb_test_name + } + -re -wrap "" { + pass $gdb_test_name + } +} diff --git a/gdb/testsuite/gdb.base/gold-gdb-index.h b/gdb/testsuite/gdb.base/gold-gdb-index.h new file mode 100644 index 0000000000..81ebb7b16a --- /dev/null +++ b/gdb/testsuite/gdb.base/gold-gdb-index.h @@ -0,0 +1,25 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2020 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +namespace N1 +{ + class C1 + { + public: + static void baz () {} + }; +}