Improve the evaluate requests (#2583)

Currently it evaluates the given expression in the context of the top most stack frame.
The expression should access to any variables and arguments that are in the scope chain.
Implement the eval_at request with the level of the scope chain as a further argument.

JerryScript-DCO-1.0-Signed-off-by: Robert Sipka rsipka.uszeged@partner.samsung.com
This commit is contained in:
Robert Sipka
2018-11-15 15:53:10 +01:00
committed by GitHub
parent 6c4b316609
commit 47fa5904b1
10 changed files with 170 additions and 13 deletions
+20
View File
@@ -0,0 +1,20 @@
eval_at 0
eval_at 0 b
n
eval_at 0 b
b do_eval_at.js:20
n
scopes
eval_at 0 b
eval_at 1 b
eval_at 0 b=20
eval_at 1 b=100
n
eval_at 0 a
scopes
eval_at 0 b
eval_at -1 b
eval_at 65536 b
eval_at b
eval_at 200
c
+44
View File
@@ -0,0 +1,44 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_eval_at.js:15
(jerry-debugger) eval_at 0
undefined
(jerry-debugger) eval_at 0 b
undefined
(jerry-debugger) n
Stopped at tests/debugger/do_eval_at.js:23
(jerry-debugger) eval_at 0 b
2
(jerry-debugger) b do_eval_at.js:20
Breakpoint 1 at tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
(jerry-debugger) n
Stopped at breakpoint:1 tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
(jerry-debugger) scopes
level | type
0 | local
1 | global
(jerry-debugger) eval_at 0 b
6
(jerry-debugger) eval_at 1 b
2
(jerry-debugger) eval_at 0 b=20
20
(jerry-debugger) eval_at 1 b=100
100
(jerry-debugger) n
Stopped at tests/debugger/do_eval_at.js:25
(jerry-debugger) eval_at 0 a
23
(jerry-debugger) scopes
level | type
0 | global
(jerry-debugger) eval_at 0 b
100
(jerry-debugger) eval_at -1 b
Error: Invalid scope chain index: -1 (must be between 0 and 65535)
(jerry-debugger) eval_at 65536 b
Error: Invalid scope chain index: 65536 (must be between 0 and 65535)
(jerry-debugger) eval_at b
Error: invalid literal for int() with base 10: 'b'
(jerry-debugger) eval_at 200
Uncaught exception: Error
(jerry-debugger) c
+25
View File
@@ -0,0 +1,25 @@
// 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 b = 2;
function f(a)
{
var b = 6;
return a + b;
}
var a = f(3);
null;
+5 -4
View File
@@ -4,9 +4,10 @@ Stopped at tests/debugger/do_help.js:15
Documented commands (type help <topic>):
========================================
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
abort c e finish n s step
b continue eval help next scopes throw
backtrace delete eval_at list quit scroll variables
break display exception memstats res source
bt dump f ms restart src
(jerry-debugger) quit