public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: hilbert  <swdtian@163.com>
To: "John Baldwin" <jhb@FreeBSD.org>
Cc: gdb@sourceware.org
Subject: Re:Re: Why are these two methods default_memory_insert_breakpoint() and default_memory_remove_breakpoint() called multiple times
Date: Thu, 1 Jun 2023 09:50:00 +0800 (CST)	[thread overview]
Message-ID: <1e72b0a7.2eba.18874a5c3c9.Coremail.swdtian@163.com> (raw)
In-Reply-To: <95c62feb-4189-64a8-c819-b5d0717b7734@FreeBSD.org>

[-- Attachment #1: Type: text/plain, Size: 1405 bytes --]

 @John Baldwin 



Thank you very much for your answer;




I have another question, very confused.I don't understand the mechanism of register caching.

The register cache is initialized at the very beginning, when will it be updated later?

Will it be automatically updated later?




In the infrun.c/displaced_step_prepare() , it can accurately read the original_pc, which is the pc at the breakpoint position.
The instruction replaced by the breakpoint can be obtained through this original_pc;








Thank you very much.











At 2023-05-31 23:57:52, "John Baldwin" <jhb@FreeBSD.org> wrote:
>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-06-01  1:50 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
2023-06-01  1:50   ` hilbert [this message]
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=1e72b0a7.2eba.18874a5c3c9.Coremail.swdtian@163.com \
    --to=swdtian@163.com \
    --cc=gdb@sourceware.org \
    --cc=jhb@FreeBSD.org \
    /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).