Skip to content

Commit 06de0f3

Browse files
author
Daniel Balla
committed
Multiple nexts with one command
Make a next command more gdb like. If an argument is given `next 10`, it does 10 nexts. JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
1 parent e860870 commit 06de0f3

File tree

1 file changed

+21
-2
lines changed

1 file changed

+21
-2
lines changed

jerry-debugger/jerry-client-ws.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import struct
2626
import sys
2727
import math
28+
import time
2829

2930
# Expected debugger protocol version.
3031
JERRY_DEBUGGER_VERSION = 1
@@ -273,7 +274,19 @@ def do_step(self, args):
273274

274275
def do_next(self, args):
275276
""" Next breakpoint in the same context """
276-
self.exec_command(args, JERRY_DEBUGGER_NEXT)
277+
if args == "":
278+
args = 0
279+
else:
280+
try:
281+
args = int(args)
282+
args = min(args, len(self.debugger.last_breakpoint_hit.function.lines) -
283+
self.debugger.last_breakpoint_hit.function.line) - 1
284+
self.debugger.nexts_remain = args
285+
except ValueError as val_errno:
286+
print("Error: expected a positive integer: %s" % val_errno)
287+
return
288+
289+
self.exec_command("", JERRY_DEBUGGER_NEXT)
277290
self.cont = True
278291

279292
do_n = do_next
@@ -571,6 +584,7 @@ def __init__(self, address):
571584
self.src_offset_diff = 0
572585
self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
573586
self.client_socket.connect((self.host, self.port))
587+
self.nexts_remain = 0
574588

575589
self.send_message(b"GET /jerry-debugger HTTP/1.1\r\n" +
576590
b"Upgrade: websocket\r\n" +
@@ -1149,7 +1163,12 @@ def main():
11491163
if debugger.display:
11501164
print_source(prompt.debugger, debugger.display, 0)
11511165

1152-
prompt.cmdloop()
1166+
if debugger.nexts_remain:
1167+
prompt.do_next(debugger.nexts_remain)
1168+
time.sleep(0.1)
1169+
else:
1170+
prompt.cmdloop()
1171+
11531172
if prompt.quit:
11541173
break
11551174

0 commit comments

Comments
 (0)