Re: How GDB knows a breakpoint is hit?

kceiwH
2009-08-20T01:50:18Z

Thanks very much.

Mao

On Aug 19, 2009, at 5:09 PM, Andreas Schwab wrote:

> kceiwH <kceiwh@gmail.com> writes:
>
>> I wonder how GDB knows it should stop the inferior when a
>> breakpoint is
>> hit. I try to read the code but only to find how GDB creates a
>> breakpoint. I thought GDB might change some instructions of
>> inferior so
>> that when the inferior executes the modified instructions, GDB
>> should
>> know. But what the function "create_breakpoint" does is to add a
>> breakpoint to the list "breakpoint_chain".
>
> Breakpoints are only inserted immediately before the inferior is
> resumed, see insert_breakpoints.
>
> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276
> 4ED5
> "And now for something completely different."