public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: hilbert <swdtian@163.com>, gdb@sourceware.org
Subject: Re: Why are these two methods default_memory_insert_breakpoint() and default_memory_remove_breakpoint() called multiple times
Date: Wed, 31 May 2023 08:57:52 -0700	[thread overview]
Message-ID: <95c62feb-4189-64a8-c819-b5d0717b7734@FreeBSD.org> (raw)
In-Reply-To: <3141f115.df17.18871148f89.Coremail.swdtian@163.com>

On 5/31/23 2:12 AM, hilbert via Gdb wrote:
> Hi,
> 
>           I just inserted a breakpoint, shouldn't the two methods default_memory_insert_breakpoint() and default_memory_remove_breakpoint() be used only once?
> 
> There is only one breakpoint, why both functions default_memory_insert_breakpoint() and default_memory_remove_breakpoint() are called before stopping and after stopping (after the continue command), why?

GDB inserts some of its own internal breakpoints.  For example,
in the runtime linker/loader there is a special symbol GDB sets
a breakpoint on so it can be notified about shared libraries being
loaded or unloaded.  If you are using libthread_db on a target it
may install internal breakpoints to detect thread creation and
thread exit as well.

-- 
John Baldwin


  reply	other threads:[~2023-05-31 15:58 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-31  9:12 hilbert
2023-05-31 15:57 ` John Baldwin [this message]
2023-06-01  1:50   ` hilbert
2023-06-01 17:09     ` John Baldwin
2023-06-02  2:09       ` hilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=95c62feb-4189-64a8-c819-b5d0717b7734@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb@sourceware.org \
    --cc=swdtian@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).