@@ -146,11 +146,11 @@ void* SimpleDebugger::exceptionServer() {
146146 printf (" Error getting thread state: %s\n " , mach_error_string (kr));
147147 }
148148 if (exceptionCallback) {
149- exceptionCallback (state, [this , exceptionMessage, state, state_count]() {
150- continueFromBreak (exceptionMessage, state, state_count);
149+ exceptionCallback (thread, state, [this , exceptionMessage, state, state_count](bool removeBreak ) {
150+ continueFromBreak (removeBreak, exceptionMessage, state, state_count);
151151 });
152152 } else {
153- continueFromBreak (exceptionMessage, state, state_count);
153+ continueFromBreak (true , exceptionMessage, state, state_count);
154154 }
155155 } else {
156156 os_log (OS_LOG_DEFAULT, " Not breakpoint message" );
@@ -160,16 +160,18 @@ void* SimpleDebugger::exceptionServer() {
160160 return nullptr ;
161161}
162162
163- void SimpleDebugger::continueFromBreak (MachExceptionMessage exceptionMessage, arm_thread_state64_t state, mach_msg_type_number_t state_count) {
163+ void SimpleDebugger::continueFromBreak (bool removeBreak, MachExceptionMessage exceptionMessage, arm_thread_state64_t state, mach_msg_type_number_t state_count) {
164164
165- if (originalInstruction.contains (state.__pc )) {
166- uint32_t orig = originalInstruction.at (state.__pc );
167- setInstruction (state.__pc , orig);
168- originalInstruction.erase (state.__pc );
169- } else {
170- // Address was not tracked, do nothing. Maybe this was a thread that hit the breakpoint
171- // at the same time another thread cleared it.
172- printf (" Unexpected not tracked address\n " );
165+ if (removeBreak) {
166+ if (originalInstruction.contains (state.__pc )) {
167+ uint32_t orig = originalInstruction.at (state.__pc );
168+ setInstruction (state.__pc , orig);
169+ originalInstruction.erase (state.__pc );
170+ } else {
171+ // Address was not tracked, do nothing. Maybe this was a thread that hit the breakpoint
172+ // at the same time another thread cleared it.
173+ printf (" Unexpected not tracked address\n " );
174+ }
173175 }
174176
175177 MachReplyMessage replyMessage = {{0 }};
0 commit comments