aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/29k-share/udi/udip2soc.c8
-rw-r--r--gdb/29k-share/udi/udr.c4
-rw-r--r--gdb/ChangeLog21
-rw-r--r--gdb/a68v-nat.c26
-rw-r--r--gdb/altos-xdep.c2
-rw-r--r--gdb/config/a29k/tm-a29k.h6
-rw-r--r--gdb/config/arm/tm-arm.h400
-rw-r--r--gdb/config/h8300/tm-h8300.h2
-rw-r--r--gdb/config/h8500/tm-h8500.h2
-rw-r--r--gdb/config/i386/tm-i386aix.h4
-rw-r--r--gdb/config/i386/tm-sun386.h6
-rw-r--r--gdb/config/i386/tm-symmetry.h12
-rw-r--r--gdb/config/i960/tm-i960.h6
-rw-r--r--gdb/config/m68k/tm-news.h2
-rw-r--r--gdb/config/m88k/tm-m88k.h6
-rw-r--r--gdb/config/mips/tm-mips.h4
-rw-r--r--gdb/config/ns32k/tm-merlin.h6
-rw-r--r--gdb/config/ns32k/tm-umax.h6
-rw-r--r--gdb/config/pa/tm-hppa.h5
-rw-r--r--gdb/config/rs6000/tm-rs6000.h7
-rw-r--r--gdb/config/sh/tm-sh.h2
-rw-r--r--gdb/config/vax/tm-vax.h6
-rw-r--r--gdb/config/z8k/tm-z8k.h2
-rw-r--r--gdb/convex-tdep.c7
-rw-r--r--gdb/convex-xdep.c4
-rw-r--r--gdb/findvar.c331
-rw-r--r--gdb/hppab-nat.c4
-rw-r--r--gdb/hppah-nat.c4
-rw-r--r--gdb/i386mach-nat.c27
-rw-r--r--gdb/irix4-nat.c2
-rw-r--r--gdb/m68k-tdep.c148
-rw-r--r--gdb/m88k-tdep.c2
-rw-r--r--gdb/mipsread.c2
-rw-r--r--gdb/regex.c5
-rw-r--r--gdb/remote-bug.c5
-rw-r--r--gdb/remote-hms.c4
-rw-r--r--gdb/rs6000-nat.c6
-rw-r--r--gdb/rs6000-tdep.c22
-rw-r--r--gdb/sparc-nat.c4
-rw-r--r--gdb/stabsread.c4
-rw-r--r--gdb/sun3-nat.c26
-rw-r--r--gdb/sun386-nat.c29
-rw-r--r--gdb/symfile.c207
-rw-r--r--gdb/umax-xdep.c2
-rw-r--r--gdb/xcoffread.c2
45 files changed, 1035 insertions, 357 deletions
diff --git a/gdb/29k-share/udi/udip2soc.c b/gdb/29k-share/udi/udip2soc.c
index ec7a8fb..d0547da 100644
--- a/gdb/29k-share/udi/udip2soc.c
+++ b/gdb/29k-share/udi/udip2soc.c
@@ -296,8 +296,8 @@ UDIConnect(Config, Session)
}
soc_con[cnt].tip_sockaddr.sa_family = domain;
- bcopy(soc_con[cnt].tip_string,
- soc_con[cnt].tip_sockaddr.sa_data,
+ memcpy(soc_con[cnt].tip_sockaddr.sa_data,
+ soc_con[cnt].tip_string,
sizeof(soc_con[cnt].tip_sockaddr.sa_data));
if (connect(soc_con[cnt].dfe_sd,
&soc_con[cnt].tip_sockaddr,
@@ -372,8 +372,8 @@ UDIConnect(Config, Session)
dfe_errno = UDIErrorNoSuchConnection;
goto tip_failure;
}
- bcopy(tip_info_p->h_addr,
- (char *)&soc_con[cnt].tip_sockaddr_in.sin_addr,
+ memcpy((char *)&soc_con[cnt].tip_sockaddr_in.sin_addr,
+ tip_info_p->h_addr,
tip_info_p->h_length);
}
soc_con[cnt].tip_sockaddr_in.sin_port
diff --git a/gdb/29k-share/udi/udr.c b/gdb/29k-share/udi/udr.c
index e35da32..1e58eda 100644
--- a/gdb/29k-share/udi/udr.c
+++ b/gdb/29k-share/udi/udr.c
@@ -146,7 +146,7 @@ int size;
{ udr_errno = UDIErrorIPCInternal;
return -1;
}
- bcopy((char*)object_p, udrs->putbytes, size);
+ memcpy(udrs->putbytes, (char*)object_p, size);
udrs->putbytes += size;
if(udrs->putbytes > udrs->putend) udrs->putend = udrs->putbytes;
}
@@ -169,7 +169,7 @@ int size;
return -1; /* return error code */
}
} /* read data from character stream buffer */
- bcopy(udrs->getbytes, (char*)object_p, size);
+ memcpy((char*)object_p, udrs->getbytes, size);
udrs->getbytes += size;
}
else
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 5fa4fb6..18e42c7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,24 @@
+Wed Sep 1 13:12:43 1993 K. Richard Pixley (rich@sendai.cygnus.com)
+
+ * a68v-nat.c, altos-xdep.c, convex-tdep.c, convex-xdep.c,
+ findvar.c, hppab-nat.c, hppah-nat.c, i386mach-nat.c,
+ irix4-nat.c, m68k-tdep.c, m88k-tdep.c, mipsread.c, regex.c,
+ remote-bug.c, remote-hms.c, rs6000-nat.c, rs6000-tdep.c,
+ sparc-nat.c, stabsread.c, sun3-nat.c, sun386-nat.c, symfile.c,
+ umax-xdep.c, xcoffread.c, 29k-share/udi/udip2soc.c,
+ 29k-share/udi/udr.c, config/a29k/tm-a29k.h, config/arm/tm-arm.h,
+ config/convex/tm-convex.h, config/gould/tm-np1.h,
+ config/gould/tm-pn.h, config/h8300/tm-h8300.h,
+ config/h8500/tm-h8500.h, config/i386/tm-i386aix.h,
+ config/i386/tm-sun386.h, config/i386/tm-symmetry.h,
+ config/i960/tm-i960.h, config/m68k/tm-news.h,
+ config/m88k/tm-m88k.h, config/mips/tm-mips.h,
+ config/ns32k/tm-merlin.h, config/ns32k/tm-umax.h,
+ config/pa/tm-hppa.h, config/pyr/tm-pyr.h,
+ config/rs6000/tm-rs6000.h, config/sh/tm-sh.h,
+ config/tahoe/tm-tahoe.h, config/vax/tm-vax.h,
+ config/z8k/tm-z8k.h, nindy-share/nindy.c: bcopy -> memcpy
+
Wed Sep 1 05:05:53 1993 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* mipsread.c (parse_partial_symbols): Use language from FDR if it
diff --git a/gdb/a68v-nat.c b/gdb/a68v-nat.c
index d81cbe8..8e4000e 100644
--- a/gdb/a68v-nat.c
+++ b/gdb/a68v-nat.c
@@ -43,16 +43,16 @@ fetch_inferior_registers ()
(PTRACE_ARG3_TYPE) &inferior_fp_registers, 0);
#endif
- bcopy (&inferior_registers, registers, 16 * 4);
+ memcpy (registers, &inferior_registers, 16 * 4);
#ifdef FP0_REGNUM
- bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof inferior_fp_registers.fps_regs);
#endif
*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
#ifdef FP0_REGNUM
- bcopy (&inferior_fp_registers.fps_control,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.fps_control,
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
}
@@ -71,17 +71,17 @@ store_inferior_registers (regno)
#endif
extern char registers[];
- bcopy (registers, &inferior_registers, 16 * 4);
+ memcpy (&inferior_registers, registers, 16 * 4);
#ifdef FP0_REGNUM
- bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+ memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fps_regs);
#endif
inferior_registers.r_ps = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
#ifdef FP0_REGNUM
- bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
- &inferior_fp_registers.fps_control,
+ memcpy (&inferior_fp_registers.fps_control,
+ &registers[REGISTER_BYTE (FPC_REGNUM)],
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
@@ -108,7 +108,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
if (core_reg_size < sizeof (struct regs))
error ("Can't find registers in core file");
- bcopy ((char *)regs, registers, 16 * 4);
+ memcpy (registers, (char *)regs, 16 * 4);
supply_register (PS_REGNUM, &regs->r_ps);
supply_register (PC_REGNUM, &regs->r_pc);
@@ -119,11 +119,11 @@ fetch_core_registers (core_reg_sect, core_reg_size, which)
if (core_reg_size >= sizeof (struct fpu))
{
#ifdef FP0_REGNUM
- bcopy (fpustruct->f_fpstatus.fps_regs,
- &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ fpustruct->f_fpstatus.fps_regs,
sizeof fpustruct->f_fpstatus.fps_regs);
- bcopy (&fpustruct->f_fpstatus.fps_control,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &fpustruct->f_fpstatus.fps_control,
sizeof fpustruct->f_fpstatus -
sizeof fpustruct->f_fpstatus.fps_regs);
#endif
diff --git a/gdb/altos-xdep.c b/gdb/altos-xdep.c
index 4156c33..ce2a5a7 100644
--- a/gdb/altos-xdep.c
+++ b/gdb/altos-xdep.c
@@ -115,7 +115,7 @@ core_file_command (filename, from_tty)
if (reg_offset > NBPG * UPAGES)
reg_offset -= KERNEL_U_ADDR;
- bcopy (&u.u_exdata, &core_aouthdr, sizeof (AOUTHDR));
+ memcpy (&core_aouthdr, &u.u_exdata, sizeof (AOUTHDR));
printf ("Core file is from \"%s\".\n", u.u_comm);
/* I don't know where to find this info.
diff --git a/gdb/config/a29k/tm-a29k.h b/gdb/config/a29k/tm-a29k.h
index cc6592e..ae89beb 100644
--- a/gdb/config/a29k/tm-a29k.h
+++ b/gdb/config/a29k/tm-a29k.h
@@ -267,13 +267,13 @@ CORE_ADDR skip_prologue ();
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
-{ bcopy ((FROM), (TO), 4); }
+{ memcpy ((TO), (FROM), 4); }
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
-{ bcopy ((FROM), (TO), 4); }
+{ memcpy ((TO), (FROM), 4); }
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -309,7 +309,7 @@ CORE_ADDR skip_prologue ();
read_memory (*((int *)(REGBUF) + LRP_REGNUM), (VALBUF) + 16 * 4, \
TYPE_LENGTH (TYPE) - 16 * 4); \
} \
- bcopy (((int *)(REGBUF))+RETURN_REGNUM, (VALBUF), reg_length); \
+ memcpy ((VALBUF), ((int *)(REGBUF))+RETURN_REGNUM, reg_length); \
}
/* Write into appropriate registers a function return value
diff --git a/gdb/config/arm/tm-arm.h b/gdb/config/arm/tm-arm.h
new file mode 100644
index 0000000..7775ea2
--- /dev/null
+++ b/gdb/config/arm/tm-arm.h
@@ -0,0 +1,400 @@
+/* Definitions to make GDB target for an ARM under RISCiX (4.3bsd).
+ Copyright 1986, 1987, 1989, 1991, 1993 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. */
+
+#define TARGET_BYTE_ORDER LITTLE_ENDIAN
+
+/* IEEE format floating point */
+
+#define IEEE_FLOAT
+
+/* I provide my own xfer_core_file to cope with shared libraries */
+
+#define XFER_CORE_FILE
+
+/* Offset from address of function to start of its code.
+ Zero on most machines. */
+
+#define FUNCTION_START_OFFSET 0
+
+/* Advance PC across any function entry prologue instructions
+ to reach some "real" code. */
+
+#define SKIP_PROLOGUE(pc) pc = skip_prologue(pc)
+
+/* Immediately after a function call, return the saved pc.
+ Can't always go through the frames for this because on some machines
+ the new frame is not set up until the new function executes
+ some instructions. */
+
+#define SAVED_PC_AFTER_CALL(frame) (read_register (LR_REGNUM) & 0x03fffffc)
+
+/* I don't know the real values for these. */
+#define TARGET_UPAGES UPAGES
+#define TARGET_NBPG NBPG
+
+/* Address of end of stack space. */
+
+#define STACK_END_ADDR (0x01000000 - (TARGET_UPAGES * TARGET_NBPG))
+
+/* Stack grows downward. */
+
+#define INNER_THAN <
+
+/* Sequence of bytes for breakpoint instruction. */
+
+#define BREAKPOINT {0x00,0x00,0x18,0xef} /* BKPT_SWI from <sys/ptrace.h> */
+
+/* Amount PC must be decremented by after a breakpoint.
+ This is often the number of bytes in BREAKPOINT
+ but not always. */
+
+#define DECR_PC_AFTER_BREAK 0
+
+/* Nonzero if instruction at PC is a return instruction. */
+
+#define ABOUT_TO_RETURN(pc) \
+ ((read_memory_integer(pc, 4) & 0x0fffffff == 0x01b0f00e) || \
+ (read_memory_integer(pc, 4) & 0x0ffff800 == 0x09eba800))
+
+/* Return 1 if P points to an invalid floating point value.
+ LEN is the length in bytes. */
+
+#define INVALID_FLOAT(p, len) 0
+
+/* code to execute to print interesting information about the
+ * floating point processor (if any)
+ * No need to define if there is nothing to do.
+ */
+#define FLOAT_INFO { arm_float_info (); }
+
+/* Say how long (ordinary) registers are. */
+
+#define REGISTER_TYPE long
+
+/* Number of machine registers */
+
+/* Note: I make a fake copy of the pc in register 25 (calling it ps) so
+ that I can clear the status bits from pc (register 15) */
+
+#define NUM_REGS 26
+
+/* Initializer for an array of names of registers.
+ There should be NUM_REGS strings in this initializer. */
+
+#define REGISTER_NAMES \
+ { "a1", "a2", "a3", "a4", \
+ "v1", "v2", "v3", "v4", "v5", "v6", \
+ "sl", "fp", "ip", "sp", "lr", "pc", \
+ "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", "fps", "ps" }
+
+/* Register numbers of various important registers.
+ Note that some of these values are "real" register numbers,
+ and correspond to the general registers of the machine,
+ and some are "phony" register numbers which are too large
+ to be actual register numbers as far as the user is concerned
+ but do serve to get the desired values when passed to read_register. */
+
+#define AP_REGNUM 11
+#define FP_REGNUM 11 /* Contains address of executing stack frame */
+#define SP_REGNUM 13 /* Contains address of top of stack */
+#define LR_REGNUM 14 /* address to return to from a function call */
+#define PC_REGNUM 15 /* Contains program counter */
+#define F0_REGNUM 16 /* first floating point register */
+#define FPS_REGNUM 24 /* floating point status register */
+#define PS_REGNUM 25 /* Contains processor status */
+
+
+/* Total amount of space needed to store our copies of the machine's
+ register state, the array `registers'. */
+#define REGISTER_BYTES (16*4 + 12*8 + 4 + 4)
+
+/* Index within `registers' of the first byte of the space for
+ register N. */
+
+#define REGISTER_BYTE(N) (((N) < F0_REGNUM) ? (N)*4 : \
+ (((N) < PS_REGNUM) ? 16*4 + ((N) - 16)*12 : \
+ 16*4 + 8*12 + ((N) - FPS_REGNUM) * 4))
+
+/* Number of bytes of storage in the actual machine representation
+ for register N. On the vax, all regs are 4 bytes. */
+
+#define REGISTER_RAW_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 12)
+
+/* Number of bytes of storage in the program's representation
+ for register N. On the vax, all regs are 4 bytes. */
+
+#define REGISTER_VIRTUAL_SIZE(N) (((N) < F0_REGNUM || (N) >= FPS_REGNUM) ? 4 : 8)
+
+/* Largest value REGISTER_RAW_SIZE can have. */
+
+#define MAX_REGISTER_RAW_SIZE 12
+
+/* Largest value REGISTER_VIRTUAL_SIZE can have. */
+
+#define MAX_REGISTER_VIRTUAL_SIZE 8
+
+/* Nonzero if register N requires conversion
+ from raw format to virtual format. */
+
+#define REGISTER_CONVERTIBLE(N) ((unsigned)(N) - F0_REGNUM < 8)
+
+/* Convert data from raw format for register REGNUM
+ to virtual format for register REGNUM. */
+
+#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
+ if (REGISTER_CONVERTIBLE(REGNUM)) \
+ convert_from_extended((FROM), (TO)); \
+ else \
+ memcpy ((TO), (FROM), 4);
+
+/* Convert data from virtual format for register REGNUM
+ to raw format for register REGNUM. */
+
+#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
+ if (REGISTER_CONVERTIBLE(REGNUM)) \
+ convert_to_extended((FROM), (TO)); \
+ else \
+ memcpy ((TO), (FROM), 4);
+
+/* Return the GDB type object for the "standard" data type
+ of data in register N. */
+
+#define REGISTER_VIRTUAL_TYPE(N) \
+ (((unsigned)(N) - F0_REGNUM) < 8 ? builtin_type_double : builtin_type_int)
+
+/* The system C compiler uses a similar structure return convention to gcc */
+
+#define USE_STRUCT_CONVENTION(gcc_p, type) (TYPE_LENGTH (type) > 4)
+
+/* Store the address of the place in which to copy the structure the
+ subroutine will return. This is called from call_function. */
+
+#define STORE_STRUCT_RETURN(ADDR, SP) \
+ { write_register (0, (ADDR)); }
+
+/* Extract from an array REGBUF containing the (raw) register state
+ a function return value of type TYPE, and copy that, in virtual format,
+ into VALBUF. */
+
+#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
+ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) \
+ convert_from_extended(REGBUF + REGISTER_BYTE (F0_REGNUM), VALBUF); \
+ else \
+ memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE))
+
+/* Write into appropriate registers a function return value
+ of type TYPE, given in virtual format. */
+
+#define STORE_RETURN_VALUE(TYPE,VALBUF) \
+ if (TYPE_CODE (TYPE) == TYPE_CODE_FLT) { \
+ char _buf[MAX_REGISTER_RAW_SIZE]; \
+ convert_to_extended(VALBUF, _buf); \
+ write_register_bytes (REGISTER_BYTE (F0_REGNUM), _buf, MAX_REGISTER_RAW_SIZE); \
+ } else \
+ write_register_bytes (0, VALBUF, TYPE_LENGTH (TYPE))
+
+/* Extract from an array REGBUF containing the (raw) register state
+ the address in which a function should return its structure value,
+ as a CORE_ADDR (or an expression that can be used as one). */
+
+#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
+
+/* Specify that for the native compiler variables for a particular
+ lexical context are listed after the beginning LBRAC instead of
+ before in the executables list of symbols. */
+#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
+
+
+/* Describe the pointer in each stack frame to the previous stack frame
+ (its caller). */
+
+/* FRAME_CHAIN takes a frame's nominal address
+ and produces the frame's chain-pointer.
+
+ However, if FRAME_CHAIN_VALID returns zero,
+ it means the given frame is the outermost one and has no caller. */
+
+/* In the case of the ARM, the frame's nominal address is the FP value,
+ and 12 bytes before comes the saved previous FP value as a 4-byte word. */
+
+#define FRAME_CHAIN(thisframe) \
+ ((thisframe)->pc >= first_object_file_end ? \
+ read_memory_integer ((thisframe)->frame - 12, 4) :\
+ 0)
+
+#define FRAME_CHAIN_VALID(chain, thisframe) \
+ (chain != 0 && (FRAME_SAVED_PC (thisframe) >= first_object_file_end))
+
+/* Define other aspects of the stack frame. */
+
+/* A macro that tells us whether the function invocation represented
+ by FI does not have a frame on the stack associated with it. If it
+ does not, FRAMELESS is set to 1, else 0. */
+#define FRAMELESS_FUNCTION_INVOCATION(FI, FRAMELESS) \
+{ \
+ CORE_ADDR func_start, after_prologue; \
+ func_start = (get_pc_function_start ((FI)->pc) + \
+ FUNCTION_START_OFFSET); \
+ after_prologue = func_start; \
+ SKIP_PROLOGUE (after_prologue); \
+ (FRAMELESS) = (after_prologue == func_start); \
+}
+
+/* Saved Pc. */
+
+#define FRAME_SAVED_PC(FRAME) \
+ (read_memory_integer ((FRAME)->frame - 4, 4) & 0x03fffffc)
+
+#define FRAME_ARGS_ADDRESS(fi) (fi->frame)
+
+#define FRAME_LOCALS_ADDRESS(fi) ((fi)->frame)
+
+/* Return number of args passed to a frame.
+ Can return -1, meaning no way to tell. */
+
+#define FRAME_NUM_ARGS(numargs, fi) (numargs = -1)
+
+/* Return number of bytes at start of arglist that are not really args. */
+
+#define FRAME_ARGS_SKIP 0
+
+/* Put here the code to store, into a struct frame_saved_regs,
+ the addresses of the saved registers of frame described by FRAME_INFO.
+ This includes special registers such as pc and fp saved in special
+ ways in the stack frame. sp is even more special:
+ the address we return for it IS the sp for the next frame. */
+
+#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
+{ \
+ register int regnum; \
+ register int frame; \
+ register int next_addr; \
+ register int return_data_save; \
+ register int saved_register_mask; \
+ bzero (&frame_saved_regs, sizeof frame_saved_regs); \
+ frame = (frame_info)->frame; \
+ return_data_save = read_memory_integer(frame, 4) & 0x03fffffc - 12; \
+ saved_register_mask = \
+ read_memory_integer(return_data_save, 4); \
+ next_addr = frame - 12; \
+ for (regnum = 4; regnum < 10; regnum++) \
+ if (saved_register_mask & (1<<regnum)) { \
+ next_addr -= 4; \
+ (frame_saved_regs).regs[regnum] = next_addr; \
+ } \
+ if (read_memory_integer(return_data_save + 4, 4) == 0xed6d7103) { \
+ next_addr -= 12; \
+ (frame_saved_regs).regs[F0_REGNUM + 7] = next_addr; \
+ } \
+ if (read_memory_integer(return_data_save + 8, 4) == 0xed6d6103) { \
+ next_addr -= 12; \
+ (frame_saved_regs).regs[F0_REGNUM + 6] = next_addr; \
+ } \
+ if (read_memory_integer(return_data_save + 12, 4) == 0xed6d5103) { \
+ next_addr -= 12; \
+ (frame_saved_regs).regs[F0_REGNUM + 5] = next_addr; \
+ } \
+ if (read_memory_integer(return_data_save + 16, 4) == 0xed6d4103) { \
+ next_addr -= 12; \
+ (frame_saved_regs).regs[F0_REGNUM + 4] = next_addr; \
+ } \
+ (frame_saved_regs).regs[SP_REGNUM] = next_addr; \
+ (frame_saved_regs).regs[PC_REGNUM] = frame - 4; \
+ (frame_saved_regs).regs[PS_REGNUM] = frame - 4; \
+ (frame_saved_regs).regs[FP_REGNUM] = frame - 12; \
+}
+
+/* Things needed for making the inferior call functions. */
+
+/* Push an empty stack frame, to record the current PC, etc. */
+
+#define PUSH_DUMMY_FRAME \
+{ \
+ register CORE_ADDR sp = read_register (SP_REGNUM); \
+ register int regnum; \
+ /* opcode for ldmdb fp,{v1-v6,fp,ip,lr,pc}^ */ \
+ sp = push_word(sp, 0xe92dbf0); /* dummy return_data_save ins */ \
+ /* push a pointer to the dummy instruction minus 12 */ \
+ sp = push_word(sp, read_register (SP_REGNUM) - 16); \
+ sp = push_word(sp, read_register (PS_REGNUM)); \
+ sp = push_word(sp, read_register (SP_REGNUM)); \
+ sp = push_word(sp, read_register (FP_REGNUM)); \
+ for (regnum = 9; regnum >= 4; regnum --) \
+ sp = push_word(sp, read_register (regnum)); \
+ write_register (FP_REGNUM, read_register (SP_REGNUM) - 8); \
+ write_register (SP_REGNUM, sp); }
+
+/* Discard from the stack the innermost frame, restoring all registers. */
+
+#define POP_FRAME \
+{ \
+ register CORE_ADDR fp = read_register (FP_REGNUM); \
+ register unsigned long return_data_save = \
+ read_memory_integer ( (read_memory_integer (fp, 4) & \
+ 0x03fffffc) - 12, 4); \
+ register int regnum; \
+ write_register (PS_REGNUM, read_memory_integer (fp - 4, 4)); \
+ write_register (PC_REGNUM, read_register (PS_REGNUM) & 0x03fffffc); \
+ write_register (SP_REGNUM, read_memory_integer (fp - 8, 4)); \
+ write_register (FP_REGNUM, read_memory_integer (fp - 12, 4)); \
+ fp -= 12; \
+ for (regnum = 9; regnum >= 4; regnum--) \
+ if (return_data_save & (1<<regnum)) { \
+ fp -= 4; \
+ write_register (regnum, read_memory_integer(fp, 4)); \
+ } \
+ flush_cached_frames (); \
+ set_current_frame (create_new_frame (read_register (FP_REGNUM), \
+ read_pc ())); \
+}
+
+/* This sequence of words is the instructions
+
+ ldmia sp!,{a1-a4}
+ mov lk,pc
+ bl *+8
+ swi bkpt_swi
+
+ Note this is 16 bytes. */
+
+#define CALL_DUMMY {0xe8bd000f, 0xe1a0e00f, 0xeb000000, 0xef180000}
+
+#define CALL_DUMMY_START_OFFSET 0 /* Start execution at beginning of dummy */
+
+/* Insert the specified number of args and function address
+ into a call sequence of the above form stored at DUMMYNAME. */
+
+#define FIX_CALL_DUMMY(dummyname, pc, fun, nargs, args, type, gcc_p) \
+{ \
+ register enum type_code code = TYPE_CODE (type); \
+ register nargs_in_registers, struct_return = 0; \
+ /* fix the load-arguments mask to move the first 4 or less arguments \
+ into a1-a4 but make sure the structure return address in a1 is \
+ not disturbed if the function is returning a structure */ \
+ if ((code == TYPE_CODE_STRUCT || \
+ code == TYPE_CODE_UNION || \
+ code == TYPE_CODE_ARRAY) && \
+ TYPE_LENGTH (type) > 4) { \
+ nargs_in_registers = min(nargs + 1, 4); \
+ struct_return = 1; \
+ } else \
+ nargs_in_registers = min(nargs, 4); \
+ *(char *) dummyname = (1 << nargs_in_registers) - 1 - struct_return; \
+ *(int *)((char *) dummyname + 8) = \
+ (((fun - (pc + 16)) / 4) & 0x00ffffff) | 0xeb000000; }
diff --git a/gdb/config/h8300/tm-h8300.h b/gdb/config/h8300/tm-h8300.h
index e79ad64..bee667a 100644
--- a/gdb/config/h8300/tm-h8300.h
+++ b/gdb/config/h8300/tm-h8300.h
@@ -181,7 +181,7 @@ extern CORE_ADDR h8300_skip_prologue ();
/* FIXME: Won't work with both h8/300's. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy ((char *)(REGBUF), VALBUF, TYPE_LENGTH(TYPE))
+ memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. Assumes floats are passed
diff --git a/gdb/config/h8500/tm-h8500.h b/gdb/config/h8500/tm-h8500.h
index c15df3f..75e377a 100644
--- a/gdb/config/h8500/tm-h8500.h
+++ b/gdb/config/h8500/tm-h8500.h
@@ -181,7 +181,7 @@ struct type *h8500_register_virtual_type PARAMS ((int regno));
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy ((char *)(REGBUF), VALBUF, TYPE_LENGTH(TYPE))
+ memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
/* Write into appropriate registers a function return value
diff --git a/gdb/config/i386/tm-i386aix.h b/gdb/config/i386/tm-i386aix.h
index 9294e62..646b434 100644
--- a/gdb/config/i386/tm-i386aix.h
+++ b/gdb/config/i386/tm-i386aix.h
@@ -116,14 +116,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
to virtual format for register REGNUM. */
#undef REGISTER_CONVERT_TO_VIRTUAL
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- ((REGNUM < FP0_REGNUM) ? bcopy ((FROM), (TO), 4) : \
+ ((REGNUM < FP0_REGNUM) ? memcpy ((TO), (FROM), 4) : \
i387_to_double((FROM), (TO)))
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#undef REGISTER_CONVERT_TO_RAW
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- ((REGNUM < FP0_REGNUM) ? bcopy ((FROM), (TO), 4) : \
+ ((REGNUM < FP0_REGNUM) ? memcpy ((TO), (FROM), 4) : \
double_to_i387((FROM), (TO)))
/* Return the GDB type object for the "standard" data type
diff --git a/gdb/config/i386/tm-sun386.h b/gdb/config/i386/tm-sun386.h
index 28fec6a..b2d0b76 100644
--- a/gdb/config/i386/tm-sun386.h
+++ b/gdb/config/i386/tm-sun386.h
@@ -174,7 +174,7 @@ i386_skip_prologue PARAMS ((int));
{ if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
i387_to_double ((FROM), (TO)); \
else \
- bcopy ((FROM), (TO), 4); }
+ memcpy ((TO), (FROM), 4); }
extern void
i387_to_double PARAMS ((char *, char *));
@@ -186,7 +186,7 @@ i387_to_double PARAMS ((char *, char *));
{ if ((REGNUM) >= FP0_REGNUM && (REGNUM) < FPC_REGNUM) \
double_to_i387 ((FROM), (TO)); \
else \
- bcopy ((FROM), (TO), 4); }
+ memcpy ((TO), (FROM), 4); }
extern void
double_to_i387 PARAMS ((char *, char *));
@@ -209,7 +209,7 @@ double_to_i387 PARAMS ((char *, char *));
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), VALBUF, TYPE_LENGTH (TYPE))
+ memcpy (VALBUF, REGBUF + REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 11), TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/i386/tm-symmetry.h b/gdb/config/i386/tm-symmetry.h
index 2d53d11..24d1405 100644
--- a/gdb/config/i386/tm-symmetry.h
+++ b/gdb/config/i386/tm-symmetry.h
@@ -274,11 +274,11 @@ switch (regno) { \
#undef REGISTER_CONVERT_TO_VIRTUAL
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
-((REGNUM < 3) ? bcopy ((FROM), (TO), 4) : \
+((REGNUM < 3) ? memcpy ((TO), (FROM), 4) : \
(REGNUM < 5) ? i387_to_double((FROM), (TO)) : \
-(REGNUM < 8) ? bcopy ((FROM), (TO), 4) : \
+(REGNUM < 8) ? memcpy ((TO), (FROM), 4) : \
(REGNUM < 14) ? i387_to_double((FROM), (TO)) : \
- bcopy ((FROM), (TO), 4))
+ memcpy ((TO), (FROM), 4))
extern void
i387_to_double PARAMS ((char *, char *));
@@ -288,11 +288,11 @@ i387_to_double PARAMS ((char *, char *));
#undef REGISTER_CONVERT_TO_RAW
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
-((REGNUM < 3) ? bcopy ((FROM), (TO), 4) : \
+((REGNUM < 3) ? memcpy ((TO), (FROM), 4) : \
(REGNUM < 5) ? double_to_i387((FROM), (TO)) : \
-(REGNUM < 8) ? bcopy ((FROM), (TO), 4) : \
+(REGNUM < 8) ? memcpy ((TO), (FROM), 4) : \
(REGNUM < 14) ? double_to_i387((FROM), (TO)) : \
- bcopy ((FROM), (TO), 4))
+ memcpy ((TO), (FROM), 4))
extern void
double_to_i387 PARAMS ((char *, char *));
diff --git a/gdb/config/i960/tm-i960.h b/gdb/config/i960/tm-i960.h
index 773a8b7..1337362 100644
--- a/gdb/config/i960/tm-i960.h
+++ b/gdb/config/i960/tm-i960.h
@@ -174,7 +174,7 @@ extern struct ext_format ext_format_i960;
if ((REGNUM) >= FP0_REGNUM) \
ieee_extended_to_double (&ext_format_i960, (FROM), (double *)(TO)); \
else \
- bcopy ((FROM), (TO), 4); \
+ memcpy ((TO), (FROM), 4); \
}
/* Convert data from virtual format for register REGNUM
@@ -185,7 +185,7 @@ extern struct ext_format ext_format_i960;
if ((REGNUM) >= FP0_REGNUM) \
double_to_ieee_extended (&ext_format_i960, (double *)(FROM), (TO)); \
else \
- bcopy ((FROM), (TO), 4); \
+ memcpy ((TO), (FROM), 4); \
}
@@ -221,7 +221,7 @@ extern struct ext_format ext_format_i960;
On the i960 we just take as many bytes as we need from G0 through G3. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy(REGBUF+REGISTER_BYTE(G0_REGNUM), VALBUF, TYPE_LENGTH (TYPE))
+ memcpy(VALBUF, REGBUF+REGISTER_BYTE(G0_REGNUM), TYPE_LENGTH (TYPE))
/* If USE_STRUCT_CONVENTION produces a 1,
extract from an array REGBUF containing the (raw) register state
diff --git a/gdb/config/m68k/tm-news.h b/gdb/config/m68k/tm-news.h
index 3d2cfb3..09fc7c4 100644
--- a/gdb/config/m68k/tm-news.h
+++ b/gdb/config/m68k/tm-news.h
@@ -41,7 +41,7 @@ Here is an m-news.h file for gdb. It supports the 68881 registers.
&REGBUF[REGISTER_BYTE (FP0_REGNUM)], VALBUF); \
} \
else \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE)); }
+ memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)); }
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/m88k/tm-m88k.h b/gdb/config/m88k/tm-m88k.h
index a9ca9cb..2249d35 100644
--- a/gdb/config/m88k/tm-m88k.h
+++ b/gdb/config/m88k/tm-m88k.h
@@ -277,13 +277,13 @@ extern CORE_ADDR skip_prologue ();
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
+ {memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM));}
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- {bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM));}
+ {memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM));}
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -294,7 +294,7 @@ extern CORE_ADDR skip_prologue ();
into consecutive registers starting from r2. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (&(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), (VALBUF), TYPE_LENGTH (TYPE))
+ memcpy ((VALBUF), &(((char *)REGBUF)[REGISTER_BYTE(RV_REGNUM)]), TYPE_LENGTH (TYPE))
#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
diff --git a/gdb/config/mips/tm-mips.h b/gdb/config/mips/tm-mips.h
index c74bf37..d2b5d20 100644
--- a/gdb/config/mips/tm-mips.h
+++ b/gdb/config/mips/tm-mips.h
@@ -173,13 +173,13 @@ extern CORE_ADDR mips_skip_prologue PARAMS ((CORE_ADDR addr, int lenient));
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), 4);
+ memcpy ((TO), (FROM), 4);
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), 4);
+ memcpy ((TO), (FROM), 4);
/* Return the GDB type object for the "standard" data type
of data in register N. */
diff --git a/gdb/config/ns32k/tm-merlin.h b/gdb/config/ns32k/tm-merlin.h
index 4191b04..4503993 100644
--- a/gdb/config/ns32k/tm-merlin.h
+++ b/gdb/config/ns32k/tm-merlin.h
@@ -150,13 +150,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_VIRTUAL_SIZE(REGNUM));
+ memcpy ((TO), (FROM), REGISTER_VIRTUAL_SIZE(REGNUM));
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_VIRTUAL_SIZE(REGNUM));
+ memcpy ((TO), (FROM), REGISTER_VIRTUAL_SIZE(REGNUM));
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -181,7 +181,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
+ memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/ns32k/tm-umax.h b/gdb/config/ns32k/tm-umax.h
index 3ec6852..b4e13ee 100644
--- a/gdb/config/ns32k/tm-umax.h
+++ b/gdb/config/ns32k/tm-umax.h
@@ -159,13 +159,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_VIRTUAL_SIZE(REGNUM));
+ memcpy ((TO), (FROM), REGISTER_VIRTUAL_SIZE(REGNUM));
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_VIRTUAL_SIZE(REGNUM));
+ memcpy ((TO), (FROM), REGISTER_VIRTUAL_SIZE(REGNUM));
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -192,7 +192,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), VALBUF, TYPE_LENGTH (TYPE))
+ memcpy (VALBUF, REGBUF+REGISTER_BYTE (TYPE_CODE (TYPE) == TYPE_CODE_FLT ? FP0_REGNUM : 0), TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/pa/tm-hppa.h b/gdb/config/pa/tm-hppa.h
index 855154c..55e5774 100644
--- a/gdb/config/pa/tm-hppa.h
+++ b/gdb/config/pa/tm-hppa.h
@@ -250,8 +250,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy ((REGBUF) + REGISTER_BYTE(TYPE_LENGTH(TYPE) > 4 ? \
- FP4_REGNUM :28), VALBUF, TYPE_LENGTH (TYPE))
+ memcpy (VALBUF, (REGBUF) + REGISTER_BYTE(TYPE_LENGTH(TYPE) > 4 ? \
+ FP4_REGNUM :28), TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
@@ -566,3 +566,4 @@ struct obj_unwind_info {
#define OBJ_UNWIND_INFO(obj) ((struct obj_unwind_info *)obj->obj_private)
#define TARGET_READ_PC() target_read_pc ()
+#define TARGET_WRITE_PC(v) target_write_pc (v)
diff --git a/gdb/config/rs6000/tm-rs6000.h b/gdb/config/rs6000/tm-rs6000.h
index 6350254..5fea98b 100644
--- a/gdb/config/rs6000/tm-rs6000.h
+++ b/gdb/config/rs6000/tm-rs6000.h
@@ -122,7 +122,6 @@ function_frame_info PARAMS ((CORE_ADDR, struct aix_framedata *));
if ((W)==0x57c && breakpoints_inserted) { \
mark_breakpoints_out (); \
insert_breakpoints (); \
- insert_step_breakpoint (); \
} \
resume (0, 0); \
continue; \
@@ -311,13 +310,13 @@ extern void xcoff_relocate_core PARAMS ((void));
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM))
+ memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM))
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), REGISTER_RAW_SIZE (REGNUM))
+ memcpy ((TO), (FROM), REGISTER_RAW_SIZE (REGNUM))
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -343,7 +342,7 @@ extern unsigned int rs6000_struct_return_address;
into VALBUF. */
/* #define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE)) */
+ memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE)) */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
extract_return_value(TYPE,REGBUF,VALBUF)
diff --git a/gdb/config/sh/tm-sh.h b/gdb/config/sh/tm-sh.h
index 7dc6819..b1f53c2 100644
--- a/gdb/config/sh/tm-sh.h
+++ b/gdb/config/sh/tm-sh.h
@@ -160,7 +160,7 @@ extern CORE_ADDR sh_skip_prologue ();
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy ((char *)(REGBUF), VALBUF, TYPE_LENGTH(TYPE))
+ memcpy (VALBUF, (char *)(REGBUF), TYPE_LENGTH(TYPE))
/* Write into appropriate registers a function return value
diff --git a/gdb/config/vax/tm-vax.h b/gdb/config/vax/tm-vax.h
index 8c345b8..2fbaff5 100644
--- a/gdb/config/vax/tm-vax.h
+++ b/gdb/config/vax/tm-vax.h
@@ -151,13 +151,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
to virtual format for register REGNUM. */
#define REGISTER_CONVERT_TO_VIRTUAL(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), 4);
+ memcpy ((TO), (FROM), 4);
/* Convert data from virtual format for register REGNUM
to raw format for register REGNUM. */
#define REGISTER_CONVERT_TO_RAW(REGNUM,FROM,TO) \
- bcopy ((FROM), (TO), 4);
+ memcpy ((TO), (FROM), 4);
/* Return the GDB type object for the "standard" data type
of data in register N. */
@@ -175,7 +175,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
into VALBUF. */
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy (REGBUF, VALBUF, TYPE_LENGTH (TYPE))
+ memcpy (VALBUF, REGBUF, TYPE_LENGTH (TYPE))
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/config/z8k/tm-z8k.h b/gdb/config/z8k/tm-z8k.h
index 6be9403..4d4eacf 100644
--- a/gdb/config/z8k/tm-z8k.h
+++ b/gdb/config/z8k/tm-z8k.h
@@ -171,7 +171,7 @@ extern CORE_ADDR mz8k_skip_prologue PARAMS ((CORE_ADDR ip));
#define EXTRACT_RETURN_VALUE(TYPE,REGBUF,VALBUF) \
- bcopy(REGBUF + REGISTER_BYTE(2), VALBUF, TYPE_LENGTH(TYPE));
+ memcpy(VALBUF, REGBUF + REGISTER_BYTE(2), TYPE_LENGTH(TYPE));
/* Write into appropriate registers a function return value
of type TYPE, given in virtual format. */
diff --git a/gdb/convex-tdep.c b/gdb/convex-tdep.c
index bd1a6b7..23f7113 100644
--- a/gdb/convex-tdep.c
+++ b/gdb/convex-tdep.c
@@ -350,7 +350,7 @@ value_of_trapped_internalvar (var)
{
long vm[4];
long i, *p;
- bcopy (read_vector_register_1 (VM_REGNUM), vm, sizeof vm);
+ memcpy (vm, read_vector_register_1 (VM_REGNUM), sizeof vm);
range_type =
create_range_type ((struct type *) NULL, builtin_type_int, 0, len - 1);
type =
@@ -368,8 +368,9 @@ value_of_trapped_internalvar (var)
create_array_type ((struct type *) NULL, builtin_type_long_long,
range_type);
val = allocate_value (type);
- bcopy (read_vector_register_1 (name[1] - '0'),
- VALUE_CONTENTS (val), TYPE_LENGTH (type));
+ memcpy (VALUE_CONTENTS (val),
+ read_vector_register_1 (name[1] - '0'),
+ TYPE_LENGTH (type));
}
else if (name[0] == 'v')
{
diff --git a/gdb/convex-xdep.c b/gdb/convex-xdep.c
index 4b53f07..84bddd2 100644
--- a/gdb/convex-xdep.c
+++ b/gdb/convex-xdep.c
@@ -747,11 +747,11 @@ select_thread (thread)
if (thread == inferior_thread)
return;
- bcopy (registers, thread_regs[inferior_thread], REGISTER_BYTES);
+ memcpy (thread_regs[inferior_thread], registers, REGISTER_BYTES);
ps.pi_thread = inferior_thread = thread;
if (have_inferior_p ())
ioctl (inferior_fd, PISETRWTID, &ps);
- bcopy (thread_regs[thread], registers, REGISTER_BYTES);
+ memcpy (registers, thread_regs[thread], REGISTER_BYTES);
}
/* Routine to set or clear a psw bit in the psw and also all psws
diff --git a/gdb/findvar.c b/gdb/findvar.c
index a8ac396..c743d80 100644
--- a/gdb/findvar.c
+++ b/gdb/findvar.c
@@ -26,6 +26,148 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "inferior.h"
#include "target.h"
+/* Basic byte-swapping routines. GDB has needed these for a long time...
+ All extract a target-format integer at ADDR which is LEN bytes long. */
+
+#if TARGET_CHAR_BIT != 8 || HOST_CHAR_BIT != 8
+ /* 8 bit characters are a pretty safe assumption these days, so we
+ assume it throughout all these swapping routines. If we had to deal with
+ 9 bit characters, we would need to make len be in bits and would have
+ to re-write these routines... */
+ you lose
+#endif
+
+LONGEST
+extract_signed_integer (addr, len)
+ PTR addr;
+ int len;
+{
+ LONGEST retval;
+ unsigned char *p;
+ unsigned char *startaddr = (unsigned char *)addr;
+ unsigned char *endaddr = startaddr + len;
+
+ if (len > sizeof (LONGEST))
+ error ("\
+That operation is not available on integers of more than %d bytes.",
+ sizeof (LONGEST));
+
+ /* Start at the most significant end of the integer, and work towards
+ the least significant. */
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+ p = startaddr;
+#else
+ p = endaddr - 1;
+#endif
+ /* Do the sign extension once at the start. */
+ retval = (*p ^ 0x80) - 0x80;
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+ for (++p; p < endaddr; ++p)
+#else
+ for (--p; p >= startaddr; --p)
+#endif
+ {
+ retval = (retval << 8) | *p;
+ }
+ return retval;
+}
+
+unsigned LONGEST
+extract_unsigned_integer (addr, len)
+ PTR addr;
+ int len;
+{
+ unsigned LONGEST retval;
+ unsigned char *p;
+ unsigned char *startaddr = (unsigned char *)addr;
+ unsigned char *endaddr = startaddr + len;
+
+ if (len > sizeof (unsigned LONGEST))
+ error ("\
+That operation is not available on integers of more than %d bytes.",
+ sizeof (unsigned LONGEST));
+
+ /* Start at the most significant end of the integer, and work towards
+ the least significant. */
+ retval = 0;
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+ for (p = startaddr; p < endaddr; ++p)
+#else
+ for (p = endaddr - 1; p >= startaddr; --p)
+#endif
+ {
+ retval = (retval << 8) | *p;
+ }
+ return retval;
+}
+
+CORE_ADDR
+extract_address (addr, len)
+ PTR addr;
+ int len;
+{
+ /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
+ whether we want this to be true eventually. */
+ return extract_unsigned_integer (addr, len);
+}
+
+void
+store_signed_integer (addr, len, val)
+ PTR addr;
+ int len;
+ LONGEST val;
+{
+ unsigned char *p;
+ unsigned char *startaddr = (unsigned char *)addr;
+ unsigned char *endaddr = startaddr + len;
+
+ /* Start at the least significant end of the integer, and work towards
+ the most significant. */
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+ for (p = endaddr - 1; p >= startaddr; --p)
+#else
+ for (p = startaddr; p < endaddr; ++p)
+#endif
+ {
+ *p = val & 0xff;
+ val >>= 8;
+ }
+}
+
+void
+store_unsigned_integer (addr, len, val)
+ PTR addr;
+ int len;
+ unsigned LONGEST val;
+{
+ unsigned char *p;
+ unsigned char *startaddr = (unsigned char *)addr;
+ unsigned char *endaddr = startaddr + len;
+
+ /* Start at the least significant end of the integer, and work towards
+ the most significant. */
+#if TARGET_BYTE_ORDER == BIG_ENDIAN
+ for (p = endaddr - 1; p >= startaddr; --p)
+#else
+ for (p = startaddr; p < endaddr; ++p)
+#endif
+ {
+ *p = val & 0xff;
+ val >>= 8;
+ }
+}
+
+void
+store_address (addr, len, val)
+ PTR addr;
+ int len;
+ CORE_ADDR val;
+{
+ /* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
+ whether we want this to be true eventually. */
+ store_unsigned_integer (addr, len, (LONGEST)val);
+}
+
#if !defined (GET_SAVED_REGISTER)
/* Return the address in which frame FRAME's value of register REGNUM
@@ -138,9 +280,8 @@ get_saved_register (raw_buffer, optimized, addrp, frame, regnum, lval)
{
if (raw_buffer != NULL)
{
- *(CORE_ADDR *)raw_buffer = addr;
- /* Put it back in target byte order. */
- SWAP_TARGET_AND_HOST (raw_buffer, sizeof (CORE_ADDR));
+ /* Put it back in target format. */
+ store_address (raw_buffer, REGISTER_RAW_SIZE (regnum), addr);
}
if (addrp != NULL)
*addrp = 0;
@@ -176,8 +317,9 @@ read_relative_register_raw_bytes (regnum, myaddr)
int optim;
if (regnum == FP_REGNUM && selected_frame)
{
- memcpy (myaddr, &FRAME_FP(selected_frame), REGISTER_RAW_SIZE(FP_REGNUM));
- SWAP_TARGET_AND_HOST (myaddr, REGISTER_RAW_SIZE(FP_REGNUM)); /* in target order */
+ /* Put it back in target format. */
+ store_address (myaddr, REGISTER_RAW_SIZE(FP_REGNUM),
+ FRAME_FP(selected_frame));
return 0;
}
@@ -223,7 +365,7 @@ value_of_register (regnum)
the caller got the value from the last stop). */
/* Contents of the registers in target byte order.
- We allocate some extra slop since we do a lot of bcopy's around `registers',
+ We allocate some extra slop since we do a lot of memcpy's around `registers',
and failing-soft is better than failing hard. */
char registers[REGISTER_BYTES + /* SLOP */ 256];
@@ -300,57 +442,18 @@ write_register_bytes (regbyte, myaddr, len)
target_store_registers (-1);
}
-/* Return the contents of register REGNO, regarding it as an integer. */
-/* FIXME, this loses when the REGISTER_VIRTUAL (REGNO) is true. Also,
- why is the return type CORE_ADDR rather than some integer type? */
+/* Return the raw contents of register REGNO, regarding it as an integer. */
+/* This probably should be returning LONGEST rather than CORE_ADDR. */
CORE_ADDR
read_register (regno)
int regno;
{
- unsigned short sval;
- unsigned int ival;
- unsigned long lval;
- LONGEST llval;
-
- int size;
-
if (!register_valid[regno])
target_fetch_registers (regno);
- size = REGISTER_RAW_SIZE(regno);
-
- if (size == sizeof (unsigned char))
- return registers[REGISTER_BYTE (regno)];
- else if (size == sizeof (sval))
- {
- memcpy (&sval, &registers[REGISTER_BYTE (regno)], sizeof (sval));
- SWAP_TARGET_AND_HOST (&sval, sizeof (sval));
- return sval;
- }
- else if (size == sizeof (ival))
- {
- memcpy (&ival, &registers[REGISTER_BYTE (regno)], sizeof (ival));
- SWAP_TARGET_AND_HOST (&ival, sizeof (ival));
- return ival;
- }
- else if (size == sizeof (lval))
- {
- memcpy (&lval, &registers[REGISTER_BYTE (regno)], sizeof (lval));
- SWAP_TARGET_AND_HOST (&lval, sizeof (lval));
- return lval;
- }
- else if (size == sizeof (llval))
- {
- memcpy (&llval, &registers[REGISTER_BYTE (regno)], sizeof (llval));
- SWAP_TARGET_AND_HOST (&llval, sizeof (llval));
- return llval;
- }
- else
- {
- error ("GDB Internal Error in read_register() for register %d, size %d",
- regno, REGISTER_RAW_SIZE(regno));
- }
+ return extract_address (&registers[REGISTER_BYTE (regno)],
+ REGISTER_RAW_SIZE(regno));
}
/* Registers we shouldn't try to store. */
@@ -358,74 +461,37 @@ read_register (regno)
#define CANNOT_STORE_REGISTER(regno) 0
#endif
-/* Store VALUE in the register number REGNO, regarded as an integer. */
-/* FIXME, this loses when REGISTER_VIRTUAL (REGNO) is true. Also,
- shouldn't the val arg be a LONGEST or something? */
+/* Store VALUE, into the raw contents of register number REGNO. */
+/* FIXME: The val arg should probably be a LONGEST. */
void
write_register (regno, val)
int regno, val;
{
- unsigned char cval;
- unsigned short sval;
- unsigned int ival;
- unsigned long lval;
- LONGEST llval;
+ PTR buf;
int size;
- PTR ptr;
-
+
/* On the sparc, writing %g0 is a no-op, so we don't even want to change
the registers array if something writes to this register. */
if (CANNOT_STORE_REGISTER (regno))
return;
+ size = REGISTER_RAW_SIZE(regno);
+ buf = alloca (size);
+ store_signed_integer (buf, size, (LONGEST) val);
+
/* If we have a valid copy of the register, and new value == old value,
then don't bother doing the actual store. */
- size = REGISTER_RAW_SIZE(regno);
-
- if (size == sizeof(cval))
- {
- ptr = (PTR) &cval;
- cval = val;
- }
- else if (size == sizeof(sval))
- {
- ptr = (PTR) &sval;
- sval = val;
- }
- else if (size == sizeof(ival))
- {
- ptr = (PTR) &ival;
- ival = val;
- }
- else if (size == sizeof(lval))
- {
- ptr = (PTR) &lval;
- lval = val;
- }
- else if (size == sizeof(llval))
- {
- ptr = (PTR) &llval;
- llval = val;
- }
- else
- {
- error ("GDB Internal Error in write_register() for register %d, size %d",
- regno, size);
- }
-
- SWAP_TARGET_AND_HOST (ptr, size);
if (register_valid [regno])
{
- if (memcmp (&registers[REGISTER_BYTE (regno)],
- ptr, size) == 0)
+ if (memcmp (&registers[REGISTER_BYTE (regno)], buf, size) == 0)
return;
}
target_prepare_to_store ();
- memcpy (&registers[REGISTER_BYTE (regno)], ptr, size);
+ memcpy (&registers[REGISTER_BYTE (regno)], buf, size);
register_valid [regno] = 1;
@@ -477,15 +543,15 @@ read_var_value (var, frame)
switch (SYMBOL_CLASS (var))
{
case LOC_CONST:
- memcpy (VALUE_CONTENTS_RAW (v), &SYMBOL_VALUE (var), len);
- SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len);
+ /* Put the constant back in target format. */
+ store_signed_integer (VALUE_CONTENTS_RAW (v), len,
+ (LONGEST) SYMBOL_VALUE (var));
VALUE_LVAL (v) = not_lval;
return v;
case LOC_LABEL:
- addr = SYMBOL_VALUE_ADDRESS (var);
- memcpy (VALUE_CONTENTS_RAW (v), &addr, len);
- SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len);
+ /* Put the constant back in target format. */
+ store_address (VALUE_CONTENTS_RAW (v), len, SYMBOL_VALUE_ADDRESS (var));
VALUE_LVAL (v) = not_lval;
return v;
@@ -503,60 +569,51 @@ read_var_value (var, frame)
break;
case LOC_ARG:
- if (SYMBOL_BASEREG_VALID (var))
- {
- addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
- }
- else
- {
- fi = get_frame_info (frame);
- if (fi == NULL)
- return 0;
- addr = FRAME_ARGS_ADDRESS (fi);
- }
+ fi = get_frame_info (frame);
+ if (fi == NULL)
+ return 0;
+ addr = FRAME_ARGS_ADDRESS (fi);
if (!addr)
{
return 0;
}
addr += SYMBOL_VALUE (var);
break;
-
+
case LOC_REF_ARG:
- if (SYMBOL_BASEREG_VALID (var))
- {
- addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
- }
- else
- {
- fi = get_frame_info (frame);
- if (fi == NULL)
- return 0;
- addr = FRAME_ARGS_ADDRESS (fi);
- }
+ fi = get_frame_info (frame);
+ if (fi == NULL)
+ return 0;
+ addr = FRAME_ARGS_ADDRESS (fi);
if (!addr)
{
return 0;
}
addr += SYMBOL_VALUE (var);
- read_memory (addr, (char *) &addr, sizeof (CORE_ADDR));
+ addr = read_memory_unsigned_integer
+ (addr, TARGET_PTR_BIT / TARGET_CHAR_BIT);
break;
-
+
case LOC_LOCAL:
case LOC_LOCAL_ARG:
- if (SYMBOL_BASEREG_VALID (var))
- {
- addr = FRAME_GET_BASEREG_VALUE (frame, SYMBOL_BASEREG (var));
- }
- else
- {
- fi = get_frame_info (frame);
- if (fi == NULL)
- return 0;
- addr = FRAME_LOCALS_ADDRESS (fi);
- }
+ fi = get_frame_info (frame);
+ if (fi == NULL)
+ return 0;
+ addr = FRAME_LOCALS_ADDRESS (fi);
addr += SYMBOL_VALUE (var);
break;
+ case LOC_BASEREG:
+ case LOC_BASEREG_ARG:
+ {
+ char buf[MAX_REGISTER_RAW_SIZE];
+ get_saved_register (buf, NULL, NULL, frame, SYMBOL_BASEREG (var),
+ NULL);
+ addr = extract_address (buf, REGISTER_RAW_SIZE (SYMBOL_BASEREG (var)));
+ addr += SYMBOL_VALUE (var);
+ break;
+ }
+
case LOC_TYPEDEF:
error ("Cannot look up value of a typedef");
break;
diff --git a/gdb/hppab-nat.c b/gdb/hppab-nat.c
index 77f1d57..b45af84 100644
--- a/gdb/hppab-nat.c
+++ b/gdb/hppab-nat.c
@@ -326,7 +326,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
/* Copy data to be written over corresponding part of buffer */
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
+ memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
/* Write the entire buffer. */
@@ -361,7 +361,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
}
/* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
+ memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
}
return len;
}
diff --git a/gdb/hppah-nat.c b/gdb/hppah-nat.c
index f771696..7c04593 100644
--- a/gdb/hppah-nat.c
+++ b/gdb/hppah-nat.c
@@ -271,7 +271,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
/* Copy data to be written over corresponding part of buffer */
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
+ memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
/* Write the entire buffer. */
@@ -303,7 +303,7 @@ child_xfer_memory (memaddr, myaddr, len, write, target)
}
/* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
+ memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
}
return len;
}
diff --git a/gdb/i386mach-nat.c b/gdb/i386mach-nat.c
index 52081c7..4e2d323 100644
--- a/gdb/i386mach-nat.c
+++ b/gdb/i386mach-nat.c
@@ -53,12 +53,13 @@ fetch_inferior_registers (regno)
ptrace (PTRACE_GETFPREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_fp_registers);
- bcopy (&inferior_registers, registers, sizeof inferior_registers);
+ memcpy (registers, &inferior_registers, sizeof inferior_registers);
- bcopy (inferior_fp_registers.f_st,&registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ inferior_fp_registers.f_st,
sizeof inferior_fp_registers.f_st);
- bcopy (&inferior_fp_registers.f_ctrl,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.f_ctrl,
sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
}
@@ -74,12 +75,12 @@ store_inferior_registers (regno)
struct fp_state inferior_fp_registers;
extern char registers[];
- bcopy (registers, &inferior_registers, 20 * 4);
+ memcpy (&inferior_registers, registers, 20 * 4);
- bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)],inferior_fp_registers.f_st,
+ memcpy (inferior_fp_registers.f_st,&registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.f_st);
- bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
- &inferior_fp_registers.f_ctrl,
+ memcpy (&inferior_fp_registers.f_ctrl,
+ &registers[REGISTER_BYTE (FPC_REGNUM)],
sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
#ifdef PTRACE_FP_BUG
@@ -125,18 +126,18 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
switch (which) {
case 0:
case 1:
- bcopy (core_reg_sect, registers, core_reg_size);
+ memcpy (registers, core_reg_sect, core_reg_size);
break;
case 2:
#ifdef FP0_REGNUM
- bcopy (core_reg_sect,
- &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ core_reg_sect,
core_reg_size); /* FIXME, probably bogus */
#endif
#ifdef FPC_REGNUM
- bcopy (&corestr.c_fpu.f_fpstatus.f_ctrl,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &corestr.c_fpu.f_fpstatus.f_ctrl,
sizeof corestr.c_fpu.f_fpstatus -
sizeof corestr.c_fpu.f_fpstatus.f_st);
#endif
diff --git a/gdb/irix4-nat.c b/gdb/irix4-nat.c
index b7f12f0..e2a1ff2 100644
--- a/gdb/irix4-nat.c
+++ b/gdb/irix4-nat.c
@@ -118,7 +118,7 @@ fill_fpregset (fpregsetp, regno)
{
from = (char *) &registers[REGISTER_BYTE (regi)];
to = (char *) &(fpregsetp->fp_r.fp_regs[regi - FP0_REGNUM]);
- bcopy(from, to, REGISTER_RAW_SIZE (regi));
+ memcpy(to, from, REGISTER_RAW_SIZE (regi));
}
}
diff --git a/gdb/m68k-tdep.c b/gdb/m68k-tdep.c
index 2d0428b..f3b4e9b 100644
--- a/gdb/m68k-tdep.c
+++ b/gdb/m68k-tdep.c
@@ -18,15 +18,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "defs.h"
-#include "ieee-float.h"
#include "frame.h"
#include "symtab.h"
-const struct ext_format ext_format_68881 = {
-/* tot sbyte smask expbyte manbyte */
- 12, 0, 0x80, 0,1, 4,8 /* mc68881 */
-};
-
/* Things needed for making the inferior call functions.
It seems like every m68k based machine has almost identical definitions
@@ -193,6 +187,120 @@ CORE_ADDR ip;
return (ip);
}
+void
+m68k_find_saved_regs (frame_info, saved_regs)
+ struct frame_info *frame_info;
+ struct frame_saved_regs *saved_regs;
+{
+ register int regnum;
+ register int regmask;
+ register CORE_ADDR next_addr;
+ register CORE_ADDR pc;
+
+ /* First possible address for a pc in a call dummy for this frame. */
+ CORE_ADDR possible_call_dummy_start =
+ (frame_info)->frame - CALL_DUMMY_LENGTH - FP_REGNUM*4 - 4
+#if defined (HAVE_68881)
+ - 8*12
+#endif
+ ;
+
+ int nextinsn;
+ memset (saved_regs, 0, sizeof (*saved_regs));
+ if ((frame_info)->pc >= possible_call_dummy_start
+ && (frame_info)->pc <= (frame_info)->frame)
+ {
+
+ /* It is a call dummy. We could just stop now, since we know
+ what the call dummy saves and where. But this code proceeds
+ to parse the "prologue" which is part of the call dummy.
+ This is needlessly complex, confusing, and also is the only
+ reason that the call dummy is customized based on HAVE_68881.
+ FIXME. */
+
+ next_addr = (frame_info)->frame;
+ pc = possible_call_dummy_start;
+ }
+ else
+ {
+ pc = get_pc_function_start ((frame_info)->pc);
+ /* Verify we have a link a6 instruction next;
+ if not we lose. If we win, find the address above the saved
+ regs using the amount of storage from the link instruction. */
+ if (044016 == read_memory_integer (pc, 2))
+ next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 4), pc+=4;
+ else if (047126 == read_memory_integer (pc, 2))
+ next_addr = (frame_info)->frame + read_memory_integer (pc += 2, 2), pc+=2;
+ else goto lose;
+ /* If have an addal #-n, sp next, adjust next_addr. */
+ if ((0177777 & read_memory_integer (pc, 2)) == 0157774)
+ next_addr += read_memory_integer (pc += 2, 4), pc += 4;
+ }
+ regmask = read_memory_integer (pc + 2, 2);
+#if defined (HAVE_68881)
+ /* Here can come an fmovem. Check for it. */
+ nextinsn = 0xffff & read_memory_integer (pc, 2);
+ if (0xf227 == nextinsn
+ && (regmask & 0xff00) == 0xe000)
+ { pc += 4; /* Regmask's low bit is for register fp7, the first pushed */
+ for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)
+ if (regmask & 1)
+ saved_regs->regs[regnum] = (next_addr -= 12);
+ regmask = read_memory_integer (pc + 2, 2); }
+#endif
+ /* next should be a moveml to (sp) or -(sp) or a movl r,-(sp) */
+ if (0044327 == read_memory_integer (pc, 2))
+ { pc += 4; /* Regmask's low bit is for register 0, the first written */
+ for (regnum = 0; regnum < 16; regnum++, regmask >>= 1)
+ if (regmask & 1)
+ saved_regs->regs[regnum] = (next_addr += 4) - 4; }
+ else if (0044347 == read_memory_integer (pc, 2))
+ {
+ pc += 4; /* Regmask's low bit is for register 15, the first pushed */
+ for (regnum = 15; regnum >= 0; regnum--, regmask >>= 1)
+ if (regmask & 1)
+ saved_regs->regs[regnum] = (next_addr -= 4);
+ }
+ else if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2)))
+ {
+ regnum = 0xf & read_memory_integer (pc, 2); pc += 2;
+ saved_regs->regs[regnum] = (next_addr -= 4);
+ /* gcc, at least, may use a pair of movel instructions when saving
+ exactly 2 registers. */
+ if (0x2f00 == (0xfff0 & read_memory_integer (pc, 2)))
+ {
+ regnum = 0xf & read_memory_integer (pc, 2);
+ pc += 2;
+ saved_regs->regs[regnum] = (next_addr -= 4);
+ }
+ }
+#if defined (HAVE_68881)
+ /* fmovemx to index of sp may follow. */
+ regmask = read_memory_integer (pc + 2, 2);
+ nextinsn = 0xffff & read_memory_integer (pc, 2);
+ if (0xf236 == nextinsn
+ && (regmask & 0xff00) == 0xf000)
+ { pc += 10; /* Regmask's low bit is for register fp0, the first written */
+ for (regnum = FP0_REGNUM + 7; regnum >= FP0_REGNUM; regnum--, regmask >>= 1)
+ if (regmask & 1)
+ saved_regs->regs[regnum] = (next_addr += 12) - 12;
+ regmask = read_memory_integer (pc + 2, 2); }
+#endif
+ /* clrw -(sp); movw ccr,-(sp) may follow. */
+ if (0x426742e7 == read_memory_integer (pc, 4))
+ saved_regs->regs[PS_REGNUM] = (next_addr -= 4);
+ lose: ;
+ saved_regs->regs[SP_REGNUM] = (frame_info)->frame + 8;
+ saved_regs->regs[FP_REGNUM] = (frame_info)->frame;
+ saved_regs->regs[PC_REGNUM] = (frame_info)->frame + 4;
+#ifdef SIG_SP_FP_OFFSET
+ /* Adjust saved SP_REGNUM for fake _sigtramp frames. */
+ if (frame_info->signal_handler_caller && frame_info->next)
+ saved_regs->regs[SP_REGNUM] = frame_info->next->frame + SIG_SP_FP_OFFSET;
+#endif
+}
+
+
#ifdef USE_PROC_FS /* Target dependent support for /proc */
#include <sys/procfs.h>
@@ -317,7 +425,7 @@ int regno;
{
from = (char *) &registers[REGISTER_BYTE (regi)];
to = (char *) &(fpregsetp -> f_fpregs[regi-FP0_REGNUM][0]);
- bcopy (from, to, REGISTER_RAW_SIZE (regi));
+ memcpy (to, from, REGISTER_RAW_SIZE (regi));
}
}
if ((regno == -1) || (regno == FPC_REGNUM))
@@ -348,38 +456,38 @@ int
get_longjmp_target(pc)
CORE_ADDR *pc;
{
+ char buf[TARGET_PTR_BIT / TARGET_CHAR_BIT];
CORE_ADDR sp, jb_addr;
sp = read_register(SP_REGNUM);
- if (target_read_memory(sp + SP_ARG0, /* Offset of first arg on stack */
- &jb_addr,
- sizeof(CORE_ADDR)))
+ if (target_read_memory (sp + SP_ARG0, /* Offset of first arg on stack */
+ buf,
+ TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
+ jb_addr = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
- SWAP_TARGET_AND_HOST(&jb_addr, sizeof(CORE_ADDR));
-
- if (target_read_memory(jb_addr + JB_PC * JB_ELEMENT_SIZE, pc,
- sizeof(CORE_ADDR)))
+ if (target_read_memory (jb_addr + JB_PC * JB_ELEMENT_SIZE, buf,
+ TARGET_PTR_BIT / TARGET_CHAR_BIT))
return 0;
- SWAP_TARGET_AND_HOST(pc, sizeof(CORE_ADDR));
+ *pc = extract_address (buf, TARGET_PTR_BIT / TARGET_CHAR_BIT);
return 1;
}
#endif /* GET_LONGJMP_TARGET */
/* Immediately after a function call, return the saved pc before the frame
- is setup. We check for the common case of being inside of a system call,
- and if so, we know that Sun pushes the call # on the stack prior to doing
- the trap. */
+ is setup. For sun3's, we check for the common case of being inside of a
+ system call, and if so, we know that Sun pushes the call # on the stack
+ prior to doing the trap. */
CORE_ADDR
m68k_saved_pc_after_call(frame)
struct frame_info *frame;
{
-#ifdef sun
+#ifdef GDB_TARGET_IS_SUN3
int op;
op = read_memory_integer (frame->pc, 2);
@@ -388,6 +496,6 @@ m68k_saved_pc_after_call(frame)
if (op == P_TRAP)
return read_memory_integer (read_register (SP_REGNUM) + 4, 4);
else
-#endif /* sun */
+#endif /* GDB_TARGET_IS_SUN3 */
return read_memory_integer (read_register (SP_REGNUM), 4);
}
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 63a545f..62f7f06 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -774,7 +774,7 @@ collect_returned_value (rval, value_type, struct_return, nargs, args)
{
char retbuf[REGISTER_BYTES];
- bcopy (registers, retbuf, REGISTER_BYTES);
+ memcpy (retbuf, registers, REGISTER_BYTES);
*rval = value_being_returned (value_type, retbuf, struct_return);
return;
}
diff --git a/gdb/mipsread.c b/gdb/mipsread.c
index 2756275..d1228ea 100644
--- a/gdb/mipsread.c
+++ b/gdb/mipsread.c
@@ -853,7 +853,7 @@ parse_symbol (sh, ax, ext_sh, bigend)
/* Generate a template for the type of this function. The
types of the arguments will be added as we read the symbol
table. */
- bcopy (SYMBOL_TYPE (s), lookup_function_type (t), sizeof (struct type));
+ memcpy (lookup_function_type (t), SYMBOL_TYPE (s), sizeof (struct type));
#else
SYMBOL_TYPE (s) = lookup_function_type (t);
#endif
diff --git a/gdb/regex.c b/gdb/regex.c
index a945af5..7ad351c 100644
--- a/gdb/regex.c
+++ b/gdb/regex.c
@@ -32,7 +32,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#else /* not emacs */
-#define bcopy(s,d,n) memcpy((d),(s),(n))
#define bcmp(s1,s2,n) memcmp((s1),(s2),(n))
#define bzero(s,n) memset((s),0,(n))
@@ -1297,7 +1296,7 @@ re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop)
return -2;
stackx = (unsigned char **) alloca (2 * (stacke - stackb)
* sizeof (char *));
- bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *));
+ memcpy (stackx, stackb, (stacke - stackb) * sizeof (char *));
stackp = stackx + (stackp - stackb);
stacke = stackx + 2 * (stacke - stackb);
stackb = stackx;
@@ -1377,7 +1376,7 @@ re_match_2 (pbufp, string1, size1, string2, size2, pos, regs, mstop)
unsigned char **stackx
= (unsigned char **) alloca (2 * (stacke - stackb)
* sizeof (char *));
- bcopy (stackb, stackx, (stacke - stackb) * sizeof (char *));
+ memcpy (stackx, stackb, (stacke - stackb) * sizeof (char *));
stackp = stackx + (stackp - stackb);
stacke = stackx + 2 * (stacke - stackb);
stackb = stackx;
diff --git a/gdb/remote-bug.c b/gdb/remote-bug.c
index f64ac34..da4f0e2 100644
--- a/gdb/remote-bug.c
+++ b/gdb/remote-bug.c
@@ -41,7 +41,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "dcache.h"
extern int sleep();
-extern int bcopy();
/* External data declarations */
extern int stop_soon_quietly; /* for wait_for_inferior */
@@ -928,7 +927,7 @@ bug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
/* Copy data to be written over corresponding part of buffer */
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
+ memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
/* Write the entire buffer. */
@@ -959,7 +958,7 @@ bug_xfer_inferior_memory (memaddr, myaddr, len, write, target)
}
/* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
+ memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
}
return len;
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 562f883..212b0fc 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -1024,7 +1024,7 @@ hms_xfer_inferior_memory (memaddr, myaddr, len, write, target)
/* Copy data to be written over corresponding part of buffer */
- bcopy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
+ memcpy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
/* Write the entire buffer. */
@@ -1055,7 +1055,7 @@ hms_xfer_inferior_memory (memaddr, myaddr, len, write, target)
}
/* Copy appropriate bytes out of the buffer. */
- bcopy ((char *) buffer + (memaddr & (sizeof (int) - 1)), myaddr, len);
+ memcpy (myaddr, (char *) buffer + (memaddr & (sizeof (int) - 1)), len);
}
return len;
diff --git a/gdb/rs6000-nat.c b/gdb/rs6000-nat.c
index c80f70e..f9f322e 100644
--- a/gdb/rs6000-nat.c
+++ b/gdb/rs6000-nat.c
@@ -228,20 +228,20 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
if (which == 0) {
/* copy GPRs first. */
- bcopy (core_reg_sect, registers, 32 * 4);
+ memcpy (registers, core_reg_sect, 32 * 4);
/* gdb's internal register template and bfd's register section layout
should share a common include file. FIXMEmgo */
/* then comes special registes. They are supposed to be in the same
order in gdb template and bfd `.reg' section. */
core_reg_sect += (32 * 4);
- bcopy (core_reg_sect, &registers [REGISTER_BYTE (FIRST_SP_REGNUM)],
+ memcpy (&registers [REGISTER_BYTE (FIRST_SP_REGNUM)], core_reg_sect,
(LAST_SP_REGNUM - FIRST_SP_REGNUM + 1) * 4);
}
/* fetch floating point registers from register section 2 in core bfd. */
else if (which == 2)
- bcopy (core_reg_sect, &registers [REGISTER_BYTE (FP0_REGNUM)], 32 * 8);
+ memcpy (&registers [REGISTER_BYTE (FP0_REGNUM)], core_reg_sect, 32 * 8);
else
fprintf (stderr, "Gdb error: unknown parameter to fetch_core_registers().\n");
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index e8d9af8..03fbdb3 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -746,8 +746,8 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
printf (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- bcopy (VALUE_CONTENTS (arg),
- &registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], len);
+ memcpy (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
@@ -757,8 +757,8 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
while (argbytes < len) {
*(int*)&registers[REGISTER_BYTE(ii+3)] = 0;
- bcopy ( ((char*)VALUE_CONTENTS (arg))+argbytes,
- &registers[REGISTER_BYTE(ii+3)],
+ memcpy (&registers[REGISTER_BYTE(ii+3)],
+ ((char*)VALUE_CONTENTS (arg))+argbytes,
(len - argbytes) > 4 ? 4 : len - argbytes);
++ii, argbytes += 4;
@@ -770,7 +770,7 @@ push_arguments (nargs, args, sp, struct_return, struct_addr)
}
else { /* Argument can fit in one register. No problem. */
*(int*)&registers[REGISTER_BYTE(ii+3)] = 0;
- bcopy (VALUE_CONTENTS (arg), &registers[REGISTER_BYTE(ii+3)], len);
+ memcpy (&registers[REGISTER_BYTE(ii+3)], VALUE_CONTENTS (arg), len);
}
++argno;
}
@@ -837,8 +837,8 @@ ran_out_of_registers_for_arguments:
printf (
"Fatal Error: a floating point parameter #%d with a size > 8 is found!\n", argno);
- bcopy (VALUE_CONTENTS (arg),
- &registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], len);
+ memcpy (&registers[REGISTER_BYTE(FP0_REGNUM + 1 + f_argno)], VALUE_CONTENTS (arg),
+ len);
++f_argno;
}
@@ -878,17 +878,17 @@ extract_return_value (valtype, regbuf, valbuf)
necessary. */
if (TYPE_LENGTH (valtype) > 4) /* this is a double */
- bcopy (&regbuf[REGISTER_BYTE (FP0_REGNUM + 1)], valbuf,
+ memcpy (valbuf, &regbuf[REGISTER_BYTE (FP0_REGNUM + 1)],
TYPE_LENGTH (valtype));
else { /* float */
- bcopy (&regbuf[REGISTER_BYTE (FP0_REGNUM + 1)], &dd, 8);
+ memcpy (&dd, &regbuf[REGISTER_BYTE (FP0_REGNUM + 1)], 8);
ff = (float)dd;
- bcopy (&ff, valbuf, sizeof(float));
+ memcpy (valbuf, &ff, sizeof(float));
}
}
else
/* return value is copied starting from r3. */
- bcopy (&regbuf[REGISTER_BYTE (3)], valbuf, TYPE_LENGTH (valtype));
+ memcpy (valbuf, &regbuf[REGISTER_BYTE (3)], TYPE_LENGTH (valtype));
}
diff --git a/gdb/sparc-nat.c b/gdb/sparc-nat.c
index 0147055..3835952 100644
--- a/gdb/sparc-nat.c
+++ b/gdb/sparc-nat.c
@@ -98,8 +98,8 @@ fetch_inferior_registers (regno)
perror("ptrace_getfpregs");
memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof inferior_fp_registers.fpu_fr);
- /* bcopy (&inferior_fp_registers.Fpu_fsr,
- &registers[REGISTER_BYTE (FPS_REGNUM)],
+ /* memcpy (&registers[REGISTER_BYTE (FPS_REGNUM)],
+ &inferior_fp_registers.Fpu_fsr,
sizeof (FPU_FSR_TYPE)); FIXME??? -- gnu@cyg */
for (i = FP0_REGNUM; i <= FP0_REGNUM+31; i++)
register_valid[i] = 1;
diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index f57bf8f..2a5b972 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -547,9 +547,11 @@ define_symbol (valu, string, desc, type, objfile)
SYMBOL_LANGUAGE (sym) = current_subfile -> language;
SYMBOL_NAME (sym) = (char *)
obstack_alloc (&objfile -> symbol_obstack, ((p - string) + 1));
- /* Open-coded bcopy--saves function call time. */
+ /* Open-coded memcpy--saves function call time. */
/* FIXME: Does it really? Try replacing with simple strcpy and
try it on an executable with a large symbol table. */
+ /* FIXME: considering that gcc can open code memcpy anyway, I
+ doubt it. xoxorich. */
{
register char *p1 = string;
register char *p2 = SYMBOL_NAME (sym);
diff --git a/gdb/sun3-nat.c b/gdb/sun3-nat.c
index 082ee0f..d0c7506 100644
--- a/gdb/sun3-nat.c
+++ b/gdb/sun3-nat.c
@@ -44,16 +44,16 @@ fetch_inferior_registers (regno)
(PTRACE_ARG3_TYPE) &inferior_fp_registers);
#endif
- bcopy (&inferior_registers, registers, 16 * 4);
+ memcpy (registers, &inferior_registers, 16 * 4);
#ifdef FP0_REGNUM
- bcopy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
sizeof inferior_fp_registers.fps_regs);
#endif
*(int *)&registers[REGISTER_BYTE (PS_REGNUM)] = inferior_registers.r_ps;
*(int *)&registers[REGISTER_BYTE (PC_REGNUM)] = inferior_registers.r_pc;
#ifdef FP0_REGNUM
- bcopy (&inferior_fp_registers.fps_control,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.fps_control,
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
}
@@ -72,17 +72,17 @@ store_inferior_registers (regno)
#endif
extern char registers[];
- bcopy (registers, &inferior_registers, 16 * 4);
+ memcpy (&inferior_registers, registers, 16 * 4);
#ifdef FP0_REGNUM
- bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)], &inferior_fp_registers,
+ memcpy (&inferior_fp_registers, &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.fps_regs);
#endif
inferior_registers.r_ps = *(int *)&registers[REGISTER_BYTE (PS_REGNUM)];
inferior_registers.r_pc = *(int *)&registers[REGISTER_BYTE (PC_REGNUM)];
#ifdef FP0_REGNUM
- bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
- &inferior_fp_registers.fps_control,
+ memcpy (&inferior_fp_registers.fps_control,
+ &registers[REGISTER_BYTE (FPC_REGNUM)],
sizeof inferior_fp_registers - sizeof inferior_fp_registers.fps_regs);
#endif
@@ -112,7 +112,7 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
if (core_reg_size < sizeof (struct regs))
error ("Can't find registers in core file");
- bcopy ((char *)regs, registers, 16 * 4);
+ memcpy (registers, (char *)regs, 16 * 4);
supply_register (PS_REGNUM, (char *)&regs->r_ps);
supply_register (PC_REGNUM, (char *)&regs->r_pc);
@@ -123,11 +123,11 @@ fetch_core_registers (core_reg_sect, core_reg_size, which, reg_addr)
if (core_reg_size >= sizeof (struct fpu))
{
#ifdef FP0_REGNUM
- bcopy (fpustruct->f_fpstatus.fps_regs,
- &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ fpustruct->f_fpstatus.fps_regs,
sizeof fpustruct->f_fpstatus.fps_regs);
- bcopy (&fpustruct->f_fpstatus.fps_control,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &fpustruct->f_fpstatus.fps_control,
sizeof fpustruct->f_fpstatus -
sizeof fpustruct->f_fpstatus.fps_regs);
#endif
diff --git a/gdb/sun386-nat.c b/gdb/sun386-nat.c
index 27a734d..317bd8a 100644
--- a/gdb/sun386-nat.c
+++ b/gdb/sun386-nat.c
@@ -101,19 +101,19 @@ core_file_command (filename, from_tty)
data_offset = sizeof corestr;
stack_offset = sizeof corestr + corestr.c_dsize;
- bcopy (&corestr.c_regs, registers, sizeof corestr.c_regs);
+ memcpy (registers, &corestr.c_regs, sizeof corestr.c_regs);
- bcopy (corestr.c_fpu.f_fpstatus.f_st,
- &registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],
+ corestr.c_fpu.f_fpstatus.f_st,
sizeof corestr.c_fpu.f_fpstatus.f_st);
- bcopy (&corestr.c_fpu.f_fpstatus.f_ctrl,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &corestr.c_fpu.f_fpstatus.f_ctrl,
sizeof corestr.c_fpu.f_fpstatus -
sizeof corestr.c_fpu.f_fpstatus.f_st);
/* the struct aouthdr of sun coff is not the struct exec stored
in the core file. */
- bcopy (&corestr.c_aouthdr, &core_aouthdr, sizeof (struct exec));
+ memcpy (&core_aouthdr, &corestr.c_aouthdr, sizeof (struct exec));
#ifndef COFF_ENCAPSULATE
core_aouthdr.magic = corestr.c_aouthdr.a_info;
core_aouthdr.vstamp = /*SUNVERSION*/ 31252;
@@ -216,12 +216,12 @@ fetch_inferior_registers (regno)
ptrace (PTRACE_GETFPREGS, inferior_pid,
(PTRACE_ARG3_TYPE) &inferior_fp_registers);
- bcopy (&inferior_registers, registers, sizeof inferior_registers);
+ memcpy (registers, &inferior_registers, sizeof inferior_registers);
- bcopy (inferior_fp_registers.f_st,&registers[REGISTER_BYTE (FP0_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FP0_REGNUM)],inferior_fp_registers.f_st,
sizeof inferior_fp_registers.f_st);
- bcopy (&inferior_fp_registers.f_ctrl,
- &registers[REGISTER_BYTE (FPC_REGNUM)],
+ memcpy (&registers[REGISTER_BYTE (FPC_REGNUM)],
+ &inferior_fp_registers.f_ctrl,
sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
}
@@ -237,12 +237,13 @@ store_inferior_registers (regno)
struct fp_state inferior_fp_registers;
extern char registers[];
- bcopy (registers, &inferior_registers, 20 * 4);
+ memcpy (&inferior_registers, registers, 20 * 4);
- bcopy (&registers[REGISTER_BYTE (FP0_REGNUM)],inferior_fp_registers.f_st,
+ memcpy (inferior_fp_registers.f_st,
+ &registers[REGISTER_BYTE (FP0_REGNUM)],
sizeof inferior_fp_registers.f_st);
- bcopy (&registers[REGISTER_BYTE (FPC_REGNUM)],
- &inferior_fp_registers.f_ctrl,
+ memcpy (&inferior_fp_registers.f_ctrl,
+ &registers[REGISTER_BYTE (FPC_REGNUM)],
sizeof inferior_fp_registers - sizeof inferior_fp_registers.f_st);
#ifdef PTRACE_FP_BUG
diff --git a/gdb/symfile.c b/gdb/symfile.c
index ec582da..72c6efa 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -88,9 +88,6 @@ symfile_bfd_open PARAMS ((char *));
static void
find_sym_fns PARAMS ((struct objfile *));
-void
-clear_symtab_users_once PARAMS ((void));
-
/* List of all available sym_fns. On gdb startup, each object file reader
calls add_symtab_fns() to register information on each format it is
prepared to read. */
@@ -111,12 +108,7 @@ int symbol_reloading = 0;
#endif
-/* In the following sort, we always make sure that
- register debug symbol declarations always come before regular
- debug symbol declarations (as might happen when parameters are
- then put into registers by the compiler).
-
- Since this function is called from within qsort, in an ANSI environment
+/* Since this function is called from within qsort, in an ANSI environment
it must conform to the prototype for qsort, which specifies that the
comparison function takes two "void *" pointers. */
@@ -126,22 +118,11 @@ compare_symbols (s1p, s2p)
const PTR s2p;
{
register struct symbol **s1, **s2;
- register int namediff;
s1 = (struct symbol **) s1p;
s2 = (struct symbol **) s2p;
- /* Compare the initial characters. */
- namediff = SYMBOL_NAME (*s1)[0] - SYMBOL_NAME (*s2)[0];
- if (namediff != 0) return namediff;
-
- /* If they match, compare the rest of the names. */
- namediff = STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2));
- if (namediff != 0) return namediff;
-
- /* For symbols of the same name, registers should come first. */
- return ((SYMBOL_CLASS (*s2) == LOC_REGISTER)
- - (SYMBOL_CLASS (*s1) == LOC_REGISTER));
+ return (STRCMP (SYMBOL_NAME (*s1), SYMBOL_NAME (*s2)));
}
/*
@@ -259,7 +240,7 @@ obsavestring (ptr, size, obstackp)
struct obstack *obstackp;
{
register char *p = (char *) obstack_alloc (obstackp, size + 1);
- /* Open-coded bcopy--saves function call time.
+ /* Open-coded memcpy--saves function call time.
These strings are usually short. */
{
register char *p1 = ptr;
@@ -378,12 +359,21 @@ syms_from_objfile (objfile, addr, mainline, verbo)
{
struct section_offsets *section_offsets;
asection *lowest_sect;
+ struct cleanup *old_chain;
init_entry_point_info (objfile);
find_sym_fns (objfile);
+ /* Make sure that partially constructed symbol tables will be cleaned up
+ if an error occurs during symbol reading. */
+ old_chain = make_cleanup (free_objfile, objfile);
+
if (mainline)
{
+ /* We will modify the main symbol table, make sure that all its users
+ will be cleaned up if an error occurs during symbol reading. */
+ make_cleanup (clear_symtab_users, 0);
+
/* Since no error yet, throw away the old symbol table. */
if (symfile_objfile != NULL)
@@ -488,9 +478,13 @@ syms_from_objfile (objfile, addr, mainline, verbo)
that this does not mean we found any symbols... */
objfile -> flags |= OBJF_SYMS;
+
+ /* Discard cleanups as symbol reading was successful. */
+
+ discard_cleanups (old_chain);
}
-/* Perform required actions immediately after either reading in the initial
+/* Perform required actions after either reading in the initial
symbols for a new objfile, or mapping in the symbols from a reusable
objfile. */
@@ -500,22 +494,24 @@ new_symfile_objfile (objfile, mainline, verbo)
int mainline;
int verbo;
{
+
+ /* If this is the main symbol file we have to clean up all users of the
+ old main symbol file. Otherwise it is sufficient to fixup all the
+ breakpoints that may have been redefined by this symbol file. */
if (mainline)
{
/* OK, make it the "real" symbol file. */
symfile_objfile = objfile;
- }
- /* If we have wiped out any old symbol tables, clean up. */
- clear_symtab_users_once ();
+ clear_symtab_users ();
+ }
+ else
+ {
+ breakpoint_re_set ();
+ }
/* We're done reading the symbol file; finish off complaints. */
clear_complaints (0, verbo);
-
- /* Fixup all the breakpoints that may have been redefined by this
- symbol file. */
-
- breakpoint_re_set ();
}
/* Process a symbol file, as either the main file or as a dynamically
@@ -554,11 +550,6 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
&& from_tty
&& !query ("Load new symbol table from \"%s\"? ", name))
error ("Not confirmed.");
-
- /* Getting new symbols may change our opinion about what is
- frameless. */
-
- reinit_frame_cache ();
objfile = allocate_objfile (abfd, mapped);
@@ -594,8 +585,6 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
syms_from_objfile (objfile, addr, mainline, from_tty);
}
- new_symfile_objfile (objfile, mainline, from_tty);
-
/* We now have at least a partial symbol table. Check to see if the
user requested that all symbols be read on initial access via either
the gdb startup command line or on a per symbol file basis. Expand
@@ -624,6 +613,13 @@ symbol_file_add (name, from_tty, addr, mainline, mapped, readnow)
fflush (stdout);
}
+ new_symfile_objfile (objfile, mainline, from_tty);
+
+ /* Getting new symbols may change our opinion about what is
+ frameless. */
+
+ reinit_frame_cache ();
+
return (objfile);
}
@@ -652,8 +648,6 @@ symbol_file_command (args, from_tty)
error ("Not confirmed.");
free_all_objfiles ();
symfile_objfile = NULL;
- current_source_symtab = NULL;
- current_source_line = 0;
if (from_tty)
{
printf ("No symbol file now.\n");
@@ -759,7 +753,7 @@ symfile_bfd_open (name)
name = absolute_name; /* Keep 2nd malloc'd copy in bfd */
/* It'll be freed in free_objfile(). */
- sym_bfd = bfd_fdopenr (name, NULL, desc);
+ sym_bfd = bfd_fdopenr (name, gnutarget, desc);
if (!sym_bfd)
{
close (desc);
@@ -828,6 +822,81 @@ load_command (arg, from_tty)
target_load (arg, from_tty);
}
+/* This version of "load" should be usable for any target. Currently
+ it is just used for remote targets, not inftarg.c or core files,
+ on the theory that only in that case is it useful.
+
+ Avoiding xmodem and the like seems like a win (a) because we don't have
+ to worry about finding it, and (b) On VMS, fork() is very slow and so
+ we don't want to run a subprocess. On the other hand, I'm not sure how
+ performance compares. */
+void
+generic_load (filename, from_tty)
+ char *filename;
+ int from_tty;
+{
+ struct cleanup *old_cleanups;
+ asection *s;
+ bfd *loadfile_bfd = bfd_openr (filename, gnutarget);
+ if (loadfile_bfd == NULL)
+ {
+ perror_with_name (filename);
+ return;
+ }
+ old_cleanups = make_cleanup (bfd_close, loadfile_bfd);
+
+ if (!bfd_check_format (loadfile_bfd, bfd_object))
+ {
+ error ("\"%s\" is not an object file: %s", filename,
+ bfd_errmsg (bfd_error));
+ }
+
+ for (s = loadfile_bfd->sections; s; s = s->next)
+ {
+ if (s->flags & SEC_LOAD)
+ {
+ bfd_size_type size;
+
+ size = bfd_get_section_size_before_reloc (s);
+ if (size > 0)
+ {
+ char *buffer;
+ struct cleanup *old_chain;
+ bfd_vma vma;
+
+ buffer = xmalloc (size);
+ old_chain = make_cleanup (free, buffer);
+
+ vma = bfd_get_section_vma (loadfile_bfd, s);
+
+ /* Is this really necessary? I guess it gives the user something
+ to look at during a long download. */
+ printf_filtered ("Loading section %s, size 0x%x vma 0x%x\n",
+ bfd_get_section_name (loadfile_bfd, s),
+ size, vma);
+
+ bfd_get_section_contents (loadfile_bfd, s, buffer, 0, size);
+
+ target_write_memory (vma, buffer, size);
+
+ do_cleanups (old_chain);
+ }
+ }
+ }
+
+ /* We were doing this in remote-mips.c, I suspect it is right
+ for other targets too. */
+ write_pc (loadfile_bfd->start_address);
+
+ /* FIXME: are we supposed to call symbol_file_add or not? According to
+ a comment from remote-mips.c (where a call to symbol_file_add was
+ commented out), making the call confuses GDB if more than one file is
+ loaded in. remote-nindy.c had no call to symbol_file_add, but remote-vx.c
+ does. */
+
+ do_cleanups (old_cleanups);
+}
+
/* This function allows the addition of incrementally linked object files.
It does not modify any state in the target, only in the debugger. */
@@ -1057,6 +1126,23 @@ allocate_psymtab (filename, objfile)
}
+/* Reset all data structures in gdb which may contain references to symbol
+ table date. */
+
+void
+clear_symtab_users ()
+{
+ /* Someday, we should do better than this, by only blowing away
+ the things that really need to be blown. */
+ clear_value_history ();
+ clear_displays ();
+ clear_internalvars ();
+ breakpoint_re_set ();
+ set_default_breakpoint (0, 0, 0, 0);
+ current_source_symtab = 0;
+ current_source_line = 0;
+}
+
/* clear_symtab_users_once:
This function is run after symbol reading, or from a cleanup.
@@ -1082,10 +1168,16 @@ allocate_psymtab (filename, objfile)
reading, is because the cleanup protects us in case of errors, but is
discarded if symbol reading is successful. */
+#if 0
+ /* FIXME: As free_named_symtabs is currently a big noop this function
+ is no longer needed.
+static void
+clear_symtab_users_once PARAMS ((void));
+
static int clear_symtab_users_queued;
static int clear_symtab_users_done;
-void
+static void
clear_symtab_users_once ()
{
/* Enforce once-per-`do_cleanups'-semantics */
@@ -1093,17 +1185,9 @@ clear_symtab_users_once ()
return;
clear_symtab_users_done = clear_symtab_users_queued;
- printf ("Resetting debugger state after updating old symbol tables\n");
-
- /* Someday, we should do better than this, by only blowing away
- the things that really need to be blown. */
- clear_value_history ();
- clear_displays ();
- clear_internalvars ();
- breakpoint_re_set ();
- set_default_breakpoint (0, 0, 0, 0);
- current_source_symtab = 0;
+ clear_symtab_users ();
}
+#endif
/* Delete the specified psymtab, and any others that reference it. */
@@ -1367,19 +1451,24 @@ add_psymbol_addr_to_list (name, namelength, namespace, class, list, val,
void
_initialize_symfile ()
{
-
- add_com ("symbol-file", class_files, symbol_file_command,
+ struct cmd_list_element *c;
+
+ c = add_cmd ("symbol-file", class_files, symbol_file_command,
"Load symbol table from executable file FILE.\n\
The `file' command can also load symbol tables, as well as setting the file\n\
-to execute.");
+to execute.", &cmdlist);
+ c->completer = filename_completer;
- add_com ("add-symbol-file", class_files, add_symbol_file_command,
+ c = add_cmd ("add-symbol-file", class_files, add_symbol_file_command,
"Load the symbols from FILE, assuming FILE has been dynamically loaded.\n\
-The second argument provides the starting address of the file's text.");
+The second argument provides the starting address of the file's text.",
+ &cmdlist);
+ c->completer = filename_completer;
- add_com ("load", class_files, load_command,
+ c = add_cmd ("load", class_files, load_command,
"Dynamically load FILE into the running program, and record its symbols\n\
-for access from GDB.");
+for access from GDB.", &cmdlist);
+ c->completer = filename_completer;
add_show_from_set
(add_set_cmd ("symbol-reloading", class_support, var_boolean,
diff --git a/gdb/umax-xdep.c b/gdb/umax-xdep.c
index 35bebf5..edcfee4 100644
--- a/gdb/umax-xdep.c
+++ b/gdb/umax-xdep.c
@@ -90,7 +90,7 @@ core_file_command (filename, from_tty)
stack_offset = data_offset + u.pt_dsize;
reg_offset = 0;
- bcopy (&u.pt_aouthdr, &core_aouthdr, sizeof (AOUTHDR));
+ memcpy (&core_aouthdr, &u.pt_aouthdr, sizeof (AOUTHDR));
printf ("Core file is from \"%s\".\n", u.pt_comm);
if (u.pt_signal > 0)
printf ("Program terminated with signal %d, %s.\n",
diff --git a/gdb/xcoffread.c b/gdb/xcoffread.c
index efa8e7d..28948d5 100644
--- a/gdb/xcoffread.c
+++ b/gdb/xcoffread.c
@@ -1942,7 +1942,7 @@ init_stringtab(abfd, offset, objfile)
if (strtbl == NULL)
return -1;
- bcopy(&length, strtbl, sizeof length);
+ memcpy(strtbl, &length, sizeof length);
if (length == sizeof length)
return 0;