From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18545 invoked by alias); 2 Apr 2006 16:33:27 -0000 Received: (qmail 18537 invoked by uid 22791); 2 Apr 2006 16:33:26 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Sun, 02 Apr 2006 16:33:25 +0000 Received: from drow by nevyn.them.org with local (Exim 4.54) id 1FQ5Vu-0002hH-UG; Sun, 02 Apr 2006 12:33:19 -0400 Date: Sun, 02 Apr 2006 16:33:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis Cc: der.herr@hofr.at, gdb@sourceware.org Subject: Re: /gdb/regcache.c question Message-ID: <20060402163318.GA10017@nevyn.them.org> Mail-Followup-To: Mark Kettenis , der.herr@hofr.at, gdb@sourceware.org References: <200604031349.k33DnEk24211@hofr.at> <200604021349.k32Dni9q004148@elgar.sibelius.xs4all.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200604021349.k32Dni9q004148@elgar.sibelius.xs4all.nl> User-Agent: Mutt/1.5.8i X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2006-04/txt/msg00007.txt.bz2 On Sun, Apr 02, 2006 at 03:49:44PM +0200, Mark Kettenis wrote: > No, the bug is that the code that parses your collect command is > asking for the type of a register number that doesn't exist. That > typo should have been caught much earlier before register_type() was > called. The most useful thing to provide when you hit an abort is the backtrace. Then we can figure out where the real bug is. This one's easy to reproduce. regnum == 51, descr->nr_cooked_registers == 50. It turns out that the problem is "user registers", which are implemented sort of off to the side of the regcache. user_reg_map_name_to_regnum returns 51 for i386's "pc". 0 <= x < NUM_REGS : raw registers NUM_REGS <= x < NUM_REGS + NUM_PSEUDO_REGS : cooked pseudo registers NUM_REGS + NUM_PSEUDO_REGS <= x : "user" registers The only thing that user registers have is a value, and you can get at their type through the value. The user-regs and std-regs infrastructure isn't much used; I don't know what the plan was for it. I don't think we can collect user registers without changing the interface. It is only used for $pc, $sp, $fp, and $ps. For $sp and $ps it either returns a normal register or an error. For $fp and $pc it's a bit more complicated. Anyway, for now the easiest thing to do would be to refuse to collect registers >= NUM_REGS + NUM_PSEUDO_REGS. -- Daniel Jacobowitz CodeSourcery