Last line of the source code should be printed by the python debugger client.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg 2017-09-12 03:45:11 -07:00 committed by yichoi
parent c8b99d05e1
commit 04bccea6a6
2 changed files with 6 additions and 2 deletions

View File

@ -167,6 +167,9 @@ class JerryFunction(object):
self.first_breakpoint_line = lines[0]
self.first_breakpoint_offset = offsets[0]
if len(self.source) > 1 and not self.source[-1]:
self.source.pop()
for i in range(len(lines)):
line = lines[i]
offset = offsets[i]
@ -858,10 +861,10 @@ def print_source(debugger, line_num):
if line_num == 0:
start = 0
end = len(last_bp.function.source) - 1
end = len(last_bp.function.source)
else:
start = max(last_bp.line - line_num, 0)
end = min(last_bp.line + line_num-1, len(last_bp.function.source)-1)
end = min(last_bp.line + line_num - 1, len(last_bp.function.source))
for i in range(start, end):
if i == last_bp.line - 1:

View File

@ -11,6 +11,7 @@ Stopped at tests/debugger/do_src.js:20
Stopped at <unknown>:1
(jerry-debugger) source 0
1 > f = function f() {
2 print('F2') }
(jerry-debugger) n
Stopped at tests/debugger/do_src.js:21
(jerry-debugger) step