Aptana Debugger Protocol

From Aptana Development

Contents

Aptana Debugger Protocol Specification

Request packet format:

length*request_id*command*arg0*arg1*arg2*...argN

Reply packet format:

length*request_id*arg0*arg1*arg2*...argN

Unsolicited message format:

length*message*arg0*arg1*arg2*...argN

where:

length 
integer value of the remaining part of a packet
request_id 
any string identifying request/response
command 
request command name
message 
unsolicited message name
arg0..N 
command/response specific arguments

An argument could be splitted into sub-arguments:

arg=subarg0|subarg1|subarg2|...subargN

Arguments encoding

Commands

Get debugger extension version

Command: version
Request arguments: none
Reply arguments:

arg0 
debugger protocol version (current is 1)
arg1 
debugger extension/addon version

Example:

=> 1176979825719*version
<= 1176979825719*1*0.2.8.14083


Force debugger extension update

Command: update
Request arguments: none
Reply arguments:

arg0 
(optional) version of updated debugger extension/addon (if available)

Example:

=> 1176979825720*update
<= 1176979825720*0.2.8.15000


Set debugger options

Command: option
Request arguments:

arg0 
name of an option
arg1 
new value of an option

Reply arguments: none
Example:

=> 1176979825721*option*suspendOnFirstLine*false
<= 1176979825721


Turn on debug mode

Command: enable
Request arguments: none
Reply arguments: none
Example:

=> 1176979825726*enable
<= 1176979825726


Turn off debug mode

Command: disable
Request arguments: none
Reply arguments: none
Example:

=> 1176979825727*disable
<= 1176979825727


Terminate session

Command: terminate
Request arguments: none
Reply arguments: none
Example:

=> 1176979825820*terminate
<= 1176979825820


Create/modify/remove breakpoint

Command: breakpoint
Request arguments:

arg0 
name of an action (allowed actions: create, change, remove)
arg1 
URL of a file
arg2 
line number
arg3 
breakpoint state (1 - enabled, 0 - disabled)
arg4 
hit count (no hit count if value is less or equal to 0)
arg5 
condition expression string (no condition if empty)
arg6 
condition meaning (1 - on true, 0 - on expression value change)

Reply arguments:

arg0 
action result status (created, changed, removed)

Example:

=> 1176979825728*breakpoint*create*http://127.0.0.1:8000/debug_tests.html*116*1*0**1
<= 1176979825728*created

=> 1176979825729*breakpoint*remove*http://127.0.0.1:8000/debug_tests.html*116
<= 1176979825729*removed


Create/modify/remove exception breakpoints

Command: exception
Request arguments:

arg0 
name of an action (allowed actions: create, change, remove)
arg1 
exception type name

Reply arguments:

arg0 
action result status (created, changed, removed)

Example:

=> 1176979825729*exception*create*TypeError
<= 1176979825729*created


Set detail formatters

Command: detailFormatters
Request arguments:

arg0..argN 
detail formatters 0-N
subarg0 
type name
subarg1 
formatter expression text

Reply arguments: none
Example:

=> 1176979825730*detailFormatters*Date|this.toGMTString();
<= 1176979825730


Open page URL

Command: openURL
Request arguments:

arg0 
page URl to open

Reply arguments: none
Example:

=> 1176979825729*openUrl*http://127.0.0.1:8000/debug_tests.html
<= 1176979825729


Get file sources

Command: getSource
Request arguments:

arg0 
file URl to retrieve sources

Reply arguments:

arg0 
command status (success, failure)
arg1 
file contents

Example:

=> 1176979825730*getSource*http://127.0.0.1:8000/debug_tests.html
<= 1176979825730*success*<html><body></body></html>


Suspend script execution

Command: suspend
Request arguments: none
Reply arguments: none
Example:

=> 1176979825731*suspend
<= 1176979825731


Resume script execution

Command: resume
Request arguments: none
Reply arguments: none
Example:

=> 1176979825732*resume
<= 1176979825732


Step into

Command: stepInto
Request arguments: none
Reply arguments: none
Example:

=> 1176979825733*stepInto
<= 1176979825733


Step over

Command: stepOver
Request arguments: none
Reply arguments: none
Example:

=> 1176979825734*stepOver
<= 1176979825734


Step return

Command: stepReturn
Request arguments: none
Reply arguments: none
Example:

=> 1176979825735*stepReturn
<= 1176979825735


Step to frame

Command: stepToFrame
Request arguments:

arg0 
frame id to step to

Reply arguments: none
Example:

=> 1176979825736*stepToFrame*2
<= 1176979825736


Get stack frames

Command: frames
Request arguments: none
Reply arguments:

