From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 91362 invoked by alias); 22 Mar 2016 09:33:32 -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 91258 invoked by uid 89); 22 Mar 2016 09:33:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-pf0-f193.google.com Received: from mail-pf0-f193.google.com (HELO mail-pf0-f193.google.com) (209.85.192.193) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 22 Mar 2016 09:33:29 +0000 Received: by mail-pf0-f193.google.com with SMTP id u190so34790871pfb.2 for ; Tue, 22 Mar 2016 02:33:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=y1h0B0gKqeQ5mPolgpXlDWdVQ1LPQhAW1UK0TnmbogI=; b=A2VNOWCV9FRyry27mw4/2sqZFTJyVIuDnp+QoOHaXXVvuHdGu8SXgvFvYcKX0AHqV8 IQhEMvjykAJeIthI+Vu96ClwBb+K+ahCct6GdGMTq8/5FfQGvAKsPihHMOQYDRZWDR5X RyJn9vb/Z1EVBmaQYrCP64mNmLH9U2XbWetvZpote/6THg1PJSzkv+sGMKq8oTqXGimG UIt48jcpipZTRlU72YaIfU6HgeEXoRoQj3WgkiCGP/MCvxFwNOtGnD9DnhOnj4rNUFSV eoftkfCVOh0rt4cDLLLXAb+H3k53H3P9gmTglrdSIaAqJzY32ZVA6zd+AJdNxiWkqiUc LKsw== X-Gm-Message-State: AD7BkJLazZ0+dezC1Y2Jn0aucP3OgLUqBxFonaIftepSd4oFRNYKkwHs0E/e+bgs1O8WSA== X-Received: by 10.66.171.169 with SMTP id av9mr52589717pac.36.1458639208110; Tue, 22 Mar 2016 02:33:28 -0700 (PDT) Received: from E107787-LIN (gcc1-power7.osuosl.org. [140.211.15.137]) by smtp.gmail.com with ESMTPSA id r5sm46792579pap.7.2016.03.22.02.33.25 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Tue, 22 Mar 2016 02:33:27 -0700 (PDT) From: Yao Qi To: Pedro Alves Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v2 05/25] Make the intepreters output to all UIs References: <1458573675-15478-1-git-send-email-palves@redhat.com> <1458573675-15478-6-git-send-email-palves@redhat.com> Date: Tue, 22 Mar 2016 09:33:00 -0000 In-Reply-To: <1458573675-15478-6-git-send-email-palves@redhat.com> (Pedro Alves's message of "Mon, 21 Mar 2016 15:20:55 +0000") Message-ID: <86vb4evov5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2016-03/txt/msg00449.txt.bz2 Pedro Alves writes: Hi Pedro, We have three interpreters, cli, mi and tui. Each of them has a ${inter}_on_normal_stop registered to normal_stop observer, as below, > @@ -50,10 +55,17 @@ static struct gdb_exception safe_execute_command (str= uct ui_out *uiout, > static void > cli_on_normal_stop (struct bpstats *bs, int print_frame) > { > - if (!interp_quiet_p (cli_interp)) > + struct switch_thru_all_uis state; > + > + SWITCH_THRU_ALL_UIS (state) > { > + struct cli_interp *cli =3D as_cli_interp (top_level_interpreter ()= ); > + > + if (cli =3D=3D NULL) > + continue; > + > if (print_frame) > - print_stop_event (interp_ui_out (cli_interp)); > + print_stop_event (cli->cli_uiout); > } > } >=20=20 >=20=20 > static void > -mi_on_normal_stop (struct bpstats *bs, int print_frame) > +mi_on_normal_stop_1 (struct bpstats *bs, int print_frame) > { > /* Since this can be called when CLI command is executing, > using cli interpreter, be sure to use MI uiout for output, > @@ -645,6 +697,20 @@ mi_on_normal_stop (struct bpstats *bs, int print_fra= me) > } >=20=20 > static void > +mi_on_normal_stop (struct bpstats *bs, int print_frame) > +{ > + struct switch_thru_all_uis state; > + > + SWITCH_THRU_ALL_UIS (state) > + { > + if (as_mi_interp (top_level_interpreter ()) =3D=3D NULL) > + continue; > + > + mi_on_normal_stop_1 (bs, print_frame); > + } > +} > + > static void > tui_on_normal_stop (struct bpstats *bs, int print_frame) > { > - if (!interp_quiet_p (tui_interp)) > + struct switch_thru_all_uis state; > + > + SWITCH_THRU_ALL_UIS (state) > { > + struct interp *tui =3D as_tui_interp (top_level_interpreter ()); > + > + if (tui =3D=3D NULL) > + continue; > + > if (print_frame) > - print_stop_event (tui_ui_out (tui_interp)); > + print_stop_event (tui_ui_out (tui)); > } > } Why don't we have 'struct ui' have a method 'print_stop_event', so that we can put the different handling there. In this way, we can only register one to normal_stop observer, in interps.c for example, and the code can be simplified, like this, static void interp_on_normal_stop (struct bpstats *bs, int print_frame) { struct switch_thru_all_uis state; SWITCH_THRU_ALL_UIS (state) { current_ui->print_stop_event (bs, print_frame); } } we don't have to check the type of interpreter in the loop anymore. --=20 Yao (=E9=BD=90=E5=B0=A7)