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

Requesting workflow suggestions and/or workaround #123

Open
N-R-K opened this issue Apr 15, 2024 · 9 comments
Open

Requesting workflow suggestions and/or workaround #123

N-R-K opened this issue Apr 15, 2024 · 9 comments

Comments

@N-R-K
Copy link

N-R-K commented Apr 15, 2024

This isn't really a bug report but rather a list of issues workflow I have. Some of them are related to w64devkit while others are more of a windows issue - but maybe I can get some suggestions here anyways.

Ctrl+z

This was one of the biggest issues I ran into since my workflow consists of getting in and out of vim quickly via ctrl+z. But looking at #30 it seems like this is unfixable. I've mostly managed to work around this by using 2 terminals and alt+tab.

Gdb locking up the executable

This is currently the biggest annoyance for me when using w64devkit. Because gdb locks up the exe, I cannot recompile the source again unless I go over to gdb and kill the exe with k. This is huge flow killer for me, especially since I'm not familiar with windows APIs and thus am often trying multiple different things out which requires lots of recompilations.

vim's termdebug plugin

Vim has a builtin plugin called termdebug which integrates gdb in vim. You can try it with :packadd termdebug and then :Termdebug. The problem is the gdb it spawns is unaware of w64devkit's environment. And so ! commands don't call into w64dk's shell and so forth.

I can cope with it by using a different terminal for gdb so it's more of a minor issue, though I'd prefer if termdebug worked properly instead since having editor and debugger integrated gives a better experience IMO since the line I'm stepping over in the debugger becomes synced with the editor window. And so if I notice something needs change, I can make that change more easily since the editor is at that line already.

PDB support

I've been thinking of switching over to Raddebugger (https://github.com/EpicGamesExt/raddebugger) on windows to avoid some of these gdb annoyances. But raddbg currently doesn't support DWARF files (it's in the roadmap though), only PDB. It might be nice to have some tool that can emit pdb in w64dk (afaik, clang can, but I doubt you'd want to add a giant tool like llvm/clang).

I have found this tool that claims to be able to do dwarf -> pdb conversion: https://github.com/rainers/cv2pdb but I haven't tried it out yet.

@N-R-K
Copy link
Author

N-R-K commented Apr 15, 2024

Also forgot to mention that git missing was also an annoyance. But I've worked around it by just downloading a portable version and adding it to $PATH via ~/.profile.

@skeeto
Copy link
Owner

skeeto commented Apr 15, 2024 via email

@N-R-K
Copy link
Author

N-R-K commented Apr 15, 2024

Have you considered gvim?

Not yet, but I will give it a try. Thanks for the suggestion.

Resistance to gvim is quite common, and it always surprises me.

Personally, I prefer terminal version because I'm very comfortable in the terminal and ctrl+z makes switching between terminal and vim near seamless. But since I can't use ctrl+z in w64devkit anyways, I might as well try using gvim.

At one point I explored having vim or the build pkill before building, but that won't work if the target is paused in GDB, which is the usual situation.

I wonder if there's some other way IPC mechanism to tell gdb to kill the process from vim. But quick googling doesn't reveal anything.

(Maybe something termdebug could address since it's integrated?)

This might be possible, but I haven't looked into what protocol/api termdebug is using to communicate with gdb. This might be worth investigating, but looking at the plugin source, I can't say that I'm enthusiastic about doing that myself: https://github.com/vim/vim/blob/master/runtime/pack/dist/opt/termdebug/plugin/termdebug.vim

One more thing I forgot to mention (reminded by the comment in the plugin) is that on windows, termdebug will launch the debugee process in a new console - which is generally a distraction for me (similar to annoying popups).

(unless termdebug is messing this up?).

This seems to be the case, when I run !make from a gdb launched from w64devkit shell, it tells me it couldn't find any makefile which is expected.
When I run !make from gdb inside termdebug, nothing happens, there's no feedback at all.

but I quickly learned it requires Visual Studio as a run-time dependency, which kind of defeats the purpose.

That's a bummer.

make sure you've added its "cmd" directory to your path, not "bin".

Yup, I've got that setup properly by reading the portable README.

@skeeto
Copy link
Owner

skeeto commented Apr 15, 2024 via email

@Peter0x44
Copy link
Contributor

@skeeto gcc 14 apparently has -gcodeview which might work with remedybg. I think it's worth a try.

@skeeto
Copy link
Owner

skeeto commented Apr 21, 2024 via email

@Peter0x44
Copy link
Contributor

@skeeto looks like only some patches for the option made it to gcc 14, the rest didn't.
But they got applied just now:
https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=36781ef8fd26eb9a0686957e7bac8f5ccc5ecc3f
In case you are interested to try again.

@skeeto
Copy link
Owner

skeeto commented May 12, 2024 via email

@pgalkin
Copy link

pgalkin commented Jun 22, 2024

I have it working like this.

  1. Install w64devkit to ~/code/w64devkit directory.
  2. Install https://github.com/mstorsjo/llvm-mingw to ~/code/llvm-mingw directory.
  3. Copy directories from llvm-mingw to w64devkit with replacement.
  4. Compile like this:
clang -gcodeview -g hello.cpp -luser32 -Wl,--pdb= -o build/hello.exe

Inside ~/build we get:

~/code/hello $ ls build
hello.exe  hello.pdb

And there you have it (screenshot)

image

Obviously this is very hacky, but it's possible to replace gcc with clang in Dockerfile and it will become nicely packaged.

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

No branches or pull requests

4 participants