From: Pedro Alves <palves@redhat.com>
To: "Maciej W. Rozycki" <macro@codesourcery.com>
Cc: gdb-patches@sourceware.org, Luis Machado <lgustavo@codesourcery.com>
Subject: Re: [PATCH] Avoid software breakpoint's instruction shadow inconsistency
Date: Mon, 29 Sep 2014 20:56:00 -0000 [thread overview]
Message-ID: <5429C75C.3000309@redhat.com> (raw)
In-Reply-To: <alpine.DEB.1.10.1409291950540.4971@tp.orcam.me.uk>
On 09/29/2014 08:11 PM, Maciej W. Rozycki wrote:
> On Mon, 29 Sep 2014, Pedro Alves wrote:
>> It doesn't look like to me that this is really the problem, since
>> default_memory_insert_breakpoint adjusts bp_tgt->placed_address
>> before reading memory.
>
> Not true (from `mips_breakpoint_from_pc'):
>
> insn = mips_fetch_instruction (gdbarch, ISA_MICROMIPS, pc, &status);
> size = status ? 2
> : mips_insn_size (ISA_MICROMIPS, insn) == 2 ? 2 : 4;
> *pcptr = unmake_compact_addr (pc);
>
> (hmm, weird indentation here, will have to fix) -- as you can see
> `mips_fetch_instruction' (that reads the instruction under `pc') is called
> before the ISA bit is stripped as `pc' is written back to `*pcptr', and
> `pc' has to have the ISA bit set for the reasons I stated in the last
> mail.
Ah! That's the part that I was missing. I see now.
>
> Maybe I could work it around by writing `*pcptr' back first (and still
> calling `mips_fetch_instruction' with the original `pc'), but that looks
> hackish to me; first of all there is no contract in the API between the
> implementation of `gdbarch_breakpoint_from_pc' and its callers that memory
> behind `pcptr' is the address used for breakpoint shadowing. I think the
> data structures used for shadowing should simply be consistent all the
> time.
Agreed.
So, we could fix this by not ever trying to re-insert a memory
breakpoint that has a shadow buffer. But, if we ever decide
we want to record a shadow buffer for target-managed breakpoint
that ends up reinserted, we'll end up with the same problem again.
So might as well go with your patch.
>> would be unnecessary.
>
> But as I noted that breaks mips_breakpoint_from_pc, you must not
> overwrite `placed_address' once the instruction shadow has been made.
>
Indeed.
>> I could be missing something else, of course.
That's what I was missing...
Patch is OK. Please push.
Thanks,
Pedro Alves
next prev parent reply other threads:[~2014-09-29 20:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-23 17:08 Maciej W. Rozycki
2014-09-23 17:45 ` Pedro Alves
2014-09-23 18:11 ` Maciej W. Rozycki
2014-09-23 18:34 ` Maciej W. Rozycki
2014-09-29 18:29 ` Pedro Alves
2014-09-29 19:12 ` Maciej W. Rozycki
2014-09-29 20:22 ` Maciej W. Rozycki
2014-09-29 20:56 ` Pedro Alves [this message]
2014-10-03 11:57 ` Maciej W. Rozycki
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=5429C75C.3000309@redhat.com \
--to=palves@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=lgustavo@codesourcery.com \
--cc=macro@codesourcery.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