Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* write_register_bytes() confusion
@ 2002-07-01 12:20 Aaron J. Grier
  2002-07-01 15:13 ` Andrew Cagney
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron J. Grier @ 2002-07-01 12:20 UTC (permalink / raw)
  To: gdb-patches

I'm in the middle of bringing BDM for m68k support into current gdb, and
while I have fixed the most blatant calling convention changes (pid
changing to pid_t, etc) write_register_bytes() in regcache has got me
horribly confused.

not to mention all this m68k craziness happening elsewhere.  ;)

in v1.61 of valops.c (which appears to be current) there is the snippet:

write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
                      VALUE_CONTENTS (fromval), TYPE_LENGTH (type));

I'm writing a register -- it seems in my case this should be:

write_register_bytes (VALUE_REGNO (toval), VALUE_CONTENTS (fromval), 1);

the 1 of course is machine dependent

what I'm seeing is the register number getting completely thrashed on
the way through.

yet all calls to write_register_bytes are using VALUE_ADDRESS?

insane.  I'm starting to think I need to back off -current and just
stick with gdb-5.0...

-- 
  Aaron J. Grier  |   Frye Electronics, Tigard, OR   |  aaron@frye.com


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

* Re: write_register_bytes() confusion
  2002-07-01 12:20 write_register_bytes() confusion Aaron J. Grier
@ 2002-07-01 15:13 ` Andrew Cagney
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Cagney @ 2002-07-01 15:13 UTC (permalink / raw)
  To: Aaron J. Grier; +Cc: gdb-patches

> I'm in the middle of bringing BDM for m68k support into current gdb, and
> while I have fixed the most blatant calling convention changes (pid
> changing to pid_t, etc) write_register_bytes() in regcache has got me
> horribly confused.

(BDM being a target (or backend) to GDB.)

> not to mention all this m68k craziness happening elsewhere.  ;)
> 
> in v1.61 of valops.c (which appears to be current) there is the snippet:
> 
> write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
>                       VALUE_CONTENTS (fromval), TYPE_LENGTH (type));
> 
> I'm writing a register -- it seems in my case this should be:
> 
> write_register_bytes (VALUE_REGNO (toval), VALUE_CONTENTS (fromval), 1);
> 
> the 1 of course is machine dependent

The above code behaves as per the designers intent.  The ADDRESS is an 
offset into registers[] array.

However, GDB is trying to move away from that mechanism and more towards 
something like what you describe.

> what I'm seeing is the register number getting completely thrashed on
> the way through.
> 
> yet all calls to write_register_bytes are using VALUE_ADDRESS?
> 
> insane.  I'm starting to think I need to back off -current and just
> stick with gdb-5.0...

An up-to-date target backend should only be using:

supply_register()
regcache_collect()

it should not contain code that refers to registers[].

enjoy,
Andrew



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

end of thread, other threads:[~2002-07-01 22:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-07-01 12:20 write_register_bytes() confusion Aaron J. Grier
2002-07-01 15:13 ` Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox