From 04bccea6a6522e5420bab2130ab74558c3cdc7a3 Mon Sep 17 00:00:00 2001 From: Zoltan Herczeg Date: Tue, 12 Sep 2017 03:45:11 -0700 Subject: [PATCH] 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 --- jerry-debugger/jerry-client-ws.py | 7 +++++-- tests/debugger/do_src.expected | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/jerry-debugger/jerry-client-ws.py b/jerry-debugger/jerry-client-ws.py index 34b4cf5d1..cb3a2263b 100755 --- a/jerry-debugger/jerry-client-ws.py +++ b/jerry-debugger/jerry-client-ws.py @@ -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: diff --git a/tests/debugger/do_src.expected b/tests/debugger/do_src.expected index 512f376a9..18e80a651 100644 --- a/tests/debugger/do_src.expected +++ b/tests/debugger/do_src.expected @@ -11,6 +11,7 @@ Stopped at tests/debugger/do_src.js:20 Stopped at :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