Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Marc Gauthier <marc@tensilica.com>
To: Maxim Grigoriev <maxim2405@gmail.com>, Max Filippov <jcmvbkbc@gmail.com>
Cc: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: RE: xtensa: reading privileged special registers
Date: Mon, 18 Jul 2011 02:00:00 -0000	[thread overview]
Message-ID: <522C1DF17AF50042AD8AE87F7887BD3D01E849DCB7@exch.hq.tensilica.com> (raw)
In-Reply-To: <CAC3St3DkgTP_bAbpdSh6n3bVivik1tieUopy-jd-yNrEyE=C1A@mail.gmail.com>

Hi Max,

On Sun, Jul 17, 2011 at 1:28 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> I'm trying to read privileged SRs from a remote gdbserver by the gdb
> configured for the elf target. All gdb versions that I've tried (6.8,
> 7.2 and 7.3) return 0 for those registers.

Correct.  This is simply a consequence of gdbserver being designed/used to debug user processes.  And user processes don't have access to privileged registers, i.e. privileged registers aren't part of their context.  Hence, you can't see them.

To see privileged registers, you'd want a setup that can e.g. debug a kernel or raw hardware.  Most Xtensa processor users can generally use OCD (on-chip debug) and thus use Tensilica's xt-gdb connecting directly to the processor hardware via XOCD (Xtensa OCD Daemon) and a JTAG probe.  Of course, you don't get user-process level debugging that way, you simply see everything the processor is doing.  But you certainly get access to privileged registers, and anything the processor does.  Another alternative is kgdb, however I don't think it is working at the moment for the Xtensa arch (it used to long ago).

For simplicity, the same register set is generated both for user and kernel situations, so GDB lists privileged registers even for user processes (e.g. via gdbserver or Linux native), even though they're not accessible.  Maybe one day we'll fix that.

Hope that answers your question,

-Marc


  parent reply	other threads:[~2011-07-18  2:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-17 20:29 Max Filippov
2011-07-18  1:12 ` Maxim Grigoriev
     [not found] ` <CAC3St3DkgTP_bAbpdSh6n3bVivik1tieUopy-jd-yNrEyE=C1A@mail.gmail.com>
2011-07-18  2:00   ` Marc Gauthier [this message]
2011-07-18  8:38     ` Max Filippov
2011-07-18  8:20   ` Max Filippov

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=522C1DF17AF50042AD8AE87F7887BD3D01E849DCB7@exch.hq.tensilica.com \
    --to=marc@tensilica.com \
    --cc=gdb@sourceware.org \
    --cc=jcmvbkbc@gmail.com \
    --cc=maxim2405@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