watch if

watch if


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,


2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

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

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

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo!