From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 85547 invoked by alias); 23 Nov 2018 18:23:33 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 85502 invoked by uid 89); 23 Nov 2018 18:23:31 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,MIME_BASE64_BLANKS autolearn=ham version=3.3.2 spammy= X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Nov 2018 18:23:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1542997406; x=1545589406; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=zmBlTyxI6BtmbFzOj/3vuDux9qdiP839dQTNN/o/KtQ=; b=K/WPtefLgeRDB/2GDaZgBwa/FA0UTY6esPK6VahJVtCilf9JhdzNympaHISj44c1 AayJeCsSX76ZQO9P2EhEsNJYw4CdY4VHWQFL5WL7ImpTvqTcIbiwZC3fMaKnzzo4 YdPKeAQFsEaHDSKvQqZwOPHU7SEbkHlzeqbiRldOPwc=; Received: from ESESBMB503.ericsson.se (Unknown_Domain [153.88.183.116]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id C8.31.06431.E9548FB5; Fri, 23 Nov 2018 19:23:26 +0100 (CET) Received: from ESESBMR504.ericsson.se (153.88.183.139) by ESESBMB503.ericsson.se (153.88.183.170) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 23 Nov 2018 19:23:26 +0100 Received: from ESESBMB502.ericsson.se (153.88.183.169) by ESESBMR504.ericsson.se (153.88.183.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 23 Nov 2018 19:23:26 +0100 Received: from NAM01-BN3-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB502.ericsson.se (153.88.183.169) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 23 Nov 2018 19:23:26 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zmBlTyxI6BtmbFzOj/3vuDux9qdiP839dQTNN/o/KtQ=; b=hQ17OQJv3AnEKdWzZZYvpoFGGNoSyL+ePo4WLqAjI/uH/XLlN1DFhuN87x27jpxMrWL6n1z8WaeMZ+GxB5JY9Klsaw3+MWxvcsIwtk1tsy1mOVxa86QuaFyanSin3TuAuM4L9aOrEl/QS0UcIx6iNoSHgLwdXl/UXMIO6vbIbhA= Received: from BYAPR15MB2390.namprd15.prod.outlook.com (52.135.198.30) by BYAPR15MB2439.namprd15.prod.outlook.com (52.135.198.155) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1294.27; Fri, 23 Nov 2018 18:23:23 +0000 Received: from BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::2978:b8d7:86fd:94ed]) by BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::2978:b8d7:86fd:94ed%3]) with mapi id 15.20.1361.018; Fri, 23 Nov 2018 18:23:23 +0000 From: Simon Marchi To: Sergio Durigan Junior , GDB Patches CC: Alan Hayward , nd Subject: Re: [PATCH v2] Implement timestamp'ed output on "make check" Date: Fri, 23 Nov 2018 18:23:00 -0000 Message-ID: <61b6c448-bae1-2dd9-87a7-5c500be0aa09@ericsson.com> References: <20181122221240.15354-1-sergiodj@redhat.com> <20181123150256.22584-1-sergiodj@redhat.com> In-Reply-To: <20181123150256.22584-1-sergiodj@redhat.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Content-Type: text/plain; charset="utf-8" Content-ID: Content-Transfer-Encoding: base64 MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00389.txt.bz2 T24gMjAxOC0xMS0yMyAxMDowMiBhLm0uLCBTZXJnaW8gRHVyaWdhbiBKdW5p b3Igd3JvdGU6DQo+IENoYW5nZXMgZnJvbSB2MjoNCj4gDQo+IC0gTWFrZSAn cHJpbnQtdHMucHknIGNvbXBhdGlibGUgd2l0aCBQeXRob24gMi4NCj4gDQo+ IC0gUHJpbnQgUElEIG9mIHNjcmlwdCB3aGVuIG91dHB1dHRpbmcgdGltZXN0 YW1wLg0KPiANCj4gDQo+IEl0IGlzIHVuZm9ydHVuYXRlbHkgbm90IHVuY29t bW9uIHRvIGhhdmUgdGVzdHMgaGFuZ2luZyBvbiBzb21lIG9mIHRoZQ0KPiBC dWlsZEJvdCB3b3JrZXJzLiAgRm9yIGV4YW1wbGUsIHRoZSBwcGM2NGJlL3Bw YzY0bGUrZ2Ric2VydmVyIGJ1aWxkZXJzDQo+IGFyZSBlc3BlY2lhbGx5IGlu IGEgYmFkIHN0YXRlIHdoZW4gaXQgY29tZXMgdG8gdGVzdGluZyBHREIvZ2Ri c2VydmVyLA0KPiBhbmQgd2UgY2FuIGhhdmUgYnVpbGRzIHRoYXQgd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RwczovL3NvdXJjZXdhcmUub3JnL2dkYi93aWtpL0ludGVybmFscyUyMEdE Qi1QeXRob24tQ29kaW5nLVN0YW5kYXJkcyNwcmV2aWV3DQoNCg== >From gdb-patches-return-152439-listarch-gdb-patches=sources.redhat.com@sourceware.org Fri Nov 23 18:25:25 2018 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 99486 invoked by alias); 23 Nov 2018 18:25:24 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 88894 invoked by uid 89); 23 Nov 2018 18:24:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,TIME_LIMIT_EXCEEDED autolearn=unavailable version=3.3.2 spammy=notable, all_inferiors, ALL_INFERIORS, *tp X-HELO: sessmg23.ericsson.net Received: from sessmg23.ericsson.net (HELO sessmg23.ericsson.net) (193.180.251.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 23 Nov 2018 18:24:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; d=ericsson.com; s=mailgw201801; c=relaxed/simple; q=dns/txt; i=@ericsson.com; t=1542997486; x=1545589486; h=From:Sender:Reply-To:Subject:Date:Message-ID:To:CC:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=czodNXomJyv36uckugdwBuzLDYH97puIsDTIThRrw1w=; b=QDT6gRLkN/vmuv/EBr5J3n0eUgaPUqByH2IHUIgtgKzjurYF5ZIUfkwiKJS5gBah IILRd2VSYhCfncu+niqJefOMZp3R0EZrxw5+GG9lD2S9iG5AzhOHSXzG7jFOuPWT 1Fvs7vP0s6nV3e3rkdQVz/wixrHtNPlU9+88IEwA15k=; Received: from ESESBMB501.ericsson.se (Unknown_Domain [153.88.183.114]) by sessmg23.ericsson.net (Symantec Mail Security) with SMTP id 79.14.31473.DE548FB5; Fri, 23 Nov 2018 19:24:45 +0100 (CET) Received: from ESESBMB504.ericsson.se (153.88.183.171) by ESESBMB501.ericsson.se (153.88.183.168) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3; Fri, 23 Nov 2018 19:24:45 +0100 Received: from NAM01-BY2-obe.outbound.protection.outlook.com (153.88.183.157) by ESESBMB504.ericsson.se (153.88.183.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1466.3 via Frontend Transport; Fri, 23 Nov 2018 19:24:45 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ericsson.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=0x9ldf06tfNvRnZHWxFRloVQicdNWLiJsc6VusrcXVQ=; b=HOhlvURoXH31QQtiAER33xNQ7+HotcGJv9pMvNHuEtK2bqvLejJ+PJ1OGh25UUSlve/FKLalU3mj6PwrTt00NAV86fEZDdcYFvba7kYwdQgK/NUhffbn1wHwklqnaQbFPw957rO0UrQiuEFQ9BMV86RCvqjGP0BjLT1kq6NqkmU= Received: from BYAPR15MB2390.namprd15.prod.outlook.com (52.135.198.30) by BYAPR15MB2392.namprd15.prod.outlook.com (52.135.198.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.18; Fri, 23 Nov 2018 18:24:42 +0000 Received: from BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::2978:b8d7:86fd:94ed]) by BYAPR15MB2390.namprd15.prod.outlook.com ([fe80::2978:b8d7:86fd:94ed%3]) with mapi id 15.20.1361.018; Fri, 23 Nov 2018 18:24:42 +0000 From: Simon Marchi To: "gdb-patches@sourceware.org" CC: "dblaikie@gmail.com" , Simon Marchi Subject: [PATCH] Place displaced step data directly in inferior structure Date: Fri, 23 Nov 2018 18:25:00 -0000 Message-ID: <20181123182429.9045-1-simon.marchi@ericsson.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=simon.marchi@ericsson.com; received-spf: None (protection.outlook.com: ericsson.com does not designate permitted sender hosts) Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Return-Path: simon.marchi@ericsson.com X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00390.txt.bz2 Content-length: 10912 This patch moves the per-inferior data related to displaced stepping to be directly in the inferior structure, rather than in a container on the side. On notable difference is that previously, we deleted the state on inferior exit, which guaranteed a clean state if re-using the inferior for a new run or attach. We now need to reset the state manually. gdb/ChangeLog: * inferior.h (class inferior) : New field. * infrun.h (struct displaced_step_state): Move here from infrun.c. Initialize fields. : Remove field. : New method. * infrun.c (struct displaced_step_inferior_state): Move to infrun.h. (displaced_step_inferior_states): Remove. (get_displaced_stepping_state): Adust. (displaced_step_in_progress_any_inferior): Adjust. (displaced_step_in_progress_thread): Adjust. (displaced_step_in_progress): Adjust. (add_displaced_stepping_state): Remove. (get_displaced_step_closure_by_addr): Adjust. (remove_displaced_stepping_state): Remove. (infrun_inferior_exit): Call displaced_step_state.reset. (use_displaced_stepping): Don't check for NULL. (displaced_step_prepare_throw): Call get_displaced_stepping_state. (displaced_step_fixup): Don't check for NULL. (prepare_for_detach): Don't check for NULL. --- gdb/inferior.h | 3 ++ gdb/infrun.c | 129 ++++++------------------------------------------- gdb/infrun.h | 47 ++++++++++++++++++ 3 files changed, 66 insertions(+), 113 deletions(-) diff --git a/gdb/inferior.h b/gdb/inferior.h index 33c2eac9d3c..1a3f579d8d2 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -503,6 +503,9 @@ public: this gdbarch. */ struct gdbarch *gdbarch =3D NULL; =20 + /* Data related to displaced stepping. */ + displaced_step_inferior_state displaced_step_state; + /* Per inferior data-pointers required by other GDB modules. */ REGISTRY_FIELDS; }; diff --git a/gdb/infrun.c b/gdb/infrun.c index 46a8985f860..63dd28237dd 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -1476,53 +1476,12 @@ step_over_info_valid_p (void) =20 displaced_step_closure::~displaced_step_closure () =3D default; =20 -/* Per-inferior displaced stepping state. */ -struct displaced_step_inferior_state -{ - /* The process this displaced step state refers to. */ - inferior *inf; - - /* True if preparing a displaced step ever failed. If so, we won't - try displaced stepping for this inferior again. */ - int failed_before; - - /* If this is not nullptr, this is the thread carrying out a - displaced single-step in process PID. This thread's state will - require fixing up once it has completed its step. */ - thread_info *step_thread; - - /* The architecture the thread had when we stepped it. */ - struct gdbarch *step_gdbarch; - - /* The closure provided gdbarch_displaced_step_copy_insn, to be used - for post-step cleanup. */ - struct displaced_step_closure *step_closure; - - /* The address of the original instruction, and the copy we - made. */ - CORE_ADDR step_original, step_copy; - - /* Saved contents of copy area. */ - gdb_byte *step_saved_copy; -}; - -/* The list of states of processes involved in displaced stepping - presently. */ -static std::forward_list - displaced_step_inferior_states; - /* Get the displaced stepping state of process PID. */ =20 static displaced_step_inferior_state * get_displaced_stepping_state (inferior *inf) { - for (auto *state : displaced_step_inferior_states) - { - if (state->inf =3D=3D inf) - return state; - } - - return nullptr; + return &inf->displaced_step_state; } =20 /* Returns true if any inferior has a thread doing a displaced @@ -1531,9 +1490,11 @@ get_displaced_stepping_state (inferior *inf) static bool displaced_step_in_progress_any_inferior () { - for (auto *state : displaced_step_inferior_states) + inferior *i; + + ALL_INFERIORS (i) { - if (state->step_thread !=3D nullptr) + if (i->displaced_step_state.step_thread !=3D nullptr) return true; } =20 @@ -1546,13 +1507,9 @@ displaced_step_in_progress_any_inferior () static int displaced_step_in_progress_thread (thread_info *thread) { - struct displaced_step_inferior_state *displaced; - gdb_assert (thread !=3D NULL); =20 - displaced =3D get_displaced_stepping_state (thread->inf); - - return (displaced !=3D NULL && displaced->step_thread =3D=3D thread); + return get_displaced_stepping_state (thread->inf)->step_thread =3D=3D th= read; } =20 /* Return true if process PID has a thread doing a displaced step. */ @@ -1560,34 +1517,7 @@ displaced_step_in_progress_thread (thread_info *thre= ad) static int displaced_step_in_progress (inferior *inf) { - struct displaced_step_inferior_state *displaced; - - displaced =3D get_displaced_stepping_state (inf); - if (displaced !=3D NULL && displaced->step_thread !=3D nullptr) - return 1; - - return 0; -} - -/* Add a new displaced stepping state for process PID to the displaced - stepping state list, or return a pointer to an already existing - entry, if it already exists. Never returns NULL. */ - -static displaced_step_inferior_state * -add_displaced_stepping_state (inferior *inf) -{ - displaced_step_inferior_state *state - =3D get_displaced_stepping_state (inf); - - if (state !=3D nullptr) - return state; - - state =3D XCNEW (struct displaced_step_inferior_state); - state->inf =3D inf; - - displaced_step_inferior_states.push_front (state); - - return state; + return get_displaced_stepping_state (inf)->step_thread !=3D nullptr; } =20 /* If inferior is in displaced stepping, and ADDR equals to starting addre= ss @@ -1597,42 +1527,21 @@ add_displaced_stepping_state (inferior *inf) struct displaced_step_closure* get_displaced_step_closure_by_addr (CORE_ADDR addr) { - struct displaced_step_inferior_state *displaced + displaced_step_inferior_state *displaced =3D get_displaced_stepping_state (current_inferior ()); =20 /* If checking the mode of displaced instruction in copy area. */ - if (displaced !=3D NULL - && displaced->step_thread !=3D nullptr + if (displaced->step_thread !=3D nullptr && displaced->step_copy =3D=3D addr) return displaced->step_closure; =20 return NULL; } =20 -/* Remove the displaced stepping state of process PID. */ - -static void -remove_displaced_stepping_state (inferior *inf) -{ - gdb_assert (inf !=3D nullptr); - - displaced_step_inferior_states.remove_if - ([inf] (displaced_step_inferior_state *state) - { - if (state->inf =3D=3D inf) - { - xfree (state); - return true; - } - else - return false; - }); -} - static void infrun_inferior_exit (struct inferior *inf) { - remove_displaced_stepping_state (inf); + inf->displaced_step_state.reset (); } =20 /* If ON, and the architecture supports it, GDB will use displaced @@ -1669,17 +1578,15 @@ use_displaced_stepping (struct thread_info *tp) { struct regcache *regcache =3D get_thread_regcache (tp); struct gdbarch *gdbarch =3D regcache->arch (); - struct displaced_step_inferior_state *displaced_state; - - displaced_state =3D get_displaced_stepping_state (tp->inf); + displaced_step_inferior_state *displaced_state + =3D get_displaced_stepping_state (tp->inf); =20 return (((can_use_displaced_stepping =3D=3D AUTO_BOOLEAN_AUTO && target_is_non_stop_p ()) || can_use_displaced_stepping =3D=3D AUTO_BOOLEAN_TRUE) && gdbarch_displaced_step_copy_insn_p (gdbarch) && find_record_target () =3D=3D NULL - && (displaced_state =3D=3D NULL - || !displaced_state->failed_before)); + && !displaced_state->failed_before); } =20 /* Clean out any stray displaced stepping state. */ @@ -1741,7 +1648,6 @@ displaced_step_prepare_throw (thread_info *tp) CORE_ADDR original, copy; ULONGEST len; struct displaced_step_closure *closure; - struct displaced_step_inferior_state *displaced; int status; =20 /* We should never reach this function if the architecture does not @@ -1760,7 +1666,8 @@ displaced_step_prepare_throw (thread_info *tp) /* We have to displaced step one thread at a time, as we only have access to a single scratch space per inferior. */ =20 - displaced =3D add_displaced_stepping_state (tp->inf); + displaced_step_inferior_state *displaced + =3D get_displaced_stepping_state (tp->inf); =20 if (displaced->step_thread !=3D nullptr) { @@ -1953,10 +1860,6 @@ displaced_step_fixup (thread_info *event_thread, enu= m gdb_signal signal) =3D get_displaced_stepping_state (event_thread->inf); int ret; =20 - /* Was any thread of this process doing a displaced step? */ - if (displaced =3D=3D NULL) - return 0; - /* Was this event for the thread we displaced? */ if (displaced->step_thread !=3D event_thread) return 0; @@ -3577,7 +3480,7 @@ prepare_for_detach (void) =20 /* Is any thread of this process displaced stepping? If not, there's nothing else to do. */ - if (displaced =3D=3D NULL || displaced->step_thread =3D=3D nullptr) + if (displaced->step_thread =3D=3D nullptr) return; =20 if (debug_infrun) diff --git a/gdb/infrun.h b/gdb/infrun.h index a701f0ca47f..81b3c326163 100644 --- a/gdb/infrun.h +++ b/gdb/infrun.h @@ -258,4 +258,51 @@ struct buf_displaced_step_closure : displaced_step_clo= sure gdb::byte_vector buf; }; =20 +/* Per-inferior displaced stepping state. */ +struct displaced_step_inferior_state +{ + /* Put this object back in its original state. s*/ + void reset () + { + /* These should have been cleaned after the last displaced step + operation, so if there are still set, it's a bug. */ + gdb_assert (step_thread =3D=3D nullptr); + gdb_assert (step_closure =3D=3D nullptr); + + failed_before =3D 0; + step_gdbarch =3D nullptr; + step_original =3D 0; + step_copy =3D 0; + + if (step_saved_copy !=3D nullptr) + { + xfree (step_saved_copy); + step_saved_copy =3D nullptr; + } + } + + /* True if preparing a displaced step ever failed. If so, we won't + try displaced stepping for this inferior again. */ + int failed_before =3D 0; + + /* If this is not nullptr, this is the thread carrying out a + displaced single-step in process PID. This thread's state will + require fixing up once it has completed its step. */ + thread_info *step_thread =3D nullptr; + + /* The architecture the thread had when we stepped it. */ + gdbarch *step_gdbarch =3D nullptr; + + /* The closure provided gdbarch_displaced_step_copy_insn, to be used + for post-step cleanup. */ + displaced_step_closure *step_closure =3D nullptr; + + /* The address of the original instruction, and the copy we + made. */ + CORE_ADDR step_original =3D 0, step_copy =3D 0; + + /* Saved contents of copy area. */ + gdb_byte *step_saved_copy =3D nullptr; +}; + #endif /* INFRUN_H */ --=20 2.19.1