bug-gdb
[Top][All Lists]
Advanced

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

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


From: Kevin Buettner
Subject: Re: [Bug-gdb] GDB and X11 server grabs
Date: Thu, 14 Sep 2000 13:06:47 -0700

On Sep 14,  3:32pm, 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.

The best way to debug the portions of a GUI application that have to
interact with the display is to do it from another display.  Although
it is possible to use Xnest or Xvnc to give the illusion of multiple
displays on a single display, in practice, this usually doesn't work
out very well since you end up having to move the mouse (thus
generating more X events) to give focus back to gdb.  This means that
you're really better off having two machines, one on which to run the
app that you're debugging and the other for displaying your debugger
session.

It might be possible to hack gdb to release the grab, but IMO this
would be a really ugly hack both from the gdb side of the world as
well as from the X11 side.  If I were the maintainer for the affected
part of gdb, I would probably not accept such a patch unless it were
in the form of some sort of generic hook that could be used to do
other things too.  E.g, it might be okay if you added a hook which says
to run a user specified shell command every time gdb stops and
displays a prompt.  (I still don't know if such a patch would be
accepted, but it'd have a much better shot than one which has explicit
knowledge about the X Window system.)



reply via email to

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