debugme icon indicating copy to clipboard operation
debugme copied to clipboard

Support going to the code

Open gaborcsardi opened this issue 8 years ago • 6 comments

We could add ids to the debug messages somehow, and then jump to their place in the code quickly, either just showing the code on the screen like tracer, or jumping there in RStudio.

gaborcsardi avatar Dec 08 '16 10:12 gaborcsardi

As a first step, we could just include the file name and line number of the source code.

gaborcsardi avatar Mar 24 '18 16:03 gaborcsardi

I think file+line information is only available from the parse data? This seems incompatible with the way we instrument now.

If we changed to instrumenting the parse data, we could switch to instrumenting comments (#35), this gives true zero-cost debugging. Would you support that?

krlmlr avatar Feb 17 '21 14:02 krlmlr

If the installed package has source references, then there is file + line information, I think.

gaborcsardi avatar Feb 17 '21 14:02 gaborcsardi

Yes, we have parse data. But if we walk the language tree, we don't get the source references for every token, AFAICT. Do we need to change pkgload?

krlmlr avatar Feb 17 '21 14:02 krlmlr

E.g. covr walks the language tree and uses the source refs to for every expression, so I think it is possible to do it.

Might not be worth it, though.

gaborcsardi avatar Feb 17 '21 14:02 gaborcsardi

Yeah, covr sees internal srcrefs for calls, and can impute them for control flow constructs -- we have strings. But we could search for these strings in the parse data! Not sure about " vs., ', it's worth a try.

Still, instrumenting the parse data and using comments would be much better.

krlmlr avatar Feb 17 '21 14:02 krlmlr