docs/system: rewrite gdb breakpoint and watchpoint explanation
PATCH v2 1/1 docs/system: rewrite gdb breakpoint and watchpoint explanation
There are a couple of gotchas we should point out:
- software breakpoints can fail on early boot
- TCG treats all breakpoints as "hardware" breakpoints
Rewrite the text to explain this more clearly and call out the gotchas in a note and warning sections.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3596
---
v2
- made the soft breakpoint section a warning
- moved discussion about TCG's unlimited break and watchpoints to a new note
--- docs/system/gdb.rst | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
docs/system/gdb.rst +28 -9
@@ -49,15 +49,34 @@ Here are some useful tips in order to use gdb on system code: Breakpoint and Watchpoint support ================================= -While GDB can always fall back to inserting breakpoints into memory -(if writable) other features are very much dependent on support of the -accelerator. For TCG system emulation we advertise an infinite number -of hardware assisted breakpoints and watchpoints. For other -accelerators it will depend on if support has been added (see -supports_guest_debug and related hooks in AccelOpsClass). - -As TCG cannot track all memory accesses in user-mode there is no -support for watchpoints. +GDB supports two types of breakpoint - software and hardware. Software +breakpoints are simply implemented by writing the architecture's +breakpoint instruction into memory. Hardware breakpoints are less +invasive but rely on the support from the architecture which will +usually only be able to track a limited number of breakpoints at once. +Each accelerator will also need to specifically support enabling these +hardware features. + +.. warning:: + + Software breakpoints may fail if the memory is not yet accessible, + or the guest code is not yet at that address, for example during + early Linux kernel boot before the MMU is enabled or before the + kernel has relocated itself. In such cases, you should use + hardware-assisted breakpoints (e.g., ``hbreak`` in GDB) which do not + require memory access. + +Watchpoints allow the debugger to watch for reads and writes to +various memory locations. The number of watchpoints available will be +a depend on the architecture and support of the accelerator. + +.. note:: + + If you are using the TCG accelerator, there is no limit on the + number of hardware breakpoints or watchpoints, and QEMU handles + requests for both software and hardware breakpoints identically, + as if they were hardware breakpoints. + Relocating code ===============
Signature · 1 line
2.47.3
Quoted 10 lines · Alex Bennée
There are a couple of gotchas we should point out:
- software breakpoints can fail on early boot
- TCG treats all breakpoints as "hardware" breakpointsRewrite the text to explain this more clearly and call out the gotchas in a note and warning sections.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3596
Quoted 8 lines
Signed-off-by Alex Bennée <[email protected]>---
v2
- made the soft breakpoint section a warning
- moved discussion about TCG's unlimited break and watchpoints to a new note
---
thanks
-- PMM
Quoted 11 lines · Alex Bennée
There are a couple of gotchas we should point out:
- software breakpoints can fail on early boot
- TCG treats all breakpoints as "hardware" breakpointsRewrite the text to explain this more clearly and call out the gotchas in a note and warning sections.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3596
Signed-off-by Alex Bennée <[email protected]>
Quoted 9 lines
---
v2
- made the soft breakpoint section a warning
- moved discussion about TCG's unlimited break and watchpoints to a new note--- docs/system/gdb.rst | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)
I'll let you pull this as part of gdbstub system.
Alex Bennée
AppliedQuoted 10 lines · Alex Bennée
There are a couple of gotchas we should point out:
- software breakpoints can fail on early boot
- TCG treats all breakpoints as "hardware" breakpointsRewrite the text to explain this more clearly and call out the gotchas in a note and warning sections.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3596
Signed-off-by Alex Bennée <[email protected]>
Queued to gdbstub/next, thanks.
Signature · 2 lines
Alex Bennée Virtualisation Tech Lead @ Linaro
Quoted 11 lines · Alex Bennée
There are a couple of gotchas we should point out:
- software breakpoints can fail on early boot
- TCG treats all breakpoints as "hardware" breakpointsRewrite the text to explain this more clearly and call out the gotchas in a note and warning sections.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3596
Signed-off-by Alex Bennée <[email protected]>
Quoted 8 lines
---
v2
- made the soft breakpoint section a warning
- moved discussion about TCG's unlimited break and watchpoints to a new note--- docs/system/gdb.rst | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-)