Re: gdb and gtk



On Thu, 2004-02-05 at 20:12, Chris Hoefler wrote:

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.

[ this is offtopic for the list, but since its something useful 
  most people  don't know, I'll answer it here anyways ]

Hardware watchpoints in gdb have to be on absolute addresses. If
you say, do:

 (gdb) watch bin->child

then GDB will think you want to watch the expression 'bin->child'
whatever that means as the code continues to execute. As soon
as bin goes out of scope, you get an error.

What you instead to do is:

 (gdb) p &bin->child
 $15 = (GtkWidget **)0x12345678
 (gdb) watch *$15

This gets gdb to watch that location in memory, rather than that
expression.

Regards,
                                                Owen





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