Skip to content
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

How can I test a simple Javascript code with iotjs-vscode-extension ? #10

Open
haesik opened this issue Jun 7, 2018 · 9 comments
Open

Comments

@haesik
Copy link

haesik commented Jun 7, 2018

I followed the instruction on the Readme file.
But I have failed to start debugging of a sample javascript file.
Could you explain more detailed instructions?

my test)
I tested using following instructions

$ git clone https://github.com/Samsung/iotjs-vscode-extension.git
$ cd iotjs-vscode-extension ~/.vscode -r
$ cd path/to/the/iotjs
$ ./tools/build.py --buildtype=debug --jerry-debugger
$ ./build/x86_64-linux/debug/bin/iotjs --start-debug-server ./test/run_pass/test_console.js

and I made a launch.json file in iotjs/.vscode/ with the following contents
{
"version": "0.2.0",
"configurations": [
{
"name": "IoT.js: Attach",
"type": "iotjs",
"request": "attach",
"address": "localhost",
"port": 5001,
"localRoot": "${workspaceRoot}/test/run_pass/test_console.js",
"stopOnEntry": false,
"debugLog": 0
},
]
}

I pushed F5 button on vscode ..
and I received a fail message written in Korean..
Here is a brief translation => "The debug adapter process terminated unexpectedly"

@knightburton
Copy link
Member

@haesik First of all, your launch.json is incorrect, the localRoot should be your working directory's path, the most cases the ${workspaceRoot} is enough.

In the other hand I think if you want to use the debugger directly from the iotjs directory insted of a separated empty project folder, the debugger waiting mode would be much better because of you already have that file on your computer what you want to debug.

I suggest you that to start the iotjs with this command:
./build/x86_64-linux/debug/bin/iotjs --start-debug-server --debugger-wait-source
In this case the iotjs will start the debug server and if you hit the F5 button in the vscode the debugger client will connect to it, then you will get a prompt inside the vscode where you can select the desired test file.

@haesik
Copy link
Author

haesik commented Jun 7, 2018

I have tried localRoot with ${workspaceRoot}, but the result is same.
Could you check the following sequence ?

$ git clone https://github.com/Samsung/iotjs-vscode-extension.git
$ cp iotjs-vscode-extension ~/.vscode -r
$ cd path/to/the/iotjs
$ code .
$ ./tools/build.py --buildtype=debug --jerry-debugger
$ ./build/x86_64-linux/debug/bin/iotjs --start-debug-server --debugger-wait-source

and I made a launch.json file in iotjs/.vscode/ with the following contents
{
"version": "0.2.0",
"configurations": [
{
"name": "IoT.js: Attach",
"type": "iotjs",
"request": "attach",
"address": "localhost",
"port": 5001,
"localRoot": "${workspaceRoot}",
"stopOnEntry": false,
"debugLog": 0
},
]
}

I pushed F5 button on vscode ..
and I received a same fail message..

@knightburton
Copy link
Member

@haesik I see, sorry, I missed that you wanted to copy the extension into the vscode to avoid the developer debug run. In this case the copy path that you using is incorrect, the extensions are listed in ~/.vscode/extensions/ folder, so you have to copy the extension there.

Use this: cp iotjs-vscode-extension ~/.vscode/extensions/ -r

After this, the sequence that you using should work properly.

@hs0225
Copy link

hs0225 commented Jun 8, 2018

@haesik npm install and npm run compile are required.

cd ~/.vscode/extensions/iotjs-vscode-extension
npm install
npm run compile

@knightburton Could you update the READEME.md about install extensions?

@haesik
Copy link
Author

haesik commented Jun 8, 2018

@knightburton @hs0225 Thank you very much for the guides..
Now, I can trace source code.. : )

@knightburton
Copy link
Member

@hs0225 Sure, I forgot that the npm install and npm run compile are requires for the first time running, I'll update the README.md.

@knightburton
Copy link
Member

knightburton commented Jun 11, 2018

I've opened a PR about the README update (#13) and since this issue is solved I close this.

@haesik
Copy link
Author

haesik commented Dec 17, 2018

Today, I have tested vscode-extension with latest iotjs and I got an error message.
Can you test with latest iotjs and iotjs-vscode-extension?

  1. I have tested with the following instructions

$ git clone https://github.com/Samsung/iotjs-vscode-extension.git
$ cp iotjs-vscode-extension ~/.vscode -r
$ cd ~/.vscode/extensions/iotjs-vscode-extension
$ npm install
$ npm run compile
$ cd path/to/the/iotjs
$ ./tools/build.py --buildtype=debug --jerry-debugger --no-snapshot
$ ./build/x86_64-linux/debug/bin/iotjs --start-debug-server ./test/run_pass/test_console.js &
$ code .

and I made a launch.json file in iotjs/.vscode/ with the following contents
{
"version": "0.2.0",
"configurations": [
{
"name": "IoT.js: Attach",
"type": "iotjs",
"request": "attach",
"address": "localhost",
"port": 5001,
"localRoot": "${workspaceRoot}",
"stopOnEntry": false,
"debugLog": 1
},
]
}

and I connect to a running engine and I got the following message,

TCP Error: Connection reset by peer
ICE: Assertion 'JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED' failed at /home/haesik/iotjs/iotjs/deps/jerry/jerry-core/parser/js/js-parser.c(parser_append_breakpoint_info):1403.
Error: ERR_FAILED_INTERNAL_ASSERTION

Could you check it?

  1. And One more Issue is that
    When i build with the following command
    $ ./tools/build.py --buildtype=debug --jerry-debugger
    This time I got the following message and I can't use break point..

TCP Error: Resource temporarily unavailable
Hello IoT.js!!
1
2
3
13
[1,2,3]
1 2 3
a 1 b 2 c 3
test null undefined
{
"a": "123",
"b": 123,
"c": [
1,
2,
3
]
}
Hello IoT.js!!
1
2
3
13
[1,2,3]
1 2 3
a 1 b 2 c 3

Could you check this also?

@haesik haesik reopened this Dec 17, 2018
@tdusnoki
Copy link
Contributor

  1. The path you wrote in your second command is incorrect.
    The correct path to copy your extension folder would be ~/.vscode/extensions instead of ~/.vscode/
    You should also check first if you had a previous version of the extension in that same folder and delete it before copying the new one.
  2. These fixes Fix possible failure in backtrace info jerryscript#2643 and Fix an issue while debugging with static snapshots jerryscript#2606 will be added to IoT.js in the next JerryScript update: Update JerryScript Submodule iotjs#1820.
    After that you will be able to build without --no-snapshot flag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants