Subject: bug#18294: 24.3; gud and/or gdb: Add hooks to detect when a source file is visited during debugging

From: Yuri Khan <[email-masked]>
Date: Sun, 24 Aug 2014 17:32:58 +0700

On Thu, Aug 21, 2014 at 4:24 PM, martin rudalics <[email-masked]> wrote:
>
> I'd like such a thing.  But wouldn't it be easier to do this right in
> gdb-mi.el?  All I'd need is a simple key combination to toggle this
> behavior off whenever I want to modify code on the fly.  The next "run"
> would then turn the behavior on again.

“This behavior” consists of two changes to the current state (which
allows editing while debugging):

* binding additional keys, and
* locking source files to be read-only,

and these changes need to be done simultaneously.

This may be achieved several ways, one of them being a minor mode,
which I am suggesting here.

Other ways include:

* Binding keys directly in the gud-minor-mode-map, along with fringe
clicks. This way, each such binding will have to check for a flag
(which may or may not be the read-only flag), and invoke either the
appropriate debugger command or self-insert-command.

* Binding keys globally, then checking if the debugger is active, in
addition to the above.

In my opinion, a separate minor mode is much cleaner than any of the
latter options.