Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>
Cc: der.herr@hofr.at, gdb@sourceware.org
Subject: Re: /gdb/regcache.c question
Date: Sun, 02 Apr 2006 16:33:00 -0000	[thread overview]
Message-ID: <20060402163318.GA10017@nevyn.them.org> (raw)
In-Reply-To: <200604021349.k32Dni9q004148@elgar.sibelius.xs4all.nl>

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


      reply	other threads:[~2006-04-02 16:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-02  7:45 Der Herr Hofrat
2006-04-02 12:44 ` Mark Kettenis
2006-04-02 13:37   ` Der Herr Hofrat
2006-04-02 13:49     ` Mark Kettenis
2006-04-02 16:33       ` Daniel Jacobowitz [this message]

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=20060402163318.GA10017@nevyn.them.org \
    --to=drow@false.org \
    --cc=der.herr@hofr.at \
    --cc=gdb@sourceware.org \
    --cc=mark.kettenis@xs4all.nl \
    /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