How do you debug dwm? Write log? Or use print? Or gdb something else?
Perhaps the general recommendation is to use gdb for debugging; it is supposed to make everything easier. Personally I have only used fprintf statements in relation to dwm.
Because the X will complain that I'm already in a display instance, so I can't open a new one for debug use.
You could just do Ctrl+Alt+F6 for example to go to a different tty and start a new session there, but I'd much rather recommend that you install Xephyr and start your dwm in that to test your changes. It is kind of annoying if you break dwm so badly that it crashes immediately and you have to use some other window manager to fix it.
Example commands to get you started:
$ Xephyr +extension RANDR -screen 1280x760 -ac :3
^ starting Xephyr, you can add more than one screen if necessary
$ DISPLAY=:3 dwm
^ starting dwm on the display that Xephyr is using
Any output will be shown in the terminal where you started dwm from.
https://dompoer.io/linux,/debugging/2023/01/08/hack_wm.html
Perhaps the general recommendation is to use gdb for debugging; it is supposed to make everything easier. Personally I have only used
fprintf
statements in relation to dwm.You could just do Ctrl+Alt+F6 for example to go to a different tty and start a new session there, but I'd much rather recommend that you install Xephyr and start your dwm in that to test your changes. It is kind of annoying if you break dwm so badly that it crashes immediately and you have to use some other window manager to fix it.
Example commands to get you started:
^ starting Xephyr, you can add more than one screen if necessary
^ starting dwm on the display that Xephyr is using
Any output will be shown in the terminal where you started dwm from.