From: Simon Marchi <simark@simark.ca>
To: "bilal@siemens.com" <bilal@siemens.com>,
"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: Differences in MI Breakpoint Notification for GDB CLI and MI Command
Date: Tue, 9 May 2023 14:26:42 -0400 [thread overview]
Message-ID: <d0d71efa-202a-544b-fa92-70986ce61332@simark.ca> (raw)
In-Reply-To: <PSAPR06MB400589301E05B2EFCD623206B5769@PSAPR06MB4005.apcprd06.prod.outlook.com>
On 5/9/23 11:29, bilal--- via Gdb-patches wrote:
> Hi expert,
>
> I have noticed differences in the MI breakpoint notification when creating a breakpoint from the GDB CLI command versus using the MI command
>
>
> If I create a software breakpoint for a read-only memory location using the GDB CLI command, GDB immediately notifies the MI client of a breakpoint modification by changing it to a hardware breakpoint.
> i.e
> $ ./arm-none-eabi-gdb -q /tmp/test --interpreter mi3 -ex "mem 0x0 0x100000 ro nocache"
> =thread-group-added,id="i1"
> ~"Reading symbols from /tmp/test...\n"
> (gdb)
> b main
> &"b main\n"
> ~"Breakpoint 1 at 0x254\n"
> =breakpoint-created,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000254",at="<main+12>",thread-groups=["i1"],times="0",original-location="main"}
> =breakpoint-modified,bkpt={number="1",type="hw breakpoint",disp="keep",enabled="y",addr="0x00000254",at="<main+12>",thread-groups=["i1"],times="0",original-location="main"}
> ~"Note: automatically using hardware breakpoints for read-only addresses.\n"
> ^done
> (gdb)
>
>
> However, there is no such notification if I use the MI break-insert command instead of the CLI command.
> i.e
> $ ./arm-none-eabi-gdb -q /tmp/test --interpreter mi3 -ex "mem 0x0 0x100000 ro nocache"
> =thread-group-added,id="i1"
> ~"Reading symbols from /tmp/test...\n"
> (gdb)
> -break-insert main
> ~"Note: automatically using hardware breakpoints for read-only addresses.\n"
> ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x00000254",at="<main+12>",thread-groups=["i1"],times="0",original-location="main"}
> (gdb)
>
>
> GDB only emits a modified notification when a breakpoint is hit, and an MI client, such as CDT, needs to re-install the breakpoint as a hardware breakpoint while the program is running and being debugged. Therefore, the IDE must first interrupt the program and then re-install the modified breakpoint.
>
> Could anyone explain why GDB does not emit an MI breakpoint notification when the breakpoint is first inserted?
I'm guessing that it's because all MI notifications (the things starting
with =_) are muted during the execution of the -break-insert command.
The reason being that the client doesn't need to get notified of the
breakpoint creation for its own -break-insert command.
At first glance, it looks like a bug, the ^done response should probably
say type="hw breakpoint".
Simon
prev parent reply other threads:[~2023-05-09 18:26 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-09 15:29 bilal
2023-05-09 18:26 ` Simon Marchi [this message]
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=d0d71efa-202a-544b-fa92-70986ce61332@simark.ca \
--to=simark@simark.ca \
--cc=bilal@siemens.com \
--cc=gdb-patches@sourceware.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).