public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
From: "Eli Zaretskii" <eliz@gnu.org>
To: gdb@sourceware.org
Subject: Re: RFC: Available registers as a target property
Date: Sat, 07 May 2005 10:25:00 -0000	[thread overview]
Message-ID: <01c552ee$Blat.v2.4$e21a5dc0@zahav.net.il> (raw)
In-Reply-To: <20050506162029.GA30792@nevyn.them.org> (message from Daniel Jacobowitz on Fri, 6 May 2005 12:20:29 -0400)

> Date: Fri, 6 May 2005 12:20:29 -0400
> From: Daniel Jacobowitz <drow@false.org>
> 
> Please bear with me; this is so long-winded I felt the need to give it
> section titles.  I'm interested in any and all comments about the problem or
> about my solution.  I hope to start implementing within a couple of weeks.

Thanks.

> Today, the contents of the register cache and the layout of GDB's regnum
> space are determined by the gdbarch.  There are several hooks for this,
> primarily these three:
> 
> 	num_regs
> 	register_name
> 	register_type
> 
> The gdbarch determines what raw registers are available.  But this isn't a
> perfect match with what raw registers are _really_ available, because the
> gdbarch only has the clues we use to select a gdbarch available: things like
> byte order and BFD machine number.  At best, those tell us what registers
> the binary we're debugging requires.  The runtime set of registers we can
> see are a property of the target, not of the gdbarch.

BTW, I'd be thrilled to see these issues spelled out and explained in
gdbint.texinfo.  Right now, that part of the internals manual is a
mess of outdated information and incomplete or non-existent
description of new features.  If you, or someone else, could offer
even unstructured text, I could use that to start working on the
manual.  I think it's absurd that such a central part of GDB's
internals is not documented in any reasonable way.

> After connecting to a target, GDB checks the current gdbarch for a new
> method, gdbarch_set_available_registers.  If the architecture does not
> provide this method, the rest of the process is skipped.
> 
> GDB then reads the TARGET_OBJECT_AVAILABLE_REGISTERS object from the target,
> parses it, and hands it to the gdbarch for final processing.  This means
> that the object must have a target-independent format, although it will
> have target-dependent content also.
> 
> The target calls gdbarch_update_p with an appropriately filled in argument,
> which calls its gdbarch_init routine, which can then do the real work of
> updating gdbarch_num_regs et cetera.  This means that the gdbarch_init
> routine must correctly handle filling in defaults based on the last
> architecture.  That code is a bit fragile because it's undertested; I
> recently updated ARM to do this robustly.

FWIW, I think it's a good idea to add this to GDB.  However, I'm
puzzled why your proposal sounds limited to remote targets (the
explicit references to the remote protocol and the syntax of the data
objects seem to suggest that).  Isn't this problem relevant to native
debugging as well?  If it is, then why not describe the solution in
more general terms, so that they will be appropriate for native
targets?

Also, is it indeed a fact that information about registers is the only
issue GDB has to deal with in such situations?  Maybe we need to think
about a more general mechanism, even if for now we only pass
register-related information.

> I created a gdbarch hook which returns a string describing the capabilities

You consistently talk about strings as representing the target
capabilities.  Why not design a C data structure instead?  A string is
an inefficient way of passing information around.

  reply	other threads:[~2005-05-07 10:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-06 16:20 Daniel Jacobowitz
2005-05-07 10:25 ` Eli Zaretskii [this message]
2005-05-07 16:19   ` Daniel Jacobowitz
2005-05-07 19:37     ` Eli Zaretskii
2005-05-09 15:37       ` Daniel Jacobowitz
2005-05-09 20:58         ` Eli Zaretskii
2005-05-07 16:04 ` Mark Kettenis
2005-05-09 16:20   ` Daniel Jacobowitz
2005-05-09 15:57 ` Paul Brook
2005-05-09 16:32   ` Daniel Jacobowitz
2005-05-09 21:33 ` Chris Zankel
2005-05-09 23:07   ` Daniel Jacobowitz
2005-05-10  0:23     ` Chris Zankel
2005-05-10 21:08       ` Daniel Jacobowitz
2005-05-12 23:35         ` Chris Zankel
2005-05-17 14:03           ` Daniel Jacobowitz
2005-05-10  0:54 ` Ramana Radhakrishnan
2005-05-10 21:14   ` Daniel Jacobowitz
2005-05-17 19:32 ` Daniel Jacobowitz
2005-05-18  9:29   ` Richard Earnshaw
2005-05-19  1:00     ` Daniel Jacobowitz
2005-05-20 14:54       ` Richard Earnshaw
2005-05-09 22:39 Paul Schlie
2005-05-10  0:03 Paul Schlie
2005-05-10 11:12 Paul Schlie
2005-05-17 23:08 Paul Schlie

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='01c552ee$Blat.v2.4$e21a5dc0@zahav.net.il' \
    --to=eliz@gnu.org \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).