From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [committed][gdb/testsuite] Factor out with_PIE_multilib_flags_filtered
Date: Fri, 14 Oct 2022 13:10:25 +0200 [thread overview]
Message-ID: <20221014111024.GA11135@delia.home> (raw)
Hi,
Factor out new procs with_PIE_multilib_flags_filtered and
with_multilib_flags_filtered from proc gdb_compile_shlib.
Tested on x86_64-linux.
Committed to trunk.
Thanks,
- Tom
[gdb/testsuite] Factor out with_PIE_multilib_flags_filtered
---
gdb/testsuite/lib/gdb.exp | 29 ++++++++++++++++++++++-------
1 file changed, 22 insertions(+), 7 deletions(-)
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 3049a7392a4..7de8bb60c19 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -4983,20 +4983,17 @@ proc gdb_compile_shlib_1 {sources dest options} {
return ""
}
-# Build a shared library from SOURCES. Ignore target boards PIE-related
-# multilib_flags.
+# Ignore FLAGS in target board multilib_flags while executing BODY.
-proc gdb_compile_shlib {sources dest options} {
+proc with_multilib_flags_filtered { flags body } {
global board
- # Ignore PIE-related setting in multilib_flags.
+ # Ignore flags in multilib_flags.
set board [target_info name]
set multilib_flags_orig [board_info $board multilib_flags]
set multilib_flags ""
foreach op $multilib_flags_orig {
- if { $op == "-pie" || $op == "-no-pie" \
- || $op == "-fPIE" || $op == "-fno-PIE"} {
- } else {
+ if { [lsearch -exact $flags $op] == -1 } {
append multilib_flags " $op"
}
}
@@ -5004,6 +5001,24 @@ proc gdb_compile_shlib {sources dest options} {
save_target_board_info { multilib_flags } {
unset_board_info multilib_flags
set_board_info multilib_flags "$multilib_flags"
+ set result [uplevel 1 $body]
+ }
+
+ return $result
+}
+
+# Ignore PIE-related flags in target board multilib_flags while executing BODY.
+
+proc with_PIE_multilib_flags_filtered { body } {
+ set pie_flags [list "-pie" "-no-pie" "-fPIE" "-fno-PIE"]
+ return [uplevel 1 [list with_multilib_flags_filtered $pie_flags $body]]
+}
+
+# Build a shared library from SOURCES. Ignore target boards PIE-related
+# multilib_flags.
+
+proc gdb_compile_shlib {sources dest options} {
+ with_PIE_multilib_flags_filtered {
set result [gdb_compile_shlib_1 $sources $dest $options]
}
reply other threads:[~2022-10-14 11:10 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221014111024.GA11135@delia.home \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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