From patchwork Wed Oct 16 15:01:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Simon Marchi (Code Review)" X-Patchwork-Id: 35041 Received: (qmail 32398 invoked by alias); 16 Oct 2019 15:01:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 32291 invoked by uid 89); 16 Oct 2019 15:01:13 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT autolearn=ham version=3.3.1 spammy=48 X-HELO: mx1.osci.io Received: from polly.osci.io (HELO mx1.osci.io) (8.43.85.229) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 16 Oct 2019 15:01:11 +0000 Received: by mx1.osci.io (Postfix, from userid 994) id E24D520905; Wed, 16 Oct 2019 11:01:09 -0400 (EDT) Received: from gnutoolchain-gerrit.osci.io (gnutoolchain-gerrit.osci.io [IPv6:2620:52:3:1:5054:ff:fe06:16ca]) by mx1.osci.io (Postfix) with ESMTP id 1E16B20674; Wed, 16 Oct 2019 11:01:05 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by gnutoolchain-gerrit.osci.io (Postfix) with ESMTP id F16F720AF7; Wed, 16 Oct 2019 11:01:04 -0400 (EDT) X-Gerrit-PatchSet: 2 Date: Wed, 16 Oct 2019 11:01:04 -0400 From: "Sourceware to Gerrit sync (Code Review)" To: Tom de Vries , gdb-patches@sourceware.org Cc: Tom Tromey Auto-Submitted: auto-generated X-Gerrit-MessageType: merged Subject: [review] [gdb/testsuite] Fix local-static.exp with g++-4.8 X-Gerrit-Change-Id: Ibe86707eecffc79f1bb474d7928ea7d0c39a00a2 X-Gerrit-Change-Number: 33 X-Gerrit-ChangeURL: X-Gerrit-Commit: 03e1ab9424bd1d37da5818549067ef7a7b7ec641 In-Reply-To: References: Reply-To: noreply@gnutoolchain-gerrit.osci.io, tdevries@suse.de, tromey@sourceware.org, gdb-patches@sourceware.org MIME-Version: 1.0 Content-Disposition: inline User-Agent: Gerrit/3.0.3 Message-Id: <20191016150104.F16F720AF7@gnutoolchain-gerrit.osci.io> Sourceware to Gerrit sync has submitted this change. Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/33 ...................................................................... [gdb/testsuite] Fix local-static.exp with g++-4.8 With g++-4.8, I see: ... (gdb) PASS: gdb.cp/local-static.exp: c++: print free_inline_func(void) print 'S::method()'::S_M_s_var_int^M No symbol "S_M_s_var_int" in specified context.^M (gdb) FAIL: gdb.cp/local-static.exp: c++: print 'S::method()'::S_M_s_var_int ... The variable is declared like this (showing pruned .ii): ... void S::method () { static int S_M_s_var_int = 4; } ... But the DWARF generated for the variable is encapsulated in an unnamed lexical block: ... <1><121>: Abbrev Number: 5 (DW_TAG_structure_type) <122> DW_AT_name : S ... <2><14f>: Abbrev Number: 6 (DW_TAG_subprogram) ... <150> DW_AT_name : (indirect string, offset: 0x599): method <156> DW_AT_linkage_name: (indirect string, offset: 0x517): \ _ZN1S6methodEv /* demangled: dS::method() */ ... <1><3f8>: Abbrev Number: 21 (DW_TAG_subprogram) <3f9> DW_AT_specification: <0x14f> ... <3fe> DW_AT_low_pc : 0x4004fc <406> DW_AT_high_pc : 0x2c /* 0x400528 */ ... <2><418>: Abbrev Number: 17 (DW_TAG_formal_parameter) <419> DW_AT_name : (indirect string, offset: 0x68a): this ... <2><424>: Abbrev Number: 18 (DW_TAG_lexical_block) <425> DW_AT_low_pc : 0x400508 <42d> DW_AT_high_pc : 0x1e /* 0x400526 */ <3><435>: Abbrev Number: 22 (DW_TAG_variable) <436> DW_AT_name : (indirect string, offset: 0x29d): S_M_s_var_int ... which has the effect that the variable is not addressable unless the program counter is in the range of the lexical block. This is caused by gcc PR debug/55541, which was fixed in gcc 5. Mark in total 225 FAILs as XFAIL. Tested on x86_64-linux. gdb/testsuite/ChangeLog: 2019-10-16 Tom de Vries PR testsuite/25059 * gdb.cp/local-static.exp (do_test): Add xfails for gcc PR debug/55541. Change-Id: Ibe86707eecffc79f1bb474d7928ea7d0c39a00a2 --- M gdb/testsuite/ChangeLog M gdb/testsuite/gdb.cp/local-static.exp 2 files changed, 42 insertions(+), 3 deletions(-) diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index c9e2457..877d0de 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2019-10-16 Tom de Vries + PR testsuite/25059 + * gdb.cp/local-static.exp (do_test): Add xfails for gcc PR debug/55541. + +2019-10-16 Tom de Vries + * gdb.base/jit-reader.exp: Allow non-pointer registers to be printed as signed. diff --git a/gdb/testsuite/gdb.cp/local-static.exp b/gdb/testsuite/gdb.cp/local-static.exp index fe0e2dc..9905ffb 100644 --- a/gdb/testsuite/gdb.cp/local-static.exp +++ b/gdb/testsuite/gdb.cp/local-static.exp @@ -130,6 +130,7 @@ global cxx_scopes_list global vars_list global srcfile testfile + global gdb_prompt set options {debug} @@ -201,12 +202,45 @@ set var [lindex $var_line 0] set print_re [lindex $var_line 1] - gdb_test "print '${scope}'::${var_prefix}_${var}" $print_re - gdb_test "print ${scope}::${var_prefix}_${var}" $print_re + # The gcc PR debug/55541 has the effect that local statics are + # wrapped in a DW_TAG_lexical_block, making them unaddressable from + # outside the function. XFAIL the relevant tests. + set test "print '${scope}'::${var_prefix}_${var}" + set xfail_pattern "No symbol \".*\" in specified context." + gdb_test_multiple $test $test { + -re "\[\r\n\]*(?:$print_re)\[\r\n\]+$gdb_prompt $" { + pass $test + } + -re "\[\r\n\]*(?:$xfail_pattern)\[\r\n\]+$gdb_prompt $" { + xfail $test + } + } + set test "print ${scope}::${var_prefix}_${var}" + gdb_test_multiple $test $test { + -re "\[\r\n\]*(?:$print_re)\[\r\n\]+$gdb_prompt $" { + pass $test + } + -re "\[\r\n\]*(?:$xfail_pattern)\[\r\n\]+$gdb_prompt $" { + xfail $test + } + } set sym "${scope}::${var_prefix}_${var}" if {$lang == "c++"} { - gdb_test "print '${sym}'" $print_re + set test "print '${sym}'" + set xfail_pattern "No symbol .* in current context." + set xfail_pattern2 "has unknown type; cast it to its declared type" + gdb_test_multiple $test $test { + -re "\[\r\n\]*(?:$print_re)\[\r\n\]+$gdb_prompt $" { + pass $test + } + -re "\[\r\n\]*(?:$xfail_pattern)\[\r\n\]+$gdb_prompt $" { + xfail $test + } + -re "\[\r\n\]*(?:$xfail_pattern2)\[\r\n\]+$gdb_prompt $" { + xfail $test + } + } } else { gdb_test "print '${sym}'" "No symbol \"$sym\" in current context\\." }