From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 02FA93858D3C for ; Tue, 12 Sep 2023 11:38:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 02FA93858D3C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694518689; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=D/VXpKB5y9naNY10IsDWbasLu7+Z83jgQuyoWPYvP+w=; b=VHH/cOvK4teI3qCllys+tA43QBZjK14/dEqwXSHtN04iAwAzC0Bbrc7evhJp8JSoHhUOC6 J1H3SfcmcjwUv/vP/Mqc4FbCR+cb0lZqDpoUGFpujGvps5nbVGZSodnxe225rkY82XZfSY dlDCoGJGpP2Fg2FwsUI6k6+sJplvrjw= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-abWOR7xwM_yhfXrz6fm0MA-1; Tue, 12 Sep 2023 07:38:08 -0400 X-MC-Unique: abWOR7xwM_yhfXrz6fm0MA-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-31c5c47807aso3728718f8f.1 for ; Tue, 12 Sep 2023 04:38:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694518687; x=1695123487; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=D/VXpKB5y9naNY10IsDWbasLu7+Z83jgQuyoWPYvP+w=; b=POINfxM+4Cdz36vy839Gf2NP5Q+ZozrCQfzbVR8jonbnzlF5vd/ppoOqscRF42gAuk EJHOahEfKwl3FTPgmmalQ5qTLk1PXoPnFMc1SsWK/Mg1K+k4FJo0wzw0xXXyb4VtMec3 kZ1hsD+9POFkd1OrQZlYcBBtu0aS1GKSn0M6/socKn3HJ3JBuRWnQHVzjdNxqy4UWttV gzsdX7qG/RBZoMbuHUdoIHFwxcAIiO1mBEANflkQy97VRWUsrGMMuxCaPzfnHIQXZLPw QwBDKt/Yzfs91DU7sBtVlLur1Tnw3gAm8C8SYmV17qeWIwPQr/I/7Yu0Sn6K4be2byXw ayVg== X-Gm-Message-State: AOJu0Yz6bI7k3BQxoQJR780oyNtT/ZvolK3O6ImNy2rJYkeOiBtGpalt aEyKLfWlk/kS+gqmk8jL/autHT0VfGYxOy7i2MffDgFkamRCuuvr6uktZU0CZPpDz+J3dMRBYoq OCvtDweB/XXhUC3CYDqCyxxhdbomi52CK+dWUy2ScEtFUTZrm6I90z+10ljUwCYOueN66snMyFj KnpOs9Cw== X-Received: by 2002:adf:ce0b:0:b0:319:68ce:2c53 with SMTP id p11-20020adfce0b000000b0031968ce2c53mr11742752wrn.25.1694518687236; Tue, 12 Sep 2023 04:38:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCUfB6iwyPzGl1skANRP24yvbDZFoMOPYk0LvD64patIF4GeYcFrKn3d2OC9A57OFlCBz/XQ== X-Received: by 2002:adf:ce0b:0:b0:319:68ce:2c53 with SMTP id p11-20020adfce0b000000b0031968ce2c53mr11742737wrn.25.1694518686856; Tue, 12 Sep 2023 04:38:06 -0700 (PDT) Received: from localhost (197.126.90.146.dyn.plus.net. [146.90.126.197]) by smtp.gmail.com with ESMTPSA id w6-20020adfe046000000b0031f82743e25sm11118719wrh.67.2023.09.12.04.38.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 04:38:06 -0700 (PDT) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 00/21] ui / interp cleansup In-Reply-To: <20230908190227.96319-1-simon.marchi@efficios.com> References: <20230908190227.96319-1-simon.marchi@efficios.com> Date: Tue, 12 Sep 2023 12:38:05 +0100 Message-ID: <87wmwvipuq.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Simon Marchi via Gdb-patches writes: > 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). Anything we can do to make GDB's I/O & interpreter sub-system simpler -- or at least easier to understand -- is a good thing, I've always found this part of GDB painful to work with. I've gone through all the patches and left a few comments, but mostly I think this looks great. Reviewed-By: Andrew Burgess Thanks, Andrew > > 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 > -- > 2.42.0