Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@palves.net>
To: Simon Marchi <simon.marchi@efficios.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 06/12] gdb: introduce status enum for displaced step prepare/finish
Date: Wed, 25 Nov 2020 01:30:31 +0000	[thread overview]
Message-ID: <cb916559-eac0-f2f1-cd5e-dae064c340cf@palves.net> (raw)
In-Reply-To: <20201110214614.2842615-7-simon.marchi@efficios.com>

On 11/10/20 9:46 PM, Simon Marchi via Gdb-patches wrote:

> --- /dev/null
> +++ b/gdb/displaced-stepping.h
> @@ -0,0 +1,46 @@
> +/* Displaced stepping related things.
> +
> +   Copyright (C) 2020 Free Software Foundation, Inc.
> +
> +   This file is part of GDB.
> +
> +   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/>.  */
> +
> +#ifndef DISPLACED_STEPPING_H
> +#define DISPLACED_STEPPING_H
> +
> +enum displaced_step_prepare_status
> +{
> +  /* A displaced stepping buffer was successfully allocated and prepared.  */
> +  DISPLACED_STEP_PREPARE_STATUS_OK,
> +
> +  /* Something bad happened.  */
> +  DISPLACED_STEP_PREPARE_STATUS_ERROR,
> +
> +  /* Not enough resources are available at this time, try again later.  */
> +  DISPLACED_STEP_PREPARE_STATUS_UNAVAILABLE,
> +};
> +
> +enum displaced_step_finish_status
> +{
> +  /* Either the instruction was stepped and fixed up, or the specified thread
> +     wasn't executing a displaced step (in which case there's nothing to
> +     finish). */
> +  DISPLACED_STEP_FINISH_STATUS_OK,
> +
> +  /* The thread was executing a displaced step, but didn't complete it.  */
> +  DISPLACED_STEP_FINISH_STATUS_NOT_EXECUTED,

There's an ambiguity here that gave me pause -- the enumeration is
called "not executed", but the comment says "was executing".  I'd suggest:

  /* The thread started a displaced step, but didn't complete it.  */



> -/* If we displaced stepped an instruction successfully, adjust
> -   registers and memory to yield the same effect the instruction would
> -   have had if we had executed it at its original address, and return
> -   1.  If the instruction didn't complete, relocate the PC and return
> -   -1.  If the thread wasn't displaced stepping, return 0.  */
> +/* If we displaced stepped an instruction successfully, adjust registers and
> +   memory to yield the same effect the instruction would have had if we had
> +   executed it at its original address, and return
> +   DISPLACED_STEP_PREPARE_STATUS_OK.  If the instruction didn't complete,
> +   relocate the PC and return DISPLACED_STEP_PREPARE_STATUS_NOT_EXECUTED.

DISPLACED_STEP_PREPARE_... -> DISPLACED_STEP_FINISH_...

> -static int
> +   If the thread wasn't displaced stepping, return
> +   DISPLACED_STEP_PREPARE_STATUS_OK as well..  */

Here too.  Also, spurious double period "..".

> +
> +static displaced_step_finish_status
>  displaced_step_finish (thread_info *event_thread, enum gdb_signal signal)
>  {
>    struct displaced_step_inferior_state *displaced
>      = get_displaced_stepping_state (event_thread->inf);
> -  int ret;
>  
>    /* Was this event for the thread we displaced?  */
>    if (displaced->step_thread != event_thread)
> -    return 0;
> +    return DISPLACED_STEP_FINISH_STATUS_OK;
>  


Otherwise OK.

  parent reply	other threads:[~2020-11-25  1:30 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-10 21:46 [PATCH 00/12] Concurrent displaced stepping Simon Marchi via Gdb-patches
2020-11-10 21:46 ` [PATCH 01/12] gdb: add inferior_execd observable Simon Marchi via Gdb-patches
2020-11-25  1:28   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 02/12] gdb: clear inferior displaced stepping state on exec Simon Marchi via Gdb-patches
2020-11-25  1:28   ` Pedro Alves
2020-12-01  4:27     ` Simon Marchi
2020-11-10 21:46 ` [PATCH 03/12] gdb: rename things related to step over chains Simon Marchi via Gdb-patches
2020-11-25  1:28   ` Pedro Alves
2020-11-25 13:16     ` Simon Marchi via Gdb-patches
2020-11-10 21:46 ` [PATCH 04/12] gdb: rename displaced_step_closure to displaced_step_copy_insn_closure Simon Marchi via Gdb-patches
2020-11-25  1:29   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 05/12] gdb: rename displaced_step_fixup to displaced_step_finish Simon Marchi via Gdb-patches
2020-11-25  1:29   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 06/12] gdb: introduce status enum for displaced step prepare/finish Simon Marchi via Gdb-patches
2020-11-11 23:36   ` Andrew Burgess
2020-11-25 13:17     ` Simon Marchi via Gdb-patches
2020-11-25  1:30   ` Pedro Alves [this message]
2020-11-25 13:20     ` Simon Marchi via Gdb-patches
2020-11-10 21:46 ` [PATCH 07/12] gdb: pass inferior to get_linux_inferior_data Simon Marchi via Gdb-patches
2020-11-25  1:30   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 08/12] gdb: move displaced stepping types to displaced-stepping.{h, c} Simon Marchi via Gdb-patches
2020-11-25  1:30   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 09/12] gdb: move displaced stepping logic to gdbarch, allow starting concurrent displaced steps Simon Marchi via Gdb-patches
2020-11-25  1:40   ` Pedro Alves
2020-11-25 19:29     ` Simon Marchi via Gdb-patches
2020-11-25 19:35       ` Simon Marchi
2020-11-26 14:25         ` Pedro Alves
2020-11-30 19:13           ` Simon Marchi via Gdb-patches
2020-11-26 14:24       ` Pedro Alves
2020-11-30 20:26         ` Simon Marchi
2020-11-10 21:46 ` [PATCH 10/12] gdb: change linux gdbarch data from post to pre-init Simon Marchi via Gdb-patches
2020-11-25  1:41   ` Pedro Alves
2020-11-10 21:46 ` [PATCH 11/12] gdb: make displaced stepping implementation capable of managing multiple buffers Simon Marchi via Gdb-patches
2020-11-25  1:41   ` Pedro Alves
2020-11-30 18:58     ` Simon Marchi
2020-11-30 19:01     ` Simon Marchi
2020-11-10 21:46 ` [PATCH 12/12] gdb: use two displaced step buffers on amd64/Linux Simon Marchi via Gdb-patches
2020-11-25  1:42   ` Pedro Alves
2020-11-25  6:26     ` Simon Marchi
2020-11-25 20:07       ` Simon Marchi
2020-11-25 20:56         ` Simon Marchi
2020-11-26 21:43           ` Simon Marchi
2020-11-26 22:34             ` Simon Marchi
2020-11-28 18:56             ` Pedro Alves

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=cb916559-eac0-f2f1-cd5e-dae064c340cf@palves.net \
    --to=pedro@palves.net \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@efficios.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