public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* A matter of taste?
@ 2003-07-09 13:55 Corinna Vinschen
  2003-07-09 14:03 ` register_size question (was Re: A matter of taste?) Corinna Vinschen
  2003-07-09 14:10 ` A matter of taste? Andreas Schwab
  0 siblings, 2 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-07-09 13:55 UTC (permalink / raw)
  To: gdb

Hi,

I'm currently substituting a bunch of calls to REGISTER_RAW_SIZE.
Since REGISTER_RAW_SIZE should be removed entirely, I was wondering
how to do it most nicely.

What I don't quite get is the implementation of function register_size
in regcache.c.  It retrieves the size of the regsiter from the 
regcache and then checks twice(!) if that size equals REGISTER_RAW_SIZE.
If I understand that correctly, a multi-arched target which got rid of
REGISTER_RAW_SIZE can't use register_size () since the REGISTER_RAW_SIZE
calls in register_size will raise an internal_error in
gdbarch_deprecated_register_raw_size().

What is that good for?  And what's the substitute for a target with
no REGISTER_RAW_SIZE implementation?  One idea is to use the constant
byte size in cases where it's clear (the tdep code typically knows
the register size).  But that looks always a bit ugly.  So, would

  TYPE_LENGTH (gdbarch_register_type (gdbarch, regnum))

be a good way to do it?


Corinna

^ permalink raw reply	[flat|nested] 5+ messages in thread

* register_size question (was Re: A matter of taste?)
  2003-07-09 13:55 A matter of taste? Corinna Vinschen
@ 2003-07-09 14:03 ` Corinna Vinschen
  2003-07-09 14:10 ` A matter of taste? Andreas Schwab
  1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-07-09 14:03 UTC (permalink / raw)
  To: gdb

Oops, sorry for the weird subject, I mixed the subject of one
mail with the content of another one. :-(((

I'm going to send a patch related to this mail to gdb-patches in a
minute (with a better subject, of course).

Corinna

On Wed, Jul 09, 2003 at 03:55:43PM +0200, Corinna Vinschen wrote:
> Hi,
> 
> I'm currently substituting a bunch of calls to REGISTER_RAW_SIZE.
> Since REGISTER_RAW_SIZE should be removed entirely, I was wondering
> how to do it most nicely.
> 
> What I don't quite get is the implementation of function register_size
> in regcache.c.  It retrieves the size of the regsiter from the 
> regcache and then checks twice(!) if that size equals REGISTER_RAW_SIZE.
> If I understand that correctly, a multi-arched target which got rid of
> REGISTER_RAW_SIZE can't use register_size () since the REGISTER_RAW_SIZE
> calls in register_size will raise an internal_error in
> gdbarch_deprecated_register_raw_size().
> 
> What is that good for?  And what's the substitute for a target with
> no REGISTER_RAW_SIZE implementation?  One idea is to use the constant
> byte size in cases where it's clear (the tdep code typically knows
> the register size).  But that looks always a bit ugly.  So, would
> 
>   TYPE_LENGTH (gdbarch_register_type (gdbarch, regnum))
> 
> be a good way to do it?
> 
> 
> Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A matter of taste?
  2003-07-09 13:55 A matter of taste? Corinna Vinschen
  2003-07-09 14:03 ` register_size question (was Re: A matter of taste?) Corinna Vinschen
@ 2003-07-09 14:10 ` Andreas Schwab
  2003-07-09 14:20   ` Corinna Vinschen
  2003-07-09 14:24   ` Andrew Cagney
  1 sibling, 2 replies; 5+ messages in thread
From: Andreas Schwab @ 2003-07-09 14:10 UTC (permalink / raw)
  To: gdb

Corinna Vinschen <vinschen@redhat.com> writes:

|> Hi,
|> 
|> I'm currently substituting a bunch of calls to REGISTER_RAW_SIZE.
|> Since REGISTER_RAW_SIZE should be removed entirely, I was wondering
|> how to do it most nicely.
|> 
|> What I don't quite get is the implementation of function register_size
|> in regcache.c.  It retrieves the size of the regsiter from the 
|> regcache and then checks twice(!) if that size equals REGISTER_RAW_SIZE.

The second check probabably should have been against
REGISTER_VIRTUAL_SIZE.

|> If I understand that correctly, a multi-arched target which got rid of
|> REGISTER_RAW_SIZE can't use register_size () since the REGISTER_RAW_SIZE
|> calls in register_size will raise an internal_error in
|> gdbarch_deprecated_register_raw_size().

If you don't define REGISTER_RAW_SIZE then it is defined to
generic_register_size, which uses TYPE_LENGTH.

|> What is that good for?  And what's the substitute for a target with
|> no REGISTER_RAW_SIZE implementation?

Just use register_size.  Works fine on m68k.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A matter of taste?
  2003-07-09 14:10 ` A matter of taste? Andreas Schwab
@ 2003-07-09 14:20   ` Corinna Vinschen
  2003-07-09 14:24   ` Andrew Cagney
  1 sibling, 0 replies; 5+ messages in thread
From: Corinna Vinschen @ 2003-07-09 14:20 UTC (permalink / raw)
  To: gdb

On Wed, Jul 09, 2003 at 04:09:20PM +0200, Andreas Schwab wrote:
> If you don't define REGISTER_RAW_SIZE then it is defined to
> generic_register_size, which uses TYPE_LENGTH.

Uh, I failed to notice that.  The check for 0 pointer in
gdbarch_deprecated_register_raw_size led me to believe that
deprecated_register_raw_size is initialized to 0.

Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Developer
Red Hat, Inc.
mailto:vinschen@redhat.com

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: A matter of taste?
  2003-07-09 14:10 ` A matter of taste? Andreas Schwab
  2003-07-09 14:20   ` Corinna Vinschen
@ 2003-07-09 14:24   ` Andrew Cagney
  1 sibling, 0 replies; 5+ messages in thread
From: Andrew Cagney @ 2003-07-09 14:24 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

> Corinna Vinschen <vinschen@redhat.com> writes:
> 
> |> Hi,
> |> 
> |> I'm currently substituting a bunch of calls to REGISTER_RAW_SIZE.
> |> Since REGISTER_RAW_SIZE should be removed entirely, I was wondering
> |> how to do it most nicely.
> |> 
> |> What I don't quite get is the implementation of function register_size
> |> in regcache.c.  It retrieves the size of the regsiter from the 
> |> regcache and then checks twice(!) if that size equals REGISTER_RAW_SIZE.
> 
> The second check probabably should have been against
> REGISTER_VIRTUAL_SIZE.

but it turned out that enabling it would have broken some targets :-(

> |> If I understand that correctly, a multi-arched target which got rid of
> |> REGISTER_RAW_SIZE can't use register_size () since the REGISTER_RAW_SIZE
> |> calls in register_size will raise an internal_error in
> |> gdbarch_deprecated_register_raw_size().
> 
> If you don't define REGISTER_RAW_SIZE then it is defined to
> generic_register_size, which uses TYPE_LENGTH.

Yes.

> |> What is that good for?  And what's the substitute for a target with
> |> no REGISTER_RAW_SIZE implementation?
> 
> Just use register_size.  Works fine on m68k.
> 
> Andreas.

I'll adjust the comments.

Andrew


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-07-09 14:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-09 13:55 A matter of taste? Corinna Vinschen
2003-07-09 14:03 ` register_size question (was Re: A matter of taste?) Corinna Vinschen
2003-07-09 14:10 ` A matter of taste? Andreas Schwab
2003-07-09 14:20   ` Corinna Vinschen
2003-07-09 14:24   ` Andrew Cagney

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).