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? |
Found it out: It goes just like I thought (but instead of a 'helper' breakpoint, single step is used). GDB client removes the breakpoint ('z'), then single-steps ('s') and then re-installs the breakpoint ('Z').
Also stepping over a breakpoint is handled by GDB client the same way. |
All times are GMT -5. The time now is 11:19 AM. |