From: "Maciej W. Rozycki" <macro@orcam.me.uk>
To: Andrew Burgess <aburgess@redhat.com>
Cc: Dragan Mladjenovic <Dragan.Mladjenovic@syrmia.com>,
gdb-patches@sourceware.org, Chao-ying Fu <cfu@wavecomp.com>
Subject: Re: [PATCH] gdb: mips: Add MIPSR6 support
Date: Mon, 3 Oct 2022 16:13:08 +0100 (BST) [thread overview]
Message-ID: <alpine.DEB.2.21.2210031549150.7637@angie.orcam.me.uk> (raw)
In-Reply-To: <87edvpgedx.fsf@redhat.com>
On Mon, 3 Oct 2022, Andrew Burgess wrote:
> > + /* Step through the forbidden slot to avoid repeated exceptions we do
> > + not currently have access to the BD bit when hitting a breakpoint
> > + and therefore cannot tell if the breakpoint hit on the branch or the
> > + forbidden slot. */
> > + /* delay_slot_size = 0; */
>
> It is probably just because I don't understand the MIPS architecture
> well enough, but I don't see the connection between the text of the
> comment, and the commented out source line.
>
> Assuming the comment is explaining why the source line is commented out,
> I'd like, at a minimum, to see the source line included within the same
> comment block.
>
> In general though, I'm not a fan of commented out code. The question I
> would ask is, when will it be un-commented? If the answer is never,
> then lets just remove the commented code.
>
> The next question I have is, if we can't include this code, then is
> something going to go wrong? What would be the expected consequence of
> this thing going wrong?
>
> My ideal comment would include a description of what might go wrong, why
> we can't solve the problem right now, and what we would need to do to
> fix it, in this case it seems like 'check the BD bit' would be part of
> the solution. This way, when someone hits the problem and tries to
> debug it, then they will see the comment and thing, "hey, that's the
> exact problem I'm seeing....".
FWIW there should be no problem with accessing the BD bit, which is in
the CP0 Cause register. It is a privileged register, but it's made
available to the debugger at least by Linux, and I believe FreeBSD as
well, with the BD bit faithfully reported.
It's also directly accessible with bare metal targets, though I can
imagine there might be complications depending on what debug firmware does
(MDI comes to mind, though I can't remember the details offhand), but
addressing that can be probably delegated to the relevant bare metal debug
stub.
Historically we've been avoiding placing breakpoints (either regular ones
or temporary single-stepping ones) in branch delay slots though, so why
should we start with the inclusion of MIPSr6 support? I guess we could
(and that could help in some debug scenarios), provided such a change has
been sufficiently verified, but that ought to be a separate submission.
In any case we have code already for delay slot avoidance, so I don't
think there's a need for R6 to make any extra arrangements apart from
letting that code know what the extra instructions are in R6 that have a
branch delay slot (either a regular one or a "forbidden" one).
As I say, FWIW.
Maciej
prev parent reply other threads:[~2022-10-03 15:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-28 15:03 Dragan Mladjenovic
2022-06-09 19:43 ` Dragan Mladjenovic
2022-07-18 13:04 ` [PING^3] " Dragan Mladjenovic
2022-09-19 12:03 ` [PING^4] " Dragan Mladjenovic
2022-10-03 14:39 ` Andrew Burgess
2022-10-03 15:13 ` Maciej W. Rozycki [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=alpine.DEB.2.21.2210031549150.7637@angie.orcam.me.uk \
--to=macro@orcam.me.uk \
--cc=Dragan.Mladjenovic@syrmia.com \
--cc=aburgess@redhat.com \
--cc=cfu@wavecomp.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).