Reputation: 4109
Given code like that (assume line number is x
):
if (condition) return false;
...if b x
is used to set breakpoint at that line, it would break on condition evaluation. How do I instruct gdb
to put breakpoint on the same line but different instruction? In my case target is return false
.
Upvotes: 0
Views: 92
Reputation: 213375
How do I
You can set a breakpoint on any instruction you want with b *0x1234
syntax. Example:
(gdb) disas $pc
Dump of assembler code for function main:
=> 0x0000555555555040 <+0>: xor %eax,%eax
0x0000555555555042 <+2>: cmp $0x1,%edi
0x0000555555555045 <+5>: setg %al
0x0000555555555048 <+8>: retq
End of assembler dump.
(gdb) b *0x0000555555555045
Breakpoint 2 at 0x555555555045
(gdb) c
Continuing.
Breakpoint 2, 0x0000555555555045 in main ()
(gdb) x/i $pc
=> 0x555555555045 <main+5>: setg %al
Upvotes: 1