I have an real-time OO program (nevertheless written in C) that I am trying to debug. I have an issue that some objects out of thousands get corrupted during a specific window of time, every now and then. I want to have one breakpoint at the start of the window, which automatically sets a watchpoint on a member variable, and then have that watchpoint removed at the end of the window by another breakpoint. The trouble is I need some way of tying a watchpoint number to a given object. If I could construct a convenience variable by some mechanism so that, for example, if $var=28, then set $x${var}=watch -l foo would be the equivalent of set $x28=watch -l foo. (which doesn't actually work) This would allow me to do this:
breakpoint obj_init+23
command
$var = *obj
$x${var} = watch -l foo
continue
done
breakpoint obj_final
command
$var = *obj
delete $x${var}
continue
done
So I don't (hopefully) overrun the number of available hardware watchpoints.
Does anyone know how I might achieve this without trying to write a python extension? (My python is very rusty.)