NAME
Vim::Debug::Protocol - Everything needed for the VimDebug network protocol
SYNOPSIS
package Vim::Debug::Protocol;
# respond to a client that just connected
my $connect = Vim::Debug::Protocol->connect($sessionId);
# tell the client to disconnect
my $disconnect = Vim::Debug::Protocol->disconnect;
# respond to a client command with the current debugger state
my $dbgr = Vim::Debug->new( language => 'Perl', invoke => 'cmd')->start;
my $response = Vim::Debug::Protocol->respond( $dbgr->status );
DESCRIPTION
If you are new to Vim::Debug please read the user manual, Vim::Debug::Manual, first.
This module implements the network protocol between Vim and the Vim::Debug::Daemon. It worries about end of field and end of message strings and all that sort of formatting.
FUNCTIONS
connect($sessionId)
Returns formatted string that is used to reply to a client who just connected to Vim::Debug::Daemon.
disconnect()
Returns formatted string that is used to tell a client to disconnect from Vim::Debug::Daemon.
response()
Any of the class attributes can be passed to this method.
Returns formatted string that is used to tell respond to a client that is talking to the Vim::Debug::Daemon.
touch()
This method needs to be called after send a message to Vim. It creates a file.
COMMUNICATION PROTOCOL
All messages passed between the client (vim) and the daemon (vdd) consist of a set of fields followed by an End Of Message string. Each field is seperated from the next by an End Of Record string.
All messages to the client have the following format:
Debugger status
End Of Record
Line Number
End Of Record
File Name
End Of Record
Value
End Of Record
Debugger output
End Of Message
All messages to the server have the following format:
Action (eg step, next, break, ...)
End Of Record
Parameter 1
End Of Record
Parameter 2
End Of Record
..
Parameter n
End Of Message
After every message, the daemon also touches a file. Which is kind of crazy and should be fixed but is currently necessary because the vimscript is doing nonblocking reads on the sockets.
Connecting
When you connect to the Vim::Debug Daemon (vdd), it will send you a message that looks like this:
$CONNECT . $EOR . $EOR . $EOR . $SESSION_ID . $EOR . $EOM
You should respond with a message that looks like
'create' . $EOR . $SESSION_ID . $EOR . $LANGUAGE $EOR $DBGR_COMMAND $EOM
Disconnecting
To disconnect send a 'quit' message.
'quit' . $EOM
The server will respond with:
$DISCONNECT . $EOR . $EOR . $EOR . $EOR . $EOM
And then exit.
POE STATE DIAGRAM
ClientConnected
---> Stop
|
ClientInput ----------> Start
| |
| | __
v v v |
Translate --> Write --> Read |
| ^ | | |
| |_____| |__|
|
v
Out
Attributes
These values all indicate the current state of the debugger.
line()
file()
status()
value()
output()
SEE ALSO
AUTHOR
Eric Johnson <kablamo at iijo dot nospamthanks dot org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Eric Johnson.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.