Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Sergio Durigan Junior <sergiodj@redhat.com>,
	       GDB Patches <gdb-patches@sourceware.org>
Cc: Gabriel Krisman Bertazi <gabriel@krisman.be>
Subject: Re: [PATCH 3/3] Testcase
Date: Fri, 14 Nov 2014 15:54:00 -0000	[thread overview]
Message-ID: <546625C4.5050007@redhat.com> (raw)
In-Reply-To: <1415837887-28888-4-git-send-email-sergiodj@redhat.com>

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


  reply	other threads:[~2014-11-14 15:54 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13  0:18 [PATCH] Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global Sergio Durigan Junior
2014-11-13  0:18 ` [PATCH 1/3] Making syscall information be per-arch, " Sergio Durigan Junior
2014-11-14 15:53   ` Pedro Alves
2014-11-14 23:17     ` Sergio Durigan Junior
2014-11-13  0:18 ` [PATCH 3/3] Testcase Sergio Durigan Junior
2014-11-14 15:54   ` Pedro Alves [this message]
2014-11-18  3:30     ` Sergio Durigan Junior
2014-11-18 15:13       ` Pedro Alves
2014-11-18 20:20         ` Sergio Durigan Junior
2014-11-19  9:23           ` PowerPC: "set architecture" -> "Architecture not recognized" ? (was: Re: [PATCH 3/3] Testcase) Pedro Alves
2014-11-19 18:46             ` PowerPC: "set architecture" -> "Architecture not recognized" ? Sergio Durigan Junior
2014-11-20 10:48               ` Pedro Alves
2014-11-20 17:20                 ` Sergio Durigan Junior
2014-11-13  0:18 ` [PATCH 2/3] Adjust calls for setting "catch syscall" information Sergio Durigan Junior
2014-11-14 15:53   ` Pedro Alves
2014-11-14 23:18     ` Sergio Durigan Junior
2014-11-20 17:34 ` [PATCH] Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=546625C4.5050007@redhat.com \
    --to=palves@redhat.com \
    --cc=gabriel@krisman.be \
    --cc=gdb-patches@sourceware.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox