Fork me on GitHub
#cljs-dev
<
2016-05-11
>
darwin16:05:39

just wondering if there is any example how to fill :locals in enviroment for analyze, background: Dirac has ability to provide REPL evaluation in the context of paused breakpoint. Right now I don’t instruct REPL to have any locals and to access a variable in current scope on stack, user has to enter them in form js/name. I would like to improve this. One approach could be to walk javascript stack trace, demunge scoped js names in all stack frames and fill them into :locals somehow. Another approach could be to locate breakpoint location in original cljs code and use (cached) AST to retrieve locals info. Not sure if either could fly. Any help/advice welcome. Thanks.

dnolen16:05:10

@darwin some time was spent trying to get stable names for locals, so something like that should work in theory

dnolen16:05:45

nobody ever tried it for debugging yet (which is what it was intended for) far as I know, so you’ll have to blaze the trail

darwin16:05:01

ok, so the approach should be doable, right? I like it better because I don’t want to be dealing with mismatch between javascript and (possibly stale) mapping to cljs sources

dnolen16:05:58

doable in theory

dnolen16:05:08

but no idea what’s missing or what the pitfalls are since no one tried it

darwin16:05:21

it also does not have to perfect I think, if I encounter native javascript names I don’t have to “validate” them on cljs side, they can still be “demunged” into “virtual” cljs locals

darwin16:05:51

ok, I will dive into it in next few days, thanks

mikethompson23:05:26

@darwin: we succeeded in an (abandoned) prototype debugger we created called Abra https://github.com/Day8/Abra

mikethompson23:05:31

When at a breakpoint, Abra scooped out the symbols from current stack-frame and shoved them in locals before compiling the user supplied cljs. BUT we did Abra a long time ago, and the compilation tech has moved on a long way since then. Plus we were learning as we went and there was no docs, and limited people to ask. So I'm hesitating to even point Abra out to you. I think that's enough qualification.

mikethompson23:05:36

BTW, there's all sorts of annoyances, like having to take the symbols from the stackframe and replace all _ with - etc. I'm racking my brain ... because I remember one other real annoyance.