From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Yuri Khan Newsgroups: gmane.emacs.help Subject: Re: Gud keybindings Date: Thu, 14 Aug 2014 10:48:37 +0700 Message-ID: References: <87ha1gtd6n.fsf@debian.uxu> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1407988146 12721 80.91.229.3 (14 Aug 2014 03:49:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 14 Aug 2014 03:49:06 +0000 (UTC) Cc: "help-gnu-emacs@gnu.org" To: Emanuel Berg Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 14 05:48:59 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XHm1z-0006uw-FL for geh-help-gnu-emacs@m.gmane.org; Thu, 14 Aug 2014 05:48:51 +0200 Original-Received: from localhost ([::1]:51736 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHm1z-0005SP-5i for geh-help-gnu-emacs@m.gmane.org; Wed, 13 Aug 2014 23:48:51 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34418) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHm1n-0005SK-UM for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 23:48:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XHm1m-0006xr-Rf for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 23:48:39 -0400 Original-Received: from mail-ig0-x235.google.com ([2607:f8b0:4001:c05::235]:65103) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XHm1m-0006x0-MT for help-gnu-emacs@gnu.org; Wed, 13 Aug 2014 23:48:38 -0400 Original-Received: by mail-ig0-f181.google.com with SMTP id h3so3801481igd.8 for ; Wed, 13 Aug 2014 20:48:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=SYT6M+mjbUMTwjLY1MtUpD9T2RS9SAzLyABPufW2kkA=; b=Pw8RBcaCB3uV8oJ0opVNCNAnsyN6Ii0woRk1j/M8SQB4gU4OWnDWly1bCBYhBkwYon 0KcmJynYZT2g96My3MEFHQYwiZLp3s5CliDTSqCIdrarwzv7r/Q9Us2fc40310u8wXCQ iA6lXVEmd94z3pYejf8qjDSzbNyByuEw8XL0vdPLuDziPSklfPkbgG+QYurEt8zE9rLL D3gt1CG9uFFgzJgS6fcIeWuCdL02vxKGS3ozEbCtSVz/a7r7dCD2tIwDIp8KxmY50cP+ zlTKyYGc2JvtDxGv5rwAP7YHouIXB4vxevUuzQJd3KpXJho9uE6ili+IbMwFCRP0kXhi iOGA== X-Received: by 10.50.43.193 with SMTP id y1mr13157910igl.32.1407988117965; Wed, 13 Aug 2014 20:48:37 -0700 (PDT) Original-Received: by 10.107.6.30 with HTTP; Wed, 13 Aug 2014 20:48:37 -0700 (PDT) In-Reply-To: <87ha1gtd6n.fsf@debian.uxu> X-Google-Sender-Auth: XbXt6_OgopRpWLyHJvw6Vkn-8Io X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4001:c05::235 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99207 Archived-At: On Thu, Aug 14, 2014 at 2:14 AM, Emanuel Berg wrot= e: > Yuri Khan writes: > >> * What would I need to do if I wanted to implement >> single-letter key bindings for Gud commands? Define a >> minor mode with an appropriate keymap that sets >> buffer-read-only when enabled and restores it when >> disabled? How do I arrange for this mode to be >> enabled when visiting any source buffer if and only >> if Gud is active? > > For what modes do you want it? Major modes, you mean? Ideally, this is not dependent on mode but on whether the buffer visits a file that is a source of the program currently being debugged. (Which might involve C++, plain C, and any other languages that are compiled to standard .o files with gdb-compatible debug info.) I think I would settle for just all c++-mode buffers while Gud is active, but this has to include both buffers that were opened before Gud is started and new buffers spawned while debugging. > For one or but a few, how about binding the self-insert > keys to either self-insert, or, if buffer-read-only (or > `Gud-alive-p' if such a predicate exists - otherwise > write it). I don't think that'll be too slow/much work > for just a couple of keys. That would work but is inelegant. Here in C++ world, we don=E2=80=99t pay f= or what we don=E2=80=99t use =E2=80=94 having each keypress of =E2=80=9Cs=E2= =80=9D check if Gud is active runs very much counter to that principle. > If it is, you can write a defun, we-are-debugging which > rebinds the keys, and correspondingly no-bugs-left to > reset. You can automatize this second part like, if a > non-debug key is pressed, it is not only self-inserted, > it also disables the debugging keys. This equates to a global minor mode, doesn=E2=80=99t it? And no, I don=E2=80=99t want to get out of debugging if I inadvertently pre= ss an editing key. Editing sources of the program being debugged can cause much confusion. >> I am trying to debug C++ programs using Emacs, Gud >> and GDB. This involves setting breakpoints, stepping >> through and over function calls, and examining >> variables. > > Yeah, you got GDB to work with C++ on Linux? I asked > about it on gnu.gdb.bug and it seems the post is > archived here: For me, it has always worked out of the box (except that printing standard containers is not pretty, and evaluating any expressions that involve inlineable functions may fail because their code is optimized out of the binary).