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
JS Debugger does not attach #119
Comments
I'll take a look at it. Normally you don't need to click attach. but on a side note... If you are seeing CPU spikes, one thing you can do, is from the console tab, type the command |
Thank you for the hint and yes, you are right. I do not have to click at "Attach". After a few seconds the "Attaching debugger" message appears without any action. |
wow ... I was wondering how to debug the meshcore.js from the server ! I can't wait to try this. The meshcore.js also has require statements like
are those actually resolving to js files somehow embedded in the agent exe? |
Hmm ... I tried this by copying the duktape-debugger.js (from the MeshAgent/modules folder in github) then updated the MeshAgent.msh to look like this ...
and tried connecting to http://localhost:9091 on after restarting the MeshAgent service ... but could not connect soooo must be doing something wrong here? |
Yes. If you look in ILibDuktape_Polyfills.c, you will find where some of the JS files are embedded in to agent. The module loader will first look at embedded JS files, then in the file system if it can't find it. |
You are correct in copying that JS file... That MSH option was really meant for running the agent in command line mode... To use the debugger with the background service, it's easer to do it this way:
Then direct your browser to |
By the way, if you pause the debugger, and happen to forget about it, the agent will automatically kill itself and restart, becuase it will think that a thread is stuck. I think the default timeout is 10 minutes, so if you leave the debugger paused for 10 minutes, you may find a log entry saved to disk saying "Microstack Thread STUCK", or something similar. |
Well, I got the debugger working (Built-in JS Debugger html ui) ... but must be dense as I cannot find where to set an actual breakpoint? |
never mind !!! click on the line number, could have sworn I tried that |
any trick to getting breakpoints to actually break? I am setting a breakpoint inside the 2 |
One thing you can try is to put the breakpoint a line or two before you want it. I noticed sometimes the JS runtime's reported program counter is off a little compared to the source. |
Is it realy in this order? Or does it first look in the file system? |
There's no need to delete the embedded JS. The way it's encoded, it includes the timestamp of when it was encoded. So if you just put the modified JS file in the same folder, it will pick it up. |
Is there anyway to turn on some extra agent side logging? oh, and anyway from the meshcore.js to log to the agent console window ... like where this is logged ...
|
Are you talking about the console tab in the browser? If so, then you can use |
Another way to redirect things, is to use the As far as the extra logging, what type of logging are you referring to? There's quite a bit of logging available, thats hidden behind various flags... |
I was seeing an exception, which ended up being an unhandled exception in my meshcore.js .... but in general any kind of logging that could help understand program flow ... it can be very helpful to grep your way thru an ocean of logging and refer back to the source to piece together flow ... I will look thru the repo for how to turn on the flag ... thanks ! |
I made small changes to the meshagent and recompiled it. From time to time, the agent hangs and CPU load goes up to almost 100%. I wanted to use the JS debugger to track that down.
What I did:
When I start Firefox on my pc and enter "http://myTargetIp:9091" I the "Built-in JS Debugger" opens.
When I click "Attach" it sais "Attaching debugger..." and stucks in that state.
When I click on "Pause" the meshagent prints "false, false, null" on the terminal.
Did I miss something? Do I need all sources of the meshagent on the target in order to debug it?
The text was updated successfully, but these errors were encountered: