From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13825 invoked by alias); 10 May 2002 03:55:18 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 13818 invoked from network); 10 May 2002 03:55:17 -0000 Received: from unknown (HELO localhost.redhat.com) (24.112.240.27) by sources.redhat.com with SMTP; 10 May 2002 03:55:17 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 3BB333DBA; Thu, 9 May 2002 23:55:16 -0400 (EDT) Message-ID: <3CDB44A4.8090609@cygnus.com> Date: Thu, 09 May 2002 20:55:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0rc1) Gecko/20020429 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Craig Hackney Cc: "'gdb@sources.redhat.com'" Subject: Re: Displaying more than 16 registers with GDB for ARM targets References: <2407239113CD914CBA855A47698F01B06222F8@SUGAH2.triscend.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-05/txt/msg00094.txt.bz2 > PROBLEM 1: > GDB uses a #define called NUM_REGS to determine how many > registers a target has, this #define uses gdbarch_num_regs() > to return the number of registers for a specific target. > For ARM targets, the number of registers is set by calling > set_gdbarch_num_regs() in arm-tdep.c the value passed is > NUM_GREGS + NUM_FREGS + NUM_SREGS which totals about 26. > > NUM_REGS is used to allocate memory for the register_valid, > and registers variables in regcache.c. Since my target returns > 37 registers, there is not enough space to store them all > using supply_register(). > SOLUTION: > Add a #define to arm-tdep.h called MAX_ARM_REGS, this #define > is the max number of registers for all ARM targets, currently > I'm using a value of 48, which is is enough for the currently > supported ARM registers, plus the extra ones I need. > This #define is then used in arm-tdep.c to set the number > of registers for the ARM target with the call to > set_gdbarch_num_regs(). Now when space is allocated for the > register_valid and registers variables, there is enough > space for my extra registers so I can call supply_register() > with out a core dump. As a rule of thumb[er groan] with GDB, adding #define's to headers suggests something going wrong. Have a closer look at arm_gdbarch_init(). You can change each of these parameters, as required from that function without adding extra #defines. > PROBLEM 2: > There is no way to dynamically change the register names > based on a target selection. For example, lets say I create > a remote target interface based on remote.c, when I read the > target registers by issuing the remote 'g' command I get > all 37 registers back from the target and inform GDB by calling > supply_register(). > Since GDB only displays registers that it has names for, and > my extra registers have no names, they are not displayed by > GDB. > SOLUTION: > I have expanded on GDBs 'set disassembly-flavor' command which > allows the selection of different names for the standard ARM > registers R0-R15. I don't think this is the way to do it. Per above, you simply want to modify arm_gdbarch_init() so that it correctly describes your new architecture. Separate to this, you may want to consider mechanisms for having the target (via gdbarch_update_p() et.al.) notifing core gdb of the current architecture (for instance your new architecture). enjoy, Andrew