I am writing and debugging a Window Manager for X.
I would like to be able to run gdb on my application. The application requires an X display. I want two sessions in parallel: one where I develop, run gdb and the application, and one to which I redirect my application.
I have tried multiple VT.
- login to my development session with gdm
- go to another VT with Ctrl+Alt+F3 (I am using Ubuntu 20.04)
- start a new X session with
sudo X :2
This last command kills everything else, both my development session in tty2, and the gdm login in tty1. I am left with black screens.
I also tried startx
, but that opens a Desktop Environment (it looks like gnome). I've tried to modify ~/.xinitrc
, to unset XDG_RUNTIME_DIR && sleep 60
, but then I lost access to my other ttys for the 60 seconds.
unset XDG_RUNTIME_DIR && X :2
does not really fail, but returns immediately.
How can I get a separate X session in a TTY, so that I can run and debug my application from another TTY?
sudo X :2
would not start a complete new X session, just a new X server with nothing running on it. You would have to manage its session cookie yourself (or disable the X authentication, which is not secure), then start at least a window manager (or a complete desktop environment) on your:2
display to make it useful.Xnest
orXephyr
)? Or does the application use DRI or otherwise do something that requires access to the real GPU? (If yes, that is important information that should be added to your question, as that will restrict your options quite a bit.)xinit /full/path/to/your_app -- :1 vt8
. Also Xephyr or Xnest may help.XDG_RUNTIME_DIR= Xnest :1
, and my application withDISPLAY=:1 gdb ./my_app
, and I can hunt my segfault. Thanks! It would still be great to learn what was wrong with my attempt at using the VT...