Debugging Java/JavaScript UPoC with NetBeans

  1. In a terminal, run setroot, then setsite to the JavaScript/Python demo site.
  2. Set the CLJAVA_INIT environment variable for remote debugging:
    $ setenv CLJAVA_INIT -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,
    address=12581
  3. 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}

  4. Run NetBeans.
  5. 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.
  6. In the NetBeans IDE, select Window > Debugging > Sources. This opens the Sources tab.
  7. Click the Remote Attach tab.
    1. Right-click in the tab and select Add Source Root.
    2. Navigate to, and add, these files: $HCISITEDIR/java_uccs and $HCISITEDIR/javascriptmodules
  8. In the NetBeans IDE, select Debug > Attach Debugger. You can also click the tool button. This opens the Attach dialog box.
  9. 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.
  10. When hcitpstest stops at a breakpoint, you can examine the call stack, change variable values, and so on.