From: Simon Marchi <simark@simark.ca>
To: Tom de Vries <tdevries@suse.de>, gdb-patches@sourceware.org
Subject: Re: [PATCH][gdb/testsuite] Detect 'No MPX support'
Date: Mon, 11 Apr 2022 11:00:36 -0400 [thread overview]
Message-ID: <330da9ef-584c-2072-83d0-fd60ee477632@simark.ca> (raw)
In-Reply-To: <20220411142553.GA13322@delia.home>
On 2022-04-11 10:25, Tom de Vries via Gdb-patches wrote:
> Hi,
>
> On openSUSE Leap 15.3, mpx support has been disabled for m32, so I run into:
> ...
> (gdb) run ^M
> Starting program: outputs/gdb.arch/i386-mpx/i386-mpx ^M
> [Thread debugging using libthread_db enabled]^M
> Using host libthread_db library "/lib64/libthread_db.so.1".^M
> No MPX support^M
> ...
> and eventually into all sort of fails in this and other mpx test-cases.
>
> Fix this by detecting the "No MPX support" message in have_mpx.
>
> Tested on x86_64-linux with target boards unix and unix/-m32.
>
> Any comments?
>
> Thanks,
> - Tom
>
> [gdb/testsuite] Detect 'No MPX support'
>
> ---
> gdb/testsuite/lib/gdb.exp | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
> index 2eb711748e7..9eb01e0b4b2 100644
> --- a/gdb/testsuite/lib/gdb.exp
> +++ b/gdb/testsuite/lib/gdb.exp
> @@ -8329,6 +8329,29 @@ gdb_caching_proc have_mpx {
>
> remote_file build delete $obj
>
> + if { $status == 0 } {
> + verbose "$me: returning $status" 2
> + return $status
> + }
> +
> + # Compile program with -mmpx -fcheck-pointer-bounds, try to trigger
> + # 'No MPX support', in other words, see if kernel supports mpx.
> + set src { int main (void) { return 0; } }
> + set comp_flags {}
> + append comp_flags " additional_flags=-mmpx"
> + append comp_flags " additional_flags=-fcheck-pointer-bounds"
> + if {![gdb_simple_compile $me-2 $src executable $comp_flags]} {
> + return 0
> + }
> +
> + set result [remote_exec target $obj]
> + set status [lindex $result 0]
> + set output [lindex $result 1]
> + set status [expr ($status == 0) \
> + && ![string equal $output "No MPX support\r\n"]]
> +
> + remote_file build delete $obj
> +
> verbose "$me: returning $status" 2
> return $status
> }
It seems fine to me. I am just wondering:
- Who prints this "No MPX support" string exactly? When it is printed,
is the status other than 0? If so, it wouldn't be necessary to check
for the "No MPX support" output, just check if the program runs
successfully.
- Why do you need to compile a separate program with -mmpx, why not the
existing test program?
Simon
next prev parent reply other threads:[~2022-04-11 15:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-11 14:25 Tom de Vries via Gdb-patches
2022-04-11 15:00 ` Simon Marchi [this message]
2022-04-12 6:03 ` Tom de Vries via Gdb-patches
2022-04-13 8:58 ` Tom de Vries via Gdb-patches
2022-04-13 15:29 ` Simon Marchi
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=330da9ef-584c-2072-83d0-fd60ee477632@simark.ca \
--to=simark@simark.ca \
--cc=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