From: Bruno Larsen <blarsen@redhat.com>
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 [thread overview]
Message-ID: <20221013160114.4143323-2-blarsen@redhat.com> (raw)
In-Reply-To: <20221013160114.4143323-1-blarsen@redhat.com>
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
next prev parent reply other threads:[~2022-10-13 16:05 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-13 16:01 [PATCH 0/2] Improve error messages with incomplete variables Bruno Larsen
2022-10-13 16:01 ` Bruno Larsen [this message]
2022-10-31 14:46 ` [PATCH 1/2] gdb/testsuite: allowed for function_range to deal with mangled functions Andrew Burgess
2022-11-03 15:46 ` Bruno Larsen
2022-10-13 16:01 ` [PATCH 2/2] gdb/c++: Improve error messages in overload resolution Bruno Larsen
2022-10-31 15:04 ` Andrew Burgess
2022-11-04 13:55 ` Bruno Larsen
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=20221013160114.4143323-2-blarsen@redhat.com \
--to=blarsen@redhat.com \
--cc=gdb-patches@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: link
Be 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).