all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Skip Montanaro <skip.montanaro@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: Help GNU Emacs <help-gnu-emacs@gnu.org>
Subject: Re: Executing Emacs commands when a gdb breakpoint is hit
Date: Thu, 23 Jan 2020 15:00:16 -0600	[thread overview]
Message-ID: <CANc-5Uw7oDFNw7u34p0NSQV9e+gwQZMN1FwbWbRkECHcf2v9CA@mail.gmail.com> (raw)
In-Reply-To: <83d0batene.fsf@gnu.org>

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

Skip


  reply	other threads:[~2020-01-23 21:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-01-24  8:01             ` Eli Zaretskii
2020-04-07 20:21               ` otadmor .

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=CANc-5Uw7oDFNw7u34p0NSQV9e+gwQZMN1FwbWbRkECHcf2v9CA@mail.gmail.com \
    --to=skip.montanaro@gmail.com \
    --cc=eliz@gnu.org \
    --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.