Comment by amluto
2 days ago
If a function is inlined, the breakpoint can be at the end.
If you write:
if (a)
breakpoint();
other code;
Then there two obvious ways for code to be generated, one of which puts the address after int3 in the wrong basic block.
In a good enough debugger insn length might not matter - there will be a choice of addresses, ask all belonging to the next instruction. Subtracting one and handling the case where the address is in the middle of an instruction should be good enough.
(Or just track whether the address in question is the start or end of the insn. Keep in mind that, in basically every architecture, call saves the next address, not its own.)
No comments yet
Contribute on Hacker News ↗