From patchwork Fri Sep 8 18:22:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 56100 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2090A3858408 for ; Fri, 8 Sep 2023 19:03:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2090A3858408 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1694199781; bh=MShJ01MoR2uNGLLzQF6J5AenQkt+GuESHJNBhgznv7A=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=gZ1Yhud2mpjbKYn/2kWIZ7WzQunOAlhkAZ5w1lwJMGfTloOpbYpbABSVS342ITKmb kRaf8DjGEk2dLjW370dP0u+P99j9k+9HFwW5+QWgnF09D1fMuN3d1DSylhWBC9FHLx wZb0Lvm/0++110BOiCDDVty9CDs3UBlFo72vwaKQ= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 396A63858D1E for ; Fri, 8 Sep 2023 19:02:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 396A63858D1E Received: from smarchi-efficios.internal.efficios.com (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id DECA41E092; Fri, 8 Sep 2023 15:02:28 -0400 (EDT) To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 00/21] ui / interp cleansup Date: Fri, 8 Sep 2023 14:22:54 -0400 Message-ID: <20230908190227.96319-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.42.0 MIME-Version: 1.0 X-Spam-Status: No, score=-3491.1 required=5.0 tests=BAYES_00, KAM_DMARC_NONE, KAM_DMARC_STATUS, SPF_HELO_PASS, SPF_SOFTFAIL, TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" When trying to untangle things in the ui and interp area (notably, trying to understand what happens when setting and restoring interpreters, in the context of interpreter-exec), I came up with a few cleanups. Here is a first round. One goal is to make some interp operations be methods of struct ui. Interpreters are children of UIs, so I think it makes sense if the process of looking up / creating interpreters is implemented in methods of struct ui. The concept of top level interpreter is also per UI, so I made getting and setting the top level interpreter methods of struct ui. I plan to do the same with the current and the command interpreter later, but it wasn't as obvious. Another goal is to try to reduce the number of references to current_ui in the code that manages interpreters. Such references are often behind macros, which in my opinion makes it difficult to understand how things work. To this end, there is one patch that adds a backlink from interpreters to their parent UI, so that interpreters know which UI they belong to (and they should never need to touch current_ui). Simon Marchi (21): gdb: use intrusive_list for struct ui linked list gdb: make interp_lookup_existing a method of struct ui gdb: make interp_add a method of struct ui gdb: make interp_lookup a method of struct ui gdb: remove ui:::add_interp and ui::lookup_existing_interp gdb: uncover some current_ui uses in interp_set gdb: add backlink to ui in interp gdb: pass ui down to gdb_setup_readline and gdb_disable_readline gdb/python: use m_ui instead of current_ui in dap_interp::init gdb/mi: use m_ui instead of current_ui in mi_interp::init gdb/cli: use m_ui instead of current_ui in cli_interp::resume gdb/tui: use m_ui instead of current_ui in tui_interp::resume gdb/mi: use m_ui instead of current_ui in mi_interp::resume gdb/cli: use m_ui instead of current_ui in cli_interp::suspend gdb/tui: use m_ui instead of current_ui in tui_interp::suspend gdb/mi: use m_ui instead of current_ui in mi_interp::suspend gdb: pass current_ui down to interp_set gdb: make interp_set a method of struct ui gdb: pass down current_ui to set_top_level_interpreter gdb: make set_top_level_interpreter a method of struct ui gdb: make top_level_interpreter a method of struct ui gdb/cli/cli-interp.c | 25 +++---- gdb/cli/cli-interp.h | 2 +- gdb/cli/cli-script.c | 2 +- gdb/event-top.c | 10 +-- gdb/event-top.h | 4 +- gdb/infrun.c | 8 +-- gdb/interps.c | 159 ++++--------------------------------------- gdb/interps.h | 40 ++++++----- gdb/linespec.c | 3 +- gdb/main.c | 6 +- gdb/mi/mi-interp.c | 23 +++---- gdb/mi/mi-interp.h | 4 +- gdb/python/py-dap.c | 12 ++-- gdb/python/python.c | 2 +- gdb/solib.c | 4 +- gdb/top.c | 6 +- gdb/tui/tui-interp.c | 19 +++--- gdb/tui/tui.c | 2 +- gdb/ui.c | 124 +++++++++++++++++++++++++-------- gdb/ui.h | 64 ++++++++++++----- gdb/utils.c | 5 +- 21 files changed, 243 insertions(+), 281 deletions(-) base-commit: 15db2284f2f8259e46635ca6df3efc772d951fac Reviewed-By: Andrew Burgess