Gvim interface to the ruby debugger?


(Gray, Jeff) #1

Since this thread made the Ruby Weekly News wrap-up, I feel obliged to
follow-up… :^)

Can you talk to an open pair of pipes from Vim? I didn’t think you
could keep a live connection to another process in Vim in this way,
hence my convoluted socket-based architecture.

No, named pipes (a/k/a fifo). To run a debugger command (perhaps
step):

Ahh, those named pipes. ;^) So I did a little more digging, plugging
a few holes in my own knowledge of nitty-gritty I/O in the process. Best
I can see, named pipes would limit the solution to Unix-esque platforms.
‘mkfifo’ under my Cygwin installation returns a "Function not implemented"
error – I take this to mean that it’s simply not supported in Windows.

The catch is that you can’t do “normal” file operations in VimL. You
can read a whole file, of course, and you can write or read to pipes
or files.

I did find a Gvim gdb interface on vim.sourceforge.net; it builds the
fifo rd/wr operations into a C lib which is called from Vim. Again,
I would like to keep the solution entirely in Ruby/VimL source. See
http://vim.sourceforge.net/scripts/script.php?script_id=168.

  • jeff

(Ned Konz) #2

Since this thread made the Ruby Weekly News wrap-up, I feel obliged
to follow-up… :^)

Sure! It still needs to be done…

Best I can see, named pipes would limit the solution to
Unix-esque platforms. ‘mkfifo’ under my Cygwin installation returns
a “Function not implemented” error – I take this to mean that it’s
simply not supported in Windows.

No, that means that it’s not supported in Cygwin.

Windows/NT provides named pipes; the DOS versions of Windows don’t,
but who cares?

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/pipes_94xf.asp

At the NT level, it’s just CreateNamedPipe followed by
ConnectNamedPipe. After a client connects, you just do ordinary
ReadFile and WriteFile calls.

Now, this is more complicated than just mkfifo/read/write, but you
could make a simple named-pipe server that would wait for a
connection on a given pipe, and then just connect the pipe to its
stdin/stdout (or a socket). You’d then start the NP server from Ruby
and read/write from/to it.

Anyway, named pipes aren’t needed if you can get the client/server
communications working (see below).

The catch is that you can’t do “normal” file operations in VimL.
You can read a whole file, of course, and you can write or read
to pipes or files.

I did find a Gvim gdb interface on vim.sourceforge.net; it builds
the fifo rd/wr operations into a C lib which is called from Vim.
Again, I would like to keep the solution entirely in Ruby/VimL
source. See

Actually, you can just use the Vim server stuff (:he clientserver)
directly from Ruby. I started work on the X11 interface to Ruby, but
ran into a problem with Ruby/X11, and I’m waiting for a response from
matju.

Under windows, this might also work (you have to send and receive
Windows messages). I don’t know what’s required to spin off a thread
that creates a window and processes messages to & from it, and then
talk to Ruby.

···

On Monday 01 July 2002 04:28 pm, Gray, Jeff wrote:


Ned Konz
http://bike-nomad.com
GPG key ID: BEEA7EFE