Fork me on GitHub

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.


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


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


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


doable in theory


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


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


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


@darwin: we succeeded in an (abandoned) prototype debugger we created called Abra


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.


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.