aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/eval.c28
-rw-r--r--gdb/remote-adapt.c6
-rw-r--r--gdb/remote-eb.c5
-rw-r--r--gdb/remote-hms.c14
-rw-r--r--gdb/remote-mm.c5
-rw-r--r--gdb/remote-nindy.c4
-rw-r--r--gdb/remote-vx.68.c7
-rw-r--r--gdb/remote-vx.c5
-rw-r--r--gdb/target.c93
-rw-r--r--gdb/valarith.c8
-rw-r--r--gdb/valops.c16
-rw-r--r--gdb/value.h61
-rw-r--r--gdb/xcoffexec.c4
13 files changed, 158 insertions, 98 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index 110a129..aff3a3a 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -1,5 +1,5 @@
/* Evaluate expressions for GDB.
- Copyright (C) 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -406,7 +406,7 @@ evaluate_subexp (expect_type, exp, pos, noside)
else
error ("Expression of type other than \"Function returning ...\" used as function");
}
- return target_call_function (argvec[0], nargs, argvec + 1);
+ return call_function_by_hand (argvec[0], nargs, argvec + 1);
case STRUCTOP_STRUCT:
tem = strlen (&exp->elts[pc + 1].string);
@@ -924,6 +924,7 @@ evaluate_subexp_for_address (exp, pos, noside)
{
enum exp_opcode op;
register int pc;
+ struct symbol *var;
pc = (*pos);
op = exp->elts[pc].opcode;
@@ -940,13 +941,19 @@ evaluate_subexp_for_address (exp, pos, noside)
evaluate_subexp (NULL_TYPE, exp, pos, noside));
case OP_VAR_VALUE:
+ var = exp->elts[pc + 1].symbol;
+
+ /* C++: The "address" of a reference should yield the address
+ * of the object pointed to. Let value_addr() deal with it. */
+ if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_REF)
+ goto default_case;
+
(*pos) += 3;
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
struct type *type =
- lookup_pointer_type (SYMBOL_TYPE (exp->elts[pc + 1].symbol));
- enum address_class sym_class =
- SYMBOL_CLASS (exp->elts[pc + 1].symbol);
+ lookup_pointer_type (SYMBOL_TYPE (var));
+ enum address_class sym_class = SYMBOL_CLASS (var);
if (sym_class == LOC_CONST
|| sym_class == LOC_CONST_BYTES
@@ -958,9 +965,10 @@ evaluate_subexp_for_address (exp, pos, noside)
value_zero (type, not_lval);
}
else
- return locate_var_value (exp->elts[pc + 1].symbol, (FRAME) 0);
+ return locate_var_value (var, (FRAME) 0);
default:
+ default_case:
if (noside == EVAL_AVOID_SIDE_EFFECTS)
{
value x = evaluate_subexp (NULL_TYPE, exp, pos, noside);
@@ -988,6 +996,7 @@ evaluate_subexp_with_coercion (exp, pos, noside)
register enum exp_opcode op;
register int pc;
register value val;
+ struct symbol *var;
pc = (*pos);
op = exp->elts[pc].opcode;
@@ -995,11 +1004,12 @@ evaluate_subexp_with_coercion (exp, pos, noside)
switch (op)
{
case OP_VAR_VALUE:
- if (TYPE_CODE (SYMBOL_TYPE (exp->elts[pc + 1].symbol)) == TYPE_CODE_ARRAY)
+ var = exp->elts[pc + 1].symbol;
+ if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_ARRAY)
{
(*pos) += 3;
- val = locate_var_value (exp->elts[pc + 1].symbol, (FRAME) 0);
- return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (SYMBOL_TYPE (exp->elts[pc + 1].symbol))),
+ val = locate_var_value (var, (FRAME) 0);
+ return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (SYMBOL_TYPE (var))),
val);
}
default:
diff --git a/gdb/remote-adapt.c b/gdb/remote-adapt.c
index 34abe76..b102d03 100644
--- a/gdb/remote-adapt.c
+++ b/gdb/remote-adapt.c
@@ -1,5 +1,5 @@
/* Remote debugging interface for AMD 290*0 Adapt Monitor Version 2.1d18.
- Copyright 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by David Wood at New York University (wood@lab.ultra.nyu.edu).
Adapted from work done at Cygnus Support in remote-eb.c.
@@ -46,9 +46,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* External data declarations */
extern int stop_soon_quietly; /* for wait_for_inferior */
-/* External function declarations */
-extern struct value *call_function_by_hand();
-
/* Forward data declarations */
extern struct target_ops adapt_ops; /* Forward declaration */
@@ -1427,7 +1424,6 @@ struct target_ops adapt_ops = {
0, 0, 0, 0, 0, /* Terminal handling */
adapt_kill, /* FIXME, kill */
adapt_load,
- call_function_by_hand,
0, /* lookup_symbol */
adapt_create_inferior, /* create_inferior */
adapt_mourn, /* mourn_inferior FIXME */
diff --git a/gdb/remote-eb.c b/gdb/remote-eb.c
index 9609b65..01df861 100644
--- a/gdb/remote-eb.c
+++ b/gdb/remote-eb.c
@@ -1,5 +1,5 @@
/* Remote debugging interface for AMD 29000 EBMON on IBM PC, for GDB.
- Copyright 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by Cygnus Support. Written by Jim Kingdon for Cygnus.
This file is part of GDB.
@@ -43,8 +43,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "target.h"
#include "gdbcore.h"
-extern struct value *call_function_by_hand();
-
extern struct target_ops eb_ops; /* Forward declaration */
static void eb_close();
@@ -989,7 +987,6 @@ executable as it exists on the remote computer. For example,\n\
0, 0, 0, 0, 0, /* Terminal handling */
eb_kill,
0, /* load */
- call_function_by_hand,
0, /* lookup_symbol */
eb_create_inferior,
eb_mourn_inferior,
diff --git a/gdb/remote-hms.c b/gdb/remote-hms.c
index 48df7a7..4e4e349 100644
--- a/gdb/remote-hms.c
+++ b/gdb/remote-hms.c
@@ -1,9 +1,7 @@
/* Remote debugging interface for Hitachi HMS Monitor Version 1.0
-
Copyright 1992 Free Software Foundation, Inc.
-
- Contributed by Steve Chamberlain sac@cygnus.com
-
+ Contributed by Cygnus Support. Written by Steve Chamberlain
+ (sac@cygnus.com).
This file is part of GDB.
@@ -21,14 +19,12 @@ You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-
-
#include <stdio.h>
-#include <string.h>
#include "defs.h"
#include "inferior.h"
#include "wait.h"
#include "value.h"
+#include <string.h>
#include <ctype.h>
#include <fcntl.h>
#include <signal.h>
@@ -41,9 +37,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* External data declarations */
extern int stop_soon_quietly; /* for wait_for_inferior */
-/* External function declarations */
-extern struct value *call_function_by_hand();
-
/* Forward data declarations */
extern struct target_ops hms_ops; /* Forward declaration */
@@ -1604,7 +1597,6 @@ by a serial line.",
0, 0, 0, 0, 0, /* Terminal handling */
hms_kill, /* FIXME, kill */
hms_load,
- call_function_by_hand,
0, /* lookup_symbol */
hms_create_inferior, /* create_inferior */
hms_mourn, /* mourn_inferior FIXME */
diff --git a/gdb/remote-mm.c b/gdb/remote-mm.c
index d898402..87270f7 100644
--- a/gdb/remote-mm.c
+++ b/gdb/remote-mm.c
@@ -1,5 +1,5 @@
/* Remote debugging interface for Am290*0 running MiniMON monitor, for GDB.
- Copyright (C) 1990, 1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Originally written by Daniel Mann at AMD.
This file is part of GDB.
@@ -59,8 +59,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
extern int stop_soon_quietly; /* for wait_for_inferior */
-extern struct value *call_function_by_hand();
-
static void mm_resume();
static void mm_fetch_registers ();
static int fetch_register ();
@@ -1681,7 +1679,6 @@ struct target_ops mm_ops = {
0, 0, 0, 0, 0, /* Terminal handling */
mm_kill, /* FIXME, kill */
mm_load,
- call_function_by_hand,
0, /* lookup_symbol */
mm_create_inferior, /* create_inferior */
mm_mourn, /* mourn_inferior FIXME */
diff --git a/gdb/remote-nindy.c b/gdb/remote-nindy.c
index 9751d14..d7f807e 100644
--- a/gdb/remote-nindy.c
+++ b/gdb/remote-nindy.c
@@ -1,5 +1,5 @@
/* Memory-access and commands for remote NINDY process, for GDB.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by Intel Corporation. Modified from remote.c by Chris Benenati.
GDB is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -123,7 +123,6 @@ extern char *getenv();
extern char *mktemp();
extern char *coffstrip();
-extern value call_function_by_hand ();
extern void generic_mourn_inferior ();
extern struct target_ops nindy_ops;
@@ -941,7 +940,6 @@ specified when you started GDB.",
0, 0, 0, 0, 0, /* Terminal crud */
nindy_kill,
nindy_load,
- call_function_by_hand,
0, /* lookup_symbol */
nindy_create_inferior,
nindy_mourn_inferior,
diff --git a/gdb/remote-vx.68.c b/gdb/remote-vx.68.c
index 3a46d21..c7b7058 100644
--- a/gdb/remote-vx.68.c
+++ b/gdb/remote-vx.68.c
@@ -52,7 +52,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <value.h>
#include <symtab.h>
-extern value call_function_by_hand ();
extern void symbol_file_command ();
extern int stop_soon_quietly; /* for wait_for_inferior */
@@ -187,7 +186,7 @@ vx_remove_breakpoint (addr)
#ifdef FIXME
/* FIXME, function calls are really fried. GO back to manual method. */
value
-vx_call_function (function, nargs, args)
+call_function (function, nargs, args)
value function;
int nargs;
value *args;
@@ -269,7 +268,7 @@ vx_call_function (function, nargs, args)
start_sp = text_end;
errcode = target_write_memory (start_sp, dummy1, sizeof dummy);
if (errcode != 0)
- error ("Cannot write text segment -- call_function failed");
+ error ("Cannot write text segment -- vx_call_function failed");
}
#endif /* After text_end. */
#endif /* Not on stack. */
@@ -1504,7 +1503,6 @@ Specify the name of the machine to connect to.",
0, 0, 0, 0, 0, /* terminal stuff */
0, /* vx_kill, */
vx_add_file_command,
- call_function_by_hand, /* FIXME, calling fns is maybe botched? */
vx_lookup_symbol,
vx_create_inferior, 0, /* mourn_inferior */
core_stratum, 0, /* next */
@@ -1526,7 +1524,6 @@ struct target_ops vx_run_ops = {
0, 0, 0, 0, 0, /* terminal stuff */
0, /* vx_kill, */
vx_add_file_command,
- call_function_by_hand, /* FIXME, calling fns is maybe botched? */
vx_lookup_symbol,
vx_create_inferior, vx_mourn_inferior,
process_stratum, 0, /* next */
diff --git a/gdb/remote-vx.c b/gdb/remote-vx.c
index e637987..991bc97 100644
--- a/gdb/remote-vx.c
+++ b/gdb/remote-vx.c
@@ -1,5 +1,5 @@
/* Memory-access and commands for remote VxWorks processes, for GDB.
- Copyright (C) 1990-1991 Free Software Foundation, Inc.
+ Copyright 1990, 1991, 1992 Free Software Foundation, Inc.
Contributed by Wind River Systems and Cygnus Support.
This file is part of GDB.
@@ -51,7 +51,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <value.h>
#include <symtab.h>
-extern value call_function_by_hand ();
extern void symbol_file_command ();
extern int stop_soon_quietly; /* for wait_for_inferior */
@@ -1434,7 +1433,6 @@ Specify the name of the machine to connect to.",
0, 0, 0, 0, 0, /* terminal stuff */
0, /* vx_kill, */
vx_load_command,
- 0, /* call_function */
vx_lookup_symbol,
vx_create_inferior, 0, /* mourn_inferior */
core_stratum, 0, /* next */
@@ -1457,7 +1455,6 @@ struct target_ops vx_run_ops = {
0, 0, 0, 0, 0, /* terminal stuff */
vx_kill,
vx_load_command,
- call_function_by_hand, /* FIXME, calling fns is maybe botched? */
vx_lookup_symbol,
0, vx_mourn_inferior,
process_stratum, 0, /* next */
diff --git a/gdb/target.c b/gdb/target.c
index a23c910..eefdbea 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -1,22 +1,22 @@
/* Select target systems and architectures at runtime for GDB.
- Copyright (C) 1990 Free Software Foundation, Inc.
+ Copyright 1990, 1992 Free Software Foundation, Inc.
Contributed by Cygnus Support.
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include <errno.h>
@@ -29,9 +29,10 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
#include "bfd.h"
#include "symfile.h"
+extern int errno;
+
extern int memory_insert_breakpoint(), memory_remove_breakpoint();
extern void host_convert_to_virtual(), host_convert_from_virtual();
-extern void add_syms_addr_command();
static void cleanup_target ();
@@ -55,11 +56,11 @@ struct target_ops dummy_target = {"None", "None", "",
0, 0, /* bkpts */
0, 0, 0, 0, 0, /* terminal */
0, 0, /* kill, load */
- add_syms_addr_command, /* add_syms */
- 0, 0, /* call_function, lookup_symbol */
+ 0, /* lookup_symbol */
0, 0, /* create_inferior, mourn_inferior */
dummy_stratum, 0, /* stratum, next */
0, 0, 0, 0, 0, /* all mem, mem, stack, regs, exec */
+ 0, 0, /* section pointers */
OPS_MAGIC,
};
@@ -213,16 +214,12 @@ static void
kill_or_be_killed (from_tty)
int from_tty;
{
- /* FIXME: What is savecur for? Why isn't it used? */
- struct target_ops *savecur;
-
if (target_has_execution)
{
printf ("You are already running a program:\n");
target_files_info ();
if (query ("Kill it? ")) {
- savecur = current_target;
- target_kill (0, from_tty);
+ target_kill ();
if (target_has_execution)
error ("Killing the program did not help.");
return;
@@ -280,8 +277,8 @@ cleanup_target (t)
de_fault (to_detach, (void (*)())ignore);
de_fault (to_resume, (void (*)())noprocess);
de_fault (to_wait, noprocess);
- de_fault (to_fetch_registers, noprocess);
- de_fault (to_store_registers, noprocess);
+ de_fault (to_fetch_registers, ignore);
+ de_fault (to_store_registers, (void (*)())noprocess);
de_fault (to_prepare_to_store, (void (*)())noprocess);
de_fault (to_convert_to_virtual, host_convert_to_virtual);
de_fault (to_convert_from_virtual, host_convert_from_virtual);
@@ -296,8 +293,6 @@ cleanup_target (t)
de_fault (to_terminal_info, default_terminal_info);
de_fault (to_kill, (void (*)())noprocess);
de_fault (to_load, tcomplain);
- de_fault (to_add_syms, tcomplain);
- de_fault (to_call_function, (struct value *(*)())noprocess);
de_fault (to_lookup_symbol, nosymbol);
de_fault (to_create_inferior, maybe_kill_then_create_inferior);
de_fault (to_mourn_inferior, (void (*)())noprocess);
@@ -390,6 +385,48 @@ pop_target ()
push_target (&dummy_target);
}
+#define MIN(A, B) (((A) <= (B)) ? (A) : (B))
+
+/* target_read_string -- read a null terminated string from MEMADDR in target.
+ The read may also be terminated early by getting an error from target_xfer_
+ memory.
+ LEN is the size of the buffer pointed to by MYADDR. Note that a terminating
+ null will only be written if there is sufficient room. The return value is
+ is the number of bytes (including the null) actually transferred.
+*/
+
+int
+target_read_string (memaddr, myaddr, len)
+ CORE_ADDR memaddr;
+ char *myaddr;
+ int len;
+{
+ int tlen, origlen, offset, i;
+ char buf[4];
+
+ origlen = len;
+
+ while (len > 0)
+ {
+ tlen = MIN (len, 4 - (memaddr & 3));
+ offset = memaddr & 3;
+
+ if (target_xfer_memory (memaddr & ~3, buf, 4, 0))
+ return origlen - len;
+
+ for (i = 0; i < tlen; i++)
+ {
+ *myaddr++ = buf[i + offset];
+ if (buf[i + offset] == '\000')
+ return (origlen - len) + i + 1;
+ }
+
+ memaddr += tlen;
+ len -= tlen;
+ }
+ return origlen;
+}
+
/* Move memory to or from the targets. Iterate until all of it has
been moved, if necessary. The top target gets priority; anything
it doesn't want, is offered to the next one down, etc. Note the
@@ -430,7 +467,8 @@ target_xfer_memory (memaddr, myaddr, len, write)
struct target_ops *t;
/* The quick case is that the top target does it all. */
- res = current_target->to_xfer_memory(memaddr, myaddr, len, write);
+ res = current_target->to_xfer_memory
+ (memaddr, myaddr, len, write, current_target);
if (res == len)
return 0;
@@ -445,7 +483,7 @@ target_xfer_memory (memaddr, myaddr, len, write)
t;
t = t->to_has_all_memory? 0: t->to_next)
{
- res = t->to_xfer_memory(memaddr, myaddr, curlen, write);
+ res = t->to_xfer_memory(memaddr, myaddr, curlen, write, t);
if (res > 0) break; /* Handled all or part of xfer */
if (res == 0) continue; /* Handled none */
curlen = -res; /* Could handle once we get past res bytes */
@@ -456,7 +494,10 @@ target_xfer_memory (memaddr, myaddr, len, write)
read zeros if reading, or do nothing if writing. Return error. */
if (!write)
bzero (myaddr, len);
- return EIO;
+ if (errno == 0)
+ return EIO;
+ else
+ return errno;
}
bump:
memaddr += res;
@@ -476,8 +517,8 @@ target_info (args, from_tty)
struct target_ops *t;
int has_all_mem = 0;
- if (symfile != 0)
- printf ("Symbols from \"%s\".\n", symfile);
+ if (symfile_objfile != 0)
+ printf ("Symbols from \"%s\".\n", symfile_objfile->name);
#ifdef FILES_INFO_HOOK
if (FILES_INFO_HOOK ())
@@ -493,7 +534,7 @@ target_info (args, from_tty)
if (has_all_mem)
printf("\tWhile running this, gdb does not access memory from...\n");
printf("%s:\n", t->to_longname);
- (t->to_files_info)();
+ (t->to_files_info)(t);
has_all_mem = t->to_has_all_memory;
}
}
@@ -510,7 +551,7 @@ target_preopen (from_tty)
if (target_has_execution)
{
if (query ("A program is being debugged already. Kill it? "))
- target_kill ((char *)0, from_tty);
+ target_kill ();
else
error ("Program not killed.");
}
diff --git a/gdb/valarith.c b/gdb/valarith.c
index aefa1d4..c52a06e 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1,5 +1,5 @@
/* Perform arithmetic and other operations on values, for GDB.
- Copyright 1986, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -273,11 +273,11 @@ value_x_binop (arg1, arg2, op, otherop)
argvec[1] = argvec[0];
argvec++;
}
- return target_call_function (argvec[0], 2 - static_memfuncp, argvec + 1);
+ return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1);
}
error ("member function %s not found", tstr);
#ifdef lint
- return target_call_function (argvec[0], 2 - static_memfuncp, argvec + 1);
+ return call_function_by_hand (argvec[0], 2 - static_memfuncp, argvec + 1);
#endif
}
@@ -332,7 +332,7 @@ value_x_unop (arg1, op)
argvec[1] = argvec[0];
argvec++;
}
- return target_call_function (argvec[0], 1 - static_memfuncp, argvec + 1);
+ return call_function_by_hand (argvec[0], 1 - static_memfuncp, argvec + 1);
}
error ("member function %s not found", tstr);
return 0; /* For lint -- never reached */
diff --git a/gdb/valops.c b/gdb/valops.c
index 0ebc6ef..c340932 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1,5 +1,5 @@
/* Perform non-arithmetic operations on values, for GDB.
- Copyright 1986, 1987, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1991, 1992 Free Software Foundation, Inc.
This file is part of GDB.
@@ -239,7 +239,7 @@ value_assign (toval, fromval)
int v; /* FIXME, this won't work for large bitfields */
read_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
&v, sizeof v);
- modify_field (&v, (int) value_as_long (fromval),
+ modify_field ((char *) &v, (int) value_as_long (fromval),
VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
write_memory (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
(char *)&v, sizeof v);
@@ -258,11 +258,11 @@ value_assign (toval, fromval)
int v;
read_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &v, sizeof v);
- modify_field (&v, (int) value_as_long (fromval),
+ (char *) &v, sizeof v);
+ modify_field ((char *) &v, (int) value_as_long (fromval),
VALUE_BITPOS (toval), VALUE_BITSIZE (toval));
write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
- &v, sizeof v);
+ (char *) &v, sizeof v);
}
else if (use_buffer)
write_register_bytes (VALUE_ADDRESS (toval) + VALUE_OFFSET (toval),
@@ -450,6 +450,7 @@ value
value_addr (arg1)
value arg1;
{
+ extern value value_copy ();
struct type *type = VALUE_TYPE (arg1);
if (TYPE_CODE (type) == TYPE_CODE_REF)
{
@@ -685,6 +686,9 @@ call_function_by_hand (function, nargs, args)
CORE_ADDR funaddr;
int using_gcc;
+ if (!target_has_execution)
+ noprocess();
+
save_inferior_status (&inf_status, 1);
old_chain = make_cleanup (restore_inferior_status, &inf_status);
@@ -949,7 +953,7 @@ value_string (ptr, len)
}
blocklen = value_from_longest (builtin_type_int, (LONGEST) (len + 1));
- val = target_call_function (val, 1, &blocklen);
+ val = call_function_by_hand (val, 1, &blocklen);
if (value_zerop (val))
error ("No memory available for string constant.");
write_memory (value_as_pointer (val), copy, len + 1);
diff --git a/gdb/value.h b/gdb/value.h
index e0cc0d4..a6840d1 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1,21 +1,21 @@
/* Definitions for values of C expressions, for GDB.
- Copyright (C) 1986, 1987, 1989 Free Software Foundation, Inc.
+ Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+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 GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#if !defined (VALUE_H)
#define VALUE_H 1
@@ -38,7 +38,7 @@ enum lval_type {
/* In a register series in a frame not the current one, which may have been
partially saved or saved in different places (otherwise would be
lval_register or lval_memory). */
- lval_reg_frame_relative,
+ lval_reg_frame_relative
};
struct value
@@ -138,7 +138,7 @@ extern int value_fetch_lazy ();
/* Convert a REF to the object referenced. */
#define COERCE_REF(arg) \
-{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF) \
+{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF) \
arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)), \
unpack_long (VALUE_TYPE (arg), \
VALUE_CONTENTS (arg)));}
@@ -163,7 +163,7 @@ extern int value_fetch_lazy ();
/* If ARG is an enum, convert it to an integer. */
#define COERCE_ENUM(arg) \
-{ if (TYPE_CODE ( VALUE_TYPE (arg)) == TYPE_CODE_REF) \
+{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF) \
arg = value_ind (arg); \
if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM) \
arg = value_cast (builtin_type_unsigned_int, arg); \
@@ -180,12 +180,38 @@ struct internalvar
};
#include "symtab.h"
-LONGEST value_as_long ();
-double value_as_double ();
-LONGEST unpack_long ();
-double unpack_double ();
+LONGEST value_as_long (
+#ifdef __STDC__
+ value
+#endif
+ );
+double value_as_double (
+#ifdef __STDC__
+ value
+#endif
+ );
+CORE_ADDR value_as_pointer (
+#ifdef __STDC__
+ value
+#endif
+ );
+LONGEST unpack_long (
+#ifdef __STDC__
+ struct type *, char *
+#endif
+ );
+double unpack_double (
+#ifdef __STDC__
+ struct type *, char *, int *
+#endif
+ );
+CORE_ADDR unpack_pointer (
+#ifdef __STDC__
+ struct type *, char *
+#endif
+ );
long unpack_field_as_long ();
-value value_from_long ();
+value value_from_longest ();
value value_from_double ();
value value_at ();
value value_at_lazy ();
@@ -226,6 +252,7 @@ value evaluate_expression ();
value evaluate_type ();
value parse_and_eval ();
value parse_to_comma_and_eval ();
+struct type *parse_and_eval_type ();
extern CORE_ADDR parse_and_eval_address ();
extern CORE_ADDR parse_and_eval_address_1 ();
@@ -284,8 +311,12 @@ void print_floating ();
int value_print ();
int val_print ();
void print_variable_value ();
+void typedef_print ();
char *internalvar_name ();
void clear_value_history ();
void clear_internalvars ();
+extern value
+call_function_by_hand PARAMS ((value, int value *));
+
#endif /* value.h not already included. */
diff --git a/gdb/xcoffexec.c b/gdb/xcoffexec.c
index bba2c5c..086f862 100644
--- a/gdb/xcoffexec.c
+++ b/gdb/xcoffexec.c
@@ -1,5 +1,5 @@
/* Execute AIXcoff files, for GDB.
- Copyright (C) 1988, 1989, 1991 Free Software Foundation, Inc.
+ Copyright 1988, 1989, 1991, 1992 Free Software Foundation, Inc.
Derived from exec.c. Modified by IBM Corporation.
Donated by IBM Corporation and Cygnus Support.
@@ -892,7 +892,7 @@ Specify the filename of the executable file.",
0, 0, /* insert_breakpoint, remove_breakpoint, */
0, 0, 0, 0, 0, /* terminal stuff */
0, 0, /* kill, load */
- 0, 0, /* call fn, lookup sym */
+ 0, /* lookup sym */
child_create_inferior,
0, /* mourn_inferior */
file_stratum, 0, /* next */