This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: xtensa: reading privileged special registers


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]