[PATCH 3/3] Testcase
Pedro Alves
palves@redhat.com
Fri Nov 14 15:54:00 GMT 2014
On 11/13/2014 12:18 AM, Sergio Durigan Junior wrote:
> This patch implements the testcase for this fix. The test is very
> simple: we just have to verify if the syscall number for each
> architecture has different meanings. I chose to test i386 and x86_64
> here, but it could be any other architecture supported by the "catch
> syscall" command.
This only works if the built GDB has these architectures configured
in.
E.g., an --enable-targets=all build on x86:
(gdb) set architecture aarch64
The target architecture is assumed to be aarch64
while on a default x86 build:
(gdb) set architecture aarch64
Undefined item: "aarch64".
>From that, you can see that:
(gdb) set architecture i386
would fail on non-x86 builds that don't include x86 in --enable-targets=foo.
>
> +proc test_catch_syscall_multi_target {} {
Please make this "multi_arch". Let's leave "multi-target" for
https://sourceware.org/gdb/wiki/MultiTarget.
> + global decimal binfile
> +
> + with_test_prefix "multiple targets" {
> + clean_restart $binfile
> +
> + gdb_test "set architecture i386" \
> + "The target architecture is assumed to be i386" \
> + "set arch to i386"
> +
> + gdb_test "catch syscall 1" \
> + "Catchpoint $decimal \\(syscall .exit. \\\[1\\\]\\)" \
> + "insert catch syscall on syscall 1 -- exit on i386"
> +
> + gdb_test "set architecture i386:x86-64" \
> + "The target architecture is assumed to be i386:x86-64" \
> + "set arch to x86_64"
> +
> + gdb_test "catch syscall 1" \
> + "Catchpoint $decimal \\(syscall .write. \\\[1\\\]\\)" \
> + "insert catch syscall on syscall 1 -- exit on i386"
The "exit on i386" part seems stale here.
I think we should do something like this:
if { [istarget "i*86-*-*"] || [istarget "x86_64-*-*"] } {
set arch1 "i386"
set syscall1 "exit"
set arch2 "i386:x86-64"
set syscall2 "write"
} elseif { [istarget "powerpc-*-linux*"] || [istarget "powerpc64-*-linux*"] } {
...
} elseif { [istarget "sparc-*-linux*"] && ![istarget "sparc64-*-linux*"] } {
...
} elseif { [istarget "mips*-linux*"] } {
...
} elseif { [istarget "arm*-linux*"] } {
...
} elseif { [istarget "s390*-linux*"] } {
...
} else {
error "please port me"
}
Thanks,
Pedro Alves
More information about the Gdb-patches
mailing list