r/ExploitDev • u/FewMolasses7496 • Mar 25 '26
Why is the next instruction always ret when you are debugging a program?
I have noticed for quite some time now that whenever a watchpoint or breakpoint is triggered and I inspect $rip to find the next instruction it always seems to be ret. I'm not sure why this happens and am wondering if anyone else knows?
3
Upvotes
4
u/anonymous_lurker- Mar 25 '26
Can you give some examples of this and what you are doing? Because you can set your breakpoints wherever you want, and the next instruction won't always be a return. If you are only setting breakpoints right before return instructions then there's your answer. But if you're setting arbitrary breakpoints and still only getting return instructions then something else is going on and we need more details
3
u/AttitudeAdjuster Mar 25 '26
There's quite a lot of call / ret structures in assembler code. It's also a very common way to trigger a crash