public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Luis Machado <lgustavo@codesourcery.com>
To: Yao Qi <qiyaoltc@gmail.com>, <gdb-patches@sourceware.org>
Subject: Re: [PATCH 8/8] New test about step over clone syscall
Date: Tue, 23 Feb 2016 20:31:00 -0000	[thread overview]
Message-ID: <56CCC1A0.6010401@codesourcery.com> (raw)
In-Reply-To: <1455892594-2294-9-git-send-email-yao.qi@linaro.org>

On 02/19/2016 12:36 PM, Yao Qi wrote:
> This patch adds a new test for stepping over clone syscall.
>
> 2016-02-19  Yao Qi  <yao.qi@linaro.org>
>
> 	* gdb.base/step-over-syscall.exp (step_over_syscall): Kfail.
> 	Invoke step_over_syscall "clone".
> 	* gdb.base/step-over-clone.c: New file.
> ---
>   gdb/testsuite/gdb.base/step-over-clone.c     | 53 ++++++++++++++++++++++++++++
>   gdb/testsuite/gdb.base/step-over-syscall.exp | 17 +++++++++
>   2 files changed, 70 insertions(+)
>   create mode 100644 gdb/testsuite/gdb.base/step-over-clone.c
>
> diff --git a/gdb/testsuite/gdb.base/step-over-clone.c b/gdb/testsuite/gdb.base/step-over-clone.c
> new file mode 100644
> index 0000000..43b1933
> --- /dev/null
> +++ b/gdb/testsuite/gdb.base/step-over-clone.c
> @@ -0,0 +1,53 @@
> +/* This testcase is part of GDB, the GNU debugger.
> +
> +   Copyright 2016 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/>.  */
> +
> +#define _GNU_SOURCE
> +#include <stdlib.h>
> +#include <unistd.h>
> +#include <sched.h>
> +
> +static void
> +marker () {}
> +
> +#define STACK_SIZE 0x1000
> +
> +static int
> +clone_fn (void *unused)
> +{
> +  return 0;
> +}
> +
> +int
> +main (void)
> +{
> +  int i, pid;
> +  unsigned char *stack[6];
> +
> +  for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++)
> +    stack[i] = malloc (STACK_SIZE);
> +
> +  for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++)
> +    {
> +      pid = clone (clone_fn, stack[i] + STACK_SIZE, CLONE_FILES | CLONE_VM,
> +		   NULL);
> +    }
> +
> +  for (i = 0; i < (sizeof (stack) / sizeof (stack[0])); i++)
> +    free (stack[i]);
> +
> +  marker ();
> +}
> diff --git a/gdb/testsuite/gdb.base/step-over-syscall.exp b/gdb/testsuite/gdb.base/step-over-syscall.exp
> index 863194b..e5a3d55 100644
> --- a/gdb/testsuite/gdb.base/step-over-syscall.exp
> +++ b/gdb/testsuite/gdb.base/step-over-syscall.exp
> @@ -122,6 +122,13 @@ proc step_over_syscall { syscall } {
>   	foreach displaced $disp_step_opts {
>   	    with_test_prefix "displaced $displaced" {
>
> +		if { $displaced == "on" && $syscall == "clone" } {
> +		    # GDB doesn't support step over clone syscall with

"...stepping over clone ..."?

> +		    # displaced stepping.
> +		    kfail "gdb/19675" "single step over clone"
> +		    continue
> +		}
> +
>   		gdb_test "continue" \
>   		    "Continuing\\..*Breakpoint \[0-9\]+, (.* in |__libc_|)$syscall \\(\\).*" \
>   		    "continue to $syscall (3rd time)"
> @@ -187,6 +194,15 @@ proc step_over_syscall { syscall } {
>   			}
>   		    }
>
> +		if { $syscall == "clone" } {
> +		    # Create a breakpoint in the child with the condition
> +		    # which is false, so that GDBserver can get the
> +		    # event from the child but GDB doesn't see it.  In
> +		    # this way, we don't have to adjust test flow for

"... to adjust the test flow..."?

  reply	other threads:[~2016-02-23 20:31 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-19 14:36 [PATCH 0/8] Leave child suspended when step over parent Yao Qi
2016-02-19 14:36 ` [PATCH 2/8] Refactor gdb.base/disp-step-syscall.exp for general step over test Yao Qi
2016-02-19 14:36 ` [PATCH 4/8] Step over syscalll insn with disp-step on and off Yao Qi
2016-02-25 17:27   ` Pedro Alves
2016-02-19 14:36 ` [PATCH 3/8] Use loop in disp-step-fork.c and disp-step-vfork.c Yao Qi
2016-02-25 17:28   ` Pedro Alves
2016-02-19 14:36 ` [PATCH 5/8] Step over fork/vfork syscall insn in gdbserver Yao Qi
2016-02-23 20:28   ` Luis Machado
2016-02-25 17:31   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 6/8] Reformat disp-step-syscall.exp Yao Qi
2016-02-19 14:37 ` [PATCH 7/8] Rename disp-step-syscall.exp to step-over-syscall.exp Yao Qi
2016-02-25 17:32   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 8/8] New test about step over clone syscall Yao Qi
2016-02-23 20:31   ` Luis Machado [this message]
2016-02-25 17:43   ` Pedro Alves
2016-02-25 17:43   ` Pedro Alves
2016-02-19 14:37 ` [PATCH 1/8] [GDBserver] Leave child suspended when step over parent Yao Qi
2016-02-23 20:23   ` Luis Machado
2016-02-25 17:12   ` Pedro Alves
2016-02-26 14:03 ` [PATCH 0/7 V2] " Yao Qi
2016-02-26 14:04   ` [PATCH 6/7] Reformat gdb.base/step-over-syscall.exp Yao Qi
2016-02-26 14:04   ` [PATCH 1/7] [GDBserver] Leave child suspended when step over parent Yao Qi
2016-02-26 14:04   ` [PATCH 5/7] Rename disp-step-syscall.exp to step-over-syscall.exp Yao Qi
2016-02-26 14:04   ` [PATCH 7/7] New test about step over clone syscall Yao Qi
2016-02-26 14:04   ` [PATCH 2/7] Refactor gdb.base/disp-step-syscall.exp for general step over test Yao Qi
2016-02-26 14:04   ` [PATCH 3/7] Step over syscalll insn with disp-step on and off Yao Qi
2016-02-26 14:04   ` [PATCH 4/7] Step over fork/vfork syscall insn in gdbserver Yao Qi
2016-02-26 15:02     ` Luis Machado
2016-02-26 15:50       ` Yao Qi
2016-03-03  9:21   ` [PATCH 0/7 V2] Leave child suspended when step over parent Yao Qi

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=56CCC1A0.6010401@codesourcery.com \
    --to=lgustavo@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=qiyaoltc@gmail.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).