Geoffrey R.
Geoffrey R.

Reputation: 2116

conditional breakpoint on an indirect addressing mode in gdb

I would like to set up a conditional breakpoint on an instruction that is like add [ebp+0xc], 1 but I can't figure out the right expression to give to gdb's shell.

I've tried that one yet it doesn't seem to work:

b *0xdeadbeef if ($ebp+0x0c) == 0xf00

But I think it only breaks when $ebp = 0xf0c (0xf00 + 0x0c) and this is not the intented result.

How could I perform a conditional breakpoint in that the memory location pointed by [ebp+0x0c] contains any specific value?

Upvotes: 1

Views: 151

Answers (1)

Employed Russian
Employed Russian

Reputation: 213506

Try

b *0xdeadbeef if *(int*)($ebp+0x0c) == 0xf00

Upvotes: 2

Related Questions