diff options
author | Tom de Vries <tdevries@suse.de> | 2021-01-12 17:36:51 +0100 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2021-01-12 17:36:51 +0100 |
commit | 3f94e588596cdca710de71735127560788fd8770 (patch) | |
tree | 6cb984ba9648946d0cf395aac2eb95879b58ce6a /gdb/testsuite/gdb.arch/i386-mpx-map.exp | |
parent | b2f2ae0d6ff07e935f6ab23132f1fed02640d204 (diff) | |
download | gdb-3f94e588596cdca710de71735127560788fd8770.zip gdb-3f94e588596cdca710de71735127560788fd8770.tar.gz gdb-3f94e588596cdca710de71735127560788fd8770.tar.bz2 |
[gdb/testsuite] Add have_mpx in lib/gdb.exp
The sources for the test-cases gdb.arch/i386-mpx*.exp contain have_mpx
functions that test whether the processor supports mpx instructions.
OTOH, the test-cases are compiled using -mmpx -fcheck-pointer-bounds, which
instrument all functions with mpx instructions.
So, the function that is supposed to test whether mpx instruction are
supported contains mpx instructions, which is a bit odd.
We could fix this by:
- factoring out the have_mpx function into a single source file, and
- compiling it without "-mmpx -fcheck-pointer-bounds".
But having the mpx support test as part of the test-cases seems like an
unnecessary complication that makes the test-cases more difficult to analyze,
reason about and modify.
So we go one step further and factor out the mpx support test in into a
gdb_caching_proc.
Tested on x86_64-linux.
gdb/testsuite/ChangeLog:
2021-01-12 Tom de Vries <tdevries@suse.de>
* gdb.arch/i386-mpx-call.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-call.exp: Use have_mpx.
* gdb.arch/i386-mpx-map.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx-map.exp: Use have_mpx.
* gdb.arch/i386-mpx-sigsegv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-sigsegv.exp: Use have_mpx.
* gdb.arch/i386-mpx-simple_segv.c (have_mpx): Remove.
(main): Remove call to have_mpx.
* gdb.arch/i386-mpx-simple_segv.exp: Use have_mpx.
* gdb.arch/i386-mpx.c (have_mpx): Remove.
(main): Remote call to have_mpx.
* gdb.arch/i386-mpx.exp: Use have_mpx.
* lib/gdb.exp (have_mpx): New proc.
Diffstat (limited to 'gdb/testsuite/gdb.arch/i386-mpx-map.exp')
-rw-r--r-- | gdb/testsuite/gdb.arch/i386-mpx-map.exp | 23 |
1 files changed, 5 insertions, 18 deletions
diff --git a/gdb/testsuite/gdb.arch/i386-mpx-map.exp b/gdb/testsuite/gdb.arch/i386-mpx-map.exp index a98194d..55b70d1 100644 --- a/gdb/testsuite/gdb.arch/i386-mpx-map.exp +++ b/gdb/testsuite/gdb.arch/i386-mpx-map.exp @@ -27,6 +27,11 @@ if { ![supports_mpx_check_pointer_bounds] } { return -1 } +if { ![have_mpx] } { + unsupported "processor does not support MPX" + return -1 +} + set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/" if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \ @@ -39,24 +44,6 @@ if ![runto_main] { return -1 } -set supports_mpx 0 -set test "probe MPX support" - -gdb_test_multiple "print have_mpx()" $test { - -re ".. = 1\r\n$gdb_prompt $" { - pass $test - set supports_mpx 1 - } - -re ".. = 0\r\n$gdb_prompt $" { - pass $test - } -} - -if { !$supports_mpx } { - unsupported "processor does not support MPX" - return -} - gdb_breakpoint [ gdb_get_line_number "after-decl" ] gdb_breakpoint [ gdb_get_line_number "after-alloc" ] gdb_breakpoint [ gdb_get_line_number "after-assign" ] |