Can I create a breakpoint in code in iOS, like `__asm{int 3}` on VC++, and continue execution after it's been hit?

前端 未结 9 2142
终归单人心
终归单人心 2020-12-30 04:24

I\'m trying to put the equivalent of asm{int 3} (or similar) into my iPhone program. My goal is to have Xcode stop exactly on the offending line, without having

9条回答
  •  北海茫月
    2020-12-30 05:00

    int resume = false;
    for (int i = 0; i < 20 && !resume; ++i)
        sleep(1);
    

    Above is a poor man's trap in that you have to manually attach to the program in question. Increase the delay as appropriate. Put the code where you want to break, and insert a breakpoint on the sleep statement, build and run your program, and attach to it from Xcode. Once Xcode breaks, you can right-click on the resume variable and edit it to 1, to resume execution.

提交回复
热议问题