Skip to content

Commit 930ef94

Browse files
committed
Update readme
1 parent c05a863 commit 930ef94

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

README.md

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,17 @@ void breakpointCallback(arm_thread_state64_t state, std::function<void()> sendRe
3434
sendReply();
3535
}
3636

37-
SimpleDebugger *debugger = new SimpleDebugger();
38-
debugger->setExceptionCallback(breakpointCallback);
39-
debugger->setBreakpoint((vm_address_t) &myFunction);
40-
// You must call start debugging to set up the exception server.
41-
debugger->startDebugging();
42-
43-
// The breakpoint handler will run before myFunction
44-
myFunction();
37+
__attribute__((constructor)) void example(void);
38+
__attribute__((constructor)) void setup() {
39+
SimpleDebugger *debugger = new SimpleDebugger();
40+
debugger->setExceptionCallback(breakpointCallback);
41+
debugger->setBreakpoint((vm_address_t) &myFunction);
42+
// You must call start debugging to set up the exception server.
43+
debugger->startDebugging();
44+
45+
// The breakpoint handler will run before myFunction
46+
myFunction();
47+
}
4548
```
4649
4750
# How it works

0 commit comments

Comments
 (0)