|
25 | 25 | import struct
|
26 | 26 | import sys
|
27 | 27 | import math
|
| 28 | +import time |
28 | 29 |
|
29 | 30 | # Expected debugger protocol version.
|
30 | 31 | JERRY_DEBUGGER_VERSION = 1
|
@@ -265,7 +266,22 @@ def do_step(self, args):
|
265 | 266 |
|
266 | 267 | def do_next(self, args):
|
267 | 268 | """ 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) |
269 | 285 | self.cont = True
|
270 | 286 |
|
271 | 287 | do_n = do_next
|
@@ -561,6 +577,7 @@ def __init__(self, address):
|
561 | 577 | self.src_offset_diff = 0
|
562 | 578 | self.client_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
563 | 579 | self.client_socket.connect((self.host, self.port))
|
| 580 | + self.nexts_remain = 0 |
564 | 581 |
|
565 | 582 | self.send_message(b"GET /jerry-debugger HTTP/1.1\r\n" +
|
566 | 583 | b"Upgrade: websocket\r\n" +
|
@@ -1141,7 +1158,12 @@ def main():
|
1141 | 1158 | if debugger.display:
|
1142 | 1159 | print_source(prompt.debugger, debugger.display, 0)
|
1143 | 1160 |
|
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 | + |
1145 | 1167 | if prompt.quit:
|
1146 | 1168 | break
|
1147 | 1169 |
|
|
0 commit comments