458c8db89f
This patch intends to partially fix PR breakpoints/10737, which is about making the syscall information (for the "catch syscall" command) be per-arch, instead of global. This is not a full fix because of the other issues pointed by Pedro here: <https://sourceware.org/bugzilla/show_bug.cgi?id=10737#c5> However, I consider it a good step towards the real fix. It will also help me fix <https://sourceware.org/bugzilla/show_bug.cgi?id=17402>. What this patch does, basically, is move the "syscalls_info" struct to gdbarch. Currently, the syscall information is stored in a global variable inside gdb/xml-syscall.c, which means that there is no easy way to correlate this info with the current target or architecture being used, for example. This causes strange behaviors, because the syscall info is not re-read when the arch changes. For example, if you put a syscall catchpoint in syscall 5 on i386 (syscall open), and then load a x86_64 program on GDB and put the same syscall 5 there (fstat on x86_64), you will still see that GDB tells you that it is catching "open", even though it is not. With this patch, GDB correctly says that it will be catching fstat syscalls. (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'open' [5]) But with the patch: (gdb) set architecture i386 The target architecture is assumed to be i386 (gdb) catch syscall 5 Catchpoint 1 (syscall 'open' [5]) (gdb) set architecture i386:x86-64 The target architecture is assumed to be i386:x86-64 (gdb) catch syscall 5 Catchpoint 2 (syscall 'fstat' [5]) As I said, there are still some problems on the "catch syscall" mechanism, because (for example) the user should be able to "catch syscall open" on i386, and then expect "open" to be caught also on x86_64. Currently, it doesn't work. I intend to work on this later. gdb/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * amd64-linux-tdep.c (amd64_linux_init_abi_common): Adjust call to set_xml_syscall_file_name to provide gdbarch. * arm-linux-tdep.c (arm_linux_init_abi): Likewise. * bfin-linux-tdep.c (bfin_linux_init_abi): Likewise. * breakpoint.c (print_it_catch_syscall): Adjust call to get_syscall_by_number to provide gdbarch. (print_one_catch_syscall): Likewise. (print_mention_catch_syscall): Likewise. (print_recreate_catch_syscall): Likewise. (catch_syscall_split_args): Adjust calls to get_syscall_by_number and get_syscall_by_name to provide gdbarch. (catch_syscall_completer): Adjust call to get_syscall_names to provide gdbarch. * gdbarch.c: Regenerate. * gdbarch.h: Likewise. * gdbarch.sh: Forward declare "struct syscalls_info". (xml_syscall_file): New variable. (syscalls_info): Likewise. * i386-linux-tdep.c (i386_linux_init_abi): Adjust call to set_xml_syscall_file_name to provide gdbarch. * mips-linux-tdep.c (mips_linux_init_abi): Likewise. * ppc-linux-tdep.c (ppc_linux_init_abi): Likewise. * s390-linux-tdep.c (s390_gdbarch_init): Likewise. * sparc-linux-tdep.c (sparc32_linux_init_abi): Likewise. * sparc64-linux-tdep.c (sparc64_linux_init_abi): Likewise. * xml-syscall.c: Include gdbarch.h. (set_xml_syscall_file_name): Accept gdbarch parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. (my_gdb_datadir): Delete global variable. (struct syscalls_info) <my_gdb_datadir>: New variable. (struct syscalls_info) <sysinfo>: Rename variable to "syscalls_info". (sysinfo): Delete global variable. (have_initialized_sysinfo): Likewise. (xml_syscall_file): Likewise. (sysinfo_free_syscalls_desc): Rename to... (syscalls_info_free_syscalls_desc): ... this. (free_syscalls_info): Rename "sysinfo" to "syscalls_info". Adjust code to the new layout of "struct syscalls_info". (make_cleanup_free_syscalls_info): Rename parameter "sysinfo" to "syscalls_info". (syscall_create_syscall_desc): Likewise. (syscall_start_syscall): Likewise. (syscall_parse_xml): Likewise. (xml_init_syscalls_info): Likewise. Drop "const" from return value. (init_sysinfo): Rename to... (init_syscalls_info): ...this. Add gdbarch as a parameter. Adjust function to deal with gdbarch. (xml_get_syscall_number): Delete parameter sysinfo. Accept gdbarch as a parameter. Adjust code. (xml_get_syscall_name): Likewise. (xml_list_of_syscalls): Likewise. (set_xml_syscall_file_name): Accept gdbarch as parameter. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. * xml-syscall.h (set_xml_syscall_file_name): Likewise. (get_syscall_by_number): Likewise. (get_syscall_by_name): Likewise. (get_syscall_names): Likewise. gdb/testsuite/ 2014-11-20 Sergio Durigan Junior <sergiodj@redhat.com> PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_arch. (test_catch_syscall_multi_arch): New function.
498 lines
16 KiB
Text
498 lines
16 KiB
Text
# Copyright 1997-2014 Free Software Foundation, Inc.
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
# This program tests the 'catch syscall' functionality.
|
|
#
|
|
# It was written by Sergio Durigan Junior <sergiodj@linux.vnet.ibm.com>
|
|
# on September/2008.
|
|
|
|
if { [is_remote target] || ![isnative] } then {
|
|
continue
|
|
}
|
|
|
|
# Until "catch syscall" is implemented on other targets...
|
|
if { ![istarget "hppa*-hp-hpux*"] && ![istarget "*-linux*"] } {
|
|
continue
|
|
}
|
|
|
|
# This shall be updated whenever 'catch syscall' is implemented
|
|
# on some architecture.
|
|
#if { ![istarget "i\[34567\]86-*-linux*"]
|
|
if { ![istarget "x86_64-*-linux*"] && ![istarget "i\[34567\]86-*-linux*"]
|
|
&& ![istarget "powerpc-*-linux*"] && ![istarget "powerpc64-*-linux*"]
|
|
&& ![istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"]
|
|
&& ![istarget "mips*-linux*"] && ![istarget "arm*-linux*"]
|
|
&& ![istarget "s390*-linux*"] } {
|
|
continue
|
|
}
|
|
|
|
standard_testfile
|
|
|
|
if { [prepare_for_testing ${testfile}.exp $testfile ${testfile}.c] } {
|
|
untested catch-syscall.exp
|
|
return -1
|
|
}
|
|
|
|
# All (but the last) syscalls from the example code
|
|
# They are ordered according to the file, so do not change this.
|
|
set all_syscalls { "close" "chroot" "pipe" "write" "read" }
|
|
set all_syscalls_numbers { }
|
|
|
|
# The last syscall (exit()) does not return, so
|
|
# we cannot expect the catchpoint to be triggered
|
|
# twice. It is a special case.
|
|
set last_syscall "exit_group"
|
|
set last_syscall_number { }
|
|
|
|
# Internal procedure used to check if, after issuing a 'catch syscall'
|
|
# command (without arguments), the 'info breakpoints' command displays
|
|
# that '"any syscall"' is to be caught.
|
|
proc check_info_bp_any_syscall {} {
|
|
# Verifying that the catchpoint appears in the 'info breakpoints'
|
|
# command, but with "<any syscall>".
|
|
set thistest "catch syscall appears in 'info breakpoints'"
|
|
gdb_test "info breakpoints" ".*catchpoint.*keep y.*syscall \"<any syscall>\".*" $thistest
|
|
}
|
|
|
|
# Internal procedure used to check if, after issuing a 'catch syscall X'
|
|
# command (with arguments), the 'info breakpoints' command displays
|
|
# that the syscall 'X' is to be caught.
|
|
proc check_info_bp_specific_syscall { syscall } {
|
|
set thistest "syscall(s) $syscall appears in 'info breakpoints'"
|
|
gdb_test "info breakpoints" ".*catchpoint.*keep y.*syscall(\[(\]s\[)\])? (.)?${syscall}(.)?.*" $thistest
|
|
}
|
|
|
|
# Internal procedure used to check if, after issuing a 'catch syscall X'
|
|
# command (with many arguments), the 'info breakpoints' command displays
|
|
# that the syscalls 'X' are to be caught.
|
|
proc check_info_bp_many_syscalls { syscalls } {
|
|
set filter_str ""
|
|
|
|
foreach name $syscalls {
|
|
set filter_str "${filter_str}${name}, "
|
|
}
|
|
|
|
set filter_str [ string trimright $filter_str ", " ]
|
|
|
|
set thistest "syscalls $filter_str appears in 'info breakpoints'"
|
|
gdb_test "info breakpoints" ".*catchpoint.*keep y.*syscalls (.)?${filter_str}(.)?.*" $thistest
|
|
}
|
|
|
|
# This procedure checks if there was a call to a syscall.
|
|
proc check_call_to_syscall { syscall } {
|
|
global decimal
|
|
|
|
set thistest "program has called $syscall"
|
|
gdb_test "continue" "Catchpoint $decimal \\(call to syscall .?${syscall}.?\\).*" $thistest
|
|
}
|
|
|
|
# This procedure checks if the syscall returned.
|
|
proc check_return_from_syscall { syscall } {
|
|
global decimal
|
|
|
|
set thistest "syscall $syscall has returned"
|
|
gdb_test "continue" "Catchpoint $decimal \\(returned from syscall ${syscall}\\).*" $thistest
|
|
}
|
|
|
|
# Internal procedure that performs two 'continue' commands and checks if
|
|
# a syscall call AND return occur.
|
|
proc check_continue { syscall } {
|
|
# Testing if the 'continue' stops at the
|
|
# specified syscall_name. If it does, then it should
|
|
# first print that the infeior has called the syscall,
|
|
# and after print that the syscall has returned.
|
|
|
|
# Testing if the inferiorr has called the syscall.
|
|
check_call_to_syscall $syscall
|
|
# And now, that the syscall has returned.
|
|
check_return_from_syscall $syscall
|
|
}
|
|
|
|
# Inserts a syscall catchpoint with an argument.
|
|
proc insert_catch_syscall_with_arg { syscall } {
|
|
global decimal
|
|
|
|
# Trying to set the catchpoint
|
|
set thistest "catch syscall with arguments ($syscall)"
|
|
gdb_test "catch syscall $syscall" "Catchpoint $decimal \\(syscall \'?${syscall}\'?( \[${decimal}\])?\\)" $thistest
|
|
|
|
check_info_bp_specific_syscall $syscall
|
|
}
|
|
|
|
# Inserts a syscall catchpoint with many arguments.
|
|
proc insert_catch_syscall_with_many_args { syscalls numbers } {
|
|
global decimal
|
|
|
|
set catch [ join $syscalls " " ]
|
|
set filter_str ""
|
|
|
|
foreach name $syscalls number $numbers {
|
|
set filter_str "${filter_str}'${name}' \\\[${number}\\\] "
|
|
}
|
|
|
|
set filter_str [ string trimright $filter_str " " ]
|
|
|
|
# Trying to set the catchpoint
|
|
set thistest "catch syscall with arguments ($filter_str)"
|
|
gdb_test "catch syscall $catch" "Catchpoint $decimal \\(syscalls ${filter_str}\\).*" $thistest
|
|
|
|
check_info_bp_many_syscalls $syscalls
|
|
}
|
|
|
|
proc check_for_program_end {} {
|
|
# Deleting the catchpoints
|
|
delete_breakpoints
|
|
|
|
gdb_continue_to_end
|
|
}
|
|
|
|
proc test_catch_syscall_without_args {} {
|
|
global all_syscalls last_syscall decimal
|
|
|
|
with_test_prefix "without arguments" {
|
|
# Trying to set the syscall.
|
|
gdb_test "catch syscall" "Catchpoint $decimal \\(any syscall\\)"
|
|
|
|
check_info_bp_any_syscall
|
|
|
|
# We have to check every syscall.
|
|
foreach name $all_syscalls {
|
|
check_continue $name
|
|
}
|
|
|
|
# At last but not least, we check if the inferior has called
|
|
# the last (exit) syscall.
|
|
check_call_to_syscall $last_syscall
|
|
|
|
# Now let's see if the inferior correctly finishes.
|
|
check_for_program_end
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_with_args {} {
|
|
with_test_prefix "with arguments" {
|
|
set syscall_name "close"
|
|
insert_catch_syscall_with_arg $syscall_name
|
|
|
|
# Can we continue until we catch the syscall?
|
|
check_continue $syscall_name
|
|
|
|
# Now let's see if the inferior correctly finishes.
|
|
check_for_program_end
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_with_many_args {} {
|
|
with_test_prefix "with many arguments" {
|
|
global all_syscalls all_syscalls_numbers
|
|
|
|
insert_catch_syscall_with_many_args $all_syscalls $all_syscalls_numbers
|
|
|
|
# Can we continue until we catch the syscalls?
|
|
foreach name $all_syscalls {
|
|
check_continue $name
|
|
}
|
|
|
|
# Now let's see if the inferior correctly finishes.
|
|
check_for_program_end
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_with_wrong_args {} {
|
|
with_test_prefix "wrong args" {
|
|
# mlock is not called from the source
|
|
set syscall_name "mlock"
|
|
insert_catch_syscall_with_arg $syscall_name
|
|
|
|
# Now, we must verify if the program stops with a continue.
|
|
# If it doesn't, everything is right (since we don't have
|
|
# a syscall named "mlock" in it). Otherwise, this is a failure.
|
|
set thistest "catch syscall with unused syscall ($syscall_name)"
|
|
gdb_continue_to_end $thistest
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_restarting_inferior {} {
|
|
with_test_prefix "restarting inferior" {
|
|
set syscall_name "chroot"
|
|
|
|
with_test_prefix "entry" {
|
|
insert_catch_syscall_with_arg $syscall_name
|
|
|
|
# Let's first reach the entry of the syscall.
|
|
check_call_to_syscall $syscall_name
|
|
}
|
|
|
|
with_test_prefix "entry/return" {
|
|
# Now, restart the program.
|
|
rerun_to_main
|
|
|
|
# And check for entry/return.
|
|
check_continue $syscall_name
|
|
|
|
# Can we finish?
|
|
check_for_program_end
|
|
}
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_fail_nodatadir {} {
|
|
with_test_prefix "fail no datadir" {
|
|
# Sanitizing.
|
|
delete_breakpoints
|
|
|
|
# Make sure GDB doesn't load the syscalls xml from the system
|
|
# data directory.
|
|
gdb_test "set data-directory /the/path/to/nowhere" \
|
|
"Warning: /the/path/to/nowhere: .*"
|
|
|
|
# Testing to see if we receive a warning when calling "catch
|
|
# syscall" without XML support (without datadir).
|
|
set thistest "catch syscall displays a warning when there is no XML support"
|
|
gdb_test "catch syscall" \
|
|
"warning: Could not load the syscall XML file.*warning: GDB will not be able to display syscall names nor to verify if.*any provided syscall numbers are valid.*Catchpoint .*(syscall).*" \
|
|
$thistest
|
|
|
|
# Since the catchpoint was set, we must check if it's present
|
|
# in "info breakpoints" output.
|
|
check_info_bp_any_syscall
|
|
|
|
# Sanitizing.
|
|
delete_breakpoints
|
|
}
|
|
}
|
|
|
|
proc do_syscall_tests {} {
|
|
# NOTE: We don't have to point gdb at the correct data-directory.
|
|
# For the build tree that is handled by INTERNAL_GDBFLAGS.
|
|
|
|
# Verify that the 'catch syscall' help is available
|
|
set thistest "help catch syscall"
|
|
gdb_test "help catch syscall" "Catch system calls.*" $thistest
|
|
|
|
# Try to set a catchpoint to a nonsense syscall
|
|
set thistest "catch syscall to a nonsense syscall is prohibited"
|
|
gdb_test "catch syscall nonsense_syscall" "Unknown syscall name .*" $thistest
|
|
|
|
# Regression test for syscall completer bug.
|
|
gdb_test "complete catch syscall close chroo" \
|
|
"catch syscall close chroot" \
|
|
"complete catch syscall with multiple words"
|
|
|
|
# Testing the 'catch syscall' command without arguments.
|
|
# This test should catch any syscalls.
|
|
if [runto_main] then { test_catch_syscall_without_args }
|
|
|
|
# Testing the 'catch syscall' command with arguments.
|
|
# This test should only catch the specified syscall.
|
|
if [runto_main] then { test_catch_syscall_with_args }
|
|
|
|
# Testing the 'catch syscall' command with many arguments.
|
|
# This test should catch $all_syscalls.
|
|
if [runto_main] then { test_catch_syscall_with_many_args }
|
|
|
|
# Testing the 'catch syscall' command with WRONG arguments.
|
|
# This test should not trigger any catchpoints.
|
|
if [runto_main] then { test_catch_syscall_with_wrong_args }
|
|
|
|
# Testing the 'catch' syscall command during a restart of
|
|
# the inferior.
|
|
if [runto_main] then { test_catch_syscall_restarting_inferior }
|
|
|
|
# Testing if the 'catch syscall' command works when switching to
|
|
# different architectures on-the-fly (PR gdb/10737).
|
|
if [runto_main] then { test_catch_syscall_multi_arch }
|
|
}
|
|
|
|
proc test_catch_syscall_without_args_noxml {} {
|
|
with_test_prefix "without args noxml" {
|
|
# We will need the syscall names even not using it because we
|
|
# need to know know many syscalls are in the example file.
|
|
global all_syscalls last_syscall_number all_syscalls_numbers
|
|
|
|
delete_breakpoints
|
|
|
|
gdb_test "catch syscall" "Catchpoint .*(syscall).*"
|
|
|
|
# Now, we should be able to set a catchpoint, and GDB shall
|
|
# not display the warning anymore.
|
|
foreach name $all_syscalls number $all_syscalls_numbers {
|
|
with_test_prefix "$name" {
|
|
check_continue $number
|
|
}
|
|
}
|
|
|
|
# At last but not least, we check if the inferior has called
|
|
# the last (exit) syscall.
|
|
check_call_to_syscall $last_syscall_number
|
|
|
|
delete_breakpoints
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_with_args_noxml {} {
|
|
with_test_prefix "with args noxml" {
|
|
global all_syscalls_numbers
|
|
|
|
delete_breakpoints
|
|
|
|
# Inserting all syscalls numbers to be caught
|
|
foreach syscall_number $all_syscalls_numbers {
|
|
insert_catch_syscall_with_arg $syscall_number
|
|
}
|
|
|
|
# Checking that all syscalls are caught.
|
|
foreach syscall_number $all_syscalls_numbers {
|
|
check_continue $syscall_number
|
|
}
|
|
|
|
delete_breakpoints
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_with_wrong_args_noxml {} {
|
|
with_test_prefix "with wrong args noxml" {
|
|
delete_breakpoints
|
|
|
|
# Even without XML support, GDB should not accept unknown
|
|
# syscall names for the catchpoint.
|
|
gdb_test "catch syscall nonsense_syscall" \
|
|
"Unknown syscall name .nonsense_syscall.*"
|
|
|
|
delete_breakpoints
|
|
}
|
|
}
|
|
|
|
proc test_catch_syscall_multi_arch {} {
|
|
global decimal binfile
|
|
|
|
if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } {
|
|
set arch1 "i386"
|
|
set arch2 "i386:x86-64"
|
|
set syscall1_name "exit"
|
|
set syscall2_name "write"
|
|
set syscall_number 1
|
|
} elseif { [istarget "powerpc-*-linux*"] \
|
|
|| [istarget "powerpc64-*-linux*"] } {
|
|
set arch1 "powerpc:common"
|
|
set arch2 "powerpc:common64"
|
|
set syscall1_name "openat"
|
|
set syscall2_name "unlinkat"
|
|
set syscall_number 286
|
|
} elseif { [istarget "sparc-*-linux*"] \
|
|
|| [istarget "sparc64-*-linux*"] } {
|
|
set arch1 "sparc"
|
|
set arch2 "sparc:v9"
|
|
set syscall1_name "setresuid32"
|
|
set syscall2_name "setresuid"
|
|
set syscall_number 108
|
|
} elseif { [istarget "mips*-linux*"] } {
|
|
# MIPS does not use the same numbers for syscalls on 32 and 64
|
|
# bits.
|
|
verbose "Not testing MIPS for multi-arch syscall support"
|
|
return
|
|
} elseif { [istarget "arm*-linux*"] } {
|
|
# catch syscall supports only 32-bit ARM for now.
|
|
verbose "Not testing ARM for multi-arch syscall support"
|
|
return
|
|
} elseif { [istarget "s390*-linux*"] } {
|
|
set arch1 ""
|
|
set arch2 "s390:64-bit"
|
|
set syscall1_name "_newselect"
|
|
set syscall2_name "select"
|
|
set syscall_number 142
|
|
}
|
|
|
|
with_test_prefix "multiple targets" {
|
|
# We are not interested in loading any binary here, and in
|
|
# some systems (PowerPC, for example), if we load a binary
|
|
# there is no way to set other architecture.
|
|
gdb_exit
|
|
gdb_start
|
|
|
|
gdb_test "set architecture $arch1" \
|
|
"The target architecture is assumed to be $arch1" \
|
|
"set arch to $arch1"
|
|
|
|
gdb_test "catch syscall $syscall_number" \
|
|
"Catchpoint $decimal \\(syscall .${syscall1_name}. \\\[${syscall_number}\\\]\\)" \
|
|
"insert catch syscall on syscall $syscall_number -- $syscall1_name on $arch1"
|
|
|
|
gdb_test "set architecture $arch2" \
|
|
"The target architecture is assumed to be $arch2" \
|
|
"set arch to $arch2"
|
|
|
|
gdb_test "catch syscall $syscall_number" \
|
|
"Catchpoint $decimal \\(syscall .${syscall2_name}. \\\[${syscall_number}\\\]\\)" \
|
|
"insert catch syscall on syscall $syscall_number -- $syscall2_name on $arch2"
|
|
|
|
clean_restart $binfile
|
|
}
|
|
}
|
|
|
|
proc do_syscall_tests_without_xml {} {
|
|
# Make sure GDB doesn't load the syscalls xml from the system data
|
|
# directory.
|
|
gdb_test "set data-directory /the/path/to/nowhere" \
|
|
"Warning: /the/path/to/nowhere: .*"
|
|
|
|
# Let's test if we can catch syscalls without XML support.
|
|
# We should succeed, but GDB is not supposed to print syscall names.
|
|
if [runto_main] then { test_catch_syscall_without_args_noxml }
|
|
|
|
# The only valid argument "catch syscall" should accept is the
|
|
# syscall number, and not the name (since it can't translate a
|
|
# name to a number).
|
|
if [runto_main] then { test_catch_syscall_with_args_noxml }
|
|
|
|
# Now, we'll try to provide a syscall name (valid or not) to the command,
|
|
# and expect it to fail.
|
|
if [runto_main] then { test_catch_syscall_with_wrong_args_noxml }
|
|
}
|
|
|
|
# This procedure fills the vector "all_syscalls_numbers" with the proper
|
|
# numbers for the used syscalls according to the architecture.
|
|
proc fill_all_syscalls_numbers {} {
|
|
global all_syscalls_numbers last_syscall_number all_syscalls
|
|
|
|
foreach syscall $all_syscalls {
|
|
lappend all_syscalls_numbers [get_integer_valueof "${syscall}_syscall" -1]
|
|
}
|
|
|
|
set last_syscall_number [get_integer_valueof "exit_group_syscall" -1]
|
|
}
|
|
|
|
# Fill all the syscalls numbers before starting anything.
|
|
fill_all_syscalls_numbers
|
|
|
|
# Execute the tests, using XML support
|
|
if { ![gdb_skip_xml_test] } {
|
|
clean_restart $binfile
|
|
do_syscall_tests
|
|
|
|
# Now, we have to see if GDB displays a warning when we
|
|
# don't set the data-directory but try to use catch syscall
|
|
# anyway. For that, we must restart GDB first.
|
|
clean_restart $binfile
|
|
test_catch_syscall_fail_nodatadir
|
|
}
|
|
|
|
# Restart gdb
|
|
clean_restart $binfile
|
|
|
|
# Execute the tests, without XML support. In this case, GDB will
|
|
# only display syscall numbers, and not syscall names.
|
|
do_syscall_tests_without_xml
|