From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id KO9BLr6zvV93eQAAWB0awg (envelope-from ) for ; Tue, 24 Nov 2020 20:30:38 -0500 Received: by simark.ca (Postfix, from userid 112) id B98D41F0AB; Tue, 24 Nov 2020 20:30:38 -0500 (EST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=0.3 required=5.0 tests=MAILING_LIST_MULTI,RDNS_NONE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from sourceware.org (unknown [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 6D5EE1E58E for ; Tue, 24 Nov 2020 20:30:38 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2F54B39540A3; Wed, 25 Nov 2020 01:30:38 +0000 (GMT) Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) by sourceware.org (Postfix) with ESMTPS id 2779239540A3 for ; Wed, 25 Nov 2020 01:30:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 2779239540A3 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wm1-f67.google.com with SMTP id p22so623420wmg.3 for ; Tue, 24 Nov 2020 17:30:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=duq4LFkk/tLckBX7jCTbOszzKR1gBfnxvaHKrhOFAhU=; b=rJ7+Zu5mrVkwGzlbHJ8r0gTJLTy295337kcqpRj55X86BSlwbSR+qprc/+em0yrrra p1S5o9Sig++YHP4vZ6YmiVuDOEClGpB5jQumJSX86r/DYYJqnU3ZYQBEAcIVn411VZvx p6MGBNmNTSlzRpBxhX9W/sC0C6xbrzENb3X4LfLlWzrZqbffuOyJpw1k0RMlTEQ57ke2 a4qD/9hfxlHPo5FkkdCBK63LEmEQLEoJw/FhAHCceL7oIesDL0srRdCjkIWNl33sRsec XrITU3V0OULyXmBzCKsVh4b+aQoCAk3gxU6G/ElEhBfsYUx7fugDnki8m/wmvitghSzj 4O8Q== X-Gm-Message-State: AOAM533PtnXlB4Jhn1chzw9sH4Ua3UGPtUfgbrr/xepu/HrYFEJ6Cp1l QR8sgoyAWdw+P0C0Ci+sljaJ0QE21pgtiA== X-Google-Smtp-Source: ABdhPJyGk9rYFde6S5maQcmWi7x0S2y4uWmfQ+YS0fcXQ6zzk+hXYuzs374lAvn0eVpXZiVVuHyXVg== X-Received: by 2002:a7b:cf0a:: with SMTP id l10mr1112853wmg.103.1606267833601; Tue, 24 Nov 2020 17:30:33 -0800 (PST) Received: from ?IPv6:2001:8a0:f91f:e900:1d90:d745:3c32:c159? ([2001:8a0:f91f:e900:1d90:d745:3c32:c159]) by smtp.gmail.com with ESMTPSA id y2sm1456622wrn.31.2020.11.24.17.30.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 24 Nov 2020 17:30:32 -0800 (PST) Subject: Re: [PATCH 06/12] gdb: introduce status enum for displaced step prepare/finish To: Simon Marchi , gdb-patches@sourceware.org References: <20201110214614.2842615-1-simon.marchi@efficios.com> <20201110214614.2842615-7-simon.marchi@efficios.com> From: Pedro Alves Message-ID: Date: Wed, 25 Nov 2020 01:30:31 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.2.1 MIME-Version: 1.0 In-Reply-To: <20201110214614.2842615-7-simon.marchi@efficios.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" 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 . */ > + > +#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.