Watchpoints
  Home
  Introduction
  Getting KGDB
  Documentation
  Using KGDB
  Credits
  Miscellaneous
  Troubleshooting
  FAQ
  Support
  About KGDB
  KGDB Pronew

 

KGDB stub contains support for hardware breakpoints using debugging features of ia-32(x86) processors. These breakpoints do not need code modification. They use debugging registers. 4 hardware breakpoints are available in ia-32 processors. Each hardware breakpoint can be of one of the following three types.

  1. Execution breakpoint - An Execution breakpoint is triggered when code at the  breakpoint address is executed.  As limited number of hardware breakpoints are available, it is advisable  to use software breakpoints ( break command ) instead of execution  hardware breakpoints, unless modification of code is to be avoided.
  2. Write breakpoint - A write breakpoint is triggered when memory location at the  breakpoint address is written.  A write or can be placed for data of variable length. Length of a write  breakpoint indicates length of the datatype to be watched. Length is 1 for 1 byte data , 2 for 2 byte data, 3 for 4 byte data.
  3. Access breakpoint - An access breakpoint is triggered when memory location at  the breakpoint address is either read or written.  Access breakpoints also have lengths similar to write breakpoints.
IO breakpoints in ia-32 are not supported.

Since GDB stub at present does not use the protocol used by GDB for hardware breakpoints, hardware breakpoints are accessed through GDB macros. GDB macros for hardware breakpoints are described below.

hwebrk - Places an execution breakpoint
usage: hwebrk breakpointno address
hwwbrk - Places a write breakpoint
usage: hwwbrk breakpointno length address
hwabrk - Places an access breakpoint
usage: hwabrk breakpointno length address
hwrmbrk - Removes a breakpoint
usage: hwrmbrk breakpointno
exinfo - Tells whether a software or hardware breakpoint has occurred.
 Prints number of the hardware breakpoint if a hardware breakpoint has
 occurred.

Arguments required by these commands are as follows
breakpointno - 0 to 3
length  - 1 to 3
address  - Memory location in hex digits ( without 0x ) e.g c015e9bc