Re: gdb and gtk



Chris Hoefler wrote:
I am trying to write a new widget, and I've managed to get as far as the
drawing routines. But something isn't working right and I need to debug
it. However, and this may be just an incredibly simple issue, when I try
to use gdb I can't get any useful debugging information.

On any given function, I can set watches on some of my variables, but I
get "not defined in current context" errors for others (they are
defined, btw). Does anybody know what is going on here? I have my
program compiled with -g and I even recompiled the gtk library with -g,
but that doesn't help.

Is your project compiled with optimization turned on (i.e. `-O' or `-O2')?
Then the problem is not with GTK+, but rather with optimization producing
weird from the point of view of the debugger.  Some variables can be
optimized away, for instance, some initializations postponed until really
needed etc.  Try `info gcc' for more information.

So, just do `make -s clean; make -s CFLAGS="-g"'.

Hope this helps,
  Paul



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