From: Andrew Cagney <ac131313@cygnus.com>
To: Daniel Jacobowitz <dmj+@andrew.cmu.edu>
Cc: gdb@sources.redhat.com
Subject: Re: parcelling up struct gdbarch
Date: Sat, 14 Jul 2001 08:33:00 -0000 [thread overview]
Message-ID: <3B506250.5080502@cygnus.com> (raw)
In-Reply-To: <20010713145356.A4898@nevyn.them.org>
> Indeed. The current errors on one typical target - powerpc-linux -
> are:
>
> undefined reference to `current_gdbarch'
> undefined reference to `gdbarch_cannot_store_register'
> undefined reference to `gdbarch_fp_regnum'
> undefined reference to `gdbarch_npc_regnum'
> undefined reference to `gdbarch_pc_regnum'
> undefined reference to `gdbarch_register_byte'
> undefined reference to `gdbarch_register_bytes'
> undefined reference to `gdbarch_register_raw_size'
> undefined reference to `gdbarch_sp_regnum'
Live dangerously, try linking against libgdb.a :-)
> REGISTER_BYTES, KERNEL_U_ADDR, PC_REGNUM, SP_REGNUM, FP_REGNUM
REGISTER_BYTES is hard, I'll ignore it for the moment :-)
KERNEL_U_ADDR lives in nm.h so that one is probably ok.
As for PC_REGNUM, NPC_REGNUM, ... SP_REGNUM and FP_REGNUM, I think we
need to study a little history.
~'70: Wirth introduces pascal. By now everyone is convinced that
procedural languages need a program-counter, stack-pointer, dynamic-link
and static-link. Life was good.
~'79: The VAX appears, like everyone else they follow the DL/SL/SP
mantra and hence the VAX has a stack-pointer and a frame-pointer (DL).
I don't remember what was done with the static-link but, regardless,
life was good.
~'84: RMS writes GDB 0.0. It assumes FP, PC and SP are all raw
registers. Live was good.
Unfortunatly, from here on in, things started to go wrong: NPC_REGNUM,
then NNPC_REGNUM get added, DECR_PC_AFTER_BREAK was added, the MIPS gets
a bogus FP register and then proceeds to assume it is real, the arm gets
two FP registers, and finally GDB gets PSEUDO registers. Things are no
longer so good. In fact, thanks to DECR_PC_AFTER_BREAK, things are down
right miserable.
So we turn to now. Refering to figure ``1'':
> nat-register layout
> |
> |(*-nat.c)
> |
> raw register layout
> |
> |(*frame*)
> |
> cooked register layout
While it's taken 15 years to figure out, I think this is a register
model that works. As far as core GDB is concerned PC_REGNUM, FP_REGNUM,
SP_REGNUM et.al. are all cooked registers. While for many targets,
RAW_FP_REGNUM == COOKED_FP_REGNUM, might be true, they are separate.
The gdbserver code that refers to those macros has, has a result of the
above revalation, become wrong. The nat code, in general, should refer
to nat, raw or G register numbering and not cooked registers. When it
comes to the registers to pass back with the T packet, I think it should
be given an explicit list.
--
Looking to the future, PC_REGNUM, will get more interesting. Core GDB
has the idea of a stop-address and a continuation-address.
{read,write}_pc() control this. If someone ever tries to implement more
complex operations in gdbserver then they are going to need those
functions, or similar, to determine the ``cooked'' PC.
Andrew
next prev parent reply other threads:[~2001-07-14 8:33 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-07-13 0:16 Daniel Jacobowitz
2001-07-13 12:35 ` Andrew Cagney
2001-07-13 14:53 ` Daniel Jacobowitz
2001-07-14 8:33 ` Andrew Cagney [this message]
2001-07-16 11:25 ` Daniel Jacobowitz
2001-07-16 11:27 ` H . J . Lu
2001-07-16 12:04 ` Andrew Cagney
2001-07-16 12:34 ` J.T. Conklin
2001-07-16 15:30 ` Andrew Cagney
2001-07-16 15:40 ` Daniel Jacobowitz
2001-07-16 17:24 ` gdbserver (was Re: parcelling up struct gdbarch) Fabrice Gautier
2001-07-16 21:17 ` Daniel Jacobowitz
2001-07-16 22:22 ` Fabrice Gautier
2001-07-16 22:28 ` Daniel Jacobowitz
2001-07-17 10:00 ` Andrew Cagney
2001-07-17 10:11 ` Daniel Jacobowitz
2001-07-17 11:10 ` Andrew Cagney
2001-07-17 11:21 ` Daniel Jacobowitz
2001-07-17 11:46 ` Andrew Cagney
2001-07-17 10:36 ` Quality Quorum
2001-07-16 13:05 ` parcelling up struct gdbarch Daniel Jacobowitz
2001-07-16 15:15 ` Andrew Cagney
2001-07-16 15:49 ` Daniel Jacobowitz
2001-07-17 10:46 ` Andrew Cagney
2001-07-17 11:03 ` Daniel Jacobowitz
2001-07-17 11:37 ` Andrew Cagney
2001-07-18 13:21 ` Daniel Jacobowitz
2001-07-18 22:53 ` Andrew Cagney
2001-07-18 23:22 ` Daniel Jacobowitz
2001-07-19 0:23 ` Daniel Jacobowitz
2001-07-19 7:51 ` Andrew Cagney
2001-07-19 7:44 ` Andrew Cagney
2001-07-18 8:09 ` Andrew Cagney
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=3B506250.5080502@cygnus.com \
--to=ac131313@cygnus.com \
--cc=dmj+@andrew.cmu.edu \
--cc=gdb@sources.redhat.com \
/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