unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Gemini Lasswell <gazally@runbox.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: list-threads
Date: Wed, 01 Aug 2018 13:04:18 -0700	[thread overview]
Message-ID: <87wot9onul.fsf@runbox.com> (raw)
In-Reply-To: <83o9emm4ab.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 01 Aug 2018 19:37:32 +0300")

Eli Zaretskii <eliz@gnu.org> writes:

> If a thread is running, no other thread will be able to run, so you
> will be unable to take the backtrace of that running thread.  Right?

I don't understand the question, but I can try to explain what I'm
thinking in more detail.

In the command which I haven't written yet called
thread-list-pop-to-backtrace, I'll get the thread at point and compare
it to the current thread. If they are the same then I can make a
backtrace buffer in the usual way, by using mapbacktrace to collect all
the frames (or call the new backtrace-get-frames which does that), and
the backtrace will include command-execute through
thread-list-pop-to-backtrace, and it will not be very interesting unless
there's a recursive edit or something going on.

If the thread at point is not the current thread, then I'll call the new
primitive that I'm working on, maybe to be called
backtrace--get-frames-from-thread, pass it the thread as an argument,
and it will cons up a list of backtrace frames using that thread's
specpdl stack, which I can use to fill my backtrace buffer.

As an experiment I added a thread argument to mapbacktrace, and changed
it and its subroutines to use thread->m_specpdl instead of specpdl, etc.
That works and lets me get backtraces from threads other than the
current one whether blocked or just yielded, but the problem with
mapbacktrace is that it calls a Lisp function which could yield and
allow the thread to run that I'm trying to get the backtrace of.  Hence
the new primitive.

I'd also like to collect local variable names and values for the
backtrace frames of the other thread, but I don't know how easy that
will be because I don't yet understand the backtrace_eval_unrewind hack
in backtrace--locals well enough to know if I can make it work safely on
threads other than the current one.



  reply	other threads:[~2018-08-01 20:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-29  1:11 list-threads Gemini Lasswell
2018-07-29  7:56 ` list-threads Michael Albinus
2018-07-29  8:37   ` list-threads Michael Albinus
2018-07-29 14:31   ` list-threads Gemini Lasswell
2018-07-29 17:31     ` list-threads Eli Zaretskii
2018-07-30 13:27       ` list-threads Gemini Lasswell
2018-07-30 17:21     ` list-threads Stefan Monnier
2018-07-30 14:59 ` list-threads Eli Zaretskii
2018-08-01 16:03   ` list-threads Gemini Lasswell
2018-08-01 16:37     ` list-threads Eli Zaretskii
2018-08-01 20:04       ` Gemini Lasswell [this message]
2018-08-02 13:53         ` list-threads Eli Zaretskii
2018-08-02 14:51           ` list-threads Gemini Lasswell
2018-08-27 17:38 ` list-threads Gemini Lasswell
2018-08-27 18:48   ` list-threads Eli Zaretskii
2018-09-09 15:44     ` list-threads Gemini Lasswell
2018-09-09 16:01       ` list-threads Eli Zaretskii

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wot9onul.fsf@runbox.com \
    --to=gazally@runbox.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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 public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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