From: "Nathan J. Williams" <nathanw@wasabisystems.com>
To: vexspam-gdbmail@usa.net
Cc: <gdb@sourceware.org>
Subject: Re: gdbserver-6.3 : Next command gets stuck then zooms.
Date: Wed, 11 Jan 2006 05:27:00 -0000 [thread overview]
Message-ID: <mtuslrvz64e.fsf@contents-vnder-pressvre.mit.edu> (raw)
In-Reply-To: <192kaJwZr7568S07.1136931943@cmsweb07.cms.usa.net>
vexspam-gdbmail@usa.net writes:
> In the Virtex-4 (405-ish as you know) the MSR doesn't have a single step
> enable (SE bit) - it does have a debug interrupt enable (DE bit).
>
> If you know - what is the expected flow of operations I should be seeing
> for the next command?
Roughly, what the kernel should do is to set the DE bit in the MSR and
also set the Instruction Complete (ICMP) bit in DBCR0, which gives you
a trap after each instruction. However, you have to be sure your trap
handler for the debug exception can handle (ignore and return from,
mostly) debug traps that happen at the first instruction of *other*
exception handlers, because the DE bit of the MSR isn't cleared when,
for example, you take a TLB miss exception.
So gdbserver calls ptrace(PTRACE_SSTEP), the kernel turns on ICMP and
sets DE in the process's MSR, returns to userland, takes a TLB miss on
the instruction for whatever reason, enters the TLB miss handler, and
then takes a debug exception for the completion of the first
instruction in the TLB miss handler. The debug exception handler needs
to notice this (perhaps by checking the value of CSRR0 against known
kernel code addresses or known exception handler code addresses),
clear DE in CSRR1 but leave it alone in SRR1, and return to the TLB
miss handler. The miss handler will then finish unmolested and return
to the program, which can *then* trigger the debug exception for
completing an instruction you were actually interested in.
Have fun!
- Nathan
next prev parent reply other threads:[~2006-01-11 5:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-10 22:25 vexspam-gdbmail
2006-01-11 4:20 ` Daniel Jacobowitz
2006-01-11 5:27 ` Nathan J. Williams [this message]
-- strict thread matches above, loose matches on Subject: below --
2006-01-10 20:09 vexspam-gdbmail
2006-01-10 21:43 ` Daniel Jacobowitz
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=mtuslrvz64e.fsf@contents-vnder-pressvre.mit.edu \
--to=nathanw@wasabisystems.com \
--cc=gdb@sourceware.org \
--cc=vexspam-gdbmail@usa.net \
/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