Subject: Re: bug#60237: 30.0.50; tree sitter core dumps when I edebug view a node

From: Stefan Monnier <[email-masked]>
Date: Fri, 10 Mar 2023 21:41:57 -0500

>> I can imagine corner cases where this could trigger, but they all
>> involve funny business where we change `profiler-max-stack-depth` during
>> a single profiling run (I think you'd need to write ad-hoc ELisp code
>> for that).  The only other explanation I can see is that we
>> somehow end up with a backtrace that includes `Automatic_GC` somewhere
>> not at the top (maybe this can happen with a `post-gc-hook`?).
>
> What about gc_in_progress? Why can't we use that?

In the text you quote I simply try and describe the kinds of situations
where I think the problem can appear.  I don't know which of those are
actually possible, nor do I suggest what should be done about it.

And yes, maybe we can use `gc_in_progress`.
So far I haven't taken a look at that, but feel free to do so.

> This should avoid everything related to post-gc-hook.

Probably.  At the same time, if we're sampling while running
`post-gc-hook`, then it's safe to do the "normal" job of the sampling
code (the GC proper is completed already), so maybe the better thing to
do in that case is to treat it as a backtrace which has `Automatic GC`
as its root (i.e. ignore the part of the backtrace that's above
`Automatic GC`).

        Stefan