mirror of
https://github.com/jerryscript-project/jerryscript.git
synced 2025-12-15 16:29:21 +00:00
Add feature commands for debugger python script (#1604)
JerryScript-DCO-1.0-Signed-off-by: Levente Orban orbanl@inf.u-szeged.hu
This commit is contained in:
parent
6254748081
commit
b996841a65
@ -15,14 +15,15 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import socket
|
from cmd import Cmd
|
||||||
import sys
|
from pprint import pprint # For the readable stack printing.
|
||||||
import argparse
|
import argparse
|
||||||
import logging
|
import logging
|
||||||
import re
|
import re
|
||||||
from cmd import Cmd
|
import select
|
||||||
from struct import *
|
import socket
|
||||||
from pprint import pprint # For the readable stack printing.
|
import struct
|
||||||
|
import sys
|
||||||
|
|
||||||
# Messages sent by the server to client.
|
# Messages sent by the server to client.
|
||||||
JERRY_DEBUGGER_CONFIGURATION = 1
|
JERRY_DEBUGGER_CONFIGURATION = 1
|
||||||
@ -138,9 +139,12 @@ class DebuggerPrompt(Cmd):
|
|||||||
Cmd.__init__(self)
|
Cmd.__init__(self)
|
||||||
self.debugger = debugger
|
self.debugger = debugger
|
||||||
self.stop = False
|
self.stop = False
|
||||||
|
self.quit = False
|
||||||
|
self.cont = False
|
||||||
|
|
||||||
def precmd(self, line):
|
def precmd(self, line):
|
||||||
self.stop = False
|
self.stop = False
|
||||||
|
self.cont = False
|
||||||
return line
|
return line
|
||||||
|
|
||||||
def postcmd(self, stop, line):
|
def postcmd(self, stop, line):
|
||||||
@ -152,6 +156,13 @@ class DebuggerPrompt(Cmd):
|
|||||||
else:
|
else:
|
||||||
set_breakpoint(self.debugger, args)
|
set_breakpoint(self.debugger, args)
|
||||||
|
|
||||||
|
def do_quit(self, args):
|
||||||
|
""" Exit JerryScript debugger """
|
||||||
|
self.do_delete("all")
|
||||||
|
self.exec_command(args, JERRY_DEBUGGER_CONTINUE)
|
||||||
|
self.stop = True
|
||||||
|
self.quit = True
|
||||||
|
|
||||||
def do_break(self, args):
|
def do_break(self, args):
|
||||||
""" Insert breakpoints on the given lines """
|
""" Insert breakpoints on the given lines """
|
||||||
self.insert_breakpoint(args)
|
self.insert_breakpoint(args)
|
||||||
@ -170,10 +181,16 @@ class DebuggerPrompt(Cmd):
|
|||||||
def do_continue(self, args):
|
def do_continue(self, args):
|
||||||
""" Continue execution """
|
""" Continue execution """
|
||||||
self.exec_command(args, JERRY_DEBUGGER_CONTINUE)
|
self.exec_command(args, JERRY_DEBUGGER_CONTINUE)
|
||||||
|
self.stop = True
|
||||||
|
self.cont = True
|
||||||
|
print("Press enter to stop JavaScript execution.")
|
||||||
|
|
||||||
def do_c(self, args):
|
def do_c(self, args):
|
||||||
""" Continue execution """
|
""" Continue execution """
|
||||||
self.exec_command(args, JERRY_DEBUGGER_CONTINUE)
|
self.exec_command(args, JERRY_DEBUGGER_CONTINUE)
|
||||||
|
self.stop = True
|
||||||
|
self.cont = True
|
||||||
|
print("Press enter to stop JavaScript execution.")
|
||||||
|
|
||||||
def do_step(self, args):
|
def do_step(self, args):
|
||||||
""" Next breakpoint, step into functions """
|
""" Next breakpoint, step into functions """
|
||||||
@ -202,24 +219,30 @@ class DebuggerPrompt(Cmd):
|
|||||||
print("%d: %s" % (breakpoint.active_index, breakpoint.to_string()))
|
print("%d: %s" % (breakpoint.active_index, breakpoint.to_string()))
|
||||||
|
|
||||||
def do_delete(self, args):
|
def do_delete(self, args):
|
||||||
""" Delete the given breakpoint """
|
""" Delete the given breakpoint, use 'delete all' to clear the breakpoints in the whole program"""
|
||||||
if not args:
|
if not args:
|
||||||
print("Error: Breakpoint index expected")
|
print("Error: Breakpoint index expected")
|
||||||
return
|
return
|
||||||
|
elif args == "all":
|
||||||
try:
|
for i in self.debugger.active_breakpoint_list.values():
|
||||||
breakpoint_index = int(args)
|
breakpoint = self.debugger.active_breakpoint_list[i.active_index]
|
||||||
except:
|
del self.debugger.active_breakpoint_list[i.active_index]
|
||||||
print("Error: Integer number expected")
|
breakpoint.active_index = -1
|
||||||
return
|
self.debugger.send_breakpoint(breakpoint)
|
||||||
|
|
||||||
if breakpoint_index in self.debugger.active_breakpoint_list:
|
|
||||||
breakpoint = self.debugger.active_breakpoint_list[breakpoint_index]
|
|
||||||
del self.debugger.active_breakpoint_list[breakpoint_index]
|
|
||||||
breakpoint.active_index = -1
|
|
||||||
self.debugger.send_breakpoint(breakpoint)
|
|
||||||
else:
|
else:
|
||||||
print("Error: Breakpoint %d not found" % (breakpoint_index))
|
try:
|
||||||
|
breakpoint_index = int(args)
|
||||||
|
except:
|
||||||
|
print("Error: Integer number expected")
|
||||||
|
return
|
||||||
|
|
||||||
|
if breakpoint_index in self.debugger.active_breakpoint_list:
|
||||||
|
breakpoint = self.debugger.active_breakpoint_list[breakpoint_index]
|
||||||
|
del self.debugger.active_breakpoint_list[breakpoint_index]
|
||||||
|
breakpoint.active_index = -1
|
||||||
|
self.debugger.send_breakpoint(breakpoint)
|
||||||
|
else:
|
||||||
|
print("Error: Breakpoint %d not found" % (breakpoint_index))
|
||||||
|
|
||||||
def exec_backtrace(self, args):
|
def exec_backtrace(self, args):
|
||||||
max_depth = 0
|
max_depth = 0
|
||||||
@ -234,12 +257,12 @@ class DebuggerPrompt(Cmd):
|
|||||||
print("Error: Positive integer number expected")
|
print("Error: Positive integer number expected")
|
||||||
return
|
return
|
||||||
|
|
||||||
message = pack(self.debugger.byte_order + "BBIB" + self.debugger.idx_format,
|
message = struct.pack(self.debugger.byte_order + "BBIB" + self.debugger.idx_format,
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + 1 + 4,
|
WEBSOCKET_FIN_BIT + 1 + 4,
|
||||||
0,
|
0,
|
||||||
JERRY_DEBUGGER_GET_BACKTRACE,
|
JERRY_DEBUGGER_GET_BACKTRACE,
|
||||||
max_depth)
|
max_depth)
|
||||||
self.debugger.send_message(message)
|
self.debugger.send_message(message)
|
||||||
self.stop = True
|
self.stop = True
|
||||||
|
|
||||||
@ -270,12 +293,12 @@ class DebuggerPrompt(Cmd):
|
|||||||
message_header = 1 + 4
|
message_header = 1 + 4
|
||||||
max_fragment = min(self.debugger.max_message_size - message_header, size)
|
max_fragment = min(self.debugger.max_message_size - message_header, size)
|
||||||
|
|
||||||
message = pack(self.debugger.byte_order + "BBIBI",
|
message = struct.pack(self.debugger.byte_order + "BBIBI",
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + max_fragment + message_header,
|
WEBSOCKET_FIN_BIT + max_fragment + message_header,
|
||||||
0,
|
0,
|
||||||
JERRY_DEBUGGER_EVAL,
|
JERRY_DEBUGGER_EVAL,
|
||||||
size)
|
size)
|
||||||
|
|
||||||
if size == max_fragment:
|
if size == max_fragment:
|
||||||
self.debugger.send_message(message + args)
|
self.debugger.send_message(message + args)
|
||||||
@ -292,11 +315,11 @@ class DebuggerPrompt(Cmd):
|
|||||||
while offset < size:
|
while offset < size:
|
||||||
next_fragment = min(max_fragment, size - offset)
|
next_fragment = min(max_fragment, size - offset)
|
||||||
|
|
||||||
message = pack(self.debugger.byte_order + "BBIB",
|
message = struct.pack(self.debugger.byte_order + "BBIB",
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + next_fragment + message_header,
|
WEBSOCKET_FIN_BIT + next_fragment + message_header,
|
||||||
0,
|
0,
|
||||||
JERRY_DEBUGGER_EVAL_PART)
|
JERRY_DEBUGGER_EVAL_PART)
|
||||||
|
|
||||||
prev_offset = offset
|
prev_offset = offset
|
||||||
offset += next_fragment
|
offset += next_fragment
|
||||||
@ -401,10 +424,10 @@ class JerryDebugger(object):
|
|||||||
|
|
||||||
len_result = len(result)
|
len_result = len(result)
|
||||||
|
|
||||||
expected = pack("BBB",
|
expected = struct.pack("BBB",
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
4,
|
4,
|
||||||
JERRY_DEBUGGER_CONFIGURATION)
|
JERRY_DEBUGGER_CONFIGURATION)
|
||||||
|
|
||||||
if result[0:3] != expected:
|
if result[0:3] != expected:
|
||||||
raise Exception("Unexpected configuration")
|
raise Exception("Unexpected configuration")
|
||||||
@ -444,25 +467,26 @@ class JerryDebugger(object):
|
|||||||
size -= bytes_send
|
size -= bytes_send
|
||||||
|
|
||||||
def send_breakpoint(self, breakpoint):
|
def send_breakpoint(self, breakpoint):
|
||||||
message = pack(self.byte_order + "BBIBB" + self.cp_format + self.idx_format,
|
message = struct.pack(self.byte_order + "BBIBB" + self.cp_format + self.idx_format,
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + 1 + 1 + self.cp_size + 4,
|
WEBSOCKET_FIN_BIT + 1 + 1 + self.cp_size + 4,
|
||||||
0,
|
0,
|
||||||
JERRY_DEBUGGER_UPDATE_BREAKPOINT,
|
JERRY_DEBUGGER_UPDATE_BREAKPOINT,
|
||||||
int(breakpoint.active_index >= 0),
|
int(breakpoint.active_index >= 0),
|
||||||
breakpoint.function.byte_code_cp,
|
breakpoint.function.byte_code_cp,
|
||||||
breakpoint.offset)
|
breakpoint.offset)
|
||||||
self.send_message(message)
|
self.send_message(message)
|
||||||
|
|
||||||
def send_command(self, command):
|
def send_command(self, command):
|
||||||
message = pack(self.byte_order + "BBIB",
|
message = struct.pack(self.byte_order + "BBIB",
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + 1,
|
WEBSOCKET_FIN_BIT + 1,
|
||||||
0,
|
0,
|
||||||
command)
|
command)
|
||||||
self.send_message(message)
|
self.send_message(message)
|
||||||
|
|
||||||
def get_message(self):
|
def get_message(self, blocking):
|
||||||
|
# Connection was closed
|
||||||
if self.message_data is None:
|
if self.message_data is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@ -480,7 +504,13 @@ class JerryDebugger(object):
|
|||||||
self.message_data = self.message_data[size + 2:]
|
self.message_data = self.message_data[size + 2:]
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
if not blocking:
|
||||||
|
select_result = select.select([self.client_socket], [], [], 0)[0]
|
||||||
|
if self.client_socket not in select_result:
|
||||||
|
return b''
|
||||||
|
|
||||||
data = self.client_socket.recv(MAX_BUFFER_SIZE)
|
data = self.client_socket.recv(MAX_BUFFER_SIZE)
|
||||||
|
|
||||||
if not data:
|
if not data:
|
||||||
self.message_data = None
|
self.message_data = None
|
||||||
return None
|
return None
|
||||||
@ -519,11 +549,11 @@ def parse_source(debugger, data):
|
|||||||
|
|
||||||
elif buffer_type == JERRY_DEBUGGER_PARSE_FUNCTION:
|
elif buffer_type == JERRY_DEBUGGER_PARSE_FUNCTION:
|
||||||
logging.debug("Source name: %s, function name: %s" % (source_code_name, function_name))
|
logging.debug("Source name: %s, function name: %s" % (source_code_name, function_name))
|
||||||
stack.append({ "source": source_code,
|
stack.append({"source": source_code,
|
||||||
"source_name": source_code_name,
|
"source_name": source_code_name,
|
||||||
"name": function_name,
|
"name": function_name,
|
||||||
"lines": [],
|
"lines": [],
|
||||||
"offsets": []})
|
"offsets": []})
|
||||||
function_name = ""
|
function_name = ""
|
||||||
|
|
||||||
elif buffer_type in [JERRY_DEBUGGER_BREAKPOINT_LIST, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST]:
|
elif buffer_type in [JERRY_DEBUGGER_BREAKPOINT_LIST, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST]:
|
||||||
@ -535,15 +565,15 @@ def parse_source(debugger, data):
|
|||||||
|
|
||||||
buffer_pos = 3
|
buffer_pos = 3
|
||||||
while buffer_size > 0:
|
while buffer_size > 0:
|
||||||
line = unpack(debugger.byte_order + debugger.idx_format,
|
line = struct.unpack(debugger.byte_order + debugger.idx_format,
|
||||||
data[buffer_pos: buffer_pos + 4])
|
data[buffer_pos: buffer_pos + 4])
|
||||||
stack[-1][name].append(line[0])
|
stack[-1][name].append(line[0])
|
||||||
buffer_pos += 4
|
buffer_pos += 4
|
||||||
buffer_size -= 4
|
buffer_size -= 4
|
||||||
|
|
||||||
elif buffer_type == JERRY_DEBUGGER_BYTE_CODE_CP:
|
elif buffer_type == JERRY_DEBUGGER_BYTE_CODE_CP:
|
||||||
byte_code_cp = unpack(debugger.byte_order + debugger.cp_format,
|
byte_code_cp = struct.unpack(debugger.byte_order + debugger.cp_format,
|
||||||
data[3: 3 + debugger.cp_size])[0]
|
data[3: 3 + debugger.cp_size])[0]
|
||||||
|
|
||||||
logging.debug("Byte code cptr received: {0x%x}" % (byte_code_cp))
|
logging.debug("Byte code cptr received: {0x%x}" % (byte_code_cp))
|
||||||
|
|
||||||
@ -571,7 +601,7 @@ def parse_source(debugger, data):
|
|||||||
logging.error("Parser error!")
|
logging.error("Parser error!")
|
||||||
return
|
return
|
||||||
|
|
||||||
data = debugger.get_message()
|
data = debugger.get_message(True)
|
||||||
|
|
||||||
# Copy the ready list to the global storage.
|
# Copy the ready list to the global storage.
|
||||||
debugger.function_list.update(new_function_list)
|
debugger.function_list.update(new_function_list)
|
||||||
@ -582,8 +612,8 @@ def parse_source(debugger, data):
|
|||||||
|
|
||||||
|
|
||||||
def release_function(debugger, data):
|
def release_function(debugger, data):
|
||||||
byte_code_cp = unpack(debugger.byte_order + debugger.cp_format,
|
byte_code_cp = struct.unpack(debugger.byte_order + debugger.cp_format,
|
||||||
data[3: 3 + debugger.cp_size])[0]
|
data[3: 3 + debugger.cp_size])[0]
|
||||||
|
|
||||||
function = debugger.function_list[byte_code_cp]
|
function = debugger.function_list[byte_code_cp]
|
||||||
|
|
||||||
@ -594,12 +624,12 @@ def release_function(debugger, data):
|
|||||||
|
|
||||||
del debugger.function_list[byte_code_cp]
|
del debugger.function_list[byte_code_cp]
|
||||||
|
|
||||||
message = pack(debugger.byte_order + "BBIB" + debugger.cp_format,
|
message = struct.pack(debugger.byte_order + "BBIB" + debugger.cp_format,
|
||||||
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
WEBSOCKET_BINARY_FRAME | WEBSOCKET_FIN_BIT,
|
||||||
WEBSOCKET_FIN_BIT + 1 + debugger.cp_size,
|
WEBSOCKET_FIN_BIT + 1 + debugger.cp_size,
|
||||||
0,
|
0,
|
||||||
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
JERRY_DEBUGGER_FREE_BYTE_CODE_CP,
|
||||||
byte_code_cp)
|
byte_code_cp)
|
||||||
|
|
||||||
debugger.send_message(message)
|
debugger.send_message(message)
|
||||||
|
|
||||||
@ -660,8 +690,16 @@ def main():
|
|||||||
prompt.prompt = "(jerry-debugger) "
|
prompt.prompt = "(jerry-debugger) "
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
|
if prompt.cont:
|
||||||
|
if sys.stdin in select.select([sys.stdin], [], [], 0)[0]:
|
||||||
|
sys.stdin.readline()
|
||||||
|
prompt.cont = False
|
||||||
|
debugger.send_command(JERRY_DEBUGGER_STOP)
|
||||||
|
|
||||||
data = debugger.get_message()
|
data = debugger.get_message(False)
|
||||||
|
|
||||||
|
if data == b'':
|
||||||
|
continue
|
||||||
|
|
||||||
if not data: # Break the while loop if there is no more data.
|
if not data: # Break the while loop if there is no more data.
|
||||||
break
|
break
|
||||||
@ -687,7 +725,7 @@ def main():
|
|||||||
release_function(debugger, data)
|
release_function(debugger, data)
|
||||||
|
|
||||||
elif buffer_type == JERRY_DEBUGGER_BREAKPOINT_HIT:
|
elif buffer_type == JERRY_DEBUGGER_BREAKPOINT_HIT:
|
||||||
breakpoint_data = unpack(debugger.byte_order + debugger.cp_format + debugger.idx_format, data[3:])
|
breakpoint_data = struct.unpack(debugger.byte_order + debugger.cp_format + debugger.idx_format, data[3:])
|
||||||
|
|
||||||
function = debugger.function_list[breakpoint_data[0]]
|
function = debugger.function_list[breakpoint_data[0]]
|
||||||
breakpoint = function.offsets[breakpoint_data[1]]
|
breakpoint = function.offsets[breakpoint_data[1]]
|
||||||
@ -701,6 +739,8 @@ def main():
|
|||||||
print("Stopped at%s %s" % (breakpoint_index, breakpoint.to_string()))
|
print("Stopped at%s %s" % (breakpoint_index, breakpoint.to_string()))
|
||||||
|
|
||||||
prompt.cmdloop()
|
prompt.cmdloop()
|
||||||
|
if prompt.quit:
|
||||||
|
break
|
||||||
|
|
||||||
elif buffer_type in [JERRY_DEBUGGER_BACKTRACE, JERRY_DEBUGGER_BACKTRACE_END]:
|
elif buffer_type in [JERRY_DEBUGGER_BACKTRACE, JERRY_DEBUGGER_BACKTRACE_END]:
|
||||||
frame_index = 0
|
frame_index = 0
|
||||||
@ -709,8 +749,8 @@ def main():
|
|||||||
|
|
||||||
buffer_pos = 3
|
buffer_pos = 3
|
||||||
while buffer_size > 0:
|
while buffer_size > 0:
|
||||||
breakpoint_data = unpack(debugger.byte_order + debugger.cp_format + debugger.idx_format,
|
breakpoint_data = struct.unpack(debugger.byte_order + debugger.cp_format + debugger.idx_format,
|
||||||
data[buffer_pos: buffer_pos + debugger.cp_size + 4])
|
data[buffer_pos: buffer_pos + debugger.cp_size + 4])
|
||||||
|
|
||||||
function = debugger.function_list[breakpoint_data[0]]
|
function = debugger.function_list[breakpoint_data[0]]
|
||||||
best_offset = -1
|
best_offset = -1
|
||||||
@ -734,7 +774,7 @@ def main():
|
|||||||
if buffer_type == JERRY_DEBUGGER_BACKTRACE_END:
|
if buffer_type == JERRY_DEBUGGER_BACKTRACE_END:
|
||||||
break
|
break
|
||||||
|
|
||||||
data = debugger.get_message()
|
data = debugger.get_message(True)
|
||||||
buffer_type = ord(data[2])
|
buffer_type = ord(data[2])
|
||||||
buffer_size = ord(data[1]) - 1
|
buffer_size = ord(data[1]) - 1
|
||||||
|
|
||||||
@ -758,7 +798,7 @@ def main():
|
|||||||
JERRY_DEBUGGER_EVAL_ERROR_END]:
|
JERRY_DEBUGGER_EVAL_ERROR_END]:
|
||||||
break
|
break
|
||||||
|
|
||||||
data = debugger.get_message()
|
data = debugger.get_message(True)
|
||||||
buffer_type = ord(data[2])
|
buffer_type = ord(data[2])
|
||||||
buffer_size = ord(data[1]) - 1
|
buffer_size = ord(data[1]) - 1
|
||||||
|
|
||||||
@ -790,7 +830,7 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if errno == 111:
|
if errno == 111:
|
||||||
sys.exit("Failed to connect to the JerryScript debugger.")
|
sys.exit("Failed to connect to the JerryScript debugger.")
|
||||||
elif errno == 32:
|
elif errno == 32 or errno == 104:
|
||||||
sys.exit("Connection closed.")
|
sys.exit("Connection closed.")
|
||||||
else:
|
else:
|
||||||
sys.exit("Failed to connect to the JerryScript debugger.\nError: %s" % (msg))
|
sys.exit("Failed to connect to the JerryScript debugger.\nError: %s" % (msg))
|
||||||
|
|||||||
@ -1,4 +1,9 @@
|
|||||||
b do_backtrace.js:32
|
next
|
||||||
c
|
n
|
||||||
|
next
|
||||||
|
step
|
||||||
|
next
|
||||||
|
n
|
||||||
|
s
|
||||||
bt
|
bt
|
||||||
c
|
c
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
Connecting to: localhost:5001
|
Connecting to: localhost:5001
|
||||||
Stopped at tests/debugger/do_backtrace.js:15
|
Stopped at tests/debugger/do_backtrace.js:15
|
||||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_backtrace.js:32 (in f4)
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:28
|
||||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_backtrace.js:32 (in f4)
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:37
|
||||||
(jerry-debugger) Frame 0: tests/debugger/do_backtrace.js:32 (in f4)
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:40
|
||||||
Frame 1: tests/debugger/do_backtrace.js:39 (in foo)
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:30 (in test)
|
||||||
Frame 2: tests/debugger/do_backtrace.js:48 (in test)
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:32 (in test)
|
||||||
Frame 3: tests/debugger/do_backtrace.js:60
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:33 (in test)
|
||||||
(jerry-debugger) Connection closed.
|
(jerry-debugger) Stopped at tests/debugger/do_backtrace.js:21 (in foo)
|
||||||
|
(jerry-debugger) Frame 0: tests/debugger/do_backtrace.js:21 (in foo)
|
||||||
|
Frame 1: tests/debugger/do_backtrace.js:33 (in test)
|
||||||
|
Frame 2: tests/debugger/do_backtrace.js:40
|
||||||
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
|
Connection closed.
|
||||||
|
|||||||
@ -12,21 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
print("first line of code");
|
print("backtrace-test");
|
||||||
|
|
||||||
function f1()
|
|
||||||
{
|
|
||||||
function f2()
|
|
||||||
{
|
|
||||||
return function f3() {
|
|
||||||
a = 4;
|
|
||||||
print("funciton f3");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
x =
|
|
||||||
6;
|
|
||||||
}
|
|
||||||
|
|
||||||
function f4() {
|
function f4() {
|
||||||
print("function f4");
|
print("function f4");
|
||||||
@ -39,18 +25,12 @@ function foo()
|
|||||||
f4();
|
f4();
|
||||||
}
|
}
|
||||||
|
|
||||||
print ("var cat");
|
|
||||||
var cat = 'cat';
|
var cat = 'cat';
|
||||||
|
|
||||||
function test()
|
function test()
|
||||||
{
|
{
|
||||||
print("function test");
|
print("function test");
|
||||||
foo();
|
foo();
|
||||||
var a = 3;
|
|
||||||
var b = 5;
|
|
||||||
var c = a + b;
|
|
||||||
global_var = c;
|
|
||||||
return c;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
break do_break.js:28
|
break do_break.js:24
|
||||||
|
b do_break.js:27
|
||||||
|
b do_break.js:17
|
||||||
list
|
list
|
||||||
b do_break.js:40
|
delete 2
|
||||||
delete 1
|
|
||||||
next
|
next
|
||||||
next
|
c
|
||||||
continue
|
|
||||||
|
|||||||
@ -1,8 +1,11 @@
|
|||||||
Connecting to: localhost:5001
|
Connecting to: localhost:5001
|
||||||
Stopped at tests/debugger/do_break.js:15
|
Stopped at tests/debugger/do_break.js:15
|
||||||
(jerry-debugger) Breakpoint not found
|
(jerry-debugger) Breakpoint 1 at tests/debugger/do_break.js:24 (in test)
|
||||||
(jerry-debugger) (jerry-debugger) Breakpoint not found
|
(jerry-debugger) Breakpoint 2 at tests/debugger/do_break.js:27 (in test)
|
||||||
(jerry-debugger) Error: Breakpoint 1 not found
|
(jerry-debugger) Breakpoint 3 at tests/debugger/do_break.js:17
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_break.js:42
|
(jerry-debugger) 1: tests/debugger/do_break.js:24 (in test)
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_break.js:43
|
2: tests/debugger/do_break.js:27 (in test)
|
||||||
(jerry-debugger) Connection closed.
|
3: tests/debugger/do_break.js:17
|
||||||
|
(jerry-debugger) (jerry-debugger) Stopped at breakpoint:3 tests/debugger/do_break.js:17
|
||||||
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
|
Connection closed.
|
||||||
|
|||||||
@ -12,32 +12,7 @@
|
|||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
|
|
||||||
print("first line of code");
|
print("break test");
|
||||||
|
|
||||||
function f1()
|
|
||||||
{
|
|
||||||
function f2()
|
|
||||||
{
|
|
||||||
return function f3() {
|
|
||||||
a = 4;
|
|
||||||
print("funciton f3");
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
x =
|
|
||||||
6;
|
|
||||||
}
|
|
||||||
|
|
||||||
function f4() {
|
|
||||||
print("function f4");
|
|
||||||
}
|
|
||||||
|
|
||||||
function foo()
|
|
||||||
{
|
|
||||||
print("function foo");
|
|
||||||
var tmp = 4;
|
|
||||||
f4();
|
|
||||||
}
|
|
||||||
|
|
||||||
print ("var cat");
|
print ("var cat");
|
||||||
var cat = 'cat';
|
var cat = 'cat';
|
||||||
@ -56,5 +31,3 @@ function test()
|
|||||||
var
|
var
|
||||||
x =
|
x =
|
||||||
1;
|
1;
|
||||||
|
|
||||||
test();
|
|
||||||
|
|||||||
7
tests/debugger/do_delete_all.cmd
Normal file
7
tests/debugger/do_delete_all.cmd
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
break do_delete_all.js:17
|
||||||
|
b do_delete_all.js:18
|
||||||
|
b do_delete_all.js:21
|
||||||
|
list
|
||||||
|
delete all
|
||||||
|
next
|
||||||
|
c
|
||||||
11
tests/debugger/do_delete_all.expected
Normal file
11
tests/debugger/do_delete_all.expected
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Connecting to: localhost:5001
|
||||||
|
Stopped at tests/debugger/do_delete_all.js:15
|
||||||
|
(jerry-debugger) Breakpoint 1 at tests/debugger/do_delete_all.js:17
|
||||||
|
(jerry-debugger) Breakpoint 2 at tests/debugger/do_delete_all.js:18
|
||||||
|
(jerry-debugger) Breakpoint 3 at tests/debugger/do_delete_all.js:21 (in delete_test)
|
||||||
|
(jerry-debugger) 1: tests/debugger/do_delete_all.js:17
|
||||||
|
2: tests/debugger/do_delete_all.js:18
|
||||||
|
3: tests/debugger/do_delete_all.js:21 (in delete_test)
|
||||||
|
(jerry-debugger) (jerry-debugger) Stopped at tests/debugger/do_delete_all.js:16
|
||||||
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
|
Connection closed.
|
||||||
22
tests/debugger/do_delete_all.js
Normal file
22
tests/debugger/do_delete_all.js
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// Copyright JS Foundation and other contributors, http://js.foundation
|
||||||
|
//
|
||||||
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
// you may not use this file except in compliance with the License.
|
||||||
|
// You may obtain a copy of the License at
|
||||||
|
//
|
||||||
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
//
|
||||||
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
|
// distributed under the License is distributed on an "AS IS" BASIS
|
||||||
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
// See the License for the specific language governing permissions and
|
||||||
|
// limitations under the License.
|
||||||
|
|
||||||
|
var str = "Delete all breakpoints";
|
||||||
|
var patt = new RegExp("e");
|
||||||
|
var res = patt.test(str);
|
||||||
|
var pi = Math.PI;
|
||||||
|
|
||||||
|
function delete_test(x,y) {
|
||||||
|
var sum = x + y;
|
||||||
|
}
|
||||||
@ -1,2 +1,3 @@
|
|||||||
|
step
|
||||||
dump
|
dump
|
||||||
c
|
c
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
Connecting to: localhost:5001
|
Connecting to: localhost:5001
|
||||||
Stopped at tests/debugger/do_dump.js:15
|
Stopped at tests/debugger/do_dump.js:15
|
||||||
|
(jerry-debugger) Stopped at tests/debugger/do_dump.js:42
|
||||||
(jerry-debugger) {68: Function(byte_code_cp:0x44, source_name:"tests/debugger/do_dump.js", name:"f4", { Breakpoint(line:32, offset:17, active_index:-1),Breakpoint(line:31, offset:16, active_index:-1) }),
|
(jerry-debugger) {68: Function(byte_code_cp:0x44, source_name:"tests/debugger/do_dump.js", name:"f4", { Breakpoint(line:32, offset:17, active_index:-1),Breakpoint(line:31, offset:16, active_index:-1) }),
|
||||||
79: Function(byte_code_cp:0x4f, source_name:"tests/debugger/do_dump.js", name:"f1", { Breakpoint(line:17, offset:21, active_index:-1),Breakpoint(line:27, offset:22, active_index:-1) }),
|
79: Function(byte_code_cp:0x4f, source_name:"tests/debugger/do_dump.js", name:"f1", { Breakpoint(line:17, offset:21, active_index:-1),Breakpoint(line:27, offset:22, active_index:-1) }),
|
||||||
102: Function(byte_code_cp:0x66, source_name:"tests/debugger/do_dump.js", name:"f2", { Breakpoint(line:19, offset:14, active_index:-1),Breakpoint(line:21, offset:15, active_index:-1) }),
|
102: Function(byte_code_cp:0x66, source_name:"tests/debugger/do_dump.js", name:"f2", { Breakpoint(line:19, offset:14, active_index:-1),Breakpoint(line:21, offset:15, active_index:-1) }),
|
||||||
@ -7,4 +8,5 @@ Stopped at tests/debugger/do_dump.js:15
|
|||||||
125: Function(byte_code_cp:0x7d, source_name:"tests/debugger/do_dump.js", name:"f3", { Breakpoint(line:22, offset:25, active_index:-1),Breakpoint(line:23, offset:30, active_index:-1) }),
|
125: Function(byte_code_cp:0x7d, source_name:"tests/debugger/do_dump.js", name:"f3", { Breakpoint(line:22, offset:25, active_index:-1),Breakpoint(line:23, offset:30, active_index:-1) }),
|
||||||
131: Function(byte_code_cp:0x83, source_name:"tests/debugger/do_dump.js", name:"", { Breakpoint(line:57, offset:63, active_index:-1),Breakpoint(line:42, offset:54, active_index:-1),Breakpoint(line:43, offset:59, active_index:-1),Breakpoint(line:60, offset:68, active_index:-1),Breakpoint(line:15, offset:49, active_index:-1) }),
|
131: Function(byte_code_cp:0x83, source_name:"tests/debugger/do_dump.js", name:"", { Breakpoint(line:57, offset:63, active_index:-1),Breakpoint(line:42, offset:54, active_index:-1),Breakpoint(line:43, offset:59, active_index:-1),Breakpoint(line:60, offset:68, active_index:-1),Breakpoint(line:15, offset:49, active_index:-1) }),
|
||||||
154: Function(byte_code_cp:0x9a, source_name:"tests/debugger/do_dump.js", name:"test", { Breakpoint(line:45, offset:28, active_index:-1),Breakpoint(line:47, offset:29, active_index:-1),Breakpoint(line:48, offset:34, active_index:-1),Breakpoint(line:49, offset:38, active_index:-1),Breakpoint(line:50, offset:43, active_index:-1),Breakpoint(line:51, offset:48, active_index:-1),Breakpoint(line:52, offset:54, active_index:-1),Breakpoint(line:53, offset:58, active_index:-1) })}
|
154: Function(byte_code_cp:0x9a, source_name:"tests/debugger/do_dump.js", name:"test", { Breakpoint(line:45, offset:28, active_index:-1),Breakpoint(line:47, offset:29, active_index:-1),Breakpoint(line:48, offset:34, active_index:-1),Breakpoint(line:49, offset:38, active_index:-1),Breakpoint(line:50, offset:43, active_index:-1),Breakpoint(line:51, offset:48, active_index:-1),Breakpoint(line:52, offset:54, active_index:-1),Breakpoint(line:53, offset:58, active_index:-1) })}
|
||||||
(jerry-debugger) Connection closed.
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
|
Connection closed.
|
||||||
|
|||||||
@ -2,11 +2,10 @@ e a
|
|||||||
n
|
n
|
||||||
eval a
|
eval a
|
||||||
break f
|
break f
|
||||||
c
|
|
||||||
e a
|
|
||||||
n
|
n
|
||||||
e b
|
e b
|
||||||
n
|
next
|
||||||
e b
|
e b
|
||||||
e "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ " + 123
|
e "1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ " + 123
|
||||||
|
next
|
||||||
c
|
c
|
||||||
|
|||||||
@ -5,10 +5,10 @@ Stopped at tests/debugger/do_eval.js:15
|
|||||||
(jerry-debugger) 5
|
(jerry-debugger) 5
|
||||||
(jerry-debugger) Breakpoint 1 at tests/debugger/do_eval.js:17 (in f)
|
(jerry-debugger) Breakpoint 1 at tests/debugger/do_eval.js:17 (in f)
|
||||||
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_eval.js:17 (in f)
|
(jerry-debugger) Stopped at breakpoint:1 tests/debugger/do_eval.js:17 (in f)
|
||||||
(jerry-debugger) 3.3
|
(jerry-debugger) undefined
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:19 (in f)
|
(jerry-debugger) Stopped at tests/debugger/do_eval.js:19 (in f)
|
||||||
(jerry-debugger) undefined
|
(jerry-debugger) undefined
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_eval.js:20 (in f)
|
|
||||||
(jerry-debugger) 6
|
|
||||||
(jerry-debugger) 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ 123
|
(jerry-debugger) 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 XXX 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 YYY 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 1234567890 ZZZ 123
|
||||||
(jerry-debugger) Connection closed.
|
(jerry-debugger) Stopped at tests/debugger/do_eval.js:20 (in f)
|
||||||
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
|
Connection closed.
|
||||||
|
|||||||
@ -1,13 +1,10 @@
|
|||||||
b f
|
b f
|
||||||
n
|
n
|
||||||
n
|
next
|
||||||
n
|
n
|
||||||
s
|
s
|
||||||
src
|
src
|
||||||
n
|
n
|
||||||
b f
|
step
|
||||||
c
|
|
||||||
src
|
|
||||||
c
|
|
||||||
src
|
src
|
||||||
c
|
c
|
||||||
|
|||||||
@ -8,12 +8,8 @@ Stopped at tests/debugger/do_src.js:19
|
|||||||
(jerry-debugger) f = function f() {
|
(jerry-debugger) f = function f() {
|
||||||
print('F2') }
|
print('F2') }
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_src.js:21
|
(jerry-debugger) Stopped at tests/debugger/do_src.js:21
|
||||||
(jerry-debugger) Breakpoint 2 at <unknown>:2 (in f)
|
(jerry-debugger) Stopped at <unknown>:2 (in f)
|
||||||
Breakpoint 1 at tests/debugger/do_src.js:15 (in f)
|
|
||||||
(jerry-debugger) Stopped at breakpoint:2 <unknown>:2 (in f)
|
|
||||||
(jerry-debugger) f = function f() {
|
(jerry-debugger) f = function f() {
|
||||||
print('F2') }
|
print('F2') }
|
||||||
(jerry-debugger) Stopped at breakpoint:2 <unknown>:2 (in f)
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
(jerry-debugger) f = function f() {
|
Connection closed.
|
||||||
print('F2') }
|
|
||||||
(jerry-debugger) Connection closed.
|
|
||||||
|
|||||||
@ -2,7 +2,7 @@ break do_step.js:25
|
|||||||
step
|
step
|
||||||
backtrace
|
backtrace
|
||||||
b do_step.js:26
|
b do_step.js:26
|
||||||
c
|
next
|
||||||
s
|
next
|
||||||
bt
|
bt
|
||||||
c
|
c
|
||||||
|
|||||||
@ -5,8 +5,8 @@ Stopped at tests/debugger/do_step.js:25
|
|||||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:15 (in f1)
|
(jerry-debugger) Frame 0: tests/debugger/do_step.js:15 (in f1)
|
||||||
Frame 1: tests/debugger/do_step.js:25
|
Frame 1: tests/debugger/do_step.js:25
|
||||||
(jerry-debugger) Breakpoint 2 at tests/debugger/do_step.js:26
|
(jerry-debugger) Breakpoint 2 at tests/debugger/do_step.js:26
|
||||||
|
(jerry-debugger) Stopped at tests/debugger/do_step.js:17 (in f1)
|
||||||
(jerry-debugger) Stopped at breakpoint:2 tests/debugger/do_step.js:26
|
(jerry-debugger) Stopped at breakpoint:2 tests/debugger/do_step.js:26
|
||||||
(jerry-debugger) Stopped at tests/debugger/do_step.js:20 (in f2)
|
(jerry-debugger) Frame 0: tests/debugger/do_step.js:26
|
||||||
(jerry-debugger) Frame 0: tests/debugger/do_step.js:20 (in f2)
|
(jerry-debugger) Press enter to stop JavaScript execution.
|
||||||
Frame 1: tests/debugger/do_step.js:26
|
Connection closed.
|
||||||
(jerry-debugger) Connection closed.
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user