top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How does watchpoint work in gdb and in what cases it is beneficial to used it ?

+1 vote
53 views
How does watchpoint work in gdb and in what cases it is beneficial to used it ?
posted May 14, 2016 by Harshita

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

During the unit testing, when tester suspects on the value of variable it may use "watch point" in gdb.
It prompts with old value and new value whenever value of a variable gets changed. There is a limitation of watch point is that it works on a variable till the scope of variable. I meant to say if a variable is declared as global, watch dog will work throughout the program while for a variable with local scope watch point leaves tracking variable as soon as it goes out of scope.

answer May 21, 2016 by Neeraj Mishra
Similar Questions
+1 vote

I am working on some JIT compiler and I am using GDB to debut it, my code crashes at some point (segment fault), but it crashes at the jitted code (they are generated on the fly) so I do not get the stack frame information, But I got the following backtrace:

#0 0x**********d98f22 in ?? () // JITTED CODE
#1 0x000000000000001d in ?? () // JITTED CODE
#2 ...callattribuite function....

I am wondering if it is possible for GDB to disassemble the code at location 0x**********d98f22 and display it to me. I tried disas 0x**********d98f22 but GDB complained No function contains specified address.

Any clue?

...