reverse debugging implementation + commands

David McQuillan dmcq@fano.co.uk
Wed Aug 25 20:43:00 GMT 2010


Just a bit on testing for conditions when going backwards.

Just had a look at reverse.c and it is very different from anything I 
ever did. To find the last time a location was changed for instance it 
looks like it would go back one instruction at a time until the 
condition is satisfied. I can see a middle way that encompasses both 
approaches in that if the registers are saved on every single 
instruction my approach ends up being the same as what reverse.c does so 
I've written it up here that way:

set found counter to unset
set check counter to here
while found counter is null and we can go backwards
   roll back from check counter to previous save point
   go forward till check counter reached
    if condition set then
      set found counter to instruction counter
   endif
   if found counter not set
     roll back to last save point
     set check counter to this point
   endif
endwhile

At the end of this found counter if set gives the instruction counter 
when the condition was last satisfied.

With this there is no special work needed to check conditions when going 
backwards compared to going forwards.

David



More information about the Gdb mailing list