Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Equivalent of 'int 3' on ARM/iOS processors [duplicate]

I'm looking for an equivalent of

__asm__ int 3
for ARM/iOS processors for when I'm debugging on a physical device. Is it BKPT? All I want to do is halt the processor so that I can then step past or continue execution at that point like I can with an int 3.
like image 393
rforte Avatar asked Feb 11 '11 15:02

rforte


2 Answers

According to an answer for the question Breaking into the debugger on iPhone the equivalent is asm("trap"). But see the other answers for different techniques.

Especially look into conditional breakpoints which is a less invasive method.

like image 93
DarkDust Avatar answered Oct 12 '22 23:10

DarkDust


When dealing with macOS ARM:

  1. Clang's __builtin_debugtrap(); function should generate necessary break instruction.
  2. If that won't work, try asm("brk #0x1");
like image 43
antonone Avatar answered Oct 13 '22 00:10

antonone