[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Executing Emacs commands when a gdb breakpoint is hit

From: Skip Montanaro
Subject: Executing Emacs commands when a gdb breakpoint is hit
Date: Tue, 21 Jan 2020 12:02:49 -0600

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

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]