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 5382A3858D3C for ; Tue, 12 Sep 2023 11:20:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5382A3858D3C 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=1694517656; 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=xDHXxviKNtkv0zQqHsM74cz7vQIqH7NRi9F4C9Y8heI=; b=DX6eqj6/wvH1QzJ5bJw3Ai7/fTG4af8O/2MmOpaYPVaXG6JMjb4cB74IZNvIII5vysaGMq vRCVBrIbBXG2DncquRqavj652uHx32VYFSvFMEfbiK+ZF/d4cGj13AVlihtenHO6Gqk40J o8gKYRKiuyaqryt5xSTElfGK1CyPjMo= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-18-1bP9_4wjOL2Y7O4TJHnj1Q-1; Tue, 12 Sep 2023 07:20:55 -0400 X-MC-Unique: 1bP9_4wjOL2Y7O4TJHnj1Q-1 Received: by mail-wm1-f72.google.com with SMTP id 5b1f17b1804b1-401d8873904so44196405e9.0 for ; Tue, 12 Sep 2023 04:20:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694517653; x=1695122453; 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=xDHXxviKNtkv0zQqHsM74cz7vQIqH7NRi9F4C9Y8heI=; b=Hw193SUoOnY5AsaVbmEtkL6DBB+1072nNBeUYqs0TxymI7pH21Ky2F8gDBjNB0EzG7 3pao//qf0OVjfr7Z4TubLA7jgAlS60B8gmsj+tro34x+C+YKT1bEzS5phBHdkrvvuZjq JrXL22WYEwqX8l/ybho44ZbCPU8oKHsSKOfiGhTtatw/arBh6Li3sV/LrYho8VbhFL0C slyQi0vaLbnlLrwt6THVjl486l/4TaWcde9mh+XKQM04vnKVTcxdH65w60vs6a7G3SIZ fAykfFvVUil1qqPH1P/MhiMmrTKIbMndpxvDZdpCizno8UTYg1AYTvC3RJK/p6UApI9I i14A== X-Gm-Message-State: AOJu0Yw7Tg9k5ocLw4og6D8OigkSdupqsLXwJKQoReJBxq+Z7EO5unAZ H3qtPqqBMKpy/Mn925i7xBvRGetFpMl8S6BIhc825GIi1onqzNqn9twGHyilcVDuvAu0X0ILO4L R21QhpGfWLYC+41erhCpYUiedManB0WklK8iT/CshZfcaXn8yBdzn5PmXNDndC6V5qkb3SBF22k bPohGsig== X-Received: by 2002:a05:600c:2317:b0:401:2ee0:7561 with SMTP id 23-20020a05600c231700b004012ee07561mr9673100wmo.17.1694517653666; Tue, 12 Sep 2023 04:20:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjwIjuNHA5EGP1SSfM62SYv97O9PfrKEQ1simQKhCUaiYiCHksnK+8FLTTokuxnBY7ZC3Ivw== X-Received: by 2002:a05:600c:2317:b0:401:2ee0:7561 with SMTP id 23-20020a05600c231700b004012ee07561mr9673083wmo.17.1694517653301; Tue, 12 Sep 2023 04:20:53 -0700 (PDT) Received: from localhost (197.126.90.146.dyn.plus.net. [146.90.126.197]) by smtp.gmail.com with ESMTPSA id b13-20020a05600c11cd00b003fefcbe7fa8sm12651002wmi.28.2023.09.12.04.20.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 04:20:52 -0700 (PDT) From: Andrew Burgess To: Simon Marchi via Gdb-patches , gdb-patches@sourceware.org Cc: Simon Marchi Subject: Re: [PATCH 20/21] gdb: make set_top_level_interpreter a method of struct ui In-Reply-To: <20230908190227.96319-21-simon.marchi@efficios.com> References: <20230908190227.96319-1-simon.marchi@efficios.com> <20230908190227.96319-21-simon.marchi@efficios.com> Date: Tue, 12 Sep 2023 12:20:51 +0100 Message-ID: <8734zjk57w.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=-11.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: > No behavior changes expected. > > Change-Id: Ie3ab2a2f2191a9df769c51ea81d564724789c6f6 > --- > gdb/interps.c | 14 -------------- > gdb/interps.h | 6 ------ > gdb/main.c | 2 +- > gdb/ui.c | 17 ++++++++++++++++- > gdb/ui.h | 6 ++++++ > 5 files changed, 23 insertions(+), 22 deletions(-) > > diff --git a/gdb/interps.c b/gdb/interps.c > index f954d503538c..f30357405877 100644 > --- a/gdb/interps.c > +++ b/gdb/interps.c > @@ -80,20 +80,6 @@ find_interp_factory (const char *name) > return nullptr; > } > > -/* See interps.h. */ > - > -void > -set_top_level_interpreter (ui *ui, const char *name) > -{ > - /* Find it. */ > - struct interp *interp = ui->lookup_interp (name); > - > - if (interp == NULL) > - error (_("Interpreter `%s' unrecognized"), name); > - /* Install it. */ > - ui->set_current_interpreter (interp, true); > -} > - > void > current_interp_set_logging (ui_file_up logfile, bool logging_redirect, > bool debug_redirect) > diff --git a/gdb/interps.h b/gdb/interps.h > index 4c094bf33e32..8416d657fb9a 100644 > --- a/gdb/interps.h > +++ b/gdb/interps.h > @@ -215,12 +215,6 @@ class interp : public intrusive_list_node > bool inited = false; > }; > > -/* Set UI's top level interpreter to the interpreter named NAME. > - > - Throws an error if NAME is not a known interpreter or the interpreter fails > - to initialize. */ > -extern void set_top_level_interpreter (ui *ui, const char *name); > - > /* Temporarily set the current interpreter, and reset it on > destruction. */ > class scoped_restore_interp > diff --git a/gdb/main.c b/gdb/main.c > index cf46f6acb208..58a79c518999 100644 > --- a/gdb/main.c > +++ b/gdb/main.c > @@ -1136,7 +1136,7 @@ captured_main_1 (struct captured_main_args *context) > > /* Install the default UI. All the interpreters should have had a > look at things by now. Initialize the default interpreter. */ > - set_top_level_interpreter (interpreter_p.c_str ()); > + current_ui->set_top_level_interpreter (interpreter_p.c_str ()); > > if (!quiet) > { > diff --git a/gdb/ui.c b/gdb/ui.c > index 2db899eb9c31..ec74cc91cd21 100644 > --- a/gdb/ui.c > +++ b/gdb/ui.c > @@ -223,6 +223,21 @@ ui::set_current_interpreter (interp *interp, bool top_level) > > /* See ui.h. */ > > +void > +ui::set_top_level_interpreter (const char *name) > +{ > + /* Find it. */ > + struct interp *interp = this->lookup_interp (name); > + > + if (interp == NULL) s/NULL/nullptr/ Thanks, Andrew > + error (_("Interpreter `%s' unrecognized"), name); > + > + /* Install it. */ > + this->set_current_interpreter (interp, true); > +} > + > +/* See ui.h. */ > + > void > ui::unregister_file_handler () > { > @@ -278,7 +293,7 @@ new_ui_command (const char *args, int from_tty) > > current_ui = ui.get (); > > - set_top_level_interpreter (interpreter_name); > + current_ui->set_top_level_interpreter (interpreter_name); > > top_level_interpreter ()->pre_command_loop (); > > diff --git a/gdb/ui.h b/gdb/ui.h > index 4f6a32991d6d..cebf112f971c 100644 > --- a/gdb/ui.h > +++ b/gdb/ui.h > @@ -179,6 +179,12 @@ struct ui : public intrusive_list_node > events such as target stops and new thread creation, even if they > are caused by CLI commands. */ > void set_current_interpreter (interp *interp, bool top_level); > + > + /* Set this UI's top level interpreter to the interpreter named NAME. > + > + Throws an error if NAME is not a known interpreter or the interpreter fails > + to initialize. */ > + void set_top_level_interpreter (const char *name); > }; > > /* The main UI. This is the UI that is bound to stdin/stdout/stderr. > -- > 2.42.0