arg0..argN 
frames 0-N
subarg0 
frame id
subarg1 
frame/function name
subarg2 
function arguments separated by ", "
subarg3 
file URL
subarg4 
line number
subarg5 
function native flag (temporary unused)
subarg6 
engine's internal frame PC (if available)
subarg7 
function's script id

Example:

=> 1176979825740*frames
<= 1176979825740*0|testVariables||http://127.0.0.1:8000/debug_tests.html|166|false|226|238*1|onclick|MouseEvent|http://127.0.0.1:8000/debug_tests.html|1|false|4|261


Get variables

Command: variables
Request arguments:

arg0 
variable name

Reply arguments:

arg0..argN 
variable properties 0-N
subarg0 
property name
subarg1 
property type
subarg2 
property flags (see #Variable property flags)
subarg3 
property value

Example:

=> 1176979825731*variables*frame[0]
<= 1176979825731*this|Window|o|[object Window]*vArray|Array|lowpv|item0,,,itemN*vBool|Boolean|lwpv|false*vDate|Date|lwpv|Thu Apr 19 2007 17:50:33 GMT+0700*vError|Error|lowpv|Error*vMyObj|MyObject|lowpv|[object Object]*vNum|Number|lwpv|7*vObj|Object|lowpv|[object Object]*vObj2|Object|lowpv|Object toString() method is used here*vRect|Shape|lowpv|[object Object]*vStr|String|lwpv|"Hello, World!"

=> 1176979825733*variables*eval[0]
<= 1176979825733*height|integer|wn|1*type|String|wn|"rect"*width|integer|wn|1*x|integer|wn|0*y|integer|wn|0


Get variable details

Command: details
Request arguments:

arg0 
variable name

Reply arguments:

arg0 
command status (result)
arg1 
detailed value

Example:

=> 1176979825734*details*frame[0].vRect
<= 1176979825734*result*Shape|ow|[object Object]


Evaluate expression

Command: eval
Request arguments:

arg0 
evaluation context (variable name)
arg1 
expression

Reply arguments:

arg0 
command status (result, exception)
arg1 
evaluation id or exception text
arg2 
evaluation result
subarg0 
property type
subarg1 
property flags (see #Variable property flags)
subarg2 
property value

Example:

=> 1176979825732*eval*frame[0]*vRect
<= 1176979825732*result*0*Shape|ow|[object Object]
or
<= 1176979825732*exception*Undefined variable


Change variable value

Command: setValue
Request arguments:

arg0 
variable name
arg1 
value reference name

Reply arguments:

arg0 
command status (result, exception)
arg1 
value property or exception text
subarg0 
property type
subarg1 
property flags (see #Variable property flags)
subarg2 
property value

Example:

=> 1176979825735*setValue*frame[0].vRect2*eval[1]
<= 1176979825735*result*String|w|Hello!


Unsolicited messages

Suspend notification

Message: suspended
Message arguments:

arg0 
suspend reason (breakpoint, keyword, requested, exception, firstLine or any of stepping command names)
arg1 
top frame's file URL
arg2 
top frame's line number

Example:

<= suspended*keyword*http://127.0.0.1:8000/debug_tests.html*166
<= suspended*stepInto*http://127.0.0.1:8000/debug_tests.html*167


Resume notification

Message: resumed
Message arguments:

arg0 
resume reason (started, abort or any of stepping command names)

Example:

<= resumed*start
<= resumed*stepInto
<= resumed*resume


Log console message

Message: log
Message arguments:

arg0 
log type (out, warn, err)
arg1 
message text
arg2 
(optional) source context (src, trace)

src:

arg3 
file URL
arg4 
line number

trace:

arg3..argN 
trace frame descriptions 3-N
subarg0 
frame/function name
subarg1 
function arguments separated by ", "
subarg2 
file URL
subarg3 
line number

Example:

<= log*out*Start message
<= log*out*src*http://127.0.0.1:8000/debug_tests.html*170
<= log*out*trace*testVariables||http://127.0.0.1:8000/debug_tests.html|166*onclick|MouseEvent|http://127.0.0.1:8000/debug_tests.html|1


Scripts notification

Message: scripts
Message arguments:

arg0 
action (created, resolved)
arg1..argN 
scripts definitions 1-N

created:

subarg0 
script id
subarg1 
file URL
subarg2 
function name
subarg3 
base script line number
subarg4 
script line count

resolved:

subarg0 
script id
subarg1 
function name

Example:

<= scripts*created*225|http://127.0.0.1:8000/debug_tests.html|testStepping|26|8
<= scripts*created*234|http://127.0.0.1:8000/debug_tests.html|anonymous|137|1
<= scripts*resolved*234|toString*240|myFunc0*241|myFunc1*242|myFunc2*252|onreadystatechange


Appendix

Variable property flags

writable
constant
enumeratable
permanent
function argument
variable
local/scope variable
exception
error
object/composite value