public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb/gdb-12-branch] [gdb/testsuite] Detect 'No MPX support'
@ 2022-04-14 11:17 Tom de Vries
  0 siblings, 0 replies; only message in thread
From: Tom de Vries @ 2022-04-14 11:17 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d4c9e8f5834939909859ad748c31b7a3d239aeab

commit d4c9e8f5834939909859ad748c31b7a3d239aeab
Author: Tom de Vries <tdevries@suse.de>
Date:   Thu Apr 14 13:17:24 2022 +0200

    [gdb/testsuite] Detect 'No MPX support'
    
    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.

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 08726f78563..6f6acfe188a 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -8302,6 +8302,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
 }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-14 11:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 11:17 [binutils-gdb/gdb-12-branch] [gdb/testsuite] Detect 'No MPX support' Tom de Vries

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).