Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug: Bad call to watch_expression() in SocketHandler.execute() #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

michaelhogg
Copy link

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.

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.
@mike-code
Copy link

Hi. Is your fix in any way related to this issue? #155

@michaelhogg
Copy link
Author

@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.

Copy link

@mrphang mrphang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@ryanpcmcquen
Copy link

I've merged your fixes into my fork:
https://github.com/ryanpcmcquen/SublimeTextXdebugPlus

Which I am attempting to get into Package Control:
wbond/package_control_channel#7658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants