From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id aLvwGILiOWFSAwAAWB0awg (envelope-from ) for ; Thu, 09 Sep 2021 06:31:30 -0400 Received: by simark.ca (Postfix, from userid 112) id 2E9C81EE23; Thu, 9 Sep 2021 06:31:30 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 612781EDDB for ; Thu, 9 Sep 2021 06:31:28 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 62E5A384B0E6 for ; Thu, 9 Sep 2021 10:31:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62E5A384B0E6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1631183487; bh=E5nuokroh15QwV+j51CI4Ljo2IVdjnzaAhzNJVnCc4M=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=Y1MHjJWH5gm3jbXFS8rZbhf2WgVo9pT92wXCwaMQ7oh6/qyP4pOIZ4d8UgClXcQWv Uy6p7DylWovMeO0ljsWAZhEuSkFLWpNZDMrKnQYVxvQxrN7cS+gl9kbj8kjXIxdSzP sbeHVjVuvSRhoaHqwyx87gqjOBPusNAP8v/pNL9Q= Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by sourceware.org (Postfix) with ESMTPS id 857FF3858C2C for ; Thu, 9 Sep 2021 10:31:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 857FF3858C2C Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 78AF7201C9 for ; Thu, 9 Sep 2021 10:31:06 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 65A4B13BF2 for ; Thu, 9 Sep 2021 10:31:06 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DtuPF2riOWHpNQAAMHmgww (envelope-from ) for ; Thu, 09 Sep 2021 10:31:06 +0000 Date: Thu, 9 Sep 2021 12:31:04 +0200 To: gdb-patches@sourceware.org Subject: [committed][gdb/testsuite] Fix various issues in gdb.mi/mi-sym-info.exp Message-ID: <20210909103102.GA18643@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-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: , From: Tom de Vries via Gdb-patches Reply-To: Tom de Vries Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hi, I noticed this failure in gdb.mi/mi-sym-info.exp with gcc-4.8: ... FAIL: gdb.mi/mi-sym-info.exp: -symbol-info-functions --max-results 1 \ (unexpected output) ... due to function f2 instead of f3 being listed. AFAICT, this is caused by a difference in debug info: ... $ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \ | egrep "DW_AT_name.*: f[1-3]" <72> DW_AT_name : f1 DW_AT_name : f2 DW_AT_name : f3 ... vs: ... $ readelf -wi outputs/gdb.mi/mi-sym-info/mi-sym-info1.o \ | egrep "DW_AT_name.*: f[1-3]" DW_AT_name : f3 <123> DW_AT_name : f2 <152> DW_AT_name : f1 ... and the command documentation does not mention an imposed order, so fix this by allowing f2 as well. Doing this fix, it made sense to do a refactoring of adding f2_re and f3_re variables, in order to write (?:$f2_re|$f3_re), and I applied the same pattern overall. Furthermore, I found a silent FAIL due to calling mi_gdb_proc with 2 args, fix by updating the regexp. Then I ran with clang and found another FAIL, fix by updating the regexp. Tested on x86_64-linux with gcc-4.8.5, gcc-7.5.0, gcc-11.2.1, clang-7.0.1 and clang-12.0.1. Committed to trunk. Thanks, - Tom [gdb/testsuite] Fix various issues in gdb.mi/mi-sym-info.exp --- gdb/testsuite/gdb.mi/mi-sym-info.exp | 47 ++++++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/gdb/testsuite/gdb.mi/mi-sym-info.exp b/gdb/testsuite/gdb.mi/mi-sym-info.exp index dcd6f7d9187..dfe23ec49ca 100644 --- a/gdb/testsuite/gdb.mi/mi-sym-info.exp +++ b/gdb/testsuite/gdb.mi/mi-sym-info.exp @@ -189,34 +189,58 @@ with_timeout_factor 4 { } } +set f2_re \ + "\{line=\"33\",name=\"f2\",type=\"float \\(another_float_t\\)\",description=\"float f2\\(another_float_t\\);\"\}" +set f3_re \ + "\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}" +set f4_re \ + "\{line=\"36\",name=\"f4\",type=\"void \\(int \\*\\)\",description=\"void f4\\(int \\*\\);\"\}" + +set global_i1_re \ + "\{line=\"18\",name=\"global_i1\",type=\"int\",description=\"static int global_i1;\"\}" +set global_f2_re \ + "\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\}" +set global_i2_re \ + "\{line=\"20\",name=\"global_i2\",type=\"int\",description=\"int global_i2;\"\}" +set global_f1_s1_re \ + "\{line=\"25\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}" +set global_f1_s2_re \ + "\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}" + +set another_int_re "\{line=\"23\",name=\"another_int_t\"\}" +set my_int_re "\{line=\"27\",name=\"my_int_t\"\}" +set another_char_re "\{line=\"44\",name=\"another_char_t\"\}" +set another_float_re "\{line=\"24\",name=\"another_float_t\"\}" +set another_short_re "\{line=\"45\",name=\"another_short_t\"\}" + # Filter functions by name and type. set lineno [gdb_get_line_number "f3 (another_int_t arg)" ${srcfile2}] mi_gdb_test "116-symbol-info-functions --name ^f3$" \ - "116\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \ + "116\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$f3_re\\\]\}\\\]\}" \ "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 --name ^f4$" \ - "117\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"36\",name=\"f4\",type=\"void \\(int \\*\\)\",description=\"void f4\\(int \\*\\);\"\}\\\]\}\\\]\}" \ + "117\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[$f4_re\\\]\}\\\]\}" \ "List all functions matching type void" # Filter variables by name and type. set lineno [gdb_get_line_number "int global_f2;" ${srcfile2}] mi_gdb_test "118-symbol-info-variables --name global_f2" \ - "118\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"21\",name=\"global_f2\",type=\"int\",description=\"int global_f2;\"\}\\\]\}\\\]\}" \ + "118\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$global_f2_re\\\]\}\\\]\}" \ "List all variables matching pattern global_f2" set lineno1 [gdb_get_line_number "static float __attribute__ ((used)) global_f1;" ${srcfile}] set lineno2 [gdb_get_line_number "static float __attribute__ ((used)) global_f1;" ${srcfile2}] mi_gdb_test "119-symbol-info-variables --type float --name ^global_" \ - "119\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"25\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"19\",name=\"global_f1\",type=\"float\",description=\"static float global_f1;\"\}\\\]\}\\\]\}" \ + "119\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[$global_f1_s1_re\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$global_f1_s2_re\\\]\}\\\]\}" \ "List all variables matching type float" # Fetch types, filtering by name. set lineno1 [gdb_get_line_number "typedef int my_int_t;" ${srcfile}] set lineno2 [gdb_get_line_number "typedef int another_int_t;" ${srcfile2}] mi_gdb_test "120-symbol-info-types --name _int_" \ - "120\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[\{line=\"27\",name=\"my_int_t\"\}\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"23\",name=\"another_int_t\"\}\\\]\}\\\]\}" \ + "120\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile\",fullname=\"\[^\"\]+$srcfile\",symbols=\\\[$my_int_re\\\]\},\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$another_int_re\\\]\}\\\]\}" \ "List all types matching _int_" # Test the --max-results parameter. @@ -225,20 +249,17 @@ mi_gdb_test "121-symbol-info-functions --max-results 0" \ "-symbol-info-functions --max-results 0" mi_gdb_test "122-symbol-info-functions --max-results 1 --name ^\[^_\]" \ - "122\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[\{line=\"39\",name=\"f3\",type=\"int \\(another_int_t\\)\",description=\"int f3\\(another_int_t\\);\"\}\\\]\}\\\]\}" \ + "122\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[(?:$f2_re|$f3_re)\\\]\}\\\]\}" \ "-symbol-info-functions --max-results 1" mi_gdb_test "123-symbol-info-functions --max-results 2 --name ^\[^_\]" \ - "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\\);\"\}\\\]\}\\\]\}" \ + "123\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$f2_re,$f3_re\\\]\}\\\]\}" \ "-symbol-info-functions --max-results 2" 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;\"\}\\\]\}\\\]\}" \ + "124\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$global_f2_re,$global_i2_re,(?:$global_i1_re|$global_f1_s2_re)\\\]\}\\\]\}" \ + "-symbol-info-types --max-results 3" -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\\\]\}\\\]\}" \ + "125\\^done,symbols=\{debug=\\\[\{filename=\"\[^\"\]*$srcfile2\",fullname=\"\[^\"\]+$srcfile2\",symbols=\\\[$another_char_re,$another_float_re,$another_int_re,$another_short_re\\\]\}\\\]\}" \ "-symbol-info-types --max-results 4"