1999-04-16 01:35:26 +00:00
|
|
|
|
/* Target-dependent code for Intel 386 running LynxOS.
|
2003-01-04 23:38:46 +00:00
|
|
|
|
Copyright 1993, 1996, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This file is part of GDB.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
1999-07-07 20:19:36 +00:00
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
|
Boston, MA 02111-1307, USA. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
|
|
|
|
#include "gdbcore.h"
|
2002-06-16 02:19:22 +00:00
|
|
|
|
#include "inferior.h"
|
2001-03-01 01:39:22 +00:00
|
|
|
|
#include "regcache.h"
|
2002-06-16 02:19:22 +00:00
|
|
|
|
#include "target.h"
|
2003-01-04 23:38:46 +00:00
|
|
|
|
#include "osabi.h"
|
2002-06-16 02:19:22 +00:00
|
|
|
|
|
|
|
|
|
#include "i386-tdep.h"
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2002-06-16 02:19:22 +00:00
|
|
|
|
/* Return the PC of the caller from the call frame. Assumes the subr
|
|
|
|
|
prologue has already been executed, and the frame pointer setup.
|
|
|
|
|
If this is the outermost frame, we check to see if we are in a
|
|
|
|
|
system call by examining the previous instruction. If so, then the
|
|
|
|
|
return PC is actually at SP+4 because system calls use a different
|
|
|
|
|
calling sequence. */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2002-06-16 02:19:22 +00:00
|
|
|
|
static CORE_ADDR
|
2000-07-30 01:48:28 +00:00
|
|
|
|
i386lynx_saved_pc_after_call (struct frame_info *frame)
|
1999-04-16 01:35:26 +00:00
|
|
|
|
{
|
|
|
|
|
char opcode[7];
|
1999-07-07 20:19:36 +00:00
|
|
|
|
static const unsigned char call_inst[] =
|
2002-06-16 02:19:22 +00:00
|
|
|
|
{ 0x9a, 0, 0, 0, 0, 8, 0 }; /* lcall 0x8,0x0 */
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2002-06-16 02:19:22 +00:00
|
|
|
|
read_memory_nobpt (frame->pc - 7, opcode, 7);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
if (memcmp (opcode, call_inst, 7) == 0)
|
2002-06-16 02:19:22 +00:00
|
|
|
|
return read_memory_unsigned_integer (read_register (SP_REGNUM) + 4, 4);
|
|
|
|
|
|
|
|
|
|
return read_memory_unsigned_integer (read_register (SP_REGNUM), 4);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* LynxOS. */
|
|
|
|
|
static void
|
|
|
|
|
i386lynx_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|
|
|
|
{
|
2003-04-11 18:15:40 +00:00
|
|
|
|
set_gdbarch_deprecated_saved_pc_after_call (gdbarch, i386lynx_saved_pc_after_call);
|
2002-06-16 02:19:22 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static enum gdb_osabi
|
|
|
|
|
i386lynx_coff_osabi_sniffer (bfd *abfd)
|
|
|
|
|
{
|
|
|
|
|
if (strcmp (bfd_get_target (abfd), "coff-i386-lynx") == 0)
|
|
|
|
|
return GDB_OSABI_LYNXOS;
|
|
|
|
|
|
|
|
|
|
return GDB_OSABI_UNKNOWN;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Provide a prototype to silence -Wmissing-prototypes. */
|
|
|
|
|
void _initialize_i386lynx_tdep (void);
|
|
|
|
|
|
|
|
|
|
void
|
2002-12-21 19:58:07 +00:00
|
|
|
|
_initialize_i386lynx_tdep (void)
|
2002-06-16 02:19:22 +00:00
|
|
|
|
{
|
|
|
|
|
gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_coff_flavour,
|
|
|
|
|
i386lynx_coff_osabi_sniffer);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
|
2002-12-21 19:58:07 +00:00
|
|
|
|
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_LYNXOS,
|
2002-06-16 02:19:22 +00:00
|
|
|
|
i386lynx_init_abi);
|
1999-04-16 01:35:26 +00:00
|
|
|
|
}
|