all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Yuri Khan <yuri.v.khan@gmail.com>
To: Emanuel Berg <embe8573@student.uu.se>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: Gud keybindings
Date: Thu, 14 Aug 2014 10:48:37 +0700	[thread overview]
Message-ID: <CAP_d_8XK-0WVmOwAawFPuSXkjR0T92NQzdG6kQj5XAmwcKYM0Q@mail.gmail.com> (raw)
In-Reply-To: <87ha1gtd6n.fsf@debian.uxu>

On Thu, Aug 14, 2014 at 2:14 AM, Emanuel Berg <embe8573@student.uu.se> wrote:
> Yuri Khan <yuri.v.khan@gmail.com> 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’t pay for
what we don’t use — having each keypress of “s” 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’t it?

And no, I don’t want to get out of debugging if I inadvertently press
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).



  reply	other threads:[~2014-08-14  3:48 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.7049.1407907858.1147.help-gnu-emacs@gnu.org>
2014-08-13 19:14 ` Gud keybindings Emanuel Berg
2014-08-14  3:48   ` Yuri Khan [this message]
     [not found]   ` <mailman.7092.1407988122.1147.help-gnu-emacs@gnu.org>
2014-08-14 21:13     ` Emanuel Berg
2014-08-13  5:30 Yuri Khan
2014-08-18  9:27 ` Yuri Khan
2014-08-19  1:49   ` Stefan Monnier
2014-08-19  5:03     ` Yuri Khan
     [not found] ` <mailman.7183.1408354083.1147.help-gnu-emacs@gnu.org>
2014-08-18 22:56   ` Emanuel Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAP_d_8XK-0WVmOwAawFPuSXkjR0T92NQzdG6kQj5XAmwcKYM0Q@mail.gmail.com \
    --to=yuri.v.khan@gmail.com \
    --cc=embe8573@student.uu.se \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.