1

Imagine we are debugging the following assembly code in gdb:

...

    mov eax, 0x0f
    mov edx, 0xf0
    test eax, edx
 >> jz label2
    add eax, 0xf0

...

label2:

...

In this case, if we execute si, the instruction jz label2 will make the program jump to label2. Now imagine I don't want it to jump, the only way I can think of would be to put a temporary breakpoint at the address of the instruction add eax, 0xf0 and then manually jumping to it. Or maybe resetting the eflags so that Z is 0.

Is there any other simpler way? Jumping continues execution and I have to put a tbreak everytime I want to jump

rual93
  • 553
  • 4
  • 11
  • So... This isn't your code? Cuz the easiest would be to just write it the way you want in the first place. But if you are debugging an executable you didn't build, then I suppose an alternative would be punching over the `jz label2` instruction with `nop`s. Not sure how that's done in gdb, but I assume if VS can do it (open up a Memory window at the code address and just overstrike each of the bytes with 0x90s), gdb can. – David Wohlferd May 31 '18 at 19:17
  • @DavidWohlferd: good suggestions: added duplicates for each of those possible methods. – Peter Cordes May 31 '18 at 20:54
  • well are you marking it as a duplicate of methods that I suggested? – rual93 Jun 01 '18 at 13:48

0 Answers0