This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: obsoleting the annotate level 2 interface


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]