From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17081 invoked by alias); 23 Jul 2002 20:05:31 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 17073 invoked from network); 23 Jul 2002 20:05:28 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 23 Jul 2002 20:05:28 -0000 Received: from ges.redhat.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 948EB3DBB; Tue, 23 Jul 2002 16:05:27 -0400 (EDT) Message-ID: <3D3DB707.4010001@ges.redhat.com> Date: Tue, 23 Jul 2002 13:05:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.0) Gecko/20020708 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Daniel Jacobowitz Cc: gdb@sources.redhat.com Subject: Re: Overriding uiout References: <20020723164601.GA23869@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-07/txt/msg00239.txt.bz2 > There are currently only four code paths in the entire GDB source tree where > uiout could theoretically be overridden to something other than the normal > uiout. They're all for libgdb: gdb_value_struct_elt, gdb_thread_select, > gdb_list_thread_ids, and gdb_breakpoint_query. The only place it actually > appears to be overridden is in gdb_value_struct_elt, which is occasionally > called from varobj code with uiout==NULL. Otherwise it is always overridden > to itself. The -interpreter-exec command needs it. See: http://sources.redhat.com/ml/gdb/2002-05/msg00177.html > This overriding mechanism makes it a bit awkward to redirect GDB's output; > any change to uiout is lost after the current command if we are running from > the prompt (although, surprisingly and IMO inconsistently, it lasts until > the end of a user-defined function). That is likely something that -interpreter-exec is going to have to flush out. > So I'll ask again - what is this interface supposed to accomplish? If it's > just a step down the road to passing explicit state everywhere, then I think > it's a significant step backwards in other ways, and that we should instead > let clients or wrapper functions manipulate the global state until we're > truly ready to pass a global state around - a global state which can be > overridden for this sort of task. It's a step down the road of passing explict I/O re-direction. It will likely be finished when GDB starts passing more global state around. As I mentioned in another e-mail you need to ensure that the assertion: global uiout->stream == global gdb_stdout et.al. holds. There are a number of ways of doing this short term. Replacing gdb_stdout with a function is one, blatting the global is another. > This is purely a design question, not an implementation objection. For > implementation I'm restricting this feature to CLI only, and implementing it > within cli-out. It turned out to be more elegant than I expected. Andrew