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 B3D3D3945C08 for ; Wed, 18 Mar 2020 13:48:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B3D3D3945C08 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 AB63CACC2; Wed, 18 Mar 2020 13:48:15 +0000 (UTC) Subject: [committed][gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.exp To: Tom Tromey Cc: gdb-patches@sourceware.org References: <20200309145237.GA20334@delia> <874kuv7nxk.fsf@tromey.com> From: Tom de Vries Autocrypt: addr=tdevries@suse.de; keydata= xsBNBF0ltCcBCADDhsUnMMdEXiHFfqJdXeRvgqSEUxLCy/pHek88ALuFnPTICTwkf4g7uSR7 HvOFUoUyu8oP5mNb4VZHy3Xy8KRZGaQuaOHNhZAT1xaVo6kxjswUi3vYgGJhFMiLuIHdApoc u5f7UbV+egYVxmkvVLSqsVD4pUgHeSoAcIlm3blZ1sDKviJCwaHxDQkVmSsGXImaAU+ViJ5l CwkvyiiIifWD2SoOuFexZyZ7RUddLosgsO0npVUYbl6dEMq2a5ijGF6/rBs1m3nAoIgpXk6P TCKlSWVW6OCneTaKM5C387972qREtiArTakRQIpvDJuiR2soGfdeJ6igGA1FZjU+IsM5ABEB AAHNH1RvbSBkZSBWcmllcyA8dGRldnJpZXNAc3VzZS5kZT7CwKsEEwEIAD4WIQSsnSe5hKbL MK1mGmjuhV2rbOJEoAUCXSW0JwIbAwUJA8JnAAULCQgHAgYVCgkICwIEFgIDAQIeAQIXgAAh CRDuhV2rbOJEoBYhBKydJ7mEpsswrWYaaO6FXats4kSgc48H/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y7jyBsP5QxeTqwxC/1ZtNS DUCSFQjqA6bEGwM22dP8OUY6SC94x1G81A9/xbtm9LQxKm0EiDH8KBMLfQ== Message-ID: <871db4cd-d537-e99a-3199-d5b6a76ed30d@suse.de> Date: Wed, 18 Mar 2020 14:48:14 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <874kuv7nxk.fsf@tromey.com> Content-Type: multipart/mixed; boundary="------------245AC0D3019B50D13C6F4842" Content-Language: en-US X-Spam-Status: No, score=-25.0 required=5.0 tests=GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_DMARC_STATUS, KAM_SHORT, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS 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: Wed, 18 Mar 2020 13:48:18 -0000 This is a multi-part message in MIME format. --------------245AC0D3019B50D13C6F4842 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit [ was: Re: [PATCH][gdb/symtab] Fix check-psymtab failure for inline function ] On 11-03-2020 01:08, Tom Tromey wrote: >>>>>> "Tom" == Tom de Vries writes: > > Tom> When loading the executable in gdb, we create a partial symbol for foo, but > Tom> after expansion into a full symbol table no actual symbol is created, > Tom> resulting in a maint check-psymtab failure: > Tom> ... > Tom> (gdb) maint check-psymtab > Tom> Static symbol `foo' only found in inline.c psymtab > Tom> ... > > Tom> Fix this by preventing the creation of this type of partial symbol. > > With this patch, if there is a function which is only inlined (there is > no "out-line" copy), will "break function" still work? > > It seems to me that it wouldn't always, because there wouldn't be a > partial symbol to match. Maybe it might work accidentally if the inline > function appears in a CU that is already expanded, like main's. So the > test would have to be an always-inline function that isn't used in > main's CU. > I managed to construct a test-case like that, which: - passes with master, and - fails if I apply the "preventing the creation of this type of partial symbol" patch. Since it seems there's no other test-case in the testsuite testing this behaviour ... committed as obvious. Thanks, - Tom --------------245AC0D3019B50D13C6F4842 Content-Type: text/x-patch; charset=UTF-8; name="0001-gdb-testsuite-Add-test-case-gdb.dwarf2-break-inline-psymtab.exp.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename*0="0001-gdb-testsuite-Add-test-case-gdb.dwarf2-break-inline-psy"; filename*1="mtab.exp.patch" [gdb/testsuite] Add test-case gdb.dwarf2/break-inline-psymtab.exp Add a test-case that tests whether we can set a breakpoint on an inlined inline function in CU for which the partial symtab has not yet been expanded. Tested on x86_64-linux, with gcc 4.8.5, gcc-7.5.0, gcc-10.0.1, and clang 5.0.2. gdb/testsuite/ChangeLog: 2020-03-18 Tom de Vries * gdb.dwarf2/break-inline-psymtab-2.c: New test. * gdb.dwarf2/break-inline-psymtab.c: New test. * gdb.dwarf2/break-inline-psymtab.exp: New file. --- gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c | 33 +++++++++++++++++++++ gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c | 24 +++++++++++++++ gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp | 36 +++++++++++++++++++++++ 3 files changed, 93 insertions(+) diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c new file mode 100644 index 0000000000..38c69336f2 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab-2.c @@ -0,0 +1,33 @@ +/* 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 . */ + +extern int foo (void); + +int a; + +static inline int +bar (void) +{ + a = 2; + return 0; +} + +int +foo (void) +{ + return bar (); +} diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c new file mode 100644 index 0000000000..74cea4bf90 --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.c @@ -0,0 +1,24 @@ +/* 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 . */ + +extern int foo (void); + +int +main (void) +{ + return foo (); +} diff --git a/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp new file mode 100644 index 0000000000..adbe8620aa --- /dev/null +++ b/gdb/testsuite/gdb.dwarf2/break-inline-psymtab.exp @@ -0,0 +1,36 @@ +# Copyright 2019-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 . + +standard_testfile break-inline-psymtab.c break-inline-psymtab-2.c + +set sources [list $srcfile $srcfile2] +set opts {debug optimize=-O2} +if { [prepare_for_testing "failed to prepare" ${testfile} $sources $opts] } { + return -1 +} + +if ![runto_main] { + return -1 +} + +get_compiler_info +get_debug_format +if { [skip_inline_frame_tests] } { + return -1 +} + +# Set a break-point in inline function bar, in a CU for which the partial +# symtab has not been expanded. +gdb_breakpoint "bar" message --------------245AC0D3019B50D13C6F4842--