<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/loose.dtd"> <HTML ><HEAD ><TITLE >I try to debug my GTK+ application with gdb, but it hangs my X server when I hit some breakpoint. Any Idea? [GTK 2.x]</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.79"><LINK REL="HOME" TITLE="GTK+ FAQ" HREF="book1.html"><LINK REL="UP" TITLE="Development with GTK+: the begining" HREF="c377.html"><LINK REL="PREVIOUS" TITLE="I want to add some configure stuff, how could I do this? [GTK 2.x]" HREF="x430.html"><LINK REL="NEXT" TITLE="Development with GTK+: general questions" HREF="c466.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >GTK+ FAQ</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="x430.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Development with GTK+: the begining</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="c466.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="AEN452" >I try to debug my GTK+ application with gdb, but it hangs my X server when I hit some breakpoint. Any Idea? <I CLASS="EMPHASIS" >[GTK 2.x]</I ></A ></H1 ><P >From Federico Mena Quintero:</P ><P ><SPAN CLASS="QUOTE" >"X is not locked up. It is likely that you are hitting a breakpoint inside a callback that is called from a place in Gtk that has a mouse grab."</SPAN ></P ><P ><SPAN CLASS="QUOTE" >"Run your program with the <TT CLASS="LITERAL" >--sync</TT > option; it will make it easier to debug. Also, you may want to use the console for running the debugger, and just let the program run in another console with the X server."</SPAN ></P ><P >Eric Mouw had another solution:</P ><P ><SPAN CLASS="QUOTE" >"An old terminal connected to an otherwise unused serial port is also great for debugging X programs. Old vt100/vt220 terminals are dirt cheap but a bit hard to get (here in The Netherlands, YMMV)."</SPAN ></P ><P >Another option is to run your application on Xnest. Xnest is an X server which displays its root window in a regular window of another X server. A pointer grab on the Xnest display will not affect the GUI of your debugger running on your regular X server. <TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" >Xnest :1 twm -display :1 myapp --display=:1</PRE ></TD ></TR ></TABLE ></P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="x430.html" ACCESSKEY="P" ><<< Previous</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="book1.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="c466.html" ACCESSKEY="N" >Next >>></A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >I want to add some configure stuff, how could I do this? <I CLASS="EMPHASIS" >[GTK 2.x]</I ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="c377.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Development with GTK+: general questions</TD ></TR ></TABLE ></DIV ></BODY ></HTML >