- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using idb in gdb mode to debug a code. I have a REAL*8 variable which is an array of length 50 that is changed a lot through the code. I would like to watch this variable and make the debugger stop only if some position in that array receives a negative value.
I know that I have to use watch if for doing this, but I don't know what syntax I have to use exactly. Can someone help me?
Thank you,
Victor
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Victor,
the condiktional watchpoint syntax is actually the same as for breakpoints in GDB*. Thus in genral something like
(gdb) watch my_arr[3] if my_arr[3] > 10
should work.
In addition the whole syntax as described for setting breakpoint conditions in the GDB* manual
http://sourceware.org/gdb/current/onlinedocs/gdb/Conditions.html#Conditions
also applies - especially if you are looking at more complex conditions.
Where it gets a bit tricky is if you are changing scope during the run. Then you may need to use hardware watchpoints:
(gdb) set can-use-hw-watchpoints
(gdb) watch *(int *)0x41523c0
Hardware watchpoint 1: *(int *)0x41523c0
Thanks, Rob

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page