unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Executing Emacs commands when a gdb breakpoint is hit
@ 2020-01-21 18:02 Skip Montanaro
  2020-01-21 18:39 ` Eli Zaretskii
  0 siblings, 1 reply; 10+ messages in thread
From: Skip Montanaro @ 2020-01-21 18:02 UTC (permalink / raw)
  To: Help GNU Emacs

It's straightforward to create user-defined GDB commands which trigger upon
hitting a breakpoint. I'd like to also execute some ELisp though. That
seems not so obvious. Is this doable?

Here's a concrete example. I'm working on the Python bytecode compiler. The
primary compiler struct contains the name of the file being compiled (along
with much other stuff), and one of its fields refers to a compile_unit
which holds the current line number of the Python file as the compilation
progresses.

The compiler_setlineno function is a perfect place to break. I'd like to
switch to the buffer holding the file being compiled and set point to the
current line number, thus updating my view of the where the compilation is.

On a more basic topic, I actually seem unable to cleanly terminate the
series of commands to execute upon hitting a breakpoint. For example, this
is what I see now (within an Emacs *gud-python* buffer):

(gdb) comm 2
Type commands for breakpoint(s) 2, one per line.
End with a line saying just "end".
>p c->c_filename
>p c->u->u_lineno
>end
>
>end
>  C-c C-cQuit

That is, I do what it says, end with a line saying just "end", but it
doesn't terminate. After trying that a second time, I gave up and I broke
back to the (gdb) prompt with C-c C-c. Seems like a bug to me. I'm using
25.2.2 on Ubuntu 18.04.

Skip


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

end of thread, other threads:[~2020-04-07 20:21 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-21 18:02 Executing Emacs commands when a gdb breakpoint is hit Skip Montanaro
2020-01-21 18:39 ` Eli Zaretskii
2020-01-22 13:48   ` Skip Montanaro
2020-01-22 17:04     ` Eli Zaretskii
2020-01-22 19:55       ` otadmor .
2020-01-22 21:07       ` Skip Montanaro
2020-01-23 14:45         ` Eli Zaretskii
2020-01-23 21:00           ` Skip Montanaro
2020-01-24  8:01             ` Eli Zaretskii
2020-04-07 20:21               ` otadmor .

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).