Python debugger cleanup (#3635)
- Rename scopes to scope - Make functions private - Reorder some functions JerryScript-DCO-1.0-Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
This commit is contained in:
@@ -76,8 +76,12 @@ class DebuggerPrompt(Cmd):
|
|||||||
""" Delete the given breakpoint, use 'delete all|active|pending' to clear all the given breakpoints """
|
""" Delete the given breakpoint, use 'delete all|active|pending' to clear all the given breakpoints """
|
||||||
write(self.debugger.delete(args))
|
write(self.debugger.delete(args))
|
||||||
|
|
||||||
|
def do_exception(self, args):
|
||||||
|
""" Config the exception handler module """
|
||||||
|
write(self.debugger.exception(args))
|
||||||
|
|
||||||
def do_next(self, args):
|
def do_next(self, args):
|
||||||
""" Next breakpoint in the same context """
|
""" Next breakpoint in the same code block """
|
||||||
self.stop = True
|
self.stop = True
|
||||||
if not args:
|
if not args:
|
||||||
args = 0
|
args = 0
|
||||||
@@ -116,17 +120,26 @@ class DebuggerPrompt(Cmd):
|
|||||||
self.stop = True
|
self.stop = True
|
||||||
do_s = do_step
|
do_s = do_step
|
||||||
|
|
||||||
|
def do_continue(self, _):
|
||||||
|
""" Continue execution """
|
||||||
|
self.debugger.do_continue()
|
||||||
|
self.stop = True
|
||||||
|
if not self.debugger.non_interactive:
|
||||||
|
print("Press enter to stop JavaScript execution.")
|
||||||
|
do_c = do_continue
|
||||||
|
|
||||||
|
def do_finish(self, _):
|
||||||
|
""" Continue running until the current function returns """
|
||||||
|
self.debugger.finish()
|
||||||
|
self.stop = True
|
||||||
|
do_f = do_finish
|
||||||
|
|
||||||
def do_backtrace(self, args):
|
def do_backtrace(self, args):
|
||||||
""" Get backtrace data from debugger """
|
""" Get backtrace data from debugger """
|
||||||
write(self.debugger.backtrace(args))
|
write(self.debugger.backtrace(args))
|
||||||
self.stop = True
|
self.stop = True
|
||||||
do_bt = do_backtrace
|
do_bt = do_backtrace
|
||||||
|
|
||||||
def do_variables(self, args):
|
|
||||||
""" Get scope variables from debugger """
|
|
||||||
write(self.debugger.scope_variables(args))
|
|
||||||
self.stop = True
|
|
||||||
|
|
||||||
def do_src(self, args):
|
def do_src(self, args):
|
||||||
""" Get current source code """
|
""" Get current source code """
|
||||||
if args:
|
if args:
|
||||||
@@ -150,27 +163,6 @@ class DebuggerPrompt(Cmd):
|
|||||||
else:
|
else:
|
||||||
print("Invalid key")
|
print("Invalid key")
|
||||||
|
|
||||||
def do_continue(self, _):
|
|
||||||
""" Continue execution """
|
|
||||||
self.debugger.do_continue()
|
|
||||||
self.stop = True
|
|
||||||
if not self.debugger.non_interactive:
|
|
||||||
print("Press enter to stop JavaScript execution.")
|
|
||||||
do_c = do_continue
|
|
||||||
|
|
||||||
def do_finish(self, _):
|
|
||||||
""" Continue running until the current function returns """
|
|
||||||
self.debugger.finish()
|
|
||||||
self.stop = True
|
|
||||||
do_f = do_finish
|
|
||||||
|
|
||||||
def do_dump(self, args):
|
|
||||||
""" Dump all of the debugger data """
|
|
||||||
if args:
|
|
||||||
print("Error: No argument expected")
|
|
||||||
else:
|
|
||||||
pprint(self.debugger.function_list)
|
|
||||||
|
|
||||||
def do_eval(self, args):
|
def do_eval(self, args):
|
||||||
""" Evaluate JavaScript source code """
|
""" Evaluate JavaScript source code """
|
||||||
self.debugger.eval(args)
|
self.debugger.eval(args)
|
||||||
@@ -200,19 +192,13 @@ class DebuggerPrompt(Cmd):
|
|||||||
self.debugger.eval_at(code, index)
|
self.debugger.eval_at(code, index)
|
||||||
self.stop = True
|
self.stop = True
|
||||||
|
|
||||||
def do_memstats(self, _):
|
def do_throw(self, args):
|
||||||
""" Memory statistics """
|
""" Throw an exception """
|
||||||
self.debugger.memstats()
|
self.debugger.throw(args)
|
||||||
self.stop = True
|
|
||||||
do_ms = do_memstats
|
|
||||||
|
|
||||||
def do_scopes(self, _):
|
|
||||||
""" Memory statistics """
|
|
||||||
self.debugger.scope_chain()
|
|
||||||
self.stop = True
|
self.stop = True
|
||||||
|
|
||||||
def do_abort(self, args):
|
def do_abort(self, args):
|
||||||
""" Throw an exception """
|
""" Throw an exception which cannot be caught """
|
||||||
self.debugger.abort(args)
|
self.debugger.abort(args)
|
||||||
self.stop = True
|
self.stop = True
|
||||||
|
|
||||||
@@ -222,14 +208,36 @@ class DebuggerPrompt(Cmd):
|
|||||||
self.stop = True
|
self.stop = True
|
||||||
do_res = do_restart
|
do_res = do_restart
|
||||||
|
|
||||||
def do_throw(self, args):
|
def do_scope(self, _):
|
||||||
""" Throw an exception """
|
""" Get lexical environment chain """
|
||||||
self.debugger.throw(args)
|
self.debugger.scope_chain()
|
||||||
self.stop = True
|
self.stop = True
|
||||||
|
|
||||||
def do_exception(self, args):
|
def do_variables(self, args):
|
||||||
""" Config the exception handler module """
|
""" Get scope variables from debugger """
|
||||||
write(self.debugger.exception(args))
|
write(self.debugger.scope_variables(args))
|
||||||
|
self.stop = True
|
||||||
|
|
||||||
|
def do_memstats(self, _):
|
||||||
|
""" Memory statistics """
|
||||||
|
self.debugger.memstats()
|
||||||
|
self.stop = True
|
||||||
|
do_ms = do_memstats
|
||||||
|
|
||||||
|
def do_dump(self, args):
|
||||||
|
""" Dump all of the debugger data """
|
||||||
|
if args:
|
||||||
|
print("Error: No argument expected")
|
||||||
|
else:
|
||||||
|
pprint(self.debugger.function_list)
|
||||||
|
|
||||||
|
# pylint: disable=invalid-name
|
||||||
|
def do_EOF(self, _):
|
||||||
|
""" Exit JerryScript debugger """
|
||||||
|
print("Unexpected end of input. Connection closed.")
|
||||||
|
self.debugger.quit()
|
||||||
|
self.quit = True
|
||||||
|
self.stop = True
|
||||||
|
|
||||||
def _scroll_direction(debugger, direction):
|
def _scroll_direction(debugger, direction):
|
||||||
""" Helper function for do_scroll """
|
""" Helper function for do_scroll """
|
||||||
|
|||||||
+112
-120
@@ -276,7 +276,7 @@ class JerryDebugger(object):
|
|||||||
self.exception_string = ''
|
self.exception_string = ''
|
||||||
self.frame_index = 0
|
self.frame_index = 0
|
||||||
self.scope_vars = ""
|
self.scope_vars = ""
|
||||||
self.scopes = ""
|
self.scope_data = ""
|
||||||
self.client_sources = []
|
self.client_sources = []
|
||||||
self.last_breakpoint_hit = None
|
self.last_breakpoint_hit = None
|
||||||
self.next_breakpoint_index = 0
|
self.next_breakpoint_index = 0
|
||||||
@@ -349,33 +349,18 @@ class JerryDebugger(object):
|
|||||||
self.prompt = False
|
self.prompt = False
|
||||||
self._exec_command(JERRY_DEBUGGER_CONTINUE)
|
self._exec_command(JERRY_DEBUGGER_CONTINUE)
|
||||||
|
|
||||||
|
def set_colors(self):
|
||||||
|
self.nocolor = '\033[0m'
|
||||||
|
self.green = '\033[92m'
|
||||||
|
self.red = '\033[31m'
|
||||||
|
self.yellow = '\033[93m'
|
||||||
|
self.green_bg = '\033[42m\033[30m'
|
||||||
|
self.yellow_bg = '\033[43m\033[30m'
|
||||||
|
self.blue = '\033[94m'
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self._exec_command(JERRY_DEBUGGER_STOP)
|
self._exec_command(JERRY_DEBUGGER_STOP)
|
||||||
|
|
||||||
def do_continue(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_CONTINUE)
|
|
||||||
|
|
||||||
def finish(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_FINISH)
|
|
||||||
|
|
||||||
def next(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_NEXT)
|
|
||||||
|
|
||||||
def step(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_STEP)
|
|
||||||
|
|
||||||
def memstats(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_MEMSTATS)
|
|
||||||
|
|
||||||
def scope_chain(self):
|
|
||||||
self.prompt = False
|
|
||||||
self._exec_command(JERRY_DEBUGGER_GET_SCOPE_CHAIN)
|
|
||||||
|
|
||||||
def set_break(self, args):
|
def set_break(self, args):
|
||||||
if not args:
|
if not args:
|
||||||
return "Error: Breakpoint index expected"
|
return "Error: Breakpoint index expected"
|
||||||
@@ -392,40 +377,6 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
return self._set_breakpoint(args, False)
|
return self._set_breakpoint(args, False)
|
||||||
|
|
||||||
def delete(self, args):
|
|
||||||
if not args:
|
|
||||||
return "Error: Breakpoint index expected\n" \
|
|
||||||
"Delete the given breakpoint, use 'delete all|active|pending' " \
|
|
||||||
"to clear all the given breakpoints\n "
|
|
||||||
elif args in ['all', 'pending', 'active']:
|
|
||||||
if args == "all":
|
|
||||||
self.delete_active()
|
|
||||||
self.delete_pending()
|
|
||||||
elif args == "pending":
|
|
||||||
self.delete_pending()
|
|
||||||
elif args == "active":
|
|
||||||
self.delete_active()
|
|
||||||
return ""
|
|
||||||
|
|
||||||
try:
|
|
||||||
breakpoint_index = int(args)
|
|
||||||
except ValueError as val_errno:
|
|
||||||
return "Error: Integer number expected, %s\n" % (val_errno)
|
|
||||||
|
|
||||||
if breakpoint_index in self.active_breakpoint_list:
|
|
||||||
breakpoint = self.active_breakpoint_list[breakpoint_index]
|
|
||||||
del self.active_breakpoint_list[breakpoint_index]
|
|
||||||
breakpoint.active_index = -1
|
|
||||||
self.send_breakpoint(breakpoint)
|
|
||||||
return "Breakpoint %d deleted\n" % (breakpoint_index)
|
|
||||||
elif breakpoint_index in self.pending_breakpoint_list:
|
|
||||||
del self.pending_breakpoint_list[breakpoint_index]
|
|
||||||
if not self.pending_breakpoint_list:
|
|
||||||
self.send_parser_config(0)
|
|
||||||
return "Pending breakpoint %d deleted\n" % (breakpoint_index)
|
|
||||||
else:
|
|
||||||
return "Error: Breakpoint %d not found\n" % (breakpoint_index)
|
|
||||||
|
|
||||||
def breakpoint_list(self):
|
def breakpoint_list(self):
|
||||||
result = ''
|
result = ''
|
||||||
if self.active_breakpoint_list:
|
if self.active_breakpoint_list:
|
||||||
@@ -442,6 +393,60 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def delete(self, args):
|
||||||
|
if not args:
|
||||||
|
return "Error: Breakpoint index expected\n" \
|
||||||
|
"Delete the given breakpoint, use 'delete all|active|pending' " \
|
||||||
|
"to clear all the given breakpoints\n "
|
||||||
|
elif args in ['all', 'pending', 'active']:
|
||||||
|
if args != "pending":
|
||||||
|
for i in self.active_breakpoint_list.values():
|
||||||
|
breakpoint = self.active_breakpoint_list[i.active_index]
|
||||||
|
del self.active_breakpoint_list[i.active_index]
|
||||||
|
breakpoint.active_index = -1
|
||||||
|
self._send_breakpoint(breakpoint)
|
||||||
|
|
||||||
|
if args != "active":
|
||||||
|
if self.pending_breakpoint_list:
|
||||||
|
self.pending_breakpoint_list.clear()
|
||||||
|
self._send_parser_config(0)
|
||||||
|
return ""
|
||||||
|
|
||||||
|
try:
|
||||||
|
breakpoint_index = int(args)
|
||||||
|
except ValueError as val_errno:
|
||||||
|
return "Error: Integer number expected, %s\n" % (val_errno)
|
||||||
|
|
||||||
|
if breakpoint_index in self.active_breakpoint_list:
|
||||||
|
breakpoint = self.active_breakpoint_list[breakpoint_index]
|
||||||
|
del self.active_breakpoint_list[breakpoint_index]
|
||||||
|
breakpoint.active_index = -1
|
||||||
|
self._send_breakpoint(breakpoint)
|
||||||
|
return "Breakpoint %d deleted\n" % (breakpoint_index)
|
||||||
|
elif breakpoint_index in self.pending_breakpoint_list:
|
||||||
|
del self.pending_breakpoint_list[breakpoint_index]
|
||||||
|
if not self.pending_breakpoint_list:
|
||||||
|
self._send_parser_config(0)
|
||||||
|
return "Pending breakpoint %d deleted\n" % (breakpoint_index)
|
||||||
|
else:
|
||||||
|
return "Error: Breakpoint %d not found\n" % (breakpoint_index)
|
||||||
|
|
||||||
|
def next(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_NEXT)
|
||||||
|
|
||||||
|
def step(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_STEP)
|
||||||
|
|
||||||
|
def do_continue(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_CONTINUE)
|
||||||
|
|
||||||
|
def finish(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_FINISH)
|
||||||
|
|
||||||
def backtrace(self, args):
|
def backtrace(self, args):
|
||||||
max_depth = 0
|
max_depth = 0
|
||||||
min_depth = 0
|
min_depth = 0
|
||||||
@@ -483,28 +488,6 @@ class JerryDebugger(object):
|
|||||||
self.prompt = False
|
self.prompt = False
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
def scope_variables(self, args):
|
|
||||||
index = 0
|
|
||||||
if args:
|
|
||||||
try:
|
|
||||||
index = int(args)
|
|
||||||
if index < 0:
|
|
||||||
print ("Error: A non negative integer number expected")
|
|
||||||
return ""
|
|
||||||
|
|
||||||
except ValueError as val_errno:
|
|
||||||
return "Error: Non negative integer number expected, %s\n" % (val_errno)
|
|
||||||
|
|
||||||
message = struct.pack(self.byte_order + "BB" + self.idx_format,
|
|
||||||
1 + 4,
|
|
||||||
JERRY_DEBUGGER_GET_SCOPE_VARIABLES,
|
|
||||||
index)
|
|
||||||
|
|
||||||
self.channel.send_message(self.byte_order, message)
|
|
||||||
|
|
||||||
self.prompt = False
|
|
||||||
return ""
|
|
||||||
|
|
||||||
def eval(self, code):
|
def eval(self, code):
|
||||||
self._send_string(JERRY_DEBUGGER_EVAL_EVAL + code, JERRY_DEBUGGER_EVAL)
|
self._send_string(JERRY_DEBUGGER_EVAL_EVAL + code, JERRY_DEBUGGER_EVAL)
|
||||||
self.prompt = False
|
self.prompt = False
|
||||||
@@ -538,15 +521,45 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
if enabled:
|
if enabled:
|
||||||
logging.debug("Stop at exception enabled")
|
logging.debug("Stop at exception enabled")
|
||||||
self.send_exception_config(enabled)
|
self._send_exception_config(enabled)
|
||||||
|
|
||||||
return "Stop at exception enabled\n"
|
return "Stop at exception enabled\n"
|
||||||
|
|
||||||
logging.debug("Stop at exception disabled")
|
logging.debug("Stop at exception disabled")
|
||||||
self.send_exception_config(enabled)
|
self._send_exception_config(enabled)
|
||||||
|
|
||||||
return "Stop at exception disabled\n"
|
return "Stop at exception disabled\n"
|
||||||
|
|
||||||
|
def scope_chain(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_GET_SCOPE_CHAIN)
|
||||||
|
|
||||||
|
def scope_variables(self, args):
|
||||||
|
index = 0
|
||||||
|
if args:
|
||||||
|
try:
|
||||||
|
index = int(args)
|
||||||
|
if index < 0:
|
||||||
|
print("Error: A non negative integer number expected")
|
||||||
|
return ""
|
||||||
|
|
||||||
|
except ValueError as val_errno:
|
||||||
|
return "Error: Non negative integer number expected, %s\n" % (val_errno)
|
||||||
|
|
||||||
|
message = struct.pack(self.byte_order + "BB" + self.idx_format,
|
||||||
|
1 + 4,
|
||||||
|
JERRY_DEBUGGER_GET_SCOPE_VARIABLES,
|
||||||
|
index)
|
||||||
|
|
||||||
|
self.channel.send_message(self.byte_order, message)
|
||||||
|
|
||||||
|
self.prompt = False
|
||||||
|
return ""
|
||||||
|
|
||||||
|
def memstats(self):
|
||||||
|
self.prompt = False
|
||||||
|
self._exec_command(JERRY_DEBUGGER_MEMSTATS)
|
||||||
|
|
||||||
def _send_string(self, args, message_type, index=0):
|
def _send_string(self, args, message_type, index=0):
|
||||||
|
|
||||||
# 1: length of type byte
|
# 1: length of type byte
|
||||||
@@ -594,19 +607,7 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
self.channel.send_message(self.byte_order, message + args[prev_offset:offset])
|
self.channel.send_message(self.byte_order, message + args[prev_offset:offset])
|
||||||
|
|
||||||
def delete_active(self):
|
def _breakpoint_pending_exists(self, breakpoint):
|
||||||
for i in self.active_breakpoint_list.values():
|
|
||||||
breakpoint = self.active_breakpoint_list[i.active_index]
|
|
||||||
del self.active_breakpoint_list[i.active_index]
|
|
||||||
breakpoint.active_index = -1
|
|
||||||
self.send_breakpoint(breakpoint)
|
|
||||||
|
|
||||||
def delete_pending(self):
|
|
||||||
if self.pending_breakpoint_list:
|
|
||||||
self.pending_breakpoint_list.clear()
|
|
||||||
self.send_parser_config(0)
|
|
||||||
|
|
||||||
def breakpoint_pending_exists(self, breakpoint):
|
|
||||||
for existing_bp in self.pending_breakpoint_list.values():
|
for existing_bp in self.pending_breakpoint_list.values():
|
||||||
if (breakpoint.line and existing_bp.source_name == breakpoint.source_name and \
|
if (breakpoint.line and existing_bp.source_name == breakpoint.source_name and \
|
||||||
existing_bp.line == breakpoint.line) \
|
existing_bp.line == breakpoint.line) \
|
||||||
@@ -615,7 +616,7 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def send_breakpoint(self, breakpoint):
|
def _send_breakpoint(self, breakpoint):
|
||||||
message = struct.pack(self.byte_order + "BBB" + self.cp_format + self.idx_format,
|
message = struct.pack(self.byte_order + "BBB" + self.cp_format + self.idx_format,
|
||||||
1 + 1 + self.cp_size + 4,
|
1 + 1 + self.cp_size + 4,
|
||||||
JERRY_DEBUGGER_UPDATE_BREAKPOINT,
|
JERRY_DEBUGGER_UPDATE_BREAKPOINT,
|
||||||
@@ -624,36 +625,27 @@ class JerryDebugger(object):
|
|||||||
breakpoint.offset)
|
breakpoint.offset)
|
||||||
self.channel.send_message(self.byte_order, message)
|
self.channel.send_message(self.byte_order, message)
|
||||||
|
|
||||||
def send_bytecode_cp(self, byte_code_cp):
|
def _send_bytecode_cp(self, byte_code_cp):
|
||||||
message = struct.pack(self.byte_order + "BB" + self.cp_format,
|
message = struct.pack(self.byte_order + "BB" + self.cp_format,
|
||||||
1 + self.cp_size,
|
1 + self.cp_size,
|
||||||
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
||||||
byte_code_cp)
|
byte_code_cp)
|
||||||
self.channel.send_message(self.byte_order, message)
|
self.channel.send_message(self.byte_order, message)
|
||||||
|
|
||||||
def send_exception_config(self, enable):
|
def _send_exception_config(self, enable):
|
||||||
message = struct.pack(self.byte_order + "BBB",
|
message = struct.pack(self.byte_order + "BBB",
|
||||||
1 + 1,
|
1 + 1,
|
||||||
JERRY_DEBUGGER_EXCEPTION_CONFIG,
|
JERRY_DEBUGGER_EXCEPTION_CONFIG,
|
||||||
enable)
|
enable)
|
||||||
self.channel.send_message(self.byte_order, message)
|
self.channel.send_message(self.byte_order, message)
|
||||||
|
|
||||||
def send_parser_config(self, enable):
|
def _send_parser_config(self, enable):
|
||||||
message = struct.pack(self.byte_order + "BBB",
|
message = struct.pack(self.byte_order + "BBB",
|
||||||
1 + 1,
|
1 + 1,
|
||||||
JERRY_DEBUGGER_PARSER_CONFIG,
|
JERRY_DEBUGGER_PARSER_CONFIG,
|
||||||
enable)
|
enable)
|
||||||
self.channel.send_message(self.byte_order, message)
|
self.channel.send_message(self.byte_order, message)
|
||||||
|
|
||||||
def set_colors(self):
|
|
||||||
self.nocolor = '\033[0m'
|
|
||||||
self.green = '\033[92m'
|
|
||||||
self.red = '\033[31m'
|
|
||||||
self.yellow = '\033[93m'
|
|
||||||
self.green_bg = '\033[42m\033[30m'
|
|
||||||
self.yellow_bg = '\033[43m\033[30m'
|
|
||||||
self.blue = '\033[94m'
|
|
||||||
|
|
||||||
def store_client_sources(self, args):
|
def store_client_sources(self, args):
|
||||||
self.client_sources = args
|
self.client_sources = args
|
||||||
|
|
||||||
@@ -805,11 +797,11 @@ class JerryDebugger(object):
|
|||||||
self.send_client_source()
|
self.send_client_source()
|
||||||
|
|
||||||
elif buffer_type in [JERRY_DEBUGGER_SCOPE_CHAIN, JERRY_DEBUGGER_SCOPE_CHAIN_END]:
|
elif buffer_type in [JERRY_DEBUGGER_SCOPE_CHAIN, JERRY_DEBUGGER_SCOPE_CHAIN_END]:
|
||||||
self.scopes = data[1:]
|
self.scope_data = data[1:]
|
||||||
|
|
||||||
if buffer_type == JERRY_DEBUGGER_SCOPE_CHAIN_END:
|
if buffer_type == JERRY_DEBUGGER_SCOPE_CHAIN_END:
|
||||||
result = self._process_scopes()
|
result = self._process_scope()
|
||||||
self.scopes = ""
|
self.scope_data = ""
|
||||||
|
|
||||||
self.prompt = True
|
self.prompt = True
|
||||||
|
|
||||||
@@ -971,7 +963,7 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
if byte_code_cp in new_function_list:
|
if byte_code_cp in new_function_list:
|
||||||
del new_function_list[byte_code_cp]
|
del new_function_list[byte_code_cp]
|
||||||
self.send_bytecode_cp(byte_code_cp)
|
self._send_bytecode_cp(byte_code_cp)
|
||||||
else:
|
else:
|
||||||
self._release_function(data)
|
self._release_function(data)
|
||||||
|
|
||||||
@@ -1021,7 +1013,7 @@ class JerryDebugger(object):
|
|||||||
del bp_list[breakpoint_index]
|
del bp_list[breakpoint_index]
|
||||||
|
|
||||||
if not bp_list:
|
if not bp_list:
|
||||||
self.send_parser_config(0)
|
self._send_parser_config(0)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
logging.debug("No pending breakpoints")
|
logging.debug("No pending breakpoints")
|
||||||
@@ -1040,13 +1032,13 @@ class JerryDebugger(object):
|
|||||||
del self.active_breakpoint_list[breakpoint.active_index]
|
del self.active_breakpoint_list[breakpoint.active_index]
|
||||||
|
|
||||||
del self.function_list[byte_code_cp]
|
del self.function_list[byte_code_cp]
|
||||||
self.send_bytecode_cp(byte_code_cp)
|
self._send_bytecode_cp(byte_code_cp)
|
||||||
logging.debug("Function {0x%x} byte-code released", byte_code_cp)
|
logging.debug("Function {0x%x} byte-code released", byte_code_cp)
|
||||||
|
|
||||||
|
|
||||||
def _enable_breakpoint(self, breakpoint):
|
def _enable_breakpoint(self, breakpoint):
|
||||||
if isinstance(breakpoint, JerryPendingBreakpoint):
|
if isinstance(breakpoint, JerryPendingBreakpoint):
|
||||||
if self.breakpoint_pending_exists(breakpoint):
|
if self._breakpoint_pending_exists(breakpoint):
|
||||||
return "%sPending breakpoint%s already exists\n" % (self.yellow, self.nocolor)
|
return "%sPending breakpoint%s already exists\n" % (self.yellow, self.nocolor)
|
||||||
|
|
||||||
self.next_breakpoint_index += 1
|
self.next_breakpoint_index += 1
|
||||||
@@ -1061,7 +1053,7 @@ class JerryDebugger(object):
|
|||||||
self.next_breakpoint_index += 1
|
self.next_breakpoint_index += 1
|
||||||
self.active_breakpoint_list[self.next_breakpoint_index] = breakpoint
|
self.active_breakpoint_list[self.next_breakpoint_index] = breakpoint
|
||||||
breakpoint.active_index = self.next_breakpoint_index
|
breakpoint.active_index = self.next_breakpoint_index
|
||||||
self.send_breakpoint(breakpoint)
|
self._send_breakpoint(breakpoint)
|
||||||
|
|
||||||
return "%sBreakpoint %d%s at %s\n" % (self.green,
|
return "%sBreakpoint %d%s at %s\n" % (self.green,
|
||||||
breakpoint.active_index,
|
breakpoint.active_index,
|
||||||
@@ -1103,7 +1095,7 @@ class JerryDebugger(object):
|
|||||||
ans = sys.stdin.readline()
|
ans = sys.stdin.readline()
|
||||||
if ans in ['yes\n', 'y\n']:
|
if ans in ['yes\n', 'y\n']:
|
||||||
if not self.pending_breakpoint_list:
|
if not self.pending_breakpoint_list:
|
||||||
self.send_parser_config(1)
|
self._send_parser_config(1)
|
||||||
|
|
||||||
if line:
|
if line:
|
||||||
breakpoint = JerryPendingBreakpoint(int(line.group(2)), line.group(1))
|
breakpoint = JerryPendingBreakpoint(int(line.group(2)), line.group(1))
|
||||||
@@ -1235,11 +1227,11 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
def _process_scopes(self):
|
def _process_scope(self):
|
||||||
result = ""
|
result = ""
|
||||||
table = [['level', 'type']]
|
table = [['level', 'type']]
|
||||||
|
|
||||||
for i, level in enumerate(self.scopes):
|
for i, level in enumerate(self.scope_data):
|
||||||
if ord(level) == JERRY_DEBUGGER_SCOPE_WITH:
|
if ord(level) == JERRY_DEBUGGER_SCOPE_WITH:
|
||||||
table.append([str(i), 'with'])
|
table.append([str(i), 'with'])
|
||||||
elif ord(level) == JERRY_DEBUGGER_SCOPE_GLOBAL:
|
elif ord(level) == JERRY_DEBUGGER_SCOPE_GLOBAL:
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ n
|
|||||||
eval_at 0 b
|
eval_at 0 b
|
||||||
b do_eval_at.js:20
|
b do_eval_at.js:20
|
||||||
n
|
n
|
||||||
scopes
|
scope
|
||||||
eval_at 0 b
|
eval_at 0 b
|
||||||
eval_at 1 b
|
eval_at 1 b
|
||||||
eval_at 0 b=20
|
eval_at 0 b=20
|
||||||
eval_at 1 b=100
|
eval_at 1 b=100
|
||||||
n
|
n
|
||||||
eval_at 0 a
|
eval_at 0 a
|
||||||
scopes
|
scope
|
||||||
eval_at 0 b
|
eval_at 0 b
|
||||||
eval_at -1 b
|
eval_at -1 b
|
||||||
eval_at 65536 b
|
eval_at 65536 b
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ Stopped at tests/debugger/do_eval_at.js:23
|
|||||||
Breakpoint 1 at tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
|
Breakpoint 1 at tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
|
||||||
(jerry-debugger) n
|
(jerry-debugger) n
|
||||||
Stopped at breakpoint:1 tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
|
Stopped at breakpoint:1 tests/debugger/do_eval_at.js:20 (in f() at line:17, col:1)
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | local
|
0 | local
|
||||||
1 | global
|
1 | global
|
||||||
@@ -28,7 +28,7 @@ level | type
|
|||||||
Stopped at tests/debugger/do_eval_at.js:25
|
Stopped at tests/debugger/do_eval_at.js:25
|
||||||
(jerry-debugger) eval_at 0 a
|
(jerry-debugger) eval_at 0 a
|
||||||
23
|
23
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | global
|
0 | global
|
||||||
(jerry-debugger) eval_at 0 b
|
(jerry-debugger) eval_at 0 b
|
||||||
|
|||||||
@@ -4,10 +4,10 @@ Stopped at tests/debugger/do_help.js:15
|
|||||||
|
|
||||||
Documented commands (type help <topic>):
|
Documented commands (type help <topic>):
|
||||||
========================================
|
========================================
|
||||||
abort c e finish n s step
|
EOF bt dump f ms restart src
|
||||||
b continue eval help next scopes throw
|
abort c e finish n s step
|
||||||
backtrace delete eval_at list quit scroll variables
|
b continue eval help next scope throw
|
||||||
break display exception memstats res source
|
backtrace delete eval_at list quit scroll variables
|
||||||
bt dump f ms restart src
|
break display exception memstats res source
|
||||||
|
|
||||||
(jerry-debugger) quit
|
(jerry-debugger) quit
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
scope
|
||||||
|
b do_scope.js:22
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
b do_scope.js:28
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
b do_scope.js:31
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
b do_scope.js:33
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
b do_scope.js:35
|
||||||
|
c
|
||||||
|
scope
|
||||||
|
c
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
Connecting to: localhost:5001
|
||||||
|
Stopped at tests/debugger/do_scope.js:15
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | global
|
||||||
|
(jerry-debugger) b do_scope.js:22
|
||||||
|
Breakpoint 1 at tests/debugger/do_scope.js:22 (in f() at line:17, col:1)
|
||||||
|
(jerry-debugger) c
|
||||||
|
Exception throw detected (to disable automatic stop type exception 0)
|
||||||
|
Exception hint: error
|
||||||
|
Stopped at tests/debugger/do_scope.js:19 (in f() at line:17, col:1)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | local
|
||||||
|
1 | global
|
||||||
|
(jerry-debugger) c
|
||||||
|
Stopped at breakpoint:1 tests/debugger/do_scope.js:22 (in f() at line:17, col:1)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | catch
|
||||||
|
1 | local
|
||||||
|
2 | global
|
||||||
|
(jerry-debugger) b do_scope.js:28
|
||||||
|
Breakpoint 2 at tests/debugger/do_scope.js:28 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) c
|
||||||
|
Stopped at breakpoint:2 tests/debugger/do_scope.js:28 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | local
|
||||||
|
1 | closure
|
||||||
|
2 | global
|
||||||
|
(jerry-debugger) b do_scope.js:31
|
||||||
|
Breakpoint 3 at tests/debugger/do_scope.js:31 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) c
|
||||||
|
Stopped at breakpoint:3 tests/debugger/do_scope.js:31 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | with
|
||||||
|
1 | local
|
||||||
|
2 | closure
|
||||||
|
3 | global
|
||||||
|
(jerry-debugger) b do_scope.js:33
|
||||||
|
Breakpoint 4 at tests/debugger/do_scope.js:33 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) c
|
||||||
|
Stopped at breakpoint:4 tests/debugger/do_scope.js:33 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | with
|
||||||
|
1 | with
|
||||||
|
2 | local
|
||||||
|
3 | closure
|
||||||
|
4 | global
|
||||||
|
(jerry-debugger) b do_scope.js:35
|
||||||
|
Breakpoint 5 at tests/debugger/do_scope.js:35 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) c
|
||||||
|
Stopped at breakpoint:5 tests/debugger/do_scope.js:35 (in function() at line:27, col:4)
|
||||||
|
(jerry-debugger) scope
|
||||||
|
level | type
|
||||||
|
0 | with
|
||||||
|
1 | local
|
||||||
|
2 | closure
|
||||||
|
3 | global
|
||||||
|
(jerry-debugger) c
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
scopes
|
|
||||||
b do_scopes.js:22
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
b do_scopes.js:28
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
b do_scopes.js:31
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
b do_scopes.js:33
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
b do_scopes.js:35
|
|
||||||
c
|
|
||||||
scopes
|
|
||||||
c
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
Connecting to: localhost:5001
|
|
||||||
Stopped at tests/debugger/do_scopes.js:15
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | global
|
|
||||||
(jerry-debugger) b do_scopes.js:22
|
|
||||||
Breakpoint 1 at tests/debugger/do_scopes.js:22 (in f() at line:17, col:1)
|
|
||||||
(jerry-debugger) c
|
|
||||||
Exception throw detected (to disable automatic stop type exception 0)
|
|
||||||
Exception hint: error
|
|
||||||
Stopped at tests/debugger/do_scopes.js:19 (in f() at line:17, col:1)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | local
|
|
||||||
1 | global
|
|
||||||
(jerry-debugger) c
|
|
||||||
Stopped at breakpoint:1 tests/debugger/do_scopes.js:22 (in f() at line:17, col:1)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | catch
|
|
||||||
1 | local
|
|
||||||
2 | global
|
|
||||||
(jerry-debugger) b do_scopes.js:28
|
|
||||||
Breakpoint 2 at tests/debugger/do_scopes.js:28 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) c
|
|
||||||
Stopped at breakpoint:2 tests/debugger/do_scopes.js:28 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | local
|
|
||||||
1 | closure
|
|
||||||
2 | global
|
|
||||||
(jerry-debugger) b do_scopes.js:31
|
|
||||||
Breakpoint 3 at tests/debugger/do_scopes.js:31 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) c
|
|
||||||
Stopped at breakpoint:3 tests/debugger/do_scopes.js:31 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | with
|
|
||||||
1 | local
|
|
||||||
2 | closure
|
|
||||||
3 | global
|
|
||||||
(jerry-debugger) b do_scopes.js:33
|
|
||||||
Breakpoint 4 at tests/debugger/do_scopes.js:33 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) c
|
|
||||||
Stopped at breakpoint:4 tests/debugger/do_scopes.js:33 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | with
|
|
||||||
1 | with
|
|
||||||
2 | local
|
|
||||||
3 | closure
|
|
||||||
4 | global
|
|
||||||
(jerry-debugger) b do_scopes.js:35
|
|
||||||
Breakpoint 5 at tests/debugger/do_scopes.js:35 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) c
|
|
||||||
Stopped at breakpoint:5 tests/debugger/do_scopes.js:35 (in function() at line:27, col:4)
|
|
||||||
(jerry-debugger) scopes
|
|
||||||
level | type
|
|
||||||
0 | with
|
|
||||||
1 | local
|
|
||||||
2 | closure
|
|
||||||
3 | global
|
|
||||||
(jerry-debugger) c
|
|
||||||
@@ -1,27 +1,27 @@
|
|||||||
scopes
|
scope
|
||||||
variables
|
variables
|
||||||
variables 1
|
variables 1
|
||||||
variables 0
|
variables 0
|
||||||
b tests/debugger/do_variables.js:20
|
b tests/debugger/do_variables.js:20
|
||||||
c
|
c
|
||||||
scopes
|
scope
|
||||||
variables 0
|
variables 0
|
||||||
variables 1
|
variables 1
|
||||||
variables 2
|
variables 2
|
||||||
b tests/debugger/do_variables.js:30
|
b tests/debugger/do_variables.js:30
|
||||||
c
|
c
|
||||||
scopes
|
scope
|
||||||
variables 1
|
variables 1
|
||||||
variables 0
|
variables 0
|
||||||
b tests/debugger/do_variables.js:33
|
b tests/debugger/do_variables.js:33
|
||||||
c
|
c
|
||||||
c
|
c
|
||||||
scopes
|
scope
|
||||||
variables 0
|
variables 0
|
||||||
variables 1
|
variables 1
|
||||||
b tests/debugger/do_variables.js:50
|
b tests/debugger/do_variables.js:50
|
||||||
c
|
c
|
||||||
scopes
|
scope
|
||||||
variables 0
|
variables 0
|
||||||
variables 1
|
variables 1
|
||||||
variables 2
|
variables 2
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
Connecting to: localhost:5001
|
Connecting to: localhost:5001
|
||||||
Stopped at tests/debugger/do_variables.js:15
|
Stopped at tests/debugger/do_variables.js:15
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | global
|
0 | global
|
||||||
(jerry-debugger) variables
|
(jerry-debugger) variables
|
||||||
@@ -29,7 +29,7 @@ assert | Function |
|
|||||||
Breakpoint 1 at tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
Breakpoint 1 at tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
||||||
(jerry-debugger) c
|
(jerry-debugger) c
|
||||||
Stopped at breakpoint:1 tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
Stopped at breakpoint:1 tests/debugger/do_variables.js:20 (in function() at line:19, col:10)
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | local
|
0 | local
|
||||||
1 | closure
|
1 | closure
|
||||||
@@ -56,7 +56,7 @@ assert | Function |
|
|||||||
Breakpoint 2 at tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
Breakpoint 2 at tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||||
(jerry-debugger) c
|
(jerry-debugger) c
|
||||||
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | local
|
0 | local
|
||||||
1 | global
|
1 | global
|
||||||
@@ -87,7 +87,7 @@ Exception hint: error
|
|||||||
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
Stopped at breakpoint:2 tests/debugger/do_variables.js:30 (in f() at line:28, col:1)
|
||||||
(jerry-debugger) c
|
(jerry-debugger) c
|
||||||
Stopped at breakpoint:3 tests/debugger/do_variables.js:33 (in f() at line:28, col:1)
|
Stopped at breakpoint:3 tests/debugger/do_variables.js:33 (in f() at line:28, col:1)
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | catch
|
0 | catch
|
||||||
1 | local
|
1 | local
|
||||||
@@ -106,7 +106,7 @@ c | undefined | undefined
|
|||||||
Breakpoint 4 at tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
Breakpoint 4 at tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
||||||
(jerry-debugger) c
|
(jerry-debugger) c
|
||||||
Stopped at breakpoint:4 tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
Stopped at breakpoint:4 tests/debugger/do_variables.js:50 (in function() at line:46, col:4)
|
||||||
(jerry-debugger) scopes
|
(jerry-debugger) scope
|
||||||
level | type
|
level | type
|
||||||
0 | with
|
0 | with
|
||||||
1 | local
|
1 | local
|
||||||
|
|||||||
Reference in New Issue
Block a user