This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Problem with manual watchpoints
On Thu, 24 Dec 2009 22:41:37 +0100, Aravinda wrote:
> Yes, thats why I have a watchpoint added at &a[20]. So on accessing
> the first element out of the allocated array, I want the program to
> receive a SIGTRAP.
Ah, OK.
> Infact it gets this signal when the getc(stdin) is included, is it
> something to do with the program should be in single step mode to get
> SIGTRAPs
No.
> or is the loop way too simple that it executes in no time before the SIGTRAP
> is even raised ?
There may be some compiler optimization in effect such as if you have not used
"volatile" keyword for the "a" array. You should rather check the code using
"objdump -dS" or GDB "disass/m" how it got compiled.
Still (with default -O0) I do not know the answer.
Regards,
Jan