Skip to content
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

stacktraces point to the temp snail file instead of the source file after evaluating top-level-form or region #28

Closed
orialb opened this issue May 1, 2020 · 4 comments
Labels
enhancement New feature or request

Comments

@orialb
Copy link
Contributor

orialb commented May 1, 2020

Consider the following code:

function foo()
    throw("oh oh something went wrong")
end

And evaluate foo with julia-snail-send-top-level-form.

The resulting stack trace when running in the REPL is:

julia> foo()
ERROR: "oh oh something went wrong"
Stacktrace:
 [1] foo() at /var/folders/lw/pcgd7z3n00bdlc8_jncyqw1m0000gn/T/julia-tmpBhAl8A:2
 [2] top-level scope at REPL[1]:1

This can make it hard to figure out where is the error coming from in a more complicated situation (for example line numbers don't correspond to those in the actual source file).

I don't know if there is a way to somehow track the correct source file when evaluating code in the way snail does or how complicated it would be to do so. Maybe one can look into Revise for inspiration as it seems that there stack-traces point to the correct place after re-evaluation of the code (but maybe the re-evaluation mechanism is too different than Snail, I don't know).

@gcv
Copy link
Owner

gcv commented May 1, 2020

Yes, I know about this problem. I researched it a little bit a while ago, and found some Julia-internal metadata with function file and line number. I don't remember why I didn't just overwrite it with known correct entries after a top-level form has been loaded. It's definitely worth another look.

@gcv gcv added the enhancement New feature or request label May 1, 2020
@gcv
Copy link
Owner

gcv commented Jul 30, 2021

I tried to fix this. Commit 4c826e8 takes care of locations for xref purposes, but not for stack traces. I don't know enough about Julia internals to solve this, and posted a question on Discourse: https://discourse.julialang.org/t/updating-the-location-of-a-method-definition/65247/1

@orialb
Copy link
Contributor Author

orialb commented Jul 31, 2021

thanks for looking into this!

@gcv
Copy link
Owner

gcv commented Aug 3, 2021

Thanks to a great suggestion on Discourse, I think I finally fixed this: 7bdfef8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants