]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdb/testsuite/gdb.arch/i386-mpx-map.exp
[gdb/testsuite] Fix failure in gdb.threads/signal-sigtrap.exp
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.arch / i386-mpx-map.exp
CommitLineData
1d506c26 1# Copyright 2015-2024 Free Software Foundation, Inc.
29c1c244
WT
2#
3# Contributed by Intel Corp. <walfred.tedeschi@intel.com>,
4# <mircea.gherzan@intel.com>
5#
6# This program is free software; you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation; either version 3 of the License, or
9# (at your option) any later version.
10#
11# This program is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with this program. If not, see <http://www.gnu.org/licenses/>.
18
c7ccb471 19require {is_any_target i?86-*-* x86_64-*-*}
29c1c244
WT
20
21standard_testfile
22
73c06197 23require supports_mpx_check_pointer_bounds have_mpx
3f94e588 24
1a2ccd2e 25set comp_flags "-mmpx -fcheck-pointer-bounds -I${srcdir}/../nat/"
29c1c244 26
5b362f04 27if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile} \
29c1c244
WT
28 [list debug nowarnings additional_flags=${comp_flags}]] } {
29 return -1
30}
31
32if ![runto_main] {
29c1c244
WT
33 return -1
34}
35
29c1c244
WT
36gdb_breakpoint [ gdb_get_line_number "after-decl" ]
37gdb_breakpoint [ gdb_get_line_number "after-alloc" ]
38gdb_breakpoint [ gdb_get_line_number "after-assign" ]
39
40gdb_test "show mpx bound 0x0" "Invalid bounds directory entry at $hex." "NULL address of the pointer"
41
42gdb_continue_to_breakpoint "after-decl" ".*after-decl.*"
43gdb_test "show mpx bound a" "Invalid bounds directory entry at $hex." "pointer instead of pointer address"
44
45gdb_continue_to_breakpoint "after-alloc" ".*after-alloc.*"
46gdb_test "show mpx bound a" "\\\{lbound = $hex, ubound = $hex\\\}: pointer value = $hex, size = \[8, 4\], metadata = 0x0+" "pointer after allocation"
47
48gdb_continue_to_breakpoint "after-assign" ".*after-assign.*"
49gdb_test "show mpx bound x" "\\\{lbound = $hex, ubound = $hex\\\}: pointer value = $hex, size = \[8, 4\], metadata = 0x0+" "pointer after assignment"
50gdb_test "set mpx bound 0x0, 0x1, 0x2" "Invalid bounds directory entry at $hex." "set mpx bound: NULL address of the pointer"
51gdb_test_no_output "set mpx bound x, 0xcafebabe, 0xdeadbeef" "set mpx bound: set bounds for a valid pointer address"
52gdb_test "show mpx bound x" "\\\{lbound = .*cafebabe, ubound = .*deadbeef\\\}: pointer value = $hex, size = $decimal, metadata = 0x0+" "set mpx bound: bounds map entry after set mpx bound"
53
54
55gdb_test "set mpx bound 0x0, 0x1 0x2" "A syntax error in expression.*" "set mpx bound: Controlling syntax error, missing comma "
56gdb_test "set mpx bound 0x0, 0x1" "Wrong number of arguments.*" "set mpx bound: Controlling syntax error, missing argument "