summaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authornobody <>2003-06-22 18:32:50 +0000
committernobody <>2003-06-22 18:32:50 +0000
commit80ac87715c56a77eb51c3454434daf1f16a7bd49 (patch)
tree5ba5aedb242fd6b1e9d09fa7e7a20adba3a00c08 /gdb/valops.c
parent11308f70b39a78aae01eb7b0fbe5e23e9a8313ee (diff)
downloadbinutils-gdb-80ac87715c56a77eb51c3454434daf1f16a7bd49.tar.gz
This commit was manufactured by cvs2svn to create branch 'gdb_6_0-branch'.gdb_6_0-2003-06-23-branchpoint
Sprout from jimb-ppc64-linux-20030613-branch 2003-06-13 21:56:28 UTC nobody 'This commit was manufactured by cvs2svn to create branch 'jimb-' Cherrypick from master 2003-06-22 18:32:49 UTC Daniel Jacobowitz <drow@false.org> ' * symfile.c (add_symbol_file_command): Use parse_and_eval_address.': ChangeLog Makefile.in Makefile.tpl bfd/ChangeLog bfd/bfd-in2.h bfd/config.bfd bfd/elf32-cris.c bfd/elf64-ppc.c bfd/elf64-ppc.h bfd/elf64-sparc.c bfd/elflink.h bfd/elfxx-ia64.c bfd/section.c bfd/version.h config.guess config.sub configure configure.in gdb/ChangeLog gdb/Makefile.in gdb/NEWS gdb/README gdb/ada-lang.c gdb/ada-lex.l gdb/ada-tasks.c gdb/alpha-tdep.c gdb/arch-utils.c gdb/arch-utils.h gdb/avr-tdep.c gdb/breakpoint.c gdb/c-valprint.c gdb/cli/cli-cmds.c gdb/config/alpha/alpha-linux.mh gdb/config/arm/linux.mh gdb/config/arm/linux.mt gdb/config/arm/nm-linux.h gdb/config/arm/tm-linux.h gdb/config/djgpp/fnchange.lst gdb/config/i386/linux.mh gdb/config/i386/linux.mt gdb/config/i386/nm-x86-64linux.h gdb/config/i386/tm-i386.h gdb/config/i386/x86-64linux.mh gdb/config/ia64/linux.mh gdb/config/ia64/linux.mt gdb/config/ia64/nm-linux.h gdb/config/ia64/tm-ia64.h gdb/config/m68k/linux.mh gdb/config/mips/embed.mt gdb/config/mips/embed64.mt gdb/config/mips/embedl.mt gdb/config/mips/embedl64.mt gdb/config/mips/linux.mh gdb/config/mips/linux.mt gdb/config/mips/tm-irix5.h gdb/config/mips/tm-irix6.h gdb/config/mips/tm-mips.h gdb/config/mips/tm-mips64.h gdb/config/nm-linux.h gdb/config/pa/nm-hppah.h gdb/config/powerpc/linux.mh gdb/config/s390/s390.mh gdb/config/s390/tm-linux.h gdb/config/s390/tm-s390.h gdb/config/sh/linux.mt gdb/config/sparc/linux.mh gdb/cp-valprint.c gdb/cris-tdep.c gdb/doc/ChangeLog gdb/doc/Makefile.in gdb/doc/agentexpr.texi gdb/doc/gdb.texinfo gdb/doc/gdbint.texinfo gdb/dummy-frame.c gdb/findvar.c gdb/frame.c gdb/frame.h gdb/gdbarch.c gdb/gdbarch.h gdb/gdbarch.sh gdb/gdbserver/ChangeLog gdb/gdbserver/Makefile.in gdb/gdbserver/linux-low.c gdb/gdbserver/server.c gdb/gdbserver/target.h gdb/gnu-nat.c gdb/h8300-tdep.c gdb/hppa-tdep.c gdb/hppah-nat.c gdb/i386-nto-tdep.c gdb/i386-tdep.c gdb/i387-tdep.c gdb/i387-tdep.h gdb/ia64-tdep.c gdb/infcall.c gdb/infcmd.c gdb/infrun.c gdb/infttrace.c gdb/lin-lwp.c gdb/linux-nat.c gdb/linux-nat.h gdb/linux-proc.c gdb/mcore-tdep.c gdb/mi/ChangeLog gdb/mi/mi-cmds.c gdb/mips-tdep.c gdb/mn10300-tdep.c gdb/nto-tdep.c gdb/osabi.c gdb/ppc-linux-tdep.c gdb/rdi-share/host.h gdb/regcache.c gdb/remote-fileio.h gdb/remote-rdi.c gdb/remote.c gdb/rs6000-tdep.c gdb/s390-nat.c gdb/s390-tdep.c gdb/solib.c gdb/sparc-nat.c gdb/symfile.c gdb/target.c gdb/target.h gdb/testsuite/ChangeLog gdb/testsuite/gdb.base/attach.exp gdb/testsuite/gdb.base/fileio.c gdb/testsuite/gdb.base/fileio.exp gdb/testsuite/gdb.base/relocate.exp gdb/testsuite/gdb.base/store.c gdb/testsuite/gdb.base/store.exp gdb/testsuite/gdb.c++/pr-1210.cc gdb/testsuite/gdb.c++/pr-1210.exp gdb/testsuite/lib/mi-support.exp gdb/trad-frame.h gdb/tui/ChangeLog gdb/tui/tui-hooks.c gdb/tui/tui.c gdb/tui/tuiCommand.c gdb/tui/tuiData.c gdb/tui/tuiDataWin.c gdb/tui/tuiDisassem.c gdb/tui/tuiGeneralWin.c gdb/tui/tuiIO.c gdb/tui/tuiLayout.c gdb/tui/tuiRegs.c gdb/tui/tuiSource.c gdb/tui/tuiSourceWin.c gdb/tui/tuiStack.c gdb/tui/tuiWin.c gdb/valops.c gdb/varobj.c gdb/version.in gdb/x86-64-tdep.c gdb/xstormy16-tdep.c include/ChangeLog include/ansidecl.h include/opcode/ChangeLog include/safe-ctype.h libiberty/ChangeLog libiberty/Makefile.in libiberty/config.in libiberty/configure libiberty/configure.in libiberty/functions.texi libiberty/hashtab.c libiberty/hex.c libiberty/safe-ctype.c opcodes/ChangeLog opcodes/z8k-dis.c opcodes/z8k-opc.h opcodes/z8kgen.c readline/ChangeLog.gdb readline/support/config.guess readline/support/config.sub sim/common/ChangeLog sim/common/cgen-trace.c sim/common/cgen-trace.h sim/common/sim-fpu.c sim/common/sim-fpu.h sim/d10v/ChangeLog sim/d10v/interp.c sim/h8300/ChangeLog sim/h8300/compile.c sim/h8300/sim-main.h sim/mips/ChangeLog sim/mips/mips.igen sim/ppc/ChangeLog sim/ppc/Makefile.in sim/ppc/altivec.igen sim/ppc/altivec_expression.h sim/ppc/altivec_registers.h sim/ppc/configure sim/ppc/configure.in sim/ppc/e500.igen sim/ppc/e500_expression.h sim/ppc/e500_registers.h sim/ppc/emul_chirp.c sim/ppc/gen-idecode.c sim/ppc/gen-itable.c sim/ppc/gen-model.c sim/ppc/gen-support.c sim/ppc/hw_com.c sim/ppc/hw_htab.c sim/ppc/hw_init.c sim/ppc/hw_nvram.c sim/ppc/hw_register.c sim/ppc/idecode_expression.h sim/ppc/igen.c sim/ppc/interrupts.c sim/ppc/ld-cache.c sim/ppc/ld-cache.h sim/ppc/ld-insn.c sim/ppc/ld-insn.h sim/ppc/ppc-instructions sim/ppc/ppc-spr-table sim/ppc/psim.c sim/ppc/psim.h sim/ppc/registers.c sim/ppc/registers.h sim/ppc/sim_calls.c sim/testsuite/sim/h8300/ChangeLog sim/testsuite/sim/h8300/addx.s sim/testsuite/sim/h8300/allinsn.exp sim/testsuite/sim/h8300/andb.s sim/testsuite/sim/h8300/band.s sim/testsuite/sim/h8300/biand.s sim/testsuite/sim/h8300/brabc.s sim/testsuite/sim/h8300/bset.s sim/testsuite/sim/h8300/div.s sim/testsuite/sim/h8300/jmp.s sim/testsuite/sim/h8300/ldm.s sim/testsuite/sim/h8300/mac.s sim/testsuite/sim/h8300/mul.s sim/testsuite/sim/h8300/orb.s sim/testsuite/sim/h8300/stack.s sim/testsuite/sim/h8300/subs.s sim/testsuite/sim/h8300/subx.s sim/testsuite/sim/h8300/tas.s sim/testsuite/sim/h8300/testutils.inc sim/testsuite/sim/h8300/xorb.s Delete: gdb/config/mips/bigmips.mt gdb/config/mips/bigmips64.mt gdb/config/mips/decstation.mt gdb/config/mips/littlemips.mt gdb/config/mips/tm-bigmips.h gdb/config/mips/tm-bigmips64.h gdb/config/mips/tm-embed64.h gdb/config/mips/tm-embedl.h gdb/config/mips/tm-embedl64.h gdb/config/mips/tm-tx39l.h gdb/config/mips/tm-vr4100.h gdb/config/mips/tm-vr4300.h gdb/config/mips/tm-vr4300el.h gdb/config/mips/tm-vr4xxx.h gdb/config/mips/tm-vr4xxxel.h gdb/config/mips/tm-vr5000.h gdb/config/mips/tm-vr5000el.h gdb/config/mips/vr4100.mt gdb/config/mips/vr4300.mt gdb/config/mips/vr4300el.mt gdb/config/mips/vr4xxx.mt gdb/config/mips/vr4xxxel.mt gdb/config/mips/vr5000.mt gdb/config/mips/vr5000el.mt gdb/dwarf2cfi.c gdb/dwarf2cfi.h gdb/gdbserver/linux-ppc64-low.c gdb/gdbserver/low-hppabsd.c gdb/gdbserver/low-lynx.c gdb/gdbserver/low-nbsd.c gdb/gdbserver/low-sim.c gdb/gdbserver/low-sparc.c gdb/gdbserver/low-sun3.c gdb/regformats/reg-ppc64.dat gdb/remote-array.c sim/ppc/ppc-cache-rules
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c156
1 files changed, 58 insertions, 98 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 276763086d9..9d02a350298 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -498,22 +498,6 @@ value_assign (struct value *toval, struct value *fromval)
COERCE_ARRAY (fromval);
CHECK_TYPEDEF (type);
- /* If TOVAL is a special machine register requiring conversion
- of program values to a special raw format,
- convert FROMVAL's contents now, with result in `raw_buffer',
- and set USE_BUFFER to the number of bytes to write. */
-
- if (VALUE_REGNO (toval) >= 0)
- {
- int regno = VALUE_REGNO (toval);
- if (CONVERT_REGISTER_P (regno))
- {
- struct type *fromtype = check_typedef (VALUE_TYPE (fromval));
- VALUE_TO_REGISTER (fromtype, regno, VALUE_CONTENTS (fromval), raw_buffer);
- use_buffer = REGISTER_RAW_SIZE (regno);
- }
- }
-
/* Since modifying a register can trash the frame chain, and modifying memory
can trash the frame cache, we save the old frame and then restore the new
frame afterwards. */
@@ -587,17 +571,8 @@ value_assign (struct value *toval, struct value *fromval)
case lval_reg_frame_relative:
case lval_register:
{
- /* value is stored in a series of registers in the frame
- specified by the structure. Copy that value out, modify
- it, and copy it back in. */
- int amount_copied;
- int amount_to_copy;
- char *buffer;
- int value_reg;
- int reg_offset;
- int byte_offset;
- int regno;
struct frame_info *frame;
+ int value_reg;
/* Figure out which frame this is in currently. */
if (VALUE_LVAL (toval) == lval_register)
@@ -613,92 +588,77 @@ value_assign (struct value *toval, struct value *fromval)
if (!frame)
error ("Value being assigned to is no longer active.");
-
- /* Locate the first register that falls in the value that
- needs to be transfered. Compute the offset of the value in
- that register. */
- {
- int offset;
- for (reg_offset = value_reg, offset = 0;
- offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval);
- reg_offset++);
- byte_offset = VALUE_OFFSET (toval) - offset;
- }
-
- /* Compute the number of register aligned values that need to
- be copied. */
- if (VALUE_BITSIZE (toval))
- amount_to_copy = byte_offset + 1;
- else
- amount_to_copy = byte_offset + TYPE_LENGTH (type);
-
- /* And a bounce buffer. Be slightly over generous. */
- buffer = (char *) alloca (amount_to_copy + MAX_REGISTER_SIZE);
-
- /* Copy it in. */
- for (regno = reg_offset, amount_copied = 0;
- amount_copied < amount_to_copy;
- amount_copied += REGISTER_RAW_SIZE (regno), regno++)
- {
- frame_register_read (frame, regno, buffer + amount_copied);
- }
- /* Modify what needs to be modified. */
- if (VALUE_BITSIZE (toval))
- {
- modify_field (buffer + byte_offset,
- value_as_long (fromval),
- VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
- }
- else if (use_buffer)
+ if (VALUE_LVAL (toval) == lval_reg_frame_relative
+ && CONVERT_REGISTER_P (VALUE_FRAME_REGNUM (toval), type))
{
- memcpy (buffer + VALUE_OFFSET (toval), raw_buffer, use_buffer);
+ /* If TOVAL is a special machine register requiring
+ conversion of program values to a special raw format. */
+ VALUE_TO_REGISTER (frame, VALUE_FRAME_REGNUM (toval),
+ type, VALUE_CONTENTS (fromval));
}
else
{
- memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
- TYPE_LENGTH (type));
- /* Do any conversion necessary when storing this type to
- more than one register. */
-#ifdef REGISTER_CONVERT_FROM_TYPE
- REGISTER_CONVERT_FROM_TYPE (value_reg, type,
- (buffer + byte_offset));
-#endif
- }
+ /* TOVAL is stored in a series of registers in the frame
+ specified by the structure. Copy that value out,
+ modify it, and copy it back in. */
+ int amount_copied;
+ int amount_to_copy;
+ char *buffer;
+ int reg_offset;
+ int byte_offset;
+ int regno;
+
+ /* Locate the first register that falls in the value that
+ needs to be transfered. Compute the offset of the
+ value in that register. */
+ {
+ int offset;
+ for (reg_offset = value_reg, offset = 0;
+ offset + REGISTER_RAW_SIZE (reg_offset) <= VALUE_OFFSET (toval);
+ reg_offset++);
+ byte_offset = VALUE_OFFSET (toval) - offset;
+ }
- /* Copy it out. */
- for (regno = reg_offset, amount_copied = 0;
- amount_copied < amount_to_copy;
- amount_copied += REGISTER_RAW_SIZE (regno), regno++)
- {
- enum lval_type lval;
- CORE_ADDR addr;
- int optim;
- int realnum;
+ /* Compute the number of register aligned values that need
+ to be copied. */
+ if (VALUE_BITSIZE (toval))
+ amount_to_copy = byte_offset + 1;
+ else
+ amount_to_copy = byte_offset + TYPE_LENGTH (type);
- /* Just find out where to put it. */
- frame_register (frame, regno, &optim, &lval, &addr, &realnum,
- NULL);
+ /* And a bounce buffer. Be slightly over generous. */
+ buffer = (char *) alloca (amount_to_copy + MAX_REGISTER_SIZE);
+
+ /* Copy it in. */
+ for (regno = reg_offset, amount_copied = 0;
+ amount_copied < amount_to_copy;
+ amount_copied += REGISTER_RAW_SIZE (regno), regno++)
+ frame_register_read (frame, regno, buffer + amount_copied);
- if (optim)
- error ("Attempt to assign to a value that was optimized out.");
- if (lval == lval_memory)
- write_memory (addr, buffer + amount_copied,
- REGISTER_RAW_SIZE (regno));
- else if (lval == lval_register)
- regcache_cooked_write (current_regcache, realnum,
- (buffer + amount_copied));
+ /* Modify what needs to be modified. */
+ if (VALUE_BITSIZE (toval))
+ modify_field (buffer + byte_offset,
+ value_as_long (fromval),
+ VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
+ else if (use_buffer)
+ memcpy (buffer + VALUE_OFFSET (toval), raw_buffer, use_buffer);
else
- error ("Attempt to assign to an unmodifiable value.");
- }
+ memcpy (buffer + byte_offset, VALUE_CONTENTS (fromval),
+ TYPE_LENGTH (type));
+ /* Copy it out. */
+ for (regno = reg_offset, amount_copied = 0;
+ amount_copied < amount_to_copy;
+ amount_copied += REGISTER_RAW_SIZE (regno), regno++)
+ put_frame_register (frame, regno, buffer + amount_copied);
+
+ }
if (register_changed_hook)
register_changed_hook (-1);
target_changed_event ();
-
+ break;
}
- break;
-
default:
error ("Left operand of assignment is not an lvalue.");