From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28061 invoked by alias); 18 Jul 2011 02:00:47 -0000 Received: (qmail 27932 invoked by uid 22791); 18 Jul 2011 02:00:46 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SARE_TOCC_CONS6s X-Spam-Check-By: sourceware.org Received: from mailgw.tensilica.com (HELO mailgw.tensilica.com) (65.119.96.134) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 18 Jul 2011 02:00:31 +0000 Received: from localhost (unknown [127.0.0.1]) by mailgw.tensilica.com (Postfix) with ESMTP id 8B6A11160580; Mon, 18 Jul 2011 02:00:29 +0000 (UTC) Received: from mailgw.tensilica.com ([127.0.0.1]) by localhost (mailgw.tensilica.com [127.0.0.1]) (amavisd-maia, port 10024) with ESMTP id 03734-08; Sun, 17 Jul 2011 19:00:29 -0700 (PDT) Received: from mail.tensilica.com (mail.tensilica.com [192.168.15.138]) by mailgw.tensilica.com (Postfix) with ESMTP id 5BD38116057F; Sun, 17 Jul 2011 19:00:29 -0700 (PDT) Received: from exch.hq.tensilica.com ([::1]) by exch.hq.tensilica.com ([::1]) with mapi; Sun, 17 Jul 2011 19:00:29 -0700 From: Marc Gauthier To: Maxim Grigoriev , Max Filippov CC: "gdb@sourceware.org" Date: Mon, 18 Jul 2011 02:00:00 -0000 Subject: RE: xtensa: reading privileged special registers Message-ID: <522C1DF17AF50042AD8AE87F7887BD3D01E849DCB7@exch.hq.tensilica.com> References: <201107180028.54700.jcmvbkbc@gmail.com> In-Reply-To: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2011-07/txt/msg00075.txt.bz2 Hi Max, On Sun, Jul 17, 2011 at 1:28 PM, Max Filippov 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 r= egisters, i.e. privileged registers aren't part of their context. Hence, y= ou can't see them. To see privileged registers, you'd want a setup that can e.g. debug a kerne= l or raw hardware. Most Xtensa processor users can generally use OCD (on-c= hip debug) and thus use Tensilica's xt-gdb connecting directly to the proce= ssor hardware via XOCD (Xtensa OCD Daemon) and a JTAG probe. Of course, yo= u don't get user-process level debugging that way, you simply see everythin= g the processor is doing. But you certainly get access to privileged regis= ters, and anything the processor does. Another alternative is kgdb, howeve= r 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. Mayb= e one day we'll fix that. Hope that answers your question, -Marc