Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb@sources.redhat.com
Subject: The REG_NUM and REGISTER_BYTES problem
Date: Fri, 30 Nov 2001 19:23:00 -0000	[thread overview]
Message-ID: <3C084D16.4090205@cygnus.com> (raw)

Hello,

This is one of those ``in the beginning there was a VAX and life was 
good'' stories.  Rather than start that way, lets try something 
different, in the beginning there was an m68k, er no, never mind ...

Each GDB architecture defines two constants:

	NUM_REGS -> number of ``real registers''
	REGISTER_BYTES -> number of byte the real registers occupy

Simple eh?

The problem is that this pair is very heavily entrenced in the way GDB 
views the world - they have come to mean a lot more.  For instance:

	o	A G packet is REGISTER_BYTES in size
		and can contain only NUM_REG registers.

		If, for some reason, you have a lot of
		``real registers'' (i586 has the potential
		for 4 billion) then you're a bit stuffed.

	o	The regcache is REGISTER_BYTES in size.

	o	The generic inferior function call code
		assumes that, to save the target state,
		it just needs to slurp REGISTER_BYTES from
		the target stack and it can fetch any NUM_REG
		from that saved state.

		If you only think a subset of those
		registers should be saved or if you want
		to save both registers and memory then
		your out of luck.

These problems come to a head when you try to do things like:

	o	increase the number of ``real registers''
		with out increasing the G packet size.

	o	increase the size of the regcache via
		REGISTER_BYTES without forcing up the
		size of that G packet.

	o	Add registers that you don't want saved/restored.

To address this, I intend changing regcache and remote.c so that they 
treat all registers equal (don't differentiate between real and psuedo 
registers).  Instead, regchace reserves space for all of them, and 
remote.c will fetch any of them when so asked.  Exactly what to do with 
all that potential regcache space being the responsibility of the target 
architecture.

By doing this, the immdiate restriction of not being able to expand the 
number of registers is lifted.  While some of REGISTER_BYTES and 
NUM_REGS special effects will remain, they won't be causing GDB's 
ability to handle large register sets.

Thoughts?

Andrew


WARNING: multiple messages have this Message-ID
From: Andrew Cagney <ac131313@cygnus.com>
To: gdb@sources.redhat.com
Subject: The REG_NUM and REGISTER_BYTES problem
Date: Sun, 25 Nov 2001 12:44:00 -0000	[thread overview]
Message-ID: <3C084D16.4090205@cygnus.com> (raw)
Message-ID: <20011125124400.i80tzciaXD_qfhPXDvzyVoXty72JmbbvDK22xLl_X0E@z> (raw)

Hello,

This is one of those ``in the beginning there was a VAX and life was 
good'' stories.  Rather than start that way, lets try something 
different, in the beginning there was an m68k, er no, never mind ...

Each GDB architecture defines two constants:

	NUM_REGS -> number of ``real registers''
	REGISTER_BYTES -> number of byte the real registers occupy

Simple eh?

The problem is that this pair is very heavily entrenced in the way GDB 
views the world - they have come to mean a lot more.  For instance:

	o	A G packet is REGISTER_BYTES in size
		and can contain only NUM_REG registers.

		If, for some reason, you have a lot of
		``real registers'' (i586 has the potential
		for 4 billion) then you're a bit stuffed.

	o	The regcache is REGISTER_BYTES in size.

	o	The generic inferior function call code
		assumes that, to save the target state,
		it just needs to slurp REGISTER_BYTES from
		the target stack and it can fetch any NUM_REG
		from that saved state.

		If you only think a subset of those
		registers should be saved or if you want
		to save both registers and memory then
		your out of luck.

These problems come to a head when you try to do things like:

	o	increase the number of ``real registers''
		with out increasing the G packet size.

	o	increase the size of the regcache via
		REGISTER_BYTES without forcing up the
		size of that G packet.

	o	Add registers that you don't want saved/restored.

To address this, I intend changing regcache and remote.c so that they 
treat all registers equal (don't differentiate between real and psuedo 
registers).  Instead, regchace reserves space for all of them, and 
remote.c will fetch any of them when so asked.  Exactly what to do with 
all that potential regcache space being the responsibility of the target 
architecture.

By doing this, the immdiate restriction of not being able to expand the 
number of registers is lifted.  While some of REGISTER_BYTES and 
NUM_REGS special effects will remain, they won't be causing GDB's 
ability to handle large register sets.

Thoughts?

Andrew


             reply	other threads:[~2001-11-30 19:23 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-30 19:23 Andrew Cagney [this message]
2001-11-25 12:44 ` Andrew Cagney
2001-12-02 15:02 ` Daniel Jacobowitz
2001-12-02 21:22   ` 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=3C084D16.4090205@cygnus.com \
    --to=ac131313@cygnus.com \
    --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