the breakpoint of gdb

Michael Snyder Michael.Snyder@palmsource.com
Fri Oct 13 19:05:00 GMT 2006


On Sat, 2006-10-14 at 01:53 +0800, s88 wrote:
> Hi all:
> 
> Could anyone tell me something about how the gdb to achieve the the
> breakpoint function in different platform?

Thru a platform_specific method (function pointer) called
"target_insert_breakpoint".  Each target or platform defines
this function as appropriate.

Look for "target_insert_breakpoint" in breakpoint.c and target.h, 
then grep for "to_insert_breakpoint" in *.c.

> I heard the gdb's breakpoint implement on the X86 platform is by the
> instruction patch. It sounds interesting!! I want to know more
> details.

Yes, the most common method is to insert a trap instruction
(or similar) into memory.  See function "memory_insert_breakpoint"
in mem-break.c.  Again, each target platform has to define the
appropriate bit-pattern or instruction to be inserted.


> Any reference info, web page, books are welcome.

Hah.  If you write that book, you will become famous.   ;-)




More information about the Gdb mailing list