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

Add @autoinfiltrate for simple, ad-hoc interactive debugging #150

Merged
merged 2 commits into from
May 15, 2023

Conversation

sloede
Copy link
Member

@sloede sloede commented May 15, 2023

Same as trixi-framework/Trixi.jl#1465

This allows one to have the Infiltrator.jl package installed anywhere in the Julia environment stack and then just add @autoinfiltrate to any function in TrixiParticles.jl. When the macro location is hit, it will drop you into an interactive session that allows you to inspect the local variables (see also the Infiltrator.jl docs).

I don't know if this is useful for you, but since I added it for Trix.jl, I thought I might add it here as well.

@sloede sloede requested review from efaulhaber and LasNikas May 15, 2023 15:02
Copy link
Member

@efaulhaber efaulhaber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's nice. I've always opened the GH page and copied that into our code

if isdefined(Main, :Infiltrator)
  Main.infiltrate(@__MODULE__, Base.@locals, @__FILE__, @__LINE__)
end

But JuliaFormatter is failing.

@sloede
Copy link
Member Author

sloede commented May 15, 2023

That's nice. I've always opened the GH page and copied that into our code

That's exactly why I added this to Trix.jl in the first place 🤣

But JuliaFormatter is failing.

Sorry. Rectified.

src/util.jl Outdated
Comment on lines 291 to 294
return Expr(
:macrocall,
Symbol("@warn"),
lnn,
"Could not load Infiltrator.")
return Expr(:macrocall,
Symbol("@warn"),
lnn,
"Could not load Infiltrator.")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that we can allow the previous version in the future with the option variable_call_indent (see domluna/JuliaFormatter.jl#676).
I want to wait for this PR to make it into VSCode before we add it to TrixiP, though.

@efaulhaber efaulhaber enabled auto-merge (squash) May 15, 2023 15:13
@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Merging #150 (e939717) into main (f04439a) will decrease coverage by 0.19%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##             main     #150      +/-   ##
==========================================
- Coverage   50.47%   50.29%   -0.19%     
==========================================
  Files          38       38              
  Lines        2193     2201       +8     
==========================================
  Hits         1107     1107              
- Misses       1086     1094       +8     
Flag Coverage Δ
unitandintegration 50.29% <ø> (-0.19%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/util.jl 39.39% <ø> (-5.44%) ⬇️

@efaulhaber efaulhaber merged commit 2a52df2 into main May 15, 2023
@ranocha ranocha deleted the msl/add-at-autoinfiltrate branch May 15, 2023 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants