RuntimeGeneratedFunctions.jl icon indicating copy to clipboard operation
RuntimeGeneratedFunctions.jl copied to clipboard

Debugging generated functions

Open YingboMa opened this issue 4 years ago • 6 comments

@ChrisRackauckas mentioned that to get a nice stack trace from generated functions, we can print the expression into a temporary file and point the stack trace to that file.

Can this be done automatically with Ctrl - Q functionality in the REPL and other IDEs?

CC: @pfitzseb, @c42f

YingboMa avatar Jan 16 '21 18:01 YingboMa

I feel like I'm missing some context here :) Can't you just insert LNNs to where the expression is defined or something?

pfitzseb avatar Jan 16 '21 19:01 pfitzseb

There is no file in which the function exists because it's a runtime generated object. Think of SymPy generating a function and then that function errors: how do you show the code that errored to the user?

ChrisRackauckas avatar Jan 16 '21 19:01 ChrisRackauckas

Ok, I was just going by the example in the readme. Makes sense that that doesn't reflect real usecases though.

It should be fairly easy to support the Ctrl-Q case by overwriting the handler for that and inserting a special marker for RGFs. Generating a clickable link seems impossible without writing a file containing the expr at definition time, which seems like a bad idea.

pfitzseb avatar Jan 16 '21 20:01 pfitzseb

If we can overload the stacktrace function, we can inject code so that the RuntimeGeneratedFunction can save out a stream to a temporary file and point to that file?

ChrisRackauckas avatar Jan 16 '21 22:01 ChrisRackauckas

Any updates now?

wangyunyueyueniao avatar Dec 08 '22 03:12 wangyunyueyueniao

It hasn't. We know what we want to do, but not how to implement it.

ChrisRackauckas avatar Dec 08 '22 08:12 ChrisRackauckas