[Top][All Lists]

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

Re: Executing Emacs commands when a gdb breakpoint is hit

From: Skip Montanaro
Subject: Re: Executing Emacs commands when a gdb breakpoint is hit
Date: Thu, 23 Jan 2020 15:00:16 -0600

> You could define a timer that runs your function after some small
> delay, maybe it could work.

A quarter-second sleep didn't help. I'll poke around a bit more.

> But in general, I must admit I find this design somewhat strange.  GDB
> offers you 3 extension languages: the CLI scripting, Python, and Guile
> Scheme.  Why not use one of these to do what you want? this is how the
> GDB developers intended for you to extend the debugger for doing these
> kinds of jobs.  If you use Guile, you could even write code that is
> almost Emacs Lisp ;-)

Note that I'm not really trying to script GDB. I'm trying to adjust the
display in Emacs of the file which is being compiled. It seems to me that
the proper language for that is ELisp.

It seems that the shortest route to something which will/might work will be
adding commands for GDB to execute when the breakpoint is hit. Something
like this:

(gdb) comm N
> p c->c_filename
> p c->u->u_lineno
> end

When my stop function gets called, all I need to do is search back in
*gud-python* for the printed line number and filename. I initially
dispensed with that idea though, since doing things that way means I need
an ELisp component (to grab the details I want and adjust the Emacs
display) and a GDB component. If I had (for example) two different stop
functions in my list (I don't currently), it's not clear how I'd guarantee
the two functions didn't step on one anothers' toes.


reply via email to

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