if actual_mem_addr is non-NULL, store there the address that it
was fetched from (or if from a register the offset within
registers). Set *LVAL to lval_memory or lval_register, depending
- on where it came from. */
+ on where it came from. The contents written into MYADDR are in
+ target format. */
void
read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
CORE_ADDR memaddr;
/* If we don't do this 'info register' stops in the middle. */
if (memaddr >= rstack_high_address)
{
- int val = -1; /* a bogus value */
+ /* a bogus value */
+ char val[] = {~0, ~0, ~0, ~0};
/* It's in a local register, but off the end of the stack. */
int regnum = (memaddr - rsp) / 4 + LR0_REGNUM;
if (myaddr != NULL)
- *(int*)myaddr = val; /* Provide bogusness */
- supply_register(regnum, (char *)&val); /* More bogusness */
+ {
+ /* Provide bogusness */
+ memcpy (myaddr, val, 4);
+ }
+ supply_register(regnum, val); /* More bogusness */
if (lval != NULL)
*lval = lval_register;
if (actual_mem_addr != NULL)
{
/* It's in the memory portion of the register stack. */
if (myaddr != NULL)
- read_memory (memaddr, myaddr, 4);
+ read_memory (memaddr, myaddr, 4);
if (lval != NULL)
*lval = lval_memory;
if (actual_mem_addr != NULL)
if (regnum == RSP_REGNUM)
{
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = fi->frame;
+ {
+ *(CORE_ADDR *)raw_buffer = fi->frame;
+ /* Put it back in target byte order. */
+ SWAP_TARGET_AND_HOST (raw_buffer, sizeof (CORE_ADDR));
+ }
if (lvalp != NULL)
*lvalp = not_lval;
return;
else if (regnum == PC_REGNUM)
{
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = fi->pc;
+ {
+ *(CORE_ADDR *)raw_buffer = fi->pc;
+ /* Put it back in target byte order. */
+ SWAP_TARGET_AND_HOST (raw_buffer, sizeof (CORE_ADDR));
+ }
/* Not sure we have to do this. */
if (lvalp != NULL)
if (raw_buffer != NULL)
{
if (fi->next != NULL)
- *(CORE_ADDR *)raw_buffer = fi->next->saved_msp;
+ {
+ *(CORE_ADDR *)raw_buffer = fi->next->saved_msp;
+ /* Put it back in target byte order. */
+ SWAP_TARGET_AND_HOST (raw_buffer, sizeof (CORE_ADDR));
+ }
else
- *(CORE_ADDR *)raw_buffer = read_register (MSP_REGNUM);
+ read_register_gen (MSP_REGNUM, raw_buffer);
}
/* The value may have been computed, not fetched. */
if (lvalp != NULL)
/* These registers are not saved over procedure calls,
so just print out the current values. */
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = read_register (regnum);
+ read_register_gen (regnum, raw_buffer);
if (lvalp != NULL)
*lvalp = lval_register;
if (addrp != NULL)
return addr;
}
-/* Find register number REGNUM relative to FRAME and put its
- (raw) contents in *RAW_BUFFER. Set *OPTIMIZED if the variable
- was optimized out (and thus can't be fetched). Set *LVAL to
- lval_memory, lval_register, or not_lval, depending on whether the
- value was fetched from memory, from a register, or in a strange
+/* Find register number REGNUM relative to FRAME and put its (raw,
+ target format) contents in *RAW_BUFFER. Set *OPTIMIZED if the
+ variable was optimized out (and thus can't be fetched). Set *LVAL
+ to lval_memory, lval_register, or not_lval, depending on whether
+ the value was fetched from memory, from a register, or in a strange
and non-modifiable way (e.g. a frame pointer which was calculated
rather than fetched). Set *ADDRP to the address, either in memory
on as a REGISTER_BYTE offset into the registers array.
your own.
The argument RAW_BUFFER must point to aligned memory. */
+
void
get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
char *raw_buffer;
if (regnum == SP_REGNUM)
{
if (raw_buffer != NULL)
- *(CORE_ADDR *)raw_buffer = addr;
+ {
+ *(CORE_ADDR *)raw_buffer = addr;
+ /* Put it back in target byte order. */
+ SWAP_TARGET_AND_HOST (raw_buffer, sizeof (CORE_ADDR));
+ }
if (addrp != NULL)
*addrp = 0;
return;