ysl2 / dwm-flexipatch

A dwm build with preprocessor directives to decide which patches to include during build time
MIT License
0 stars 0 forks source link

Debug dwm #5

Open ysl2 opened 8 months ago

ysl2 commented 8 months ago

https://dompoer.io/linux,/debugging/2023/01/08/hack_wm.html

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.

ysl2 commented 7 months ago

Ref: https://superuser.com/questions/538789/emulating-extra-displays

# Open a terminal
Xephyr +extension RANDR +xinerama -screen 1280x720 -screen 1280x720 -ac :1
# Open another terminal
DISPLAY=:1 dwm