mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-26 03:24:41 +08:00
* target.c (nomemory): Now that higher levels examine errno, give EIO.
* tm-sparc.h: Don't #include <sun4/reg.h>. * sparc-tdep.c (sparc_frame_chain, frame_saved_pc): Remove dependency on <sun4/reg.h>. Start to handle cross-byte-order. * language.h: Avoid forward enum declaration. * configure.in, tm-sun4os5.h, xm-sun4os5.h, config/sun4os5.mh, config/sun4os5.mt: New host and target. * defs.h (errno): #include <errno.h> rather than assuming int. From Pierre Willard.
This commit is contained in:
parent
1eeba68641
commit
f9e3b3ccc2
@ -63,9 +63,10 @@ m68000)
|
||||
|
||||
sparc)
|
||||
case "${host_os}" in
|
||||
sunos3) gdb_host=sun4os3 ;;
|
||||
sunos4) gdb_host=sun4os4 ;;
|
||||
*) gdb_host=sun4 ;;
|
||||
sunos3) gdb_host=sun4os3 ;;
|
||||
sunos4) gdb_host=sun4os4 ;;
|
||||
sunos5*|sysv4*) gdb_host=sun4os5 ;;
|
||||
*) gdb_host=sun4 ;;
|
||||
esac
|
||||
;;
|
||||
|
||||
@ -255,9 +256,10 @@ sparc)
|
||||
case "${target_vendor}" in
|
||||
sun)
|
||||
case "${target_os}" in
|
||||
sunos3) gdb_target=sun4os3 ;;
|
||||
sunos4) gdb_target=sun4os4 ;;
|
||||
*) gdb_target=sun4 ;;
|
||||
sunos3) gdb_target=sun4os3 ;;
|
||||
sunos4) gdb_target=sun4os4 ;;
|
||||
sunos5|sysv4*) gdb_target=sun4os5 ;;
|
||||
*) gdb_target=sun4 ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
|
@ -22,9 +22,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#if !defined (LANGUAGE_H)
|
||||
#define LANGUAGE_H 1
|
||||
|
||||
#ifdef __STDC__ /* Forward defs for prototypes */
|
||||
#ifdef __STDC__ /* Forward decls for prototypes */
|
||||
struct value;
|
||||
enum exp_opcode;
|
||||
/* enum exp_opcode; ANSI's `wisdom' didn't include forward enum decls. */
|
||||
#endif
|
||||
|
||||
/* This used to be included to configure GDB for one or more specific
|
||||
|
@ -1,7 +1,5 @@
|
||||
/* Machine-dependent code which would otherwise be in inflow.c and core.c,
|
||||
for GDB, the GNU debugger.
|
||||
Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
|
||||
This code is for the sparc cpu.
|
||||
/* Target-dependent code for the SPARC for GDB, the GNU debugger.
|
||||
Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
@ -19,9 +17,7 @@ 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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include "defs.h"
|
||||
#include "param.h"
|
||||
#include "frame.h"
|
||||
#include "inferior.h"
|
||||
#include "obstack.h"
|
||||
@ -38,7 +34,7 @@ extern int stop_after_trap;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
Error, not_branch, bicc, bicca, ba, baa, ticc, ta,
|
||||
Error, not_branch, bicc, bicca, ba, baa, ticc, ta
|
||||
} branch_type;
|
||||
|
||||
/* Simulate single-step ptrace call for sun4. Code written by Gary
|
||||
@ -67,7 +63,8 @@ int one_stepped;
|
||||
set up a simulated single-step, we undo our damage. */
|
||||
|
||||
void
|
||||
single_step ()
|
||||
single_step (pid)
|
||||
int pid; /* ignored */
|
||||
{
|
||||
branch_type br, isannulled();
|
||||
CORE_ADDR pc;
|
||||
@ -122,18 +119,23 @@ single_step ()
|
||||
}
|
||||
}
|
||||
|
||||
#define FRAME_SAVED_L0 0 /* Byte offset from SP */
|
||||
#define FRAME_SAVED_I0 32 /* Byte offset from SP */
|
||||
|
||||
CORE_ADDR
|
||||
sparc_frame_chain (thisframe)
|
||||
FRAME thisframe;
|
||||
{
|
||||
CORE_ADDR retval;
|
||||
int err;
|
||||
err = target_read_memory
|
||||
((CORE_ADDR)&(((struct rwindow *)(thisframe->frame))->rw_in[6]),
|
||||
&retval,
|
||||
sizeof (CORE_ADDR));
|
||||
CORE_ADDR addr;
|
||||
|
||||
addr = thisframe->frame + FRAME_SAVED_I0 +
|
||||
REGISTER_RAW_SIZE(FP_REGNUM) * (FP_REGNUM - I0_REGNUM);
|
||||
err = target_read_memory (addr, (char *) &retval, sizeof (CORE_ADDR));
|
||||
if (err)
|
||||
return 0;
|
||||
SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
|
||||
return retval;
|
||||
}
|
||||
|
||||
@ -141,33 +143,30 @@ CORE_ADDR
|
||||
sparc_extract_struct_value_address (regbuf)
|
||||
char regbuf[REGISTER_BYTES];
|
||||
{
|
||||
CORE_ADDR retval;
|
||||
read_memory (((int *)(regbuf))[SP_REGNUM]+(16*4),
|
||||
&retval,
|
||||
sizeof (CORE_ADDR));
|
||||
return retval;
|
||||
/* FIXME, handle byte swapping */
|
||||
return read_memory_integer (((int *)(regbuf))[SP_REGNUM]+(16*4),
|
||||
sizeof (CORE_ADDR));
|
||||
}
|
||||
|
||||
/*
|
||||
* Find the pc saved in frame FRAME.
|
||||
*/
|
||||
/* Find the pc saved in frame FRAME. */
|
||||
|
||||
CORE_ADDR
|
||||
frame_saved_pc (frame)
|
||||
FRAME frame;
|
||||
{
|
||||
CORE_ADDR prev_pc;
|
||||
|
||||
/* If it's at the bottom, the return value's stored in i7/rp */
|
||||
if (get_current_frame () == frame)
|
||||
read_memory ((CORE_ADDR)&((struct rwindow *)
|
||||
(read_register (SP_REGNUM)))->rw_in[7],
|
||||
&prev_pc, sizeof (CORE_ADDR));
|
||||
else
|
||||
/* Wouldn't this always work? */
|
||||
read_memory ((CORE_ADDR)&((struct rwindow *)(frame->bottom))->rw_in[7],
|
||||
&prev_pc,
|
||||
sizeof (CORE_ADDR));
|
||||
|
||||
if (get_current_frame () == frame) /* FIXME, debug check. Remove >=gdb-4.6 */
|
||||
{
|
||||
if (read_register (SP_REGNUM) != frame->bottom) abort();
|
||||
}
|
||||
|
||||
read_memory ((CORE_ADDR) (frame->bottom + FRAME_SAVED_I0 +
|
||||
REGISTER_RAW_SIZE(I7_REGNUM) * (I7_REGNUM - I0_REGNUM)),
|
||||
(char *) &prev_pc,
|
||||
sizeof (CORE_ADDR));
|
||||
|
||||
SWAP_TARGET_AND_HOST (&prev_pc, sizeof (prev_pc));
|
||||
return PC_ADJUST (prev_pc);
|
||||
}
|
||||
|
||||
@ -638,7 +637,30 @@ sparc_pc_adjust(pc)
|
||||
This information is not currently used by GDB, since no current SPARC
|
||||
implementations support extended float. */
|
||||
|
||||
const struct ext_format ext_format_sparc[] = {
|
||||
const struct ext_format ext_format_sparc = {
|
||||
/* tot sbyte smask expbyte manbyte */
|
||||
{ 16, 0, 0x80, 0,1, 4,8 }, /* sparc */
|
||||
16, 0, 0x80, 0,1, 4,8, /* sparc */
|
||||
};
|
||||
|
||||
/* Figure out where the longjmp will land. We expect that we have just entered
|
||||
longjmp and haven't yet setup the stack frame, so the args are still in the
|
||||
output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we
|
||||
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
|
||||
This routine returns true on success */
|
||||
|
||||
int
|
||||
get_longjmp_target(pc)
|
||||
CORE_ADDR *pc;
|
||||
{
|
||||
CORE_ADDR jb_addr;
|
||||
|
||||
jb_addr = read_register(O0_REGNUM);
|
||||
|
||||
if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, (char *) pc,
|
||||
sizeof(CORE_ADDR)))
|
||||
return 0;
|
||||
|
||||
SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -295,10 +295,6 @@ sparc_extract_struct_value_address PARAMS ((char [REGISTER_BYTES]));
|
||||
/* Describe the pointer in each stack frame to the previous stack frame
|
||||
(its caller). */
|
||||
|
||||
/* If you're not compiling this on a sun, you'll have to get a copy
|
||||
of <sun4/reg.h> (also known as <machine/reg.h>). */
|
||||
#include <sun4/reg.h>
|
||||
|
||||
/* FRAME_CHAIN takes a frame's nominal address
|
||||
and produces the frame's chain-pointer. */
|
||||
|
||||
|
52
gdb/tm-sun4os5.h
Normal file
52
gdb/tm-sun4os5.h
Normal file
@ -0,0 +1,52 @@
|
||||
/* Macro definitions for GDB for a Sun 4 running SunOS 5.
|
||||
Copyright (C) 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
#include "tm-sparc.h"
|
||||
|
||||
#include "tm-sysv4.h"
|
||||
|
||||
#undef STACK_END_ADDRESS
|
||||
#define STACK_END_ADDRESS 0xf8000000
|
||||
|
||||
#if 0 /* Setjmp/longjmp are not as well doc'd in SunOS 5.x yet */
|
||||
|
||||
/* Offsets into jmp_buf. Not defined by Sun, but at least documented in a
|
||||
comment in <machine/setjmp.h>! */
|
||||
|
||||
#define JB_ELEMENT_SIZE 4 /* Size of each element in jmp_buf */
|
||||
|
||||
#define JB_ONSSTACK 0
|
||||
#define JB_SIGMASK 1
|
||||
#define JB_SP 2
|
||||
#define JB_PC 3
|
||||
#define JB_NPC 4
|
||||
#define JB_PSR 5
|
||||
#define JB_G1 6
|
||||
#define JB_O0 7
|
||||
#define JB_WBCNT 8
|
||||
|
||||
/* Figure out where the longjmp will land. We expect that we have just entered
|
||||
longjmp and haven't yet setup the stack frame, so the args are still in the
|
||||
output regs. %o0 (O0_REGNUM) points at the jmp_buf structure from which we
|
||||
extract the pc (JB_PC) that we will land at. The pc is copied into ADDR.
|
||||
This routine returns true on success */
|
||||
|
||||
#define GET_LONGJMP_TARGET(ADDR) get_longjmp_target(ADDR)
|
||||
|
||||
#endif /* 0 */
|
57
gdb/xm-sun4os5.h
Normal file
57
gdb/xm-sun4os5.h
Normal file
@ -0,0 +1,57 @@
|
||||
/* Macro definitions for running gdb on a Sun 4 running sunos 5.
|
||||
Copyright 1989, 1992 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GDB.
|
||||
|
||||
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.
|
||||
|
||||
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.
|
||||
|
||||
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., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
|
||||
/* Most of what we know is generic to SPARC hosts. */
|
||||
|
||||
#include "xm-sparc.h"
|
||||
|
||||
/* Pick up more stuff from the generic SVR4 host include file. */
|
||||
|
||||
#include "xm-sysv4.h"
|
||||
|
||||
/* SVR4's can't seem to agree on what to call the type that contains the
|
||||
general registers. Kludge around it with a #define. */
|
||||
|
||||
#define gregset_t prgreg_t
|
||||
#define fpregset_t prfpregset_t
|
||||
|
||||
/* The native Sun compiler complains about using volatile
|
||||
to indicate functions that never return. So shut it up by simply
|
||||
defining away "NORETURN", which is normally defined to "volatile". */
|
||||
|
||||
#ifndef __GNUC__
|
||||
# define NORETURN /**/
|
||||
#endif
|
||||
|
||||
/* Large alloca's fail because the attempt to increase the stack limit in
|
||||
main() fails because shared libraries are allocated just below the initial
|
||||
stack limit. The SunOS kernel will not allow the stack to grow into
|
||||
the area occupied by the shared libraries. Sun knows about this bug
|
||||
but has no obvious fix for it. */
|
||||
#define BROKEN_LARGE_ALLOCA
|
||||
|
||||
/* If you expect to use the mmalloc package to obtain mapped symbol files,
|
||||
for now you have to specify some parameters that determine how gdb places
|
||||
the mappings in it's address space. See the comments in map_to_address()
|
||||
for details. This is expected to only be a short term solution. Yes it
|
||||
is a kludge.
|
||||
FIXME: Make this more automatic. */
|
||||
|
||||
#define MMAP_BASE_ADDRESS 0xE0000000 /* First mapping here */
|
||||
#define MMAP_INCREMENT 0x01000000 /* Increment to next mapping */
|
Loading…
Reference in New Issue
Block a user