List scope chain levels and their variables to the selected stack frame. (#2557)
It supports to list the scope chain of the current execution context and see which variables are available. JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
@@ -4,9 +4,9 @@ Stopped at tests/debugger/do_help.js:15
|
||||
|
||||
Documented commands (type help <topic>):
|
||||
========================================
|
||||
abort bt display exception list next s step
|
||||
b c dump f memstats quit scroll throw
|
||||
backtrace continue e finish ms res source
|
||||
break delete eval help n restart src
|
||||
abort bt display exception list next s src
|
||||
b c dump f memstats quit scopes step
|
||||
backtrace continue e finish ms res scroll throw
|
||||
break delete eval help n restart source variables
|
||||
|
||||
(jerry-debugger) quit
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
scopes
|
||||
b do_scopes.js:22
|
||||
c
|
||||
scopes
|
||||
c
|
||||
scopes
|
||||
b do_scopes.js:28
|
||||
c
|
||||
scopes
|
||||
b do_scopes.js:31
|
||||
c
|
||||
scopes
|
||||
b do_scopes.js:33
|
||||
c
|
||||
scopes
|
||||
b do_scopes.js:35
|
||||
c
|
||||
scopes
|
||||
c
|
||||
@@ -0,0 +1,63 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_scopes.js:15
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | global
|
||||
(jerry-debugger) b do_scopes.js:22
|
||||
Breakpoint 1 at tests/debugger/do_scopes.js:22 (in f() at line:17, col:1)
|
||||
(jerry-debugger) c
|
||||
Exception throw detected (to disable automatic stop type exception 0)
|
||||
Exception hint: error
|
||||
Stopped at tests/debugger/do_scopes.js:19 (in f() at line:17, col:1)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | local
|
||||
1 | global
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:1 tests/debugger/do_scopes.js:22 (in f() at line:17, col:1)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | catch
|
||||
1 | local
|
||||
2 | global
|
||||
(jerry-debugger) b do_scopes.js:28
|
||||
Breakpoint 2 at tests/debugger/do_scopes.js:28 (in function() at line:27, col:4)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:2 tests/debugger/do_scopes.js:28 (in function() at line:27, col:4)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | local
|
||||
1 | closure
|
||||
2 | global
|
||||
(jerry-debugger) b do_scopes.js:31
|
||||
Breakpoint 3 at tests/debugger/do_scopes.js:31 (in function() at line:27, col:4)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:3 tests/debugger/do_scopes.js:31 (in function() at line:27, col:4)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | with
|
||||
1 | local
|
||||
2 | closure
|
||||
3 | global
|
||||
(jerry-debugger) b do_scopes.js:33
|
||||
Breakpoint 4 at tests/debugger/do_scopes.js:33 (in function() at line:27, col:4)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:4 tests/debugger/do_scopes.js:33 (in function() at line:27, col:4)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | with
|
||||
1 | with
|
||||
2 | local
|
||||
3 | closure
|
||||
4 | global
|
||||
(jerry-debugger) b do_scopes.js:35
|
||||
Breakpoint 5 at tests/debugger/do_scopes.js:35 (in function() at line:27, col:4)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:5 tests/debugger/do_scopes.js:35 (in function() at line:27, col:4)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | with
|
||||
1 | local
|
||||
2 | closure
|
||||
3 | global
|
||||
(jerry-debugger) c
|
||||
@@ -0,0 +1,41 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var c = 4;
|
||||
|
||||
function f() {
|
||||
try {
|
||||
throw "error";
|
||||
}
|
||||
catch (err) {
|
||||
var c = 10;
|
||||
}
|
||||
|
||||
var z = true;
|
||||
var g = 0;
|
||||
(function() {
|
||||
var a = [1,2,3]
|
||||
a.y = "abc";
|
||||
with (a) {
|
||||
var h = [4,5,6]
|
||||
with (h) {
|
||||
h.d = "dfg"
|
||||
}
|
||||
a.d = g + c;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
f();
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
scopes
|
||||
variables
|
||||
variables 1
|
||||
variables 0
|
||||
b tests/debugger/do_variables.js:20
|
||||
c
|
||||
scopes
|
||||
variables 0
|
||||
variables 1
|
||||
variables 2
|
||||
b tests/debugger/do_variables.js:30
|
||||
c
|
||||
scopes
|
||||
variables 1
|
||||
variables 0
|
||||
b tests/debugger/do_variables.js:33
|
||||
c
|
||||
c
|
||||
scopes
|
||||
variables 0
|
||||
variables 1
|
||||
b tests/debugger/do_variables.js:50
|
||||
c
|
||||
scopes
|
||||
variables 0
|
||||
variables 1
|
||||
variables 2
|
||||
c
|
||||
@@ -0,0 +1,128 @@
|
||||
Connecting to: localhost:5001
|
||||
Stopped at tests/debugger/do_variables.js:15
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | global
|
||||
(jerry-debugger) variables
|
||||
name | type | value
|
||||
f | Function |
|
||||
addX | Function |
|
||||
z | undefined | undefined
|
||||
c | undefined | undefined
|
||||
print | Function |
|
||||
gc | Function |
|
||||
assert | Function |
|
||||
(jerry-debugger) variables 1
|
||||
name | type | value
|
||||
(jerry-debugger) variables 0
|
||||
name | type | value
|
||||
f | Function |
|
||||
addX | Function |
|
||||
z | undefined | undefined
|
||||
c | undefined | undefined
|
||||
print | Function |
|
||||
gc | Function |
|
||||
assert | Function |
|
||||
(jerry-debugger) b tests/debugger/do_variables.js:20
|
||||
Breakpoint 1 at tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:1 tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | local
|
||||
1 | closure
|
||||
2 | global
|
||||
(jerry-debugger) variables 0
|
||||
name | type | value
|
||||
n | Number | 9
|
||||
b | undefined | undefined
|
||||
(jerry-debugger) variables 1
|
||||
name | type | value
|
||||
x | Number | 3
|
||||
(jerry-debugger) variables 2
|
||||
name | type | value
|
||||
addThree | Function |
|
||||
f | Function |
|
||||
addX | Function |
|
||||
z | Number | 5
|
||||
c | Number | 4
|
||||
print | Function |
|
||||
gc | Function |
|
||||
assert | Function |
|
||||
(jerry-debugger) b tests/debugger/do_variables.js:30
|
||||
Breakpoint 2 at tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | local
|
||||
1 | global
|
||||
(jerry-debugger) variables 1
|
||||
name | type | value
|
||||
d | Number | 12
|
||||
addThree | Function |
|
||||
f | Function |
|
||||
addX | Function |
|
||||
z | Number | 5
|
||||
c | Number | 4
|
||||
print | Function |
|
||||
gc | Function |
|
||||
assert | Function |
|
||||
(jerry-debugger) variables 0
|
||||
name | type | value
|
||||
b | undefined | undefined
|
||||
x | undefined | undefined
|
||||
user | undefined | undefined
|
||||
m | undefined | undefined
|
||||
c | undefined | undefined
|
||||
(jerry-debugger) b tests/debugger/do_variables.js:33
|
||||
Breakpoint 3 at tests/debugger/do_variables.js:33 (in f() at line:28, col:1)
|
||||
(jerry-debugger) c
|
||||
Exception throw detected (to disable automatic stop type exception 0)
|
||||
Exception hint: error
|
||||
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:3 tests/debugger/do_variables.js:33 (in f() at line:28, col:1)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | catch
|
||||
1 | local
|
||||
2 | global
|
||||
(jerry-debugger) variables 0
|
||||
name | type | value
|
||||
err | String | error
|
||||
(jerry-debugger) variables 1
|
||||
name | type | value
|
||||
b | undefined | undefined
|
||||
x | undefined | undefined
|
||||
user | undefined | undefined
|
||||
m | undefined | undefined
|
||||
c | undefined | undefined
|
||||
(jerry-debugger) b tests/debugger/do_variables.js:50
|
||||
Breakpoint 4 at tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
||||
(jerry-debugger) c
|
||||
Stopped at breakpoint:4 tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
||||
(jerry-debugger) scopes
|
||||
level | type
|
||||
0 | with
|
||||
1 | local
|
||||
2 | closure
|
||||
3 | global
|
||||
(jerry-debugger) variables 0
|
||||
name | type | value
|
||||
y | String | abc
|
||||
2 | Number | 3
|
||||
1 | Number | 2
|
||||
0 | Number | 1
|
||||
(jerry-debugger) variables 1
|
||||
name | type | value
|
||||
h | undefined | undefined
|
||||
a | Array | [1,2,3]
|
||||
(jerry-debugger) variables 2
|
||||
name | type | value
|
||||
b | Number | 10
|
||||
x | Boolean | true
|
||||
user | Object | {"name":"John","age":30}
|
||||
m | Null | null
|
||||
c | Number | 10
|
||||
(jerry-debugger) c
|
||||
@@ -0,0 +1,60 @@
|
||||
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
var c = 4;
|
||||
var z = 5;
|
||||
|
||||
function addX(x) {
|
||||
return function(n) {
|
||||
var b = 2;
|
||||
return n + x;
|
||||
}
|
||||
}
|
||||
|
||||
addThree = addX(3);
|
||||
d = addThree(c+z);
|
||||
|
||||
function f() {
|
||||
try {
|
||||
throw "error";
|
||||
}
|
||||
catch (err) {
|
||||
var c = 10;
|
||||
}
|
||||
|
||||
var m = null;
|
||||
|
||||
var user = {
|
||||
name: "John",
|
||||
age: 30
|
||||
};
|
||||
|
||||
var x = true;
|
||||
var b = 10;
|
||||
|
||||
(function() {
|
||||
var a = [1,2,3]
|
||||
a.y = "abc";
|
||||
with (a) {
|
||||
var h = [4,5,6]
|
||||
with (h) {
|
||||
h.d = "dfg"
|
||||
}
|
||||
a.d = x;
|
||||
}
|
||||
})();
|
||||
}
|
||||
|
||||
f();
|
||||
|
||||
Reference in New Issue
Block a user