public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: "bilal@siemens.com" <bilal@siemens.com>
To: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Differences in MI Breakpoint Notification for GDB CLI and MI Command
Date: Tue, 9 May 2023 15:29:48 +0000	[thread overview]
Message-ID: <PSAPR06MB400589301E05B2EFCD623206B5769@PSAPR06MB4005.apcprd06.prod.outlook.com> (raw)

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?


Thanks
-Bilal
    

             reply	other threads:[~2023-05-09 15:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-09 15:29 bilal [this message]
2023-05-09 18:26 ` Simon Marchi

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=PSAPR06MB400589301E05B2EFCD623206B5769@PSAPR06MB4005.apcprd06.prod.outlook.com \
    --to=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).