Introducing debugger modes (run, breakpoint). (#1645)

This makes the code more robust and error prone, since certain
messages cannot be received in certain situations, e.g. an eval
command during garbage collection.

JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
Zoltan Herczeg
2017-03-07 11:58:46 +01:00
committed by GitHub
parent c6f22a9683
commit a20b9dfa19
6 changed files with 94 additions and 38 deletions
+7 -2
View File
@@ -68,6 +68,7 @@ def arguments_parse():
parser.add_argument("address", action="store", nargs="?", default="localhost:5001", help="specify a unique network address for connection (default: %(default)s)")
parser.add_argument("-v", "--verbose", action="store_true", default=False, help="increase verbosity (default: %(default)s)")
parser.add_argument("--non-interactive", action="store_true", default=False, help="disable stop when newline is pressed (default: %(default)s)")
args = parser.parse_args()
@@ -140,7 +141,7 @@ class DebuggerPrompt(Cmd):
self.debugger = debugger
self.stop = False
self.quit = False
self.cont = False
self.cont = True
def precmd(self, line):
self.stop = False
@@ -188,12 +189,14 @@ class DebuggerPrompt(Cmd):
def do_step(self, args):
""" Next breakpoint, step into functions """
self.exec_command(args, JERRY_DEBUGGER_STEP)
self.cont = True
do_s = do_step
def do_next(self, args):
""" Next breakpoint in the same context """
self.exec_command(args, JERRY_DEBUGGER_NEXT)
self.cont = True
do_n = do_next
@@ -669,13 +672,15 @@ def main():
debugger = JerryDebugger(args.address)
non_interactive = args.non_interactive
logging.debug("Connected to JerryScript on %d port" % (debugger.port))
prompt = DebuggerPrompt(debugger)
prompt.prompt = "(jerry-debugger) "
while True:
if prompt.cont:
if not non_interactive and prompt.cont:
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
sys.stdin.readline()
prompt.cont = False