Skip to content

Commit 23db6f5

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 [email protected]
1 parent 29b337d commit 23db6f5

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

jerry-debugger/jerry-client-ws.py

Lines changed: 24 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
@@ -265,7 +266,22 @@ def do_step(self, args):
265266

266267
def do_next(self, args):
267268
""" Next breakpoint in the same context """
268-
self._exec_command(args, JERRY_DEBUGGER_NEXT)
269+
if not args:
270+
args = 0
271+
else:
272+
try:
273+
args = int(args)
274+
if args <= 0:
275+
raise ValueError(args)
276+
except ValueError as val_errno:
277+
print("Error: expected a positive integer: %s" % val_errno)
278+
return
279+
280+
args = min(args, len(self.debugger.last_breakpoint_hit.function.lines) -
281+
self.debugger.last_breakpoint_hit.function.line) - 1
282+
self.debugger.nexts_remain = args
283+
284+
self._exec_command("", JERRY_DEBUGGER_NEXT)
269285
self.cont = True
270286

271287
do_n = do_next
@@ -561,6 +577,7 @@ def __init__(self, address):
561577
self.src_offset_diff = 0
562578
self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
563579
self.client_socket.connect((self.host, self.port))
580+
self.nexts_remain = 0
564581

565582
self.send_message(b"GET /jerry-debugger HTTP/1.1\r\n" +
566583
b"Upgrade: websocket\r\n" +
@@ -1141,7 +1158,12 @@ def main():
11411158
if debugger.display:
11421159
print_source(prompt.debugger, debugger.display, 0)
11431160

1144-
prompt.cmdloop()
1161+
if debugger.nexts_remain:
1162+
prompt.do_next(debugger.nexts_remain)
1163+
time.sleep(0.1)
1164+
else:
1165+
prompt.cmdloop()
1166+
11451167
if prompt.quit:
11461168
break
11471169

0 commit comments

Comments
 (0)