From patchwork Wed Mar 20 14:08:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom Tromey X-Patchwork-Id: 31911 Received: (qmail 40604 invoked by alias); 20 Mar 2019 14:08:53 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 40596 invoked by uid 89); 20 Mar 2019 14:08:53 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-20.4 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=ecs, HX-Languages-Length:1999, HContent-Transfer-Encoding:8bit X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 20 Mar 2019 14:08:52 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 66D6F560C2; Wed, 20 Mar 2019 10:08:50 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id pRHtlHQ0NrTZ; Wed, 20 Mar 2019 10:08:50 -0400 (EDT) Received: from murgatroyd.Home (174-29-37-56.hlrn.qwest.net [174.29.37.56]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by rock.gnat.com (Postfix) with ESMTPSA id 1D439560C1; Wed, 20 Mar 2019 10:08:50 -0400 (EDT) From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Merge handle_inferior_event and handle_inferior_event_1 Date: Wed, 20 Mar 2019 08:08:46 -0600 Message-Id: <20190320140846.13031-1-tromey@adacore.com> MIME-Version: 1.0 I noticed that handle_inferior_event is just a small wrapper that frees the value chain. This patch replaces it with a scoped_value_mark, reducing the number of lines of code here. Regression tested on x86-64 Fedora 29. gdb/ChangeLog 2019-03-20 Tom Tromey * infrun.c (handle_inferior_event): Rename from handle_inferior_event_1. Create a scoped_value_mark. (handle_inferior_event): Remove. --- gdb/ChangeLog | 6 ++++++ gdb/infrun.c | 23 ++++++----------------- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/gdb/infrun.c b/gdb/infrun.c index 550fbe7f5b9..ad7892105a4 100644 --- a/gdb/infrun.c +++ b/gdb/infrun.c @@ -4591,8 +4591,13 @@ handle_no_resumed (struct execution_control_state *ecs) once). */ static void -handle_inferior_event_1 (struct execution_control_state *ecs) +handle_inferior_event (struct execution_control_state *ecs) { + /* Make sure that all temporary struct value objects that were + created during the handling of the event get deleted at the + end. */ + scoped_value_mark free_values; + enum stop_kind stop_soon; if (ecs->ws.kind == TARGET_WAITKIND_IGNORE) @@ -5189,22 +5194,6 @@ Cannot fill $_exitsignal with the correct signal number.\n")); } } -/* A wrapper around handle_inferior_event_1, which also makes sure - that all temporary struct value objects that were created during - the handling of the event get deleted at the end. */ - -static void -handle_inferior_event (struct execution_control_state *ecs) -{ - struct value *mark = value_mark (); - - handle_inferior_event_1 (ecs); - /* Purge all temporary values created during the event handling, - as it could be a long time before we return to the command level - where such values would otherwise be purged. */ - value_free_to_mark (mark); -} - /* Restart threads back to what they were trying to do back when we paused them for an in-line step-over. The EVENT_THREAD thread is ignored. */