From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126791 invoked by alias); 21 Mar 2016 11:54:15 -0000 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 Received: (qmail 126778 invoked by uid 89); 21 Mar 2016 11:54:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=AWL,BAYES_20,MIME_BASE64_BLANKS,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=sk:address, Loading, boil, Fortune X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Mar 2016 11:54:13 +0000 Received: from hhmail02.hh.imgtec.org (unknown [10.100.10.20]) by Websense Email Security Gateway with ESMTPS id 89879289DA0D8; Mon, 21 Mar 2016 11:54:07 +0000 (GMT) Received: from HHMAIL01.hh.imgtec.org ([fe80::710b:f219:72bc:e0b3]) by hhmail02.hh.imgtec.org ([fe80::5400:d33e:81a4:f775%25]) with mapi id 14.03.0266.001; Mon, 21 Mar 2016 11:54:09 +0000 From: Matthew Fortune To: Mike Frysinger , Maciej Rozycki CC: Steve Ellcey , "gdb-patches@sourceware.org" Subject: RE: MIPS simulator is broken Date: Mon, 21 Mar 2016 11:54:00 -0000 Message-ID: <6D39441BF12EF246A7ABCE6654B023537E3A3580@HHMAIL01.hh.imgtec.org> References: <5f31ca78-325c-4c18-9abf-16de50bac964@BAMAIL02.ba.imgtec.org> <20160112010025.GE4894@vapier.lan> <20160210072842.GX7732@vapier.lan> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 MIME-Version: 1.0 X-SW-Source: 2016-03/txt/msg00387.txt.bz2 UGluZy4NCg0KTW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bjogICAgIDB4ODAwMTAwMDAg LS0tICAgX3N0YXJ0ICAgICAgICAgbm9wICAgICAgICAgICAgICAtIFNMTGIN Cj4gaW5zbjogICAgIDB4ODAwMTAwMDQgLS0tICAgX3N0YXJ0ICAgICAgICAg bm9wICAgICAgICAgICAgICAtIFNMTGINCj4gaW5zbjogICAgIDB4ODAwMTAw MDggLS0tICAgX2ZhaWwgICAgICAgICAgbm9wICAgICAgICAgICAgICAtIFNM TGINCj4gaW5zbjogICAgIDB4ODAwMTAwMGMgLS0tICAgX2ZhaWwgICAgICAg ICAgbm9wICAgICAgICAgICAgICAtIFNMTGINCj4gaW5zbjogICAgIDB4ODAw MTAwMTAgLS0tICAgX2ZhaWwgICAgICAgICAgbm9wICAgICAgICAgICAgICAt IFNMTGINCj4gaW5zbjogICAgIDB4ODAwMTAwMTQgLS0tICAgX2ZhaWwgICAg ICAgICAgbm9wICAgICAgICAgICAgICAtIFNMTGINCj4gDQo+IENhbiB5b3Ug aGVscCBtZSB1bmRlcnN0YW5kIHdoeSB0aGUgY29kZSBkb2VzIG5vdCBnZXQg bG9hZGVkIGFuZC9vciBpZg0KPiB0aGVyZSBpcyBzb21ld2hlcmUgZWxzZSB3 ZSBtYXkgbmVlZCB0byBlZHVjYXRlIGFib3V0IHNpZ24gZXh0ZW5kZWQNCj4g YWRkcmVzc2VzPw0KPiANCj4gVGhhbmtzLA0KPiBNYXR0aGV3DQo= >From gdb-patches-return-130402-listarch-gdb-patches=sources.redhat.com@sourceware.org Mon Mar 21 15:21:30 2016 Return-Path: Delivered-To: listarch-gdb-patches@sources.redhat.com Received: (qmail 91344 invoked by alias); 21 Mar 2016 15:21:29 -0000 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 Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 91324 invoked by uid 89); 21 Mar 2016 15:21:28 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.5 required=5.0 tests=BAYES_05,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=UD:selftest.exp, selftest.exp, selftestexp, CDT X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 21 Mar 2016 15:21:18 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (Postfix) with ESMTPS id 8E3D0C01B3EB; Mon, 21 Mar 2016 15:21:17 +0000 (UTC) Received: from cascais.lan (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u2LFLGPS019569; Mon, 21 Mar 2016 11:21:16 -0400 From: Pedro Alves To: gdb-patches@sourceware.org Cc: Marc Khouzam Subject: [PATCH v2 00/25] Towards great frontend GDB consoles Date: Mon, 21 Mar 2016 15:21:00 -0000 Message-Id: <1458573675-15478-1-git-send-email-palves@redhat.com> X-SW-Source: 2016-03/txt/msg00388.txt.bz2 Content-length: 7575 Here's an update of the series I first posted here: https://sourceware.org/ml/gdb-patches/2016-02/msg00067.html New in v2: - The "Command line input handling TLC" patch [1] has since been split into a series of its own [2], and pushed in. [1] https://sourceware.org/ml/gdb-patches/2016-02/msg00070.html [2] https://sourceware.org/ml/gdb-patches/2016-02/msg00557.html - Currently, if GDB's (main) stdin closes, GDB exits. That logic carried over to secondary UIs as well, by mistake, so v1, if a secondary UI's terminal was closed, GDB would just exit as well... In v2, that's now detected, and GDB just discards the UI. - I noticed that if you typed something in a secondary UI, and then Ctrl-C'd the main UI, GDB would internal error. The problem was that nothing was making use async signal handlers (in this case, async_request_quit) always run on the main UI. - Added a convenience "info uis" command to list UIs. - Some cleanups here and there 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 ". 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 24, which actually adds the new-ui command. This still misses ChangeLog entries, some comments, and documentation changes. And I haven't thought about tests yet. 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-v1 Pedro Alves (25): 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 and serial_stdin be per UI Make input_fd be per UI Make outstream 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 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 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 terminal closed Add new command to create extra console/mi UI channels Add command to list UIs gdb/annotate.c | 15 +- gdb/breakpoint.c | 21 +- gdb/cli/cli-interp.c | 248 +++++++--- gdb/cli/cli-interp.h | 32 ++ gdb/cli/cli-script.c | 27 +- gdb/compile/compile.c | 14 +- gdb/event-loop.c | 5 + gdb/event-top.c | 322 +++++++------ gdb/event-top.h | 13 +- gdb/exceptions.c | 4 +- gdb/gdbthread.h | 5 - gdb/guile/guile.c | 14 +- gdb/guile/scm-ports.c | 6 +- gdb/inf-loop.c | 2 +- gdb/infcall.c | 43 +- gdb/infcmd.c | 102 ++-- gdb/inflow.c | 23 +- gdb/infrun.c | 137 ++++-- gdb/infrun.h | 10 +- gdb/interps.c | 262 +++++++--- gdb/interps.h | 49 +- gdb/linux-nat.c | 2 - gdb/main.c | 53 +-- gdb/mi/mi-interp.c | 946 ++++++++++++++++++++++--------------- gdb/mi/mi-main.c | 2 +- gdb/python/python.c | 15 +- gdb/remote.c | 2 - gdb/target.c | 27 +- gdb/terminal.h | 6 +- gdb/testsuite/gdb.gdb/selftest.exp | 4 + gdb/thread-fsm.c | 12 +- gdb/thread-fsm.h | 23 +- gdb/thread.c | 2 +- gdb/top.c | 344 ++++++++++++-- gdb/top.h | 154 +++++- gdb/tui/tui-interp.c | 168 +++++-- gdb/tui/tui-io.c | 4 +- gdb/ui-file.c | 4 +- gdb/ui-file.h | 4 +- gdb/ui-out.c | 184 -------- gdb/ui-out.h | 3 +- gdb/utils.c | 4 +- gdb/utils.h | 19 +- 43 files changed, 2146 insertions(+), 1190 deletions(-) create mode 100644 gdb/cli/cli-interp.h -- 2.5.0