From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 32516 invoked by alias); 28 Jan 2003 20:51:38 -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 32509 invoked from network); 28 Jan 2003 20:51:37 -0000 Received: from unknown (HELO zenia.red-bean.com) (66.244.67.22) by 172.16.49.205 with SMTP; 28 Jan 2003 20:51:37 -0000 Received: from zenia.red-bean.com (localhost.localdomain [127.0.0.1]) by zenia.red-bean.com (8.12.5/8.12.5) with ESMTP id h0SKjl8A023353; Tue, 28 Jan 2003 15:45:47 -0500 Received: (from jimb@localhost) by zenia.red-bean.com (8.12.5/8.12.5/Submit) id h0SKjjVF023349; Tue, 28 Jan 2003 15:45:45 -0500 To: Nick Roberts Cc: rms@gnu.org, gdb@sources.redhat.com Subject: Re: obsoleting the annotate level 2 interface References: <15917.39229.935851.920452@nick.uklinux.net> From: Jim Blandy Date: Tue, 28 Jan 2003 20:51:00 -0000 In-Reply-To: <15917.39229.935851.920452@nick.uklinux.net> Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.2.92 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-SW-Source: 2003-01/txt/msg00467.txt.bz2 Nick, what is involved in bringing gdb-ui over to using MI? Annotations have been deprecated for a while now, so it probably won't kill us to keep them for a while longer, but it doesn't make sense for us to keep them indefinitely; gdb-ui needs to start making the transition. Keep in mind, I haven't been taking part of all these conversations about MI, Eclipse, and the rest, so I don't know the whole history of what was broken when, who was unhelpful to whom, etc. But from what I do understand, I really think MI is the way GDB should go. I'd like to help make that happen. Personally, I want a command-line interface to GDB too; I'd like to see MI used to improve that (say, by handling 'display' or the breakpoint list better), but I don't want to replace it. What is MI missing in this regard? It seems to me like it's all there: zenia:emacs$ $D6/gdb/gdb --interpreter=mi2 $D6/gdb/gdb ~"GNU gdb 2003-01-23-cvs\n" ~"Copyright 2003 Free Software Foundation, Inc.\n" ~"GDB is free software, covered by the GNU General Public License, and you are\n" ~"welcome to change it and/or distribute copies of it under certain conditions.\n" ~"Type \"show copying\" to see the conditions.\n" ~"There is absolutely no warranty for GDB. Type \"show warranty\" for details.\n" ~"This GDB was configured as \"i686-pc-linux-gnu\"..." ~"\n" (gdb) break symfile.c:1234 &"break symfile.c:1234\n" ^done (gdb) print annotation_level &"print annotation_level\n" ~"$1 = 0" ~"\n" ^done (gdb) In other words, you can just send the user's input to an MI GDB directly, and whatever you get back prefixed with a ~ is what should go into the interaction buffer as GDB's output. One problem is that even command-line commands produce output in MI style: whether I say "info breakpoints" (the CLI command) or "-break-list" (the MI command), I get MI-style output: (gdb) -break-list ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080b183c",func="symbol_file_command",file="/home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/symfile.c",line="1234",times="0"}]} (gdb) info breakpoints &"info breakpoints\n" ^done,BreakpointTable={nr_rows="1",nr_cols="6",hdr=[{width="3",alignment="-1",col_name="number",colhdr="Num"},{width="14",alignment="-1",col_name="type",colhdr="Type"},{width="4",alignment="-1",col_name="disp",colhdr="Disp"},{width="3",alignment="-1",col_name="enabled",colhdr="Enb"},{width="10",alignment="-1",col_name="addr",colhdr="Address"},{width="40",alignment="2",col_name="what",colhdr="What"}],body=[bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x080b183c",func="symbol_file_command",file="/home/jimb/cygnus/src/sourceware/gdb/main/src/gdb/symfile.c",line="1234",times="0"}]} (gdb) But I think this could be handled by having a cli ui_out stream built on top of the default MI ui_out stream, and setting the global uiout to that while running a command-line command. That way, you'd get CLI-style output wrapped up as an MI-style ~ packet. For completion, can't gdb-ui.el continue to use the "complete" command, just as Emacs always has? (gdb) complete break symfi &"complete break symfi\n" ~"break symfile_bfd\n" ~"break symfile_bfd_open\n" ~"break symfile_complaint_book\n" ~"break symfile_complaints\n" ~"break symfile_explanations\n" ~"break symfile_objfile\n" ~"break symfile_relocatable\n" ^done (gdb) There's also the issue of having the program's output interleaved with GDB's. But you can use GDB's `tty' command to send the inferior's output to any pseudotty you like --- you could put it in a separate buffer from the GDB interaction, or you could copy it into the GDB interaction buffer if that's what you want. What are the other issues? This may not be the largest issue, but one thing that might be of interest is that, given the way the MI support is done, it would be very easy to have GDB provide all its output as Emacs Lisp s-expressions, so Emacs could just 'read' them directly. And this would be a modular and relatively small change. All you need to do is provide your own `struct ui_out_impl' that prints things the way you like.