[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-gdb] GDB and X11 server grabs

From: Gary Aviv
Subject: Re: [Bug-gdb] GDB and X11 server grabs
Date: Thu, 14 Sep 2000 16:15:33 -0400 (EDT)

On Thu, 14 Sep 2000, Pierre Sarrazin wrote:

> A GDB breakpoint can totally freeze an X11 display when debugging
> a GUI application, if the app makes a "server grab."
> For example, if the application has a pull-down menu and I put
> a breakpoint in the menu's callback, then the following happens:
> - the menu is opened and an X11 server grab happens (in order to
>   catch all mouse events even if they are outside the menu's window);
> - the callback is called and GDB stops on it due to the breakpoint;
> - GDB expects commands from the user, but the user cannot type
>   anything anywhere in the display because of the server grab;
>   of course, the menu cannot be closed because the app is stopped.
> One way to get out of this is to login through the network and
> kill GDB.  Usually, I access the machine through a VNC remote
> display.  In addition, I telnet into the machine and run GDB in it,
> sending the display to the VNC/X11 server.  When the breakpoint is
> reached, I can still control GDB through the telnet session.
> Is there a better way?  I would imagine that GDB could automatically
> try to end an X11 server grab every time it displays its prompt.
> -- 
> Pierre Sarrazin <address@hidden>
> _______________________________________________
> Bug-gdb mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/bug-gdb

Yes. Use Xnest which gives you a X server which runs inside your host X server.
So the procedure is something like this:

Xnest :1 &      # from a local xterm, an X server is run in a window as screen 1
twm -display :1 &       # run a window manager in Xnest, for example twm,
xhost +         # to turn off security in Xnest server

Now run your application under gdb (or in emacs, etc.) passing the application
the additional argument "-display :1". The application will then run
in a window under Xnest. If your application does not accept the -display
argument you will have to "set env DISPLAY=:1" in gdb  prior to running it.

Now you can set breakpoints even during pointer grabs because the grab
occurs only in the Xnest session. So, you will not get locked up as you
describe above.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]