From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2205) id A81D63857418; Thu, 14 Apr 2022 10:32:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A81D63857418 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Tom de Vries To: gdb-cvs@sourceware.org Subject: [binutils-gdb] [gdb/testsuite] Detect 'No MPX support' X-Act-Checkin: binutils-gdb X-Git-Author: Tom de Vries X-Git-Refname: refs/heads/master X-Git-Oldrev: c641fe0dcb886dc1b8a235ab2b236275ee46510a X-Git-Newrev: 75b2a443d515f531299ce1ed942810edd5bf5d84 Message-Id: <20220414103254.A81D63857418@sourceware.org> Date: Thu, 14 Apr 2022 10:32:54 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 14 Apr 2022 10:32:54 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D75b2a443d515= f531299ce1ed942810edd5bf5d84 commit 75b2a443d515f531299ce1ed942810edd5bf5d84 Author: Tom de Vries Date: Thu Apr 14 12:32:51 2022 +0200 [gdb/testsuite] Detect 'No MPX support' =20 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. =20 Fix this by detecting the "No MPX support" message in have_mpx. =20 Tested on x86_64-linux with target boards unix and unix/-m32. Diff: --- 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 902fb4a7b5e..7c35fbb18c4 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -8329,6 +8329,29 @@ gdb_caching_proc have_mpx { =20 remote_file build delete $obj =20 + if { $status =3D=3D 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=3D-mmpx" + append comp_flags " additional_flags=3D-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 =3D=3D 0) \ + && ![string equal $output "No MPX support\r\n"]] + + remote_file build delete $obj + verbose "$me: returning $status" 2 return $status }