From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3335 invoked by alias); 20 Mar 2007 00:57:23 -0000 Received: (qmail 3234 invoked by uid 22791); 20 Mar 2007 00:57:23 -0000 X-Spam-Check-By: sourceware.org Received: from viper.snap.net.nz (HELO viper.snap.net.nz) (202.37.101.8) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 20 Mar 2007 00:57:16 +0000 Received: from kahikatea.snap.net.nz (95.60.255.123.dynamic.snap.net.nz [123.255.60.95]) by viper.snap.net.nz (Postfix) with ESMTP id 3F2233D9DDD; Tue, 20 Mar 2007 12:57:12 +1200 (NZST) Received: by kahikatea.snap.net.nz (Postfix, from userid 500) id 8F9E24F72E; Tue, 20 Mar 2007 12:57:10 +1200 (NZST) From: Nick Roberts MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <17919.12645.81319.568064@kahikatea.snap.net.nz> Date: Tue, 20 Mar 2007 00:57:00 -0000 To: Denis PILAT Cc: gdb-patches Subject: Re: [RFC] -thread-select double print stack frame In-Reply-To: <45FE948B.9090007@st.com> References: <45FE948B.9090007@st.com> X-Mailer: VM 7.19 under Emacs 22.0.95.6 X-IsSubscribed: yes 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 X-SW-Source: 2007-03/txt/msg00177.txt.bz2 > 2007-03-19 Denis Pilat > > * thread.c (do_captured_thread_select): print_stack_frame use > LOC_AND_ADDRESS for mi output. > > Index: thread.c > =================================================================== > RCS file: /cvs/src/src/gdb/thread.c,v > retrieving revision 1.51 > diff -u -p -r1.51 thread.c > --- thread.c 28 Feb 2007 17:35:01 -0000 1.51 > +++ thread.c 19 Mar 2007 13:27:53 -0000 > @@ -700,7 +700,12 @@ do_captured_thread_select (struct ui_out > ui_out_text (uiout, target_tid_to_str (inferior_ptid)); > ui_out_text (uiout, ")]"); > > - print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC); > + /* For mi, we just print location. */ > + if (ui_out_is_mi_like_p (uiout)) > + print_stack_frame (get_selected_frame (NULL), 1, LOC_AND_ADDRESS); > + else > + print_stack_frame (get_selected_frame (NULL), 1, SRC_AND_LOC); > + > return GDB_RC_OK; > } > While this surely fixes the immediate problem, I'm not sure it's the best way. For example, we could have: args.print_what = ui_out_is_mi_like_p (uiout) ? LOC_AND_ADDRESS : print_what in print_stack_frame, to centralise things and remove the need for the clause in normal_stop. Furthermore, I don't understand why file and line details are duplicated in MI, but not CLI. It has something to do with uiout->flags not being 0 in MI (from looking at print_source_lines_base). The frame printing code is either one big mess, or I'm not seeing the underlying structure at the moment. Hopefully it's the latter. -- Nick http://www.inet.net.nz/~nickrob