diff options
author | Yao Qi <yao.qi@linaro.org> | 2015-03-18 10:47:45 +0000 |
---|---|---|
committer | Yao Qi <yao.qi@linaro.org> | 2015-03-18 10:47:45 +0000 |
commit | f68f11b76de09dcb0d399814127fbf5227fe8245 (patch) | |
tree | 0967c5bcb646c93eb79564e57004403bdbbf38d2 /gdb/testsuite/gdb.base | |
parent | b3862264bc6009a993685ee5e9dd2879a503e36a (diff) | |
download | gdb-f68f11b76de09dcb0d399814127fbf5227fe8245.zip gdb-f68f11b76de09dcb0d399814127fbf5227fe8245.tar.gz gdb-f68f11b76de09dcb0d399814127fbf5227fe8245.tar.bz2 |
Support catch syscall on aarch64 linux
Hi,
This patch is to support catch syscall on aarch64 linux. We
implement gdbarch method get_syscall_number for aarch64-linux,
and add aarch64-linux.xml file, which looks straightforward, however
the changes to test case doesn't.
First of all, we enable catch-syscall.exp on aarch64-linux target,
but skip the multi_arch testing on current stage. I plan to touch
multi arch debugging on aarch64-linux later.
Then, when I run catch-syscall.exp on aarch64-linux, gcc errors that
SYS_pipe isn't defined. We find that aarch64 kernel only has pipe2
syscall and libc already convert pipe to pipe2. As a result, I change
catch-syscall.c to use SYS_pipe if it is defined, otherwise use
SYS_pipe2 instead. The vector all_syscalls in catch-syscall.exp can't
be pre-determined, so I add a new proc setup_all_syscalls to fill it,
according to the availability of SYS_pipe.
Regression tested on {x86_64, aarch64}-linux x {native, gdbserver}.
gdb:
2015-03-18 Yao Qi <yao.qi@linaro.org>
PR tdep/18107
* aarch64-linux-tdep.c: Include xml-syscall.h
(aarch64_linux_get_syscall_number): New function.
(aarch64_linux_init_abi): Call
set_gdbarch_get_syscall_number.
* syscalls/aarch64-linux.xml: New file.
gdb/testsuite:
2015-03-18 Yao Qi <yao.qi@linaro.org>
PR tdep/18107
* gdb.base/catch-syscall.c [!SYS_pipe] (pipe2_syscall): New
variable.
* gdb.base/catch-syscall.exp: Don't skip it on
aarch64*-*-linux* target. Remove elements in all_syscalls.
(test_catch_syscall_multi_arch): Skip it on aarch64*-linux*
target.
(setup_all_syscalls): New proc.
Diffstat (limited to 'gdb/testsuite/gdb.base')
-rw-r--r-- | gdb/testsuite/gdb.base/catch-syscall.c | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.base/catch-syscall.exp | 41 |
2 files changed, 41 insertions, 4 deletions
diff --git a/gdb/testsuite/gdb.base/catch-syscall.c b/gdb/testsuite/gdb.base/catch-syscall.c index ea33b93..4d0131c 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.c +++ b/gdb/testsuite/gdb.base/catch-syscall.c @@ -21,7 +21,11 @@ int chroot_syscall = SYS_chroot; restart_syscall, which can't be called from userspace. However, the "read" syscall is zero on x86_64. */ int read_syscall = SYS_read; +#ifdef SYS_pipe int pipe_syscall = SYS_pipe; +#else +int pipe2_syscall = SYS_pipe2; +#endif int write_syscall = SYS_write; int exit_group_syscall = SYS_exit_group; diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index 29e8109..df0004a 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -29,7 +29,7 @@ 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*"] } { + && ![istarget "s390*-linux*"] && ![istarget "aarch64*-*-linux*"] } { continue } @@ -40,9 +40,9 @@ if { [prepare_for_testing ${testfile}.exp $testfile ${testfile}.c] } { 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" } +# All (but the last) syscalls from the example code. It is filled in +# proc setup_all_syscalls. +set all_syscalls { } set all_syscalls_numbers { } # The last syscall (exit()) does not return, so @@ -402,6 +402,9 @@ proc test_catch_syscall_multi_arch {} { # catch syscall supports only 32-bit ARM for now. verbose "Not testing ARM for multi-arch syscall support" return + } elseif { [istarget "aarch64*-linux*"] } { + verbose "Not testing AARCH64 for multi-arch syscall support" + return } elseif { [istarget "s390*-linux*"] } { set arch1 "s390:31-bit" set arch2 "s390:64-bit" @@ -469,6 +472,36 @@ proc fill_all_syscalls_numbers {} { set last_syscall_number [get_integer_valueof "exit_group_syscall" -1] } +# Set up the vector all_syscalls. + +proc setup_all_syscalls {} { + global all_syscalls + global gdb_prompt + + # They are ordered according to the file, so do not change this. + lappend all_syscalls "close" + lappend all_syscalls "chroot" + + # SYS_pipe doesn't exist on aarch64 kernel. + set test "check SYS_pipe" + gdb_test_multiple "p pipe_syscall" $test { + -re " = .*$gdb_prompt $" { + pass $test + lappend all_syscalls "pipe" + } + -re "No symbol .*$gdb_prompt $" { + pass $test + # SYS_pipe isn't defined, use SYS_pipe2 instead. + lappend all_syscalls "pipe2" + } + } + + lappend all_syscalls "write" + lappend all_syscalls "read" +} + +setup_all_syscalls + # Fill all the syscalls numbers before starting anything. fill_all_syscalls_numbers |