sakhnik / nvim-gdb

Neovim thin wrapper for GDB, LLDB, PDB/PDB++ and BashDB
723 stars 39 forks source link

mingw support? #191

Closed Un1q32 closed 1 year ago

Un1q32 commented 1 year ago

would be nice if this worked on windows so i could use mingw gdb with it, it almost works but it seems to try and invoke a shell script

sakhnik commented 1 year ago

I guess it's possible. To execute GDB commands behind the scenes, the plugin uses PTY. The standard Python library pty only works in Linux. But there's a newer one ptyprocess doing the same work cross-platform. It uses ConPTY in Windows, thus, will only work with newer versions of Windows: https://devblogs.microsoft.com/commandline/windows-command-line-introducing-the-windows-pseudo-console-conpty/ So basically, it's a matter of rewriting base_proxy.py with ptyprocess. The devil is in the details, as always.

sakhnik commented 1 year ago

It's time to report. The request turned out to be a plentiful source of progress. The key features are:

So the current head of the branch pty is able to run GDB and display the current line sign as well as the breakpoint signs. You could try it out. Meanwhile, I'm going to focus on the automatic tests and support for other debuggers like lldb, pdb etc.

Un1q32 commented 1 year ago

Wouldn't using lua scripts be preferable so people don't have to install python?

sakhnik commented 1 year ago

I'd wish to get everything to Lua, but Python is here for historical reasons, and the test suite is in Python. So Python is a requirement for now (choco install python). But maybe I'll get to this later and it'll be a major undertaking to get the code unified.

UPD: On the other hand, I'd agree that GDB could be launched without Python, and it isn't too difficult to fix that soon.

sakhnik commented 1 year ago

Second update. Now the debuggers are configured with Lua, not Python. The tests pass locally for me, but it's challenging to get them to succeed in GitHub Actions. For example, I'm currently investigating how to set code page 65001 (utf-8), which is configured system-wide in my system. To recap, python is actually installed automatically in MinGW as a dependency for gdb. And it's still required for the plugin because it's the way a communication channel is established between the plugin and GDB.

UPD: The tests have passed for the first time in GitHub Actions! The release is closer than I expected.

Un1q32 commented 1 year ago

python is actually installed automatically in MinGW as a dependency for gdb. And it's still required for the plugin because it's the way a communication channel is established between the plugin and GDB.

I'm not sure about the official mingw installation, but the gdb.exe from https://github.com/skeeto/w64devkit works fine without python installed, but if it's required for communication with the plugin anyway then I guess it doesn't really matter.

Thanks for all this work! I'll test it when I get home from my vacation.