How Breakpoints Work
==================
A hardware breakpoint stops your target code from running using external emulator-mounted electronics that is completely independent of your hardware. Logic circuits (often implemented as RAM arrays) watch every bus cycle, stopping execution when the address at which you've set the breakpoint occurs.
A hardware breakpoint never alters your code, stack, or any other target resource; it is completely non-intrusive.
A software breakpoint, by contrast, always modifies your code. Typically the source level debugger inserts an INT3 instruction in your code at each breakpoint address. (INT3 does a call through location 0000C).
When properly implemented the debugger remembers the instruction that was at the breakpoint address, replacing it after the code hits any breakpoint.The emulator detects the software breakpoint by watching the system execute the INT3 - specifically, by catching the INT3's read from location 0000C. It then switches to its own internal operation, stopping your code and running its own.
software breakpoints must modify your code, you cannot debug ROMed code with software breakpoints.
Don't Read from 0000C!Another problem arises from the way most software breakpoints work. The emulator typically watches for reads from location 0000C (the INT3 vector address). Any read from this address causes the unit to immediately breakpoint _ even if no breakpoints were set
http://www.avocetsystems.com/company/articles/hints/aphwbk.htm
Frank is a Software Engineer with rich experiences on messeging system, embedded system and communication system development. This is his work notes.
Friday, July 31, 2009
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment