SublimeTextXdebug
SublimeTextXdebug copied to clipboard
Fix bug: Bad call to watch_expression() in SocketHandler.execute()
A command (such as run) is sent to the debugger engine on line 197:
S.SESSION.send(command)
The engine could respond with status="stopping". From the DBGP docs:
This 'stopping' state is entered after all execution is complete. For most debugger engine implementations, only a 'stop' command can be accepted at this point
watch_expression() sends an eval command to the engine for each watch expression. If the engine's state is stopping, then it'll probably respond to the eval commands with:
error code 5: command is not available
So it's wrong to call watch_expression() here without checking the engine's state.
watch_expression() should only be called if the engine's state is break, and in fact the code does this on line 249.
Hi. Is your fix in any way related to this issue? https://github.com/martomo/SublimeTextXdebug/issues/155
@Mike-NetCode: It looks like it could be related.
Looking at @hollusion's Xdebug log in that issue:
<- step_out -i 14
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="step_out"
transaction_id="14"
status="stopping"
reason="ok">
</response>
<- eval -i 15 -- JHJ1bGVz
-> <response xmlns="urn:debugger_protocol_v1"
xmlns:xdebug="http://xdebug.org/dbgp/xdebug"
command="eval"
transaction_id="15">
<error code="5">
<message>
<![CDATA[
command is not available
]]>
</message>
</error>
</response>
The engine responded to transaction 14 with status="stopping".
An eval command was then sent in transaction 15 with data "$rules" (Base64-encoded as "JHJ1bGVz") which looks like a request to evaluate a watch expression. Since the engine had stopped, it responded with error code 5: command is not available.
I've merged your fixes into my fork: https://github.com/ryanpcmcquen/SublimeTextXdebugPlus
Which I am attempting to get into Package Control: https://github.com/wbond/package_control_channel/pull/7658