From patchwork Tue Feb 25 11:01:42 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 38299 Received: (qmail 2577 invoked by alias); 25 Feb 2020 11:01:56 -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 2569 invoked by uid 89); 25 Feb 2020 11:01:56 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-25.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx2.suse.de Received: from mx2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 25 Feb 2020 11:01:46 +0000 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 26FC5AD79 for ; Tue, 25 Feb 2020 11:01:44 +0000 (UTC) Date: Tue, 25 Feb 2020 12:01:42 +0100 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH][gdb/testsuite] Fix mi-sym-info.exp matching FAILs Message-ID: <20200225110141.GA25681@delia> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes Hi, When running gdb.mi/mi-sym-info.exp on openSUSE Leap 15.1, I get: ... FAIL: gdb.mi/mi-sym-info.exp: List all functions matching type void \ (unexpected output) FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-variables --max-results 3 \ (unexpected output) FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-types --max-results 4 \ (unexpected output) ... The executable contains debug info from files other than the source files: ... $ readelf -wi mi-sym-info | grep "DW_AT_name.*\.[cS]$" | awk '{print $8}' ../sysdeps/x86_64/start.S init.c ../sysdeps/x86_64/crti.S src/gdb/testsuite/gdb.mi/mi-sym-info-1.c src/gdb/testsuite/gdb.mi/mi-sym-info-2.c elf-init.c ../sysdeps/x86_64/crtn.S ... The test does not expect this extra info, resulting in matching failures. Fix this by restricting the failing commands using --name. Tested on x86_64-linux. OK for trunk? Thanks, - Tom [gdb/testsuite] Fix mi-sym-info.exp matching FAILs gdb/testsuite/ChangeLog: 2020-02-25 Tom de Vries * gdb.mi/mi-sym-info-2.c (another_char_t, another_short_t): New typedef. (var1, var2): New variable. * gdb.mi/mi-sym-info.exp: Add --name to various commands to restrict matching symbols. --- gdb/testsuite/gdb.mi/mi-sym-info-2.c | 5 +++++ gdb/testsuite/gdb.mi/mi-sym-info.exp | 13 ++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-sym-info-2.c b/gdb/testsuite/gdb.mi/mi-sym-info-2.c index a63d888d84..f514e426d5 100644 --- a/gdb/testsuite/gdb.mi/mi-sym-info-2.c +++ b/gdb/testsuite/gdb.mi/mi-sym-info-2.c @@ -41,3 +41,8 @@ f3 (another_int_t arg) return arg + 2; } +typedef char another_char_t; +typedef short another_short_t; + +static another_char_t var1; +static another_short_t var2; diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp index 9df683ad9d..015f83dc7b 100644 --- a/gdb/testsuite/gdb.mi/mi-sym-info.exp +++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp @@ -105,7 +105,7 @@ mi_gdb_test "116-symbol-info-functions --name f3" \ "List all functions matching pattern f3" set lineno [gdb_get_line_number "f4 (int *arg)" ${srcfile}] -mi_gdb_test "117-symbol-info-functions --type void" \ +mi_gdb_test "117-symbol-info-functions --type void --name ^\[^_\]" \ "117\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"36\",name=\"f4\",type=\"void \\(int \\*\\)\",description=\"void f4\\(int \\*\\);\"\}\\\]\}\\\]\}" \ "List all functions matching type void" @@ -141,10 +141,13 @@ mi_gdb_test "123-symbol-info-functions --max-results 2" \ "123\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"33\",name=\"f2\",type=\"float \\(another_float_t\\)\",description=\"float f2\\(another_float_t\\);\"\},\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \ "-symbol-info-functions --max-results 2" -mi_gdb_test "124-symbol-info-variables --max-results 3" \ +mi_gdb_test "124-symbol-info-variables --max-results 3 --name ^\[^_\]" \ "124\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\},\{line=\"20\",name=\"global_i2\",type=\"int\",description=\"int global_i2;\"\},\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \ - "-symbol-info-variables --max-results 3" -mi_gdb_test "125-symbol-info-types --max-results 4" \ - "125\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"24\",name=\"another_float_t\"\},\{line=\"23\",name=\"another_int_t\"\},\{name=\"float\"\},\{name=\"int\"\}\\\]\}\\\]\}" \ +set s1 "\{line=\"44\",name=\"another_char_t\"\}" +set s2 "\{line=\"24\",name=\"another_float_t\"\}" +set s3 "\{line=\"23\",name=\"another_int_t\"\}" +set s4 "\{line=\"45\",name=\"another_short_t\"\}" +mi_gdb_test "125-symbol-info-types --max-results 4 --name another_" \ + "125\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]+$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$s1,$s2,$s3,$s4\\\]\}\\\]\}" \ "-symbol-info-types --max-results 4"