Search code examples
cgdbconditional-breakpoint

GDB, break condition, check NULL pointer


I want to set a break point, and only stop at it, when one pointer called rc is NULL.

I did like that

      b task.c:190 if rc==NULL

but gdb says, NULL would be unrecognized, so I changed to

      b task.c:190 if(!rc)

which seems worked.

But I am not very sure, correct me if I am doing wrong.


Solution

  • try to re-compile your project with CFLAG -ggdb3, then set the break point.Or use (void *)0 instead of NULL