* findvar.c (read_register_gen): Add "target byte-order" comment.
Wed Apr 17 17:09:48 1991 Jim Kingdon (kingdon at cygint.cygnus.com) * i386-tdep.c (i386_get_frame_setup): Use SWAP_TARGET_AND_HOST before returning locals or slocals. * i386-tdep.c (i386_follow_jump): Do not add data16 to pos in call to codestream_seek; add one to pos if (and only if) we are dealing with a jump with data16 == 1 (i.e. 0x66, 0xe9). Mon Apr 15 12:04:32 1991 Jim Kingdon (kingdon at cygint.cygnus.com) * valops.c (call_function_by_hand): Put dummy1 in target order before FIX_CALL_DUMMY. * tm-i386v.h (FIX_CALL_DUMMY): Don't depend on host byte order. Sun Apr 14 11:55:19 1991 Jim Kingdon (kingdon at cygint.cygnus.com) * valops.c (push_word): Add SWAP_TARGET_AND_HOST. * remote.c (remote_open): Send '+' before calling putpkt(). * tm-i386v.h (REGISTER_VIRTUAL_TYPE): Return pointer to void, not int, for pc, fp, and sp. * remote.c (remote_open): Call start_remote after putpkt("?");
This commit is contained in:
parent
961b4908e9
commit
f2ebc25fc2
7 changed files with 37 additions and 20 deletions
|
@ -39,6 +39,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <ctype.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
extern char *getenv();
|
extern char *getenv();
|
||||||
|
|
|
@ -267,8 +267,9 @@ read_register_bytes (regbyte, myaddr, len)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read register REGNO into memory at MYADDR, which must be large enough
|
/* Read register REGNO into memory at MYADDR, which must be large enough
|
||||||
for REGISTER_RAW_BYTES (REGNO). If the register is known to be the
|
for REGISTER_RAW_BYTES (REGNO). Target byte-order.
|
||||||
size of a CORE_ADDR or smaller, read_register can be used instead. */
|
If the register is known to be the size of a CORE_ADDR or smaller,
|
||||||
|
read_register can be used instead. */
|
||||||
void
|
void
|
||||||
read_register_gen (regno, myaddr)
|
read_register_gen (regno, myaddr)
|
||||||
int regno;
|
int regno;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* Intel 386 stuff.
|
/* Intel 386 target-dependent stuff.
|
||||||
Copyright (C) 1988, 1989 Free Software Foundation, Inc.
|
Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of GDB.
|
This file is part of GDB.
|
||||||
|
|
||||||
|
@ -46,15 +46,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
||||||
/* I don't know whether this is right for cross-debugging even if you
|
/* helper functions for tm-i386.h */
|
||||||
do somehow manage to get the right include file. */
|
|
||||||
#if defined (USE_MACHINE_REG_H)
|
|
||||||
#include <machine/reg.h>
|
|
||||||
#else
|
|
||||||
#include <sys/reg.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* helper functions for m-i386.h */
|
|
||||||
|
|
||||||
/* stdio style buffering to minimize calls to ptrace */
|
/* stdio style buffering to minimize calls to ptrace */
|
||||||
static CORE_ADDR codestream_next_addr;
|
static CORE_ADDR codestream_next_addr;
|
||||||
|
@ -133,7 +125,9 @@ i386_follow_jump ()
|
||||||
if (data16)
|
if (data16)
|
||||||
{
|
{
|
||||||
codestream_read ((unsigned char *)&short_delta, 2);
|
codestream_read ((unsigned char *)&short_delta, 2);
|
||||||
pos += short_delta + 3; /* include size of jmp inst */
|
|
||||||
|
/* include size of jmp inst (including the 0x66 prefix). */
|
||||||
|
pos += short_delta + 4;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -147,7 +141,7 @@ i386_follow_jump ()
|
||||||
pos += byte_delta + 2;
|
pos += byte_delta + 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
codestream_seek (pos + data16);
|
codestream_seek (pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -252,6 +246,7 @@ i386_get_frame_setup (pc)
|
||||||
}
|
}
|
||||||
/* subl with 32 bit immediate */
|
/* subl with 32 bit immediate */
|
||||||
codestream_read ((unsigned char *)&locals, 4);
|
codestream_read ((unsigned char *)&locals, 4);
|
||||||
|
SWAP_TARGET_AND_HOST (&locals, 4);
|
||||||
return (locals);
|
return (locals);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -264,6 +259,7 @@ i386_get_frame_setup (pc)
|
||||||
/* enter instruction: arg is 16 bit unsigned immed */
|
/* enter instruction: arg is 16 bit unsigned immed */
|
||||||
unsigned short slocals;
|
unsigned short slocals;
|
||||||
codestream_read ((unsigned char *)&slocals, 2);
|
codestream_read ((unsigned char *)&slocals, 2);
|
||||||
|
SWAP_TARGET_AND_HOST (&slocals, 2);
|
||||||
codestream_get (); /* flush final byte of enter instruction */
|
codestream_get (); /* flush final byte of enter instruction */
|
||||||
return (slocals);
|
return (slocals);
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,6 @@ device is attached to the remote system (e.g. /dev/ttya).");
|
||||||
if (from_tty)
|
if (from_tty)
|
||||||
printf ("Remote debugging using %s\n", name);
|
printf ("Remote debugging using %s\n", name);
|
||||||
push_target (&remote_ops); /* Switch to using remote target now */
|
push_target (&remote_ops); /* Switch to using remote target now */
|
||||||
start_remote (); /* Initialize gdb process mechanisms */
|
|
||||||
|
|
||||||
#ifndef HAVE_TERMIO
|
#ifndef HAVE_TERMIO
|
||||||
#ifndef NO_SIGINTERRUPT
|
#ifndef NO_SIGINTERRUPT
|
||||||
|
@ -201,7 +200,11 @@ device is attached to the remote system (e.g. /dev/ttya).");
|
||||||
perror ("remote_open: error in signal");
|
perror ("remote_open: error in signal");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Ack any packet which the remote side has already sent. */
|
||||||
|
write (remote_desc, "+", 1);
|
||||||
putpkt ("?"); /* initiate a query from remote machine */
|
putpkt ("?"); /* initiate a query from remote machine */
|
||||||
|
|
||||||
|
start_remote (); /* Initialize gdb process mechanisms */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* remote_detach()
|
/* remote_detach()
|
||||||
|
|
|
@ -119,6 +119,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
|
||||||
|
|
||||||
if (core_reg_size >= sizeof (struct fpu))
|
if (core_reg_size >= sizeof (struct fpu))
|
||||||
{
|
{
|
||||||
|
#ifdef FP0_REGNUM
|
||||||
bcopy (fpustruct->f_fpstatus.fps_regs,
|
bcopy (fpustruct->f_fpstatus.fps_regs,
|
||||||
®isters[REGISTER_BYTE (FP0_REGNUM)],
|
®isters[REGISTER_BYTE (FP0_REGNUM)],
|
||||||
sizeof fpustruct->f_fpstatus.fps_regs);
|
sizeof fpustruct->f_fpstatus.fps_regs);
|
||||||
|
@ -126,6 +127,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
|
||||||
®isters[REGISTER_BYTE (FPC_REGNUM)],
|
®isters[REGISTER_BYTE (FPC_REGNUM)],
|
||||||
sizeof fpustruct->f_fpstatus -
|
sizeof fpustruct->f_fpstatus -
|
||||||
sizeof fpustruct->f_fpstatus.fps_regs);
|
sizeof fpustruct->f_fpstatus.fps_regs);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (stderr, "Couldn't read float regs from core file\n");
|
fprintf (stderr, "Couldn't read float regs from core file\n");
|
||||||
|
|
|
@ -191,8 +191,11 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
|
|
||||||
/* Return the GDB type object for the "standard" data type
|
/* Return the GDB type object for the "standard" data type
|
||||||
of data in register N. */
|
of data in register N. */
|
||||||
|
/* Perhaps si and di should go here, but potentially they could be
|
||||||
#define REGISTER_VIRTUAL_TYPE(N) (builtin_type_int)
|
used for things other than address. */
|
||||||
|
#define REGISTER_VIRTUAL_TYPE(N) \
|
||||||
|
((N) == PC_REGNUM || (N) == FP_REGNUM || (N) == SP_REGNUM ? \
|
||||||
|
lookup_pointer_type (builtin_type_void) : builtin_type_int)
|
||||||
|
|
||||||
/* Store the address of the place in which to copy the structure the
|
/* Store the address of the place in which to copy the structure the
|
||||||
subroutine will return. This is called from call_function. */
|
subroutine will return. This is called from call_function. */
|
||||||
|
@ -308,5 +311,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||||
from = loc + 5; \
|
from = loc + 5; \
|
||||||
to = (int)(fun); \
|
to = (int)(fun); \
|
||||||
delta = to - from; \
|
delta = to - from; \
|
||||||
*(int *)((char *)(dummyname) + 1) = delta; \
|
*((char *)(dummyname) + 1) = (delta & 0xff); \
|
||||||
|
*((char *)(dummyname) + 2) = ((delta >> 8) & 0xff); \
|
||||||
|
*((char *)(dummyname) + 3) = ((delta >> 16) & 0xff); \
|
||||||
|
*((char *)(dummyname) + 4) = ((delta >> 24) & 0xff); \
|
||||||
}
|
}
|
||||||
|
|
10
gdb/valops.c
10
gdb/valops.c
|
@ -511,6 +511,7 @@ push_word (sp, buffer)
|
||||||
{
|
{
|
||||||
register int len = sizeof (REGISTER_TYPE);
|
register int len = sizeof (REGISTER_TYPE);
|
||||||
|
|
||||||
|
SWAP_TARGET_AND_HOST (&buffer, len);
|
||||||
#if 1 INNER_THAN 2
|
#if 1 INNER_THAN 2
|
||||||
sp -= len;
|
sp -= len;
|
||||||
write_memory (sp, (char *)&buffer, len);
|
write_memory (sp, (char *)&buffer, len);
|
||||||
|
@ -671,6 +672,9 @@ call_function_by_hand (function, nargs, args)
|
||||||
register CORE_ADDR sp;
|
register CORE_ADDR sp;
|
||||||
register int i;
|
register int i;
|
||||||
CORE_ADDR start_sp;
|
CORE_ADDR start_sp;
|
||||||
|
/* CALL_DUMMY is an array of words (REGISTER_TYPE), but each word
|
||||||
|
in in host byte order. It is switched to target byte order before calling
|
||||||
|
FIX_CALL_DUMMY. */
|
||||||
static REGISTER_TYPE dummy[] = CALL_DUMMY;
|
static REGISTER_TYPE dummy[] = CALL_DUMMY;
|
||||||
REGISTER_TYPE dummy1[sizeof dummy / sizeof (REGISTER_TYPE)];
|
REGISTER_TYPE dummy1[sizeof dummy / sizeof (REGISTER_TYPE)];
|
||||||
CORE_ADDR old_sp;
|
CORE_ADDR old_sp;
|
||||||
|
@ -717,6 +721,8 @@ call_function_by_hand (function, nargs, args)
|
||||||
/* Create a call sequence customized for this function
|
/* Create a call sequence customized for this function
|
||||||
and the number of arguments for it. */
|
and the number of arguments for it. */
|
||||||
bcopy (dummy, dummy1, sizeof dummy);
|
bcopy (dummy, dummy1, sizeof dummy);
|
||||||
|
for (i = 0; i < sizeof dummy / sizeof (REGISTER_TYPE); i++)
|
||||||
|
SWAP_TARGET_AND_HOST (&dummy1[i], sizeof (REGISTER_TYPE));
|
||||||
FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
|
FIX_CALL_DUMMY (dummy1, start_sp, funaddr, nargs, args,
|
||||||
value_type, using_gcc);
|
value_type, using_gcc);
|
||||||
|
|
||||||
|
@ -1104,7 +1110,9 @@ value_struct_elt (argp, args, name, static_memfuncp, err)
|
||||||
{
|
{
|
||||||
arg1_as_ptr = *argp;
|
arg1_as_ptr = *argp;
|
||||||
*argp = value_ind (*argp);
|
*argp = value_ind (*argp);
|
||||||
COERCE_ARRAY (*argp);
|
/* Don't coerce fn pointer to fn and then back again! */
|
||||||
|
if (TYPE_CODE (VALUE_TYPE (*argp)) != TYPE_CODE_FUNC)
|
||||||
|
COERCE_ARRAY (*argp);
|
||||||
t = VALUE_TYPE (*argp);
|
t = VALUE_TYPE (*argp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue