Debugging Java/JavaScript UPoC with NetBeans
- In a terminal, run setroot, then setsite to the JavaScript/Python demo site.
-
Set the
CLJAVA_INIT
environment variable for remote debugging:$ setenv CLJAVA_INIT -agentlib:jdwp=transport=dt_socket,server=y,suspend=y, address=12581
-
Start hcitpstest,
using:
$ hcitpstest -r run -x ASCII -f nl -c sms_ib_data -e "hcitpstestshowbydisp" $HCISITEDIR/in.txt "cljTPS {CLASS ScriptTPS} {LANG javascript} {FILE per.js} {FUNC tpsFunc}"
For hcitpstest, the command line argument depends on the scripting language:
- Python:
cljTPS {CLASS ScriptTPS} {LANG python} {FILE per.py} {FUNC tpsFunc}
- JavaScrpt:
cljTPS {CLASS ScriptTPS} {LANG javascript} {FILE per.js} {FUNC tpsFunc}
- Java:
cljTPS {CLASS TestDispList}
- Python:
- Run NetBeans.
-
Select Choose menu File > Open File. Locate and open the $HCISITEDIR/java_uccs/JavascriptTPSBeta.java Java source file
and the
$HCISITEDIR/javascriptmodules/simpleUPoC.js JavaScript source
file.
Set breakpoints in the files by clicking the left margin of the lines where you require the program to stop.
- In the NetBeans IDE, select Window > Debugging > Sources. This opens the Sources tab.
-
Click the Remote
Attach tab.
- Right-click in the tab and select Add Source Root.
- Navigate to, and add, these files: $HCISITEDIR/java_uccs and $HCISITEDIR/javascriptmodules
- In the NetBeans IDE, select Debug > Attach Debugger. You can also click the tool button. This opens the Attach dialog box.
- Specify the Host and Port. If Netbeans is running on the same machine as the Cloverleaf server, then set Host to hostname. Then, click OK.
- When hcitpstest stops at a breakpoint, you can examine the call stack, change variable values, and so on.