Page 1 of 6

Debugger for Z-Way JavaScript

Posted: 23 May 2014 21:18
by PoltoS
We are happy to introduce Z-Way JavaScript engine debugger tool based on v8 debugger.

How to use it?

Install v1.7.1-rc1 (the only difference compared to v1.7.0 is the debugging available).

Install Node Inspector on your PC or on Raspberry Pi.

Add this line just after another "export" in /etc/init.d/z-way-server:

Code: Select all

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/z-way-server/libs
export V8_DEBUG=yes
Restart Z-Way:

Code: Select all

/etc/init.d/z-way-server restart
If Node Inspector is on your local manchine, make a tunnel to Raspberry Pi port:

Code: Select all

ssh -N pi@IP_OF_RASPBERRY_PI -L 8183:127.0.0.1:8183
Run Node Inspector:

Code: Select all

node-inspector --debug-port 8183
Then open Chrome and go to http://127.0.0.1:8080/debug?port=8183
Z-Way Debuggin using Node Inspector
Z-Way Debuggin using Node Inspector
Z-Way_Debugging.png (168.98 KiB) Viewed 30498 times
Enjoy!

NB! This is VERY experimental and sometimes v8 (and Z-Way) crashes if you try to inspect Z-Way internal (native) objects in JavaScript (for example, zway.devices and all others). So, do not watch them.

NB! Use old version of node-inspector. Check this: viewtopic.php?f=3419&t=24237&p=66327#p66054

Re: Debugger for Z-Way JavaScript

Posted: 27 May 2014 13:48
by alexey.zimarev
This is a big thing! So tired of console.log...

It is also very exciting to see signs of Node in Z-Way :)

Re: Debugger for Z-Way JavaScript

Posted: 27 May 2014 15:22
by PoltoS
There are no signs of Node in Z-Way at all. We just use same v8 as NodeJS uses.

But NodeJS have a visual debugger. You can instead use v8 internal debuggin tool.

Re: Debugger for Z-Way JavaScript

Posted: 11 Jun 2014 10:03
by billyboy
should port 8183 not be port 8083?
If not then Node Inspector is running but I don't see any files, if not then Node Inspector crashes with a error 500: Servewr Error, SyntaxtError: Unexpected token E.

Re: Debugger for Z-Way JavaScript

Posted: 11 Jun 2014 11:29
by PoltoS
Should be exactly 8183!

Re: Debugger for Z-Way JavaScript

Posted: 18 Jun 2014 09:32
by billyboy
I tried everything but node inspector start, the webpage loads but I don't see a script file or running code.
If I press Ctrl+O it opens a window but this is empty?

Re: Debugger for Z-Way JavaScript

Posted: 18 Jun 2014 12:33
by PoltoS
have you started Z-Way with V8_DEBUG=yes on the SAME machine or with ssh tunneling?

Re: Debugger for Z-Way JavaScript

Posted: 19 Jun 2014 15:10
by billyboy
Yes, i added V8_DEBUG=yes to /etc/init.d/z-way-server.
I installed Node Inspector on the Raspberry.
And started it: node-inspector --debug-port 8183 (via telnet)

Re: Debugger for Z-Way JavaScript

Posted: 19 Jun 2014 15:25
by billyboy
It works now!
I updated to 1.7.1 and node inspector works now.
Just finding out how to use it.

Re: Debugger for Z-Way JavaScript

Posted: 20 Jun 2014 00:44
by PoltoS
Nice! Do you have some howto for installation of node-inspector on RPi? We use it through ssh tunnel, but may be you can share with others this?