* a29k-tdep.c, findvar.c (get_saved_register): Fix byteswapping sins.

This commit is contained in:
Jim Kingdon 1993-07-09 18:33:23 +00:00
parent 332fc09ff0
commit 4d50f90ab8
3 changed files with 42 additions and 16 deletions

View File

@ -1,3 +1,7 @@
Fri Jul 9 12:36:46 1993 Jim Kingdon (kingdon@lioth.cygnus.com)
* a29k-tdep.c, findvar.c (get_saved_register): Fix byteswapping sins.
Fri Jul 9 09:47:02 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* defs.h, remote-eb.c (TM_FILE_OVERRIDE): Remove it.

View File

@ -504,7 +504,8 @@ frame_locals_address (fi)
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;
@ -518,12 +519,16 @@ read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
/* 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)
@ -550,7 +555,7 @@ read_register_stack (memaddr, myaddr, actual_mem_addr, lval)
{
/* 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)
@ -641,7 +646,11 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
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;
@ -649,7 +658,11 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
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)
@ -662,9 +675,13 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
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)
@ -676,7 +693,7 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lvalp)
/* 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)

View File

@ -101,11 +101,11 @@ find_saved_register (frame, regnum)
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.
@ -115,6 +115,7 @@ find_saved_register (frame, regnum)
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;
@ -136,7 +137,11 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
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;