From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 7A2913858C55 for ; Thu, 13 Oct 2022 16:05:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7A2913858C55 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-637-iXCtMqHtMKKNx9BfKZhYAQ-1; Thu, 13 Oct 2022 12:05:45 -0400 X-MC-Unique: iXCtMqHtMKKNx9BfKZhYAQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 796B6856508 for ; Thu, 13 Oct 2022 16:05:45 +0000 (UTC) Received: from fedora.redhat.com (unknown [10.39.194.150]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B7F0740C2144; Thu, 13 Oct 2022 16:05:44 +0000 (UTC) From: Bruno Larsen To: gdb-patches@sourceware.org Subject: [PATCH 1/2] gdb/testsuite: allowed for function_range to deal with mangled functions Date: Thu, 13 Oct 2022 18:01:15 +0200 Message-Id: <20221013160114.4143323-2-blarsen@redhat.com> In-Reply-To: <20221013160114.4143323-1-blarsen@redhat.com> References: <20221013160114.4143323-1-blarsen@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-12.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) 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: Thu, 13 Oct 2022 16:05:48 -0000 When calling get_func_info inside a test case, it would cause failures if the function was printed using a C++ style mangled name. The current patch fixes this by allowing for mangled names along with the current rules. --- gdb/testsuite/lib/dwarf.exp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/gdb/testsuite/lib/dwarf.exp b/gdb/testsuite/lib/dwarf.exp index b85ec290299..351fc8fad6f 100644 --- a/gdb/testsuite/lib/dwarf.exp +++ b/gdb/testsuite/lib/dwarf.exp @@ -397,18 +397,28 @@ proc function_range { func src {options {debug}} } { # Take this into account by optionally allowing an argument list after # the function name. set func_pattern "$func\(\?\:\\(\.\*\\)\)?" + # It is also possible that the function is printed as + # <'mangled_func'base+[0-9]*> or similar. Therefore, allow for starting + # with a mangled name, and followed by more mangling and offsets. + set func_mangled "\_\[a-zA-Z0-9\]\*$func.\*" if { $func_length != 0 } { set func_pattern "$func_pattern\\+$func_length" } set test "x/2i $func+$func_length" gdb_test_multiple $test $test { -re ".*($hex) <$func_pattern>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { set start $expect_out(1,string) set end $expect_out(2,string) + set func_length [expr $func_length + $end - $start] + } + -re ".*($hex) <$func_mangled>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" { + set start $expect_out(1,string) + set end $expect_out(2,string) + set func_length [expr $func_length + $end - $start] } } shared_gdb_end_use -- 2.37.3