Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: der.herr@hofr.at
Cc: mark.kettenis@xs4all.nl, der.herr@hofr.at, gdb@sourceware.org
Subject: Re: /gdb/regcache.c question
Date: Sun, 02 Apr 2006 13:49:00 -0000	[thread overview]
Message-ID: <200604021349.k32Dni9q004148@elgar.sibelius.xs4all.nl> (raw)
In-Reply-To: <200604031349.k33DnEk24211@hofr.at> (message from Der Herr Hofrat 	on Mon, 3 Apr 2006 15:49:14 +0200 (CEST))

> From: Der Herr Hofrat <der.herr@hofr.at>
> Date: Mon, 3 Apr 2006 15:49:14 +0200 (CEST)
> 
> > > gdb/regcache.c:159-165
> > > struct type *
> > > register_type (struct gdbarch *gdbarch, int regnum)
> > > {
> > >   struct regcache_descr *descr = regcache_descr (gdbarch);
> > >   gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
> > >   return descr->register_type[regnum];
> > > }
> > > 
> > > 
> > >  So a simple misstyp of the register name runs into an assertion
> > >  with a core file dumped - this makes sense for automatic generation
> > >  - but for tracepoints you need to manually be able to pass
> > >  registers with collect $REGNAME , and for that case gdb_assert ->
> > >  corfile is a little harsh on the user.
> > 
> > I don't understand what you're doing here, but that gdb_assert (and
> > all gdb_asserts in the code) is checking for a "should not happen"
> > condition.  If you hit one, it means there's a bug in some other piece
> > of gdb code.  You should find and fix that bug.
> > 

> the bug is a simple typo in a collect command - if you type in 
> $pc on x86 it will give you the above assertion if you use any 
> actually defined registers all is fine (and data is collected)
> My assumption is that the assertion was put in there to catch 
> incorrect register names that are generated automatically, but
> not interactively.

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.

Mark


  reply	other threads:[~2006-04-02 13:49 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 [this message]
2006-04-02 16:33       ` Daniel Jacobowitz

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=200604021349.k32Dni9q004148@elgar.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=der.herr@hofr.at \
    --cc=gdb@sourceware.org \
    /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