Vim::Debug::Protocol - Everything needed for the VimDebug network protocol
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 );
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.
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.
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
To disconnect send a 'quit' message.
'quit' . $EOM
The server will respond with:
$DISCONNECT . $EOR . $EOR . $EOR . $EOR . $EOM
And then exit.
ClientConnected ---> Stop | ClientInput ----------> Start | | | | __ v v v | Translate --> Write --> Read | | ^ | | | | |_____| |__| | v Out
These values all indicate the current state of the debugger.
Returns formatted string that is used to reply to a client who just connected to Vim::Debug::Daemon.
Returns formatted string that is used to tell a client to disconnect from Vim::Debug::Daemon.
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.
This method needs to be called after send a message to Vim. It creates a file.
Eric Johnson, cpan at iijo :dot: org
Copyright (C) 2003 - 3090, Eric Johnson
This module has the same license as Perl.
Eric Johnson <vimdebug at iijo dot org>
This software is copyright (c) 2011 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.