SDAPI Evaluating Expressions 2.0

The Script Debugger API (SDAPI) enables you to interact with halted script threads. When a script thread is halted, you can evaluate an expression in the context of a script thread and call stack frame.

To evaluate expressions, you use the eval action and you specify a thread identifier and call stack frame index. You must also use the expr query parameter with the expression to evaluate.

In the vast majority of cases, you do not want to interact with a “running” script thread, because there is no guarantee that the thread will be alive when your request is processed.

Example 1: Evaluating an expression that is a function call


REQUEST:
GET /s/-/dw/debugger/v1_0/threads/1/frames/0/eval?expr=test%28%29

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "expression":"test()",
  "result":"this is a test"
}
   

Example 2: Evaluating an expression that returns boolean


REQUEST:
GET /s/-/dw/debugger/v1_0/threads/1/frames/0/eval?expr=fName+%3D%3D+%27Larry%27

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "expression":"fName == 'Larry'",
  "result":"true"
}
   

Example 3: Evaluating an expression that returns undefined


REQUEST:
GET /s/-/dw/debugger/v1_0/threads/1/frames/0/eval?expr=fName+%3D%3D+%27Larry%27

RESPONSE:
HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
{
  "_v":"2.0",
  "expression":"fName == 'Larry'",
  "result":"\"fName\" is not defined."
}