Reworking jerry_debugger_send_string method
From now on, jerry_debugger_send_string can send a subtype of the string, making it more simple to send over strings with special parameters, therefore seperating different types of messages are simpler. Enumerations for various subtypes can be made, while there's only need to have 2 entries for the header type. JerryScript-DCO-1.0-Signed-off-by: Daniel Balla dballa@inf.u-szeged.hu
This commit is contained in:
@@ -35,6 +35,7 @@ textarea {
|
||||
<div>
|
||||
</div>
|
||||
<script>
|
||||
// Messages sent by the server to client.
|
||||
var JERRY_DEBUGGER_CONFIGURATION = 1;
|
||||
var JERRY_DEBUGGER_PARSE_ERROR = 2;
|
||||
var JERRY_DEBUGGER_BYTE_CODE_CP = 3;
|
||||
@@ -57,9 +58,12 @@ var JERRY_DEBUGGER_BACKTRACE = 19;
|
||||
var JERRY_DEBUGGER_BACKTRACE_END = 20;
|
||||
var JERRY_DEBUGGER_EVAL_RESULT = 21;
|
||||
var JERRY_DEBUGGER_EVAL_RESULT_END = 22;
|
||||
var JERRY_DEBUGGER_EVAL_ERROR = 23;
|
||||
var JERRY_DEBUGGER_EVAL_ERROR_END = 24;
|
||||
|
||||
// Subtypes of eval
|
||||
var JERRY_DEBUGGER_EVAL_OK = 1;
|
||||
var JERRY_DEBUGGER_EVAL_ERROR = 2;
|
||||
|
||||
// Messages sent by the client to server.
|
||||
var JERRY_DEBUGGER_FREE_BYTE_CODE_CP = 1;
|
||||
var JERRY_DEBUGGER_UPDATE_BREAKPOINT = 2;
|
||||
var JERRY_DEBUGGER_EXCEPTION_CONFIG = 3;
|
||||
@@ -855,7 +859,7 @@ function DebuggerClient(address)
|
||||
+ (breakpoint.at ? "at " : "around ")
|
||||
+ breakpointInfo
|
||||
+ breakpointToString(breakpoint));
|
||||
|
||||
|
||||
if (debuggerObj.display)
|
||||
{
|
||||
debuggerObj.printSource(debuggerObj.display);
|
||||
@@ -896,19 +900,18 @@ function DebuggerClient(address)
|
||||
|
||||
case JERRY_DEBUGGER_EVAL_RESULT:
|
||||
case JERRY_DEBUGGER_EVAL_RESULT_END:
|
||||
case JERRY_DEBUGGER_EVAL_ERROR:
|
||||
case JERRY_DEBUGGER_EVAL_ERROR_END:
|
||||
{
|
||||
evalResult = concatUint8Arrays(evalResult, message);
|
||||
|
||||
if (message[0] == JERRY_DEBUGGER_EVAL_RESULT_END)
|
||||
var subType = evalResult[evalResult.length - 1];
|
||||
evalResult = evalResult.slice(0, -1);
|
||||
if (subType == JERRY_DEBUGGER_EVAL_OK)
|
||||
{
|
||||
appendLog(cesu8ToString(evalResult));
|
||||
evalResult = null;
|
||||
return;
|
||||
}
|
||||
|
||||
if (message[0] == JERRY_DEBUGGER_EVAL_ERROR_END)
|
||||
if (subType == JERRY_DEBUGGER_EVAL_ERROR)
|
||||
{
|
||||
appendLog("Uncaught exception: " + cesu8ToString(evalResult));
|
||||
evalResult = null;
|
||||
|
||||
@@ -48,8 +48,10 @@ JERRY_DEBUGGER_BACKTRACE = 19
|
||||
JERRY_DEBUGGER_BACKTRACE_END = 20
|
||||
JERRY_DEBUGGER_EVAL_RESULT = 21
|
||||
JERRY_DEBUGGER_EVAL_RESULT_END = 22
|
||||
JERRY_DEBUGGER_EVAL_ERROR = 23
|
||||
JERRY_DEBUGGER_EVAL_ERROR_END = 24
|
||||
|
||||
# Subtypes of eval
|
||||
JERRY_DEBUGGER_EVAL_OK = 1
|
||||
JERRY_DEBUGGER_EVAL_ERROR = 2
|
||||
|
||||
|
||||
# Messages sent by the client to server.
|
||||
@@ -1064,17 +1066,16 @@ def main():
|
||||
prompt.cmdloop()
|
||||
|
||||
elif buffer_type in [JERRY_DEBUGGER_EVAL_RESULT,
|
||||
JERRY_DEBUGGER_EVAL_RESULT_END,
|
||||
JERRY_DEBUGGER_EVAL_ERROR,
|
||||
JERRY_DEBUGGER_EVAL_ERROR_END]:
|
||||
JERRY_DEBUGGER_EVAL_RESULT_END]:
|
||||
|
||||
message = b""
|
||||
eval_type = buffer_type
|
||||
while True:
|
||||
message += data[3:]
|
||||
|
||||
if buffer_type in [JERRY_DEBUGGER_EVAL_RESULT_END,
|
||||
JERRY_DEBUGGER_EVAL_ERROR_END]:
|
||||
if buffer_type == JERRY_DEBUGGER_EVAL_RESULT_END:
|
||||
subtype = ord(message[-1])
|
||||
message = message[:-1]
|
||||
break
|
||||
|
||||
data = debugger.get_message(True)
|
||||
@@ -1085,7 +1086,7 @@ def main():
|
||||
eval_type + 1]:
|
||||
raise Exception("Eval result expected")
|
||||
|
||||
if buffer_type == JERRY_DEBUGGER_EVAL_ERROR_END:
|
||||
if subtype == JERRY_DEBUGGER_EVAL_ERROR:
|
||||
print("Uncaught exception: %s" % (message))
|
||||
else:
|
||||
print(message)
|
||||
|
||||
Reference in New Issue
Block a user