breakpoints and gdb-stub
Any pointers about how a gdb-stub should handle soft breakpoints in case of bare metal target?
The sources I've seen this far have assumed gdb-stub having an OS under it, and the 'gdb internals' seem to miss just those chapters.
What I'm wondering is when and where to put breakpoint instructions.
I think a helper breakpoint is needed in case of breakpoint set with 'Z'. My reasoning goes like:
1) Put breakpoint to given address and store the instruction replaced.
2) When the breakpoint is hit, wait for command.
3) If 'c' is given, restore the original instruction and set a helper breakpoint to the next instruction storing the replaced instruction.
4) Resume at the restored instruction.
5) When the helper breakpoint is hit, restore the stored instruction and re-install the original breakpoint.
6) Resume at the restored instruction.
And how to handle single-stepping over a place in code that has breakpoint set?
What's done by the gdb client and what's left to the gdb-stub to do?
Is the essential difference between a set breakpoint and a single-stepping breakpoint that single-stepping uses 'throwaway' breakpoints?
Last edited by turboscrew; 04-11-2015 at 04:27 AM.
|