-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add supervisor.get_previous_traceback() #3696
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Ok great! Here are my thoughts on below. I haven't read through the PR yet. I'm starting with #3695.
I think we'll want it optional. It'll be clearer how much flash it costs after the other two PRs are merged.
Whatever is simpler makes sense to me. REPL use implies someone is "at the terminal" so I think it's less important. This is mostly for subsequent code to be able to recover on its own.
I'll try and remember to do this. Generally, I think of all C APIs as private so you can do what you need with them. :-)
Small C files don't bother me. I prefer them when they match the common structure of everything. |
9da18f8
to
5d051df
Compare
As a sign of life, here is the previous state rebased on current main. I have not made any of the other promised/planned changes yet. |
@cwalther just a heads up that I'm also working on rebasing/reworking this too (so we don't overlap in case you were considering getting back into it) |
Great, thank you. I was in fact thinking of having a go at it this weekend, but you’re so much faster than I that you better just go ahead. I first want to take a look at what you did in #3454 and test it, so by the time I get to it you’re probably done. Is it clear what my planned change regarding REPL runs was? I don’t recall the exact code change off the top of my head, but it was about removing the special case with |
I really didn't have to do that much to #3454, it was mostly just checking that the merge didn't break anything, and replacing those I don't have a strong opinion about the REPL runs. REPL access strikes me as a pitstop you use to check things as opposed to a part of any actual program/debugging flow, so retaining program details across it doesn't bother me conceptually. If someone is testing specific program behavior, having the REPL not reset their flow might be convenient. I'll probably just leave it as it is, we can revisit if people complain that it's clunky or something. |
In case it helps as a point of reference, I have done the rebasing here: cwalther/getprevtraceback2. I haven’t checked very carefully whether the merging is sane (in particular, whether the change to rgb_led_status.c should really be gone without replacement), but it compiles and runs. |
@cwalther I'm sorry I've been taking a while to catch up on this, I've had a chaotic last couple of weeks. I'm hoping to get it fully tested next week. |
Superseding with #5037 to avoid force pushing the rebase. |
As discussed in #1084, when a VM run ends with an exception, this uses the movable allocation system to preserve the traceback across a soft reload and lets the next VM run retrieve it using
supervisor.get_previous_traceback()
.Only the last commit is relevant, the next to last is #3454 (which it is not dependent on and could be rebased off if desired) and the rest is #3695 (which is required).
Open questions from my point of view:
supervisor_get_previous_traceback()
. As far as I understand, it works correctly, but my understanding of how the garbage collector works and how strings work may be incomplete. Also, am I inappropriately using non-API (implementation details) of the string class by assembling anmp_obj_str_t
object by hand? There doesn’t seem to be a macro/function for what I want.