public inbox for gdb-cvs@sourceware.org help / color / mirror / Atom feed
From: Tom de Vries <vries@sourceware.org> To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Fix c-linkage-name.exp with -flto Date: Tue, 31 Mar 2020 10:17:31 +0000 (GMT) [thread overview] Message-ID: <20200331101731.2B7B3385B835@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=16b0db75af6b4b4d434aa84c74d58b7290e04143 commit 16b0db75af6b4b4d434aa84c74d58b7290e04143 Author: Tom de Vries <tdevries@suse.de> Date: Tue Mar 31 12:17:27 2020 +0200 [gdb/testsuite] Fix c-linkage-name.exp with -flto When running test-case gdb.base/c-linkage-name.exp with target board unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects, I run into: ... PASS: gdb.base/c-linkage-name.exp: maint info psymtab: c-linkage-name-2.c: no FAIL: gdb.base/c-linkage-name.exp: print symada__cS before partial symtab \ expansion ... The test-case tries to print a symbol before and after symtab expansion. And it tries to ensure (since commit 13c3a74afb) that the symtab containing the symbol is not yet expanded when doing the 'before' print, by placing the symbol in a different CU (c-linkage-name-2.c) from the one containing main (c-linkage-name.c), such that when we load the exec and expand the symtab containing main, the symtab containing the symbol isn't. The generated debug info for the test-case when using mentioned target board however is structured like this: ... <0><d2>: Abbrev Number: 1 (DW_TAG_compile_unit) <d8> DW_AT_name : <artificial> <1><f4>: Abbrev Number: 2 (DW_TAG_imported_unit) <f5> DW_AT_import : <0x16b> [Abbrev Number: 1] <1><f9>: Abbrev Number: 2 (DW_TAG_imported_unit) <fa> DW_AT_import : <0x19c> [Abbrev Number: 1] <1><fe>: Abbrev Number: 3 (DW_TAG_subprogram) <ff> DW_AT_abstract_origin: <0x17d> <1><115>: Abbrev Number: 4 (DW_TAG_variable) <116> DW_AT_abstract_origin: <0x1ce> <0><16b>: Abbrev Number: 1 (DW_TAG_compile_unit) <171> DW_AT_name : c-linkage-name.c <1><17d>: Abbrev Number: 2 (DW_TAG_subprogram) <17e> DW_AT_name : main <0><19c>: Abbrev Number: 1 (DW_TAG_compile_unit) <1a2> DW_AT_name : c-linkage-name-2.c <1><1ce>: Abbrev Number: 5 (DW_TAG_variable) <1cf> DW_AT_name : mundane <1d6> DW_AT_linkage_name: symada__cS ... So, the CU named <artificial> contains both the concrete main and the concrete symbol, which explains the FAIL. The first test should fail, but passes for two reasons. First of all, due to PR symtab/25700, we have two regular partial symtabs c-linkage-name-2.c instead of one, and one of them is expanded, the other one not: ... { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38d6f60) readin yes { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38d6fe0) readin no ... And then there's the include symtab, which is also not expanded: ... { psymtab c-linkage-name-2.c ((struct partial_symtab *) 0x38143e0) readin no ... Fix the FAIL by explicitly setting the language before load, changing the language setting from auto/c to manual/c, such that the symtab containing main is no longer expanded. And make the symtab expansion testing more robust by using the output of "maint info symtabs" instead of "maint info psymtabs". Tested on x86_64-linux, using native and target boards cc-with-gdb-index.exp, cc-with-debug-names.exp, readnow.exp and unix/-flto/-O0/-flto-partition=none/-ffat-lto-objects. gdb/testsuite/ChangeLog: 2020-03-31 Tom de Vries <tdevries@suse.de> * gdb.base/c-linkage-name.exp: Fix test-case comment. Set language to c. Use "maint info symtabs" to check symtab expansion. Diff: --- gdb/testsuite/ChangeLog | 5 +++++ gdb/testsuite/gdb.base/c-linkage-name.exp | 20 +++++++++++++------- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9d879fba3bc..bb31bcdf3ac 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2020-03-31 Tom de Vries <tdevries@suse.de> + + * gdb.base/c-linkage-name.exp: Fix test-case comment. Set language to + c. Use "maint info symtabs" to check symtab expansion. + 2020-03-30 Tom de Vries <tdevries@suse.de> * gdb.base/c-linkage-name.exp: Use readnow call to mark a test diff --git a/gdb/testsuite/gdb.base/c-linkage-name.exp b/gdb/testsuite/gdb.base/c-linkage-name.exp index 9a472a79a29..8afd8ce301a 100644 --- a/gdb/testsuite/gdb.base/c-linkage-name.exp +++ b/gdb/testsuite/gdb.base/c-linkage-name.exp @@ -14,8 +14,8 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # This file is part of the gdb testsuite. It is intended to test that -# gdb can correctly print arrays with indexes for each element of the -# array. +# gdb can correctly print an ada symbol with linkage name before and after +# symtab expansion. standard_testfile c-linkage-name.c c-linkage-name-2.c @@ -25,13 +25,19 @@ if { [gdb_compile "${sources}" "${binfile}" executable {debug}] != "" } { return -1 } -clean_restart ${binfile} +clean_restart +gdb_test_no_output "set language c" +gdb_load ${binfile} set readnow [readnow] -# Verify that partial symtab expansion has not taken place for -# c-linkage-name-2.c. +set test "verify no symtab expansion" +if { $readnow } { + unsupported $test +} else { + # Verify that symtab expansion has not taken place. -verify_psymtab_expanded c-linkage-name-2.c no + gdb_test_no_output "maint info symtabs" $test +} set test "print symada__cS before partial symtab expansion" if { $readnow } { @@ -54,7 +60,7 @@ gdb_test "break do_something_other_cu" \ # Verify that partial symtab expansion has taken place for # c-linkage-name-2.c. -verify_psymtab_expanded c-linkage-name-2.c yes +gdb_test "maint info symtabs" "\{ symtab \[^\r\n\]*c-linkage-name-2.c.*" # Flush the symbol cache to prevent the lookup to return the same as before.
reply other threads:[~2020-03-31 10:17 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20200331101731.2B7B3385B835@sourceware.org \ --to=vries@sourceware.org \ --cc=gdb-cvs@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: linkBe 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).