Add source code support to the debugger. (#1614)

Besides the breakpoint list the JavaScript source code is
also sent to the debugger. This feature allows debugging
eval() function calls.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2017-02-28 09:25:26 +01:00
committed by Tilmann Scheller
parent c6a7765690
commit 6efe39c83c
9 changed files with 206 additions and 94 deletions
+7 -7
View File
@@ -1,10 +1,10 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_dump.js:15
(jerry-debugger) {68: Function(byte_code_cp:0x44, source:"tests/debugger/do_dump.js", name:"f4", { Breakpoint(line:32, offset:17, active_index:-1),Breakpoint(line:31, offset:16, active_index:-1) }),
79: Function(byte_code_cp:0x4f, source:"tests/debugger/do_dump.js", name:"f1", { Breakpoint(line:17, offset:21, active_index:-1),Breakpoint(line:27, offset:22, active_index:-1) }),
102: Function(byte_code_cp:0x66, source:"tests/debugger/do_dump.js", name:"f2", { Breakpoint(line:19, offset:14, active_index:-1),Breakpoint(line:21, offset:15, active_index:-1) }),
105: Function(byte_code_cp:0x69, source:"tests/debugger/do_dump.js", name:"foo", { Breakpoint(line:35, offset:22, active_index:-1),Breakpoint(line:37, offset:23, active_index:-1),Breakpoint(line:38, offset:28, active_index:-1),Breakpoint(line:39, offset:33, active_index:-1) }),
125: Function(byte_code_cp:0x7d, source:"tests/debugger/do_dump.js", name:"f3", { Breakpoint(line:22, offset:25, active_index:-1),Breakpoint(line:23, offset:30, active_index:-1) }),
131: Function(byte_code_cp:0x83, source:"tests/debugger/do_dump.js", name:"", { Breakpoint(line:57, offset:63, active_index:-1),Breakpoint(line:42, offset:54, active_index:-1),Breakpoint(line:43, offset:59, active_index:-1),Breakpoint(line:60, offset:68, active_index:-1),Breakpoint(line:15, offset:49, active_index:-1) }),
154: Function(byte_code_cp:0x9a, source:"tests/debugger/do_dump.js", name:"test", { Breakpoint(line:45, offset:28, active_index:-1),Breakpoint(line:47, offset:29, active_index:-1),Breakpoint(line:48, offset:34, active_index:-1),Breakpoint(line:49, offset:38, active_index:-1),Breakpoint(line:50, offset:43, active_index:-1),Breakpoint(line:51, offset:48, active_index:-1),Breakpoint(line:52, offset:54, active_index:-1),Breakpoint(line:53, offset:58, active_index:-1) })}
(jerry-debugger) {68: Function(byte_code_cp:0x44, source_name:"tests/debugger/do_dump.js", name:"f4", { Breakpoint(line:32, offset:17, active_index:-1),Breakpoint(line:31, offset:16, active_index:-1) }),
79: Function(byte_code_cp:0x4f, source_name:"tests/debugger/do_dump.js", name:"f1", { Breakpoint(line:17, offset:21, active_index:-1),Breakpoint(line:27, offset:22, active_index:-1) }),
102: Function(byte_code_cp:0x66, source_name:"tests/debugger/do_dump.js", name:"f2", { Breakpoint(line:19, offset:14, active_index:-1),Breakpoint(line:21, offset:15, active_index:-1) }),
105: Function(byte_code_cp:0x69, source_name:"tests/debugger/do_dump.js", name:"foo", { Breakpoint(line:35, offset:22, active_index:-1),Breakpoint(line:37, offset:23, active_index:-1),Breakpoint(line:38, offset:28, active_index:-1),Breakpoint(line:39, offset:33, active_index:-1) }),
125: Function(byte_code_cp:0x7d, source_name:"tests/debugger/do_dump.js", name:"f3", { Breakpoint(line:22, offset:25, active_index:-1),Breakpoint(line:23, offset:30, active_index:-1) }),
131: Function(byte_code_cp:0x83, source_name:"tests/debugger/do_dump.js", name:"", { Breakpoint(line:57, offset:63, active_index:-1),Breakpoint(line:42, offset:54, active_index:-1),Breakpoint(line:43, offset:59, active_index:-1),Breakpoint(line:60, offset:68, active_index:-1),Breakpoint(line:15, offset:49, active_index:-1) }),
154: Function(byte_code_cp:0x9a, source_name:"tests/debugger/do_dump.js", name:"test", { Breakpoint(line:45, offset:28, active_index:-1),Breakpoint(line:47, offset:29, active_index:-1),Breakpoint(line:48, offset:34, active_index:-1),Breakpoint(line:49, offset:38, active_index:-1),Breakpoint(line:50, offset:43, active_index:-1),Breakpoint(line:51, offset:48, active_index:-1),Breakpoint(line:52, offset:54, active_index:-1),Breakpoint(line:53, offset:58, active_index:-1) })}
(jerry-debugger) Connection closed.
+13
View File
@@ -0,0 +1,13 @@
b f
n
n
n
s
src
n
b f
c
src
c
src
c
+19
View File
@@ -0,0 +1,19 @@
Connecting to: localhost:5001
Stopped at tests/debugger/do_src.js:19
(jerry-debugger) Breakpoint 1 at tests/debugger/do_src.js:15 (in f)
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_src.js:15 (in f)
(jerry-debugger) Stopped at tests/debugger/do_src.js:16 (in f)
(jerry-debugger) Stopped at tests/debugger/do_src.js:20
(jerry-debugger) Stopped at <unknown>:1
(jerry-debugger) f = function f() {
print('F2') }
(jerry-debugger) Stopped at tests/debugger/do_src.js:21
(jerry-debugger) Breakpoint 2 at <unknown>:2 (in f)
Breakpoint 1 at tests/debugger/do_src.js:15 (in f)
(jerry-debugger) Stopped at breakpoint:2 <unknown>:2 (in f)
(jerry-debugger) f = function f() {
print('F2') }
(jerry-debugger) Stopped at breakpoint:2 <unknown>:2 (in f)
(jerry-debugger) f = function f() {
print('F2') }
(jerry-debugger) Connection closed.
+22
View File
@@ -0,0 +1,22 @@
// 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.
function f() {
print("F1");
}
f();
eval("f = function f() {\nprint('F2') }");
f();
f();