public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH v3 00/34] Towards great frontend GDB consoles
@ 2016-05-06 12:35 Pedro Alves
  2016-05-06 12:35 ` [PATCH v3 21/34] Replace the sync_execution global with a new enum prompt_state tristate Pedro Alves
                   ` (35 more replies)
  0 siblings, 36 replies; 72+ messages in thread
From: Pedro Alves @ 2016-05-06 12:35 UTC (permalink / raw)
  To: gdb-patches

Here's an update of the series I last posted here:
  https://sourceware.org/ml/gdb-patches/2016-03/msg00388.html

New in v3:

 - Now at 34 patches, from 25.

 - ChangeLog entries

 - A lot of missing comments.

 - GDB manual / NEWS documentation bits written

 - Testing infrustruture add, plus new tests.
 
   This allowed testing on x64-64 Fedora 23 with all MI tests forced
   to run MI on a separate UI, which revealed a few problems, all
   addressed.

 - Many bugs fixed, as exposed by the testsuite.
 
 - Bugs reported by Marc Khozam fixed (interpreter-exec; repeat;
   console stuck with -exec-run and "set inferior-tty").
 
 - "info uis" command dropped for now.

Force-pushed to users/palves/console at sourceware.org.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Series intro:

This series provides a way to for frontends's GDB console to be on par
with gdb's native console running on a terminal.

The current support for implementing a GDB console that MI frontends
have available, based on "-interpreter-exec console", leaves readline,
history, completion, when to show/hide/print the prompt (sync vs async
execution), pagination, etc. all up to the frontend.

The end result is that all frontends have a real bad GDB console
experience, if they provide one at all.

GDB already has to handle all that for the native CLI, when GDB is
started without MI.  This series leverages that.  Instead, have
Eclipse create a pty and wrap it in a window widget -- the same as
Eclipse's shell console -- and start GDB in that pty.  Then, create a
second pty for MI communication, and tell GDB to start a MI
interpreter there, with a new "new-ui mi /dev/pts/N" command.

GDB then creates/manages a CLI on its terminal, with readline,
history, etc., support all done by GDB.

It's also possible to start extra CLI consoles, with "new-ui console
/dev/pts/N".  The current limitation is that these extra consoles
don't have readline active (work as if "set editing off"), because
there can only be one instance of readline in a process, currently.
(I have a readline patch that addresses it, but it'll need API and
implementation discussion and it may or not be accepted.)

It should be possible to start gdb in MI mode, and then start an extra
console, and support readline on that console (since there's still
just one readline user), though it'll need a little bit more work to
get there.  I just didn't try it yet, but it's definitely possible.

My original prototype did start out by doing things the other way
around -- start GDB in MI mode, and then start an extra CLI console on
a separate tty.  I handed over that (functional) prototype to Marc
Khouzam @ Eclipse CDT a while ago, and after experimentation and
discussion, we ended up concluding that starting GDB in CLI mode
instead was both easier and actually also makes it possible to support
an interesting use case -- connect an Eclipse frontend to a GDB that
is already running outside Eclipse.  Say, you're debugging on a
terminal, and then suddendly decide to start Eclipse's Standalone
Debugger _reusing_ your existing GDB, without having to start the
debug session from scratch.  Magic.

The current usage is "new-ui <interpreter> <tty>".

E.g., on a terminal run this scriplet:

 $ cat gdb-client
 #!/bin/bash

 reset
 tty
 tail -f /dev/null

 $ gdb-client
 /dev/pts/15

Now run gdb on another terminal, and tell it to start an MI
interpreter on the tty of the other terminal:

 ...
 (gdb) new-ui mi /dev/pts/15
 New UI allocated

Now back to the the gdb-client terminal, we'll get an MI prompt, ready
for MI input:

 /dev/pts/15
 =thread-group-added,id="i1"
 (gdb)

You can also start a new UI running a CLI, with:

 (gdb) new-ui console /dev/pts/15

More details in patch 29, which actually adds the new-ui command.

In case I messed up something on this update, you can still find v1 on
my github:
  https://github.com/palves/gdb/commits/palves/console-v2

Pedro Alves (34):
  Prepare gdb.python/mi-py-events.exp for Python/MI in separate channels
  [Ada catchpoints] Fix "warning: failed to get exception name: No
    definition of \"e.full_name\" in current context"
  Introduce "struct ui"
  Make gdb_stdout&co be per UI
  Make the interpreters be per UI
  Introduce interpreter factories
  Make the intepreters output to all UIs
  Always run async signal handlers in the main UI
  Make instream be per UI
  Make input_fd be per UI
  Make out and error streams be per UI
  Delete def_uiout
  Make current_ui_out be per UI
  Make command line editing (use of readline) be per UI
  Always process target events in the main UI
  Make target_terminal_inferior/ours almost nops on non-main UIs
  Introduce display_mi_prompt
  Make raw_stdout be per MI instance
  Simplify starting the command event loop
  Make gdb_in_secondary_prompt_p() be per UI
  Replace the sync_execution global with a new enum prompt_state
    tristate
  Fix for spurious prompts in secondary UIs
  New function should_print_stop_to_console
  Push thread->control.command_interp to the struct thread_fsm
  Only send sync execution command output to the UI that ran the command
  Make main_ui be heap allocated
  Handle UI's terminal closing
  Make stdin be per UI
  Add new command to create extra console/mi UI channels
  [DOC] Document support for running interpreters on separate UI
    channels
  Add testing infrastruture bits for running with MI on a separate UI
  Send deleted watchpoint-scope output to all UIs
  Make mi-break.exp always expect breakpoint commands output on the main
    UI
  Always switch fork child to the main UI

 gdb/doc/gdb.texinfo                          |   55 +-
 gdb/NEWS                                     |   16 +
 gdb/ada-lang.c                               |    9 +
 gdb/annotate.c                               |   15 +-
 gdb/breakpoint.c                             |   61 +-
 gdb/cli/cli-interp.c                         |  255 ++++--
 gdb/cli/cli-interp.h                         |   32 +
 gdb/cli/cli-script.c                         |   33 +-
 gdb/compile/compile.c                        |   14 +-
 gdb/defs.h                                   |    4 +-
 gdb/event-loop.c                             |    5 +
 gdb/event-top.c                              |  343 ++++----
 gdb/event-top.h                              |   13 +-
 gdb/exceptions.c                             |    4 +-
 gdb/fork-child.c                             |   22 +-
 gdb/gdbthread.h                              |    5 -
 gdb/guile/guile.c                            |   14 +-
 gdb/guile/scm-ports.c                        |    6 +-
 gdb/inf-loop.c                               |    2 +-
 gdb/infcall.c                                |   50 +-
 gdb/infcmd.c                                 |  104 +--
 gdb/inflow.c                                 |   35 -
 gdb/infrun.c                                 |  157 ++--
 gdb/infrun.h                                 |   15 +-
 gdb/interps.c                                |  288 +++++--
 gdb/interps.h                                |   67 +-
 gdb/linux-nat.c                              |    2 -
 gdb/main.c                                   |   53 +-
 gdb/mi/mi-cmds.h                             |    3 -
 gdb/mi/mi-common.h                           |    7 +
 gdb/mi/mi-interp.c                           | 1131 +++++++++++++++-----------
 gdb/mi/mi-main.c                             |   95 ++-
 gdb/mi/mi-main.h                             |    4 +-
 gdb/python/python.c                          |   15 +-
 gdb/remote.c                                 |    2 -
 gdb/target.c                                 |   40 +-
 gdb/testsuite/README                         |    6 +
 gdb/testsuite/gdb.ada/mi_catch_ex.exp        |   41 +-
 gdb/testsuite/gdb.gdb/selftest.exp           |    4 +
 gdb/testsuite/gdb.mi/mi-break.exp            |   69 +-
 gdb/testsuite/gdb.mi/mi-editing.exp          |   37 +
 gdb/testsuite/gdb.mi/mi-exec-run.exp         |  158 ++++
 gdb/testsuite/gdb.mi/mi-watch.exp            |   85 +-
 gdb/testsuite/gdb.opt/inline-cmds.c          |    2 +-
 gdb/testsuite/gdb.opt/inline-cmds.exp        |   62 ++
 gdb/testsuite/gdb.python/py-mi-events-gdb.py |   12 +-
 gdb/testsuite/gdb.python/py-mi-events.exp    |   21 +-
 gdb/testsuite/lib/gdb.exp                    |    3 +-
 gdb/testsuite/lib/mi-support.exp             |  159 +++-
 gdb/thread-fsm.c                             |   12 +-
 gdb/thread-fsm.h                             |   23 +-
 gdb/thread.c                                 |    2 +-
 gdb/top.c                                    |  367 +++++++--
 gdb/top.h                                    |  174 +++-
 gdb/tui/tui-interp.c                         |  175 +++-
 gdb/tui/tui-io.c                             |    6 +-
 gdb/tui/tui.c                                |    2 +-
 gdb/ui-file.c                                |    4 +-
 gdb/ui-file.h                                |    4 +-
 gdb/ui-out.c                                 |  184 -----
 gdb/ui-out.h                                 |    3 +-
 gdb/utils.c                                  |    7 +-
 gdb/utils.h                                  |   19 +-
 63 files changed, 3090 insertions(+), 1527 deletions(-)
 create mode 100644 gdb/cli/cli-interp.h
 create mode 100644 gdb/testsuite/gdb.mi/mi-editing.exp
 create mode 100644 gdb/testsuite/gdb.mi/mi-exec-run.exp

-- 
2.5.5

^ permalink raw reply	[flat|nested] 72+ messages in thread

end of thread, other threads:[~2016-07-20 16:35 UTC | newest]

Thread overview: 72+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-05-06 12:35 [PATCH v3 00/34] Towards great frontend GDB consoles Pedro Alves
2016-05-06 12:35 ` [PATCH v3 21/34] Replace the sync_execution global with a new enum prompt_state tristate Pedro Alves
2016-05-06 12:35 ` [PATCH v3 15/34] Always process target events in the main UI Pedro Alves
2016-05-06 12:35 ` [PATCH v3 01/34] Prepare gdb.python/mi-py-events.exp for Python/MI in separate channels Pedro Alves
2016-05-06 12:35 ` [PATCH v3 16/34] Make target_terminal_inferior/ours almost nops on non-main UIs Pedro Alves
2016-05-06 12:35 ` [PATCH v3 29/34] Add new command to create extra console/mi UI channels Pedro Alves
2016-05-26 18:34   ` Pedro Alves
2016-05-06 12:35 ` [PATCH v3 03/34] Introduce "struct ui" Pedro Alves
2016-05-06 12:35 ` [PATCH v3 24/34] Push thread->control.command_interp to the struct thread_fsm Pedro Alves
2016-07-01 11:02   ` Thomas Preudhomme
2016-07-01 12:05     ` [PATCH] Build gdb.opt/inline-*.exp tests at -O0, rely on __attribute__((always_inline)) (was: Re: [PATCH v3 24/34] Push thread->control.command_interp to the struct thread_fsm) Pedro Alves
2016-07-01 15:24       ` Thomas Preudhomme
2016-07-15 12:05         ` Thomas Preudhomme
2016-07-19 17:02           ` [PATCH] Build gdb.opt/inline-*.exp tests at -O0, rely on __attribute__((always_inline)) Pedro Alves
2016-07-20 16:35             ` Thomas Preudhomme
2016-05-06 12:35 ` [PATCH v3 02/34] [Ada catchpoints] Fix "warning: failed to get exception name: No definition of \"e.full_name\" in current context" Pedro Alves
2016-05-06 12:35 ` [PATCH v3 14/34] Make command line editing (use of readline) be per UI Pedro Alves
2016-05-06 12:35 ` [PATCH v3 33/34] Make mi-break.exp always expect breakpoint commands output on the main UI Pedro Alves
2016-05-06 12:35 ` [PATCH v3 20/34] Make gdb_in_secondary_prompt_p() be per UI Pedro Alves
2016-05-06 12:36 ` [PATCH v3 31/34] Add testing infrastruture bits for running with MI on a separate UI Pedro Alves
2016-06-28 20:19   ` Simon Marchi
2016-06-29 10:50     ` Pedro Alves
2016-06-30 11:12       ` [pushed] Fix gdbserver/MI testing regression (was: Re: [PATCH v3 31/34] Add testing infrastruture bits for running with MI on a separate UI) Pedro Alves
2016-06-30 12:10         ` gdbserver/ada testing broken (was: Re: [pushed] Fix gdbserver/MI testing regression) Pedro Alves
2016-07-04 20:40           ` gdbserver/ada testing broken Simon Marchi
2016-07-05 15:28             ` Joel Brobecker
2016-07-05 15:47               ` Joel Brobecker
2016-07-05 16:36           ` gdbserver/ada testing broken (was: Re: [pushed] Fix gdbserver/MI testing regression) Joel Brobecker
2016-07-05 17:19             ` gdbserver/ada testing broken Simon Marchi
2016-07-06 13:23               ` Joel Brobecker
2016-07-06 14:28                 ` Simon Marchi
2016-07-19 17:11               ` Pedro Alves
2016-07-04 17:22         ` [pushed] Fix gdbserver/MI testing regression Simon Marchi
2016-05-06 12:40 ` [PATCH v3 11/34] Make out and error streams be per UI Pedro Alves
2016-05-06 12:40 ` [PATCH v3 13/34] Make current_ui_out " Pedro Alves
2016-05-06 12:40 ` [PATCH v3 23/34] New function should_print_stop_to_console Pedro Alves
2016-05-06 12:41 ` [PATCH v3 06/34] Introduce interpreter factories Pedro Alves
2016-05-18 19:18   ` Simon Marchi
2016-05-26 18:11     ` Pedro Alves
2016-05-18 19:20   ` Simon Marchi
2016-05-26 18:08     ` Pedro Alves
2016-05-06 12:42 ` [PATCH v3 30/34] [DOC] Document support for running interpreters on separate UI channels Pedro Alves
2016-05-06 13:04   ` Eli Zaretskii
2016-05-26 11:11     ` Pedro Alves
2016-06-17 17:24       ` Pedro Alves
2016-06-17 20:02         ` Eli Zaretskii
2016-05-06 12:43 ` [PATCH v3 17/34] Introduce display_mi_prompt Pedro Alves
2016-05-06 12:43 ` [PATCH v3 05/34] Make the interpreters be per UI Pedro Alves
2016-05-18 17:51   ` Simon Marchi
2016-05-26 18:08     ` Pedro Alves
2016-05-06 12:43 ` [PATCH v3 28/34] Make stdin " Pedro Alves
2016-05-06 12:43 ` [PATCH v3 25/34] Only send sync execution command output to the UI that ran the command Pedro Alves
2016-05-06 12:43 ` [PATCH v3 07/34] Make the intepreters output to all UIs Pedro Alves
2016-05-19 15:16   ` Simon Marchi
2016-05-26 18:12     ` Pedro Alves
2016-05-06 12:43 ` [PATCH v3 08/34] Always run async signal handlers in the main UI Pedro Alves
2016-05-19 19:28   ` Simon Marchi
2016-05-26 18:13     ` Pedro Alves
2016-05-26 18:15       ` Simon Marchi
2016-05-06 12:43 ` [PATCH v3 10/34] Make input_fd be per UI Pedro Alves
2016-05-06 12:43 ` [PATCH v3 12/34] Delete def_uiout Pedro Alves
2016-05-06 12:43 ` [PATCH v3 04/34] Make gdb_stdout&co be per UI Pedro Alves
2016-05-06 12:45 ` [PATCH v3 27/34] Handle UI's terminal closing Pedro Alves
2016-05-06 12:45 ` [PATCH v3 34/34] Always switch fork child to the main UI Pedro Alves
2016-05-06 12:45 ` [PATCH v3 22/34] Fix for spurious prompts in secondary UIs Pedro Alves
2016-05-06 12:45 ` [PATCH v3 32/34] Send deleted watchpoint-scope output to all UIs Pedro Alves
2016-05-06 12:45 ` [PATCH v3 26/34] Make main_ui be heap allocated Pedro Alves
2016-05-06 12:52 ` [PATCH v3 18/34] Make raw_stdout be per MI instance Pedro Alves
2016-05-06 12:53 ` [PATCH v3 19/34] Simplify starting the command event loop Pedro Alves
2016-05-06 12:53 ` [PATCH v3 09/34] Make instream be per UI Pedro Alves
2016-05-26 18:37 ` [PATCH v3 35/34] Add "new-ui console" tests Pedro Alves
2016-06-21  0:23 ` [pushed] Re: [PATCH v3 00/34] Towards great frontend GDB consoles Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).