From: Alexandru-Adrian Oltean <adrian.oltean@nxp.com>
To: Yao Qi <qiyaoltc@gmail.com>
Cc: "Breazeal, Don" <Don_Breazeal@mentor.com>,
"gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: hbreak reads memory
Date: Tue, 02 Aug 2016 09:15:00 -0000 [thread overview]
Message-ID: <VI1PR0401MB2671142553ADA7CCA9826368F1050@VI1PR0401MB2671.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <CAH=s-PO2rUWbiFwMgtbsqDMNQnPB0fdmsmxe2HU9y4z7F7=pFQ@mail.gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2514 bytes --]
Thanks Yao for explaining the origin of that memory access. So reading memory for a
hbreak seems the expected behavior. My understanding was that setting a HW break
would not imply a mem read operation and I'd simply have to deal with setting that
HW break inside my debug stub. But the access can't be avoided as far as I understand
from you.
Thanks,
Adrian
-----Original Message-----
From: Yao Qi [mailto:qiyaoltc@gmail.com]
Sent: Tuesday, August 02, 2016 11:44 AM
To: Alexandru-Adrian Oltean <adrian.oltean@nxp.com>
Cc: Breazeal, Don <Don_Breazeal@mentor.com>; gdb@sourceware.org
Subject: Re: hbreak reads memory
On Thu, Jul 28, 2016 at 7:28 AM, Alexandru-Adrian Oltean <adrian.oltean@nxp.com> wrote:
> Hi Don,
>
> I forgot to mention one important thing in my previous email - I'm setting breaks using addresses not symbols.
> So even with this approach I'm still seeing that memory is being
> accessed. I'm expecting a hbreak on a given address to skip that function prologue analysis.
>
> Here's what I see when activating debug in gdb:
> hbreak *0xfff54d64
> Sending packet: $mfff54d64,4#36...Ack
> Packet received: E01
> Hardware assisted breakpoint 3 at 0xfff54d64
>
I don't think it is wrong for GDB to read that memory in 'hbreak'. 'hbreak'
means hardware breakpoint (rather than software breakpoint), so GDB shouldn't write breakpoint instruction to the address, but may need to read that piece of memory. If the memory is unreadable, your debug stub returns error.
The reason of memory access of 'hbreak' is that GDB checks whether there has been a permanent breakpoint on that address or not.
#9 0x00000000008c2457 in target_read_memory (memaddr=67336,
myaddr=0x7fff9a2ab5e0 "\265\v", len=4) at
/home/yao/SourceCode/gnu/gdb/git/gdb/target.c:1459
#10 0x00000000006c537d in program_breakpoint_here_p (gdbarch=0x621000139d10, address=67336) at
/home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:9135
#11 0x00000000006c5677 in bp_loc_is_permanent (loc=0x613000018a00) at
/home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:9165
#12 0x00000000006c51c9 in add_location_to_breakpoint (b=0x611000229380, sal=0x7fff9a2ab7d0) at
/home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:9102
#13 0x00000000006be6a9 in init_raw_breakpoint (b=0x611000229380, gdbarch=0x62100017d510, sal=..., bptype=bp_hardware_breakpoint,
ops=0x13d6200 <bkpt_breakpoint_ops>) at
/home/yao/SourceCode/gnu/gdb/git/gdb/breakpoint.c:7595
--
Yao (é½å°§)
\x16º&ÖëzÛ«vÓÙb²Ö«r\x18\x1d
prev parent reply other threads:[~2016-08-02 9:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 6:29 Alexandru-Adrian Oltean
2016-07-27 21:41 ` Breazeal, Don
2016-07-28 6:28 ` Alexandru-Adrian Oltean
[not found] ` <0CEE46EB9C50E44486A861D738D3E2067ED804CC@RS-MBS02.realsil.com.cn>
2016-08-02 6:53 ` Alexandru-Adrian Oltean
[not found] ` <CAH=s-PO2rUWbiFwMgtbsqDMNQnPB0fdmsmxe2HU9y4z7F7=pFQ@mail.gmail.com>
2016-08-02 9:15 ` Alexandru-Adrian Oltean [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=VI1PR0401MB2671142553ADA7CCA9826368F1050@VI1PR0401MB2671.eurprd04.prod.outlook.com \
--to=adrian.oltean@nxp.com \
--cc=Don_Breazeal@mentor.com \
--cc=gdb@sourceware.org \
--cc=qiyaoltc@gmail.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