aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2002-09-19 03:58:41 +0000
committerAndrew Cagney <cagney@redhat.com>2002-09-19 03:58:41 +0000
commit389e51db103b5c811f1849228c2c5e9e71062f5a (patch)
treef29314af18fc82fc8eaeaf5b9ac5ddb55d09fd5c /gdb/valops.c
parent3b4efeaa2da94f19becde56d8c8f9693367acafc (diff)
downloadgdb-389e51db103b5c811f1849228c2c5e9e71062f5a.zip
gdb-389e51db103b5c811f1849228c2c5e9e71062f5a.tar.gz
gdb-389e51db103b5c811f1849228c2c5e9e71062f5a.tar.bz2
Revert previous change. Not obvious.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r--gdb/valops.c61
1 files changed, 19 insertions, 42 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 3de3409..eaf4295 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -48,8 +48,10 @@ extern int overload_debug;
static int typecmp (int staticp, int varargs, int nargs,
struct field t1[], struct value *t2[]);
+static CORE_ADDR find_function_addr (struct value *, struct type **);
static struct value *value_arg_coerce (struct value *, struct type *, int);
+
static CORE_ADDR value_push (CORE_ADDR, struct value *);
static struct value *search_struct_field (char *, struct value *, int,
@@ -89,6 +91,7 @@ int overload_resolution = 0;
int unwind_on_signal_p = 0;
+
/* Find the address of function name NAME in the inferior. */
struct value *
@@ -1216,7 +1219,7 @@ value_arg_coerce (struct value *arg, struct type *param_type,
/* Determine a function's address and its return type from its value.
Calls error() if the function is not valid for calling. */
-CORE_ADDR
+static CORE_ADDR
find_function_addr (struct value *function, struct type **retval_type)
{
register struct type *ftype = check_typedef (VALUE_TYPE (function));
@@ -1886,23 +1889,6 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
error ("Cannot invoke functions on this machine.");
}
}
-
-struct value *
-call_function_by_hand_expecting_type (struct value *function,
- struct type *expect_type,
- int nargs, struct value **args,
- int restore_frame)
-{
- if (CALL_DUMMY_P)
- {
- /* FIXME: Changes to func not implemented yet */
- return hand_function_call (function, nargs, args);
- }
- else
- {
- error ("Cannot invoke functions on this machine.");
- }
-}
@@ -3317,17 +3303,21 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop,
return new_val;
}
-/* Return the value of the local variable, if one exists.
+
+
+
+/* C++: return the value of the class instance variable, if one exists.
Flag COMPLAIN signals an error if the request is made in an
inappropriate context. */
struct value *
-value_of_local (const char *name, int complain)
+value_of_this (int complain)
{
struct symbol *func, *sym;
struct block *b;
int i;
- struct value * ret;
+ static const char funny_this[] = "this";
+ struct value *this;
if (selected_frame == 0)
{
@@ -3341,7 +3331,7 @@ value_of_local (const char *name, int complain)
if (!func)
{
if (complain)
- error ("no %s in nameless context", name);
+ error ("no `this' in nameless context");
else
return 0;
}
@@ -3351,39 +3341,26 @@ value_of_local (const char *name, int complain)
if (i <= 0)
{
if (complain)
- error ("no args, no %s", name);
+ error ("no args, no `this'");
else
return 0;
}
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */
- sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE);
+ sym = lookup_block_symbol (b, funny_this, NULL, VAR_NAMESPACE);
if (sym == NULL)
{
if (complain)
- error ("current stack frame does not contain a variable named \"%s\"", name);
+ error ("current stack frame not in method");
else
return NULL;
}
- ret = read_var_value (sym, selected_frame);
- if (ret == 0 && complain)
- error ("%s argument unreadable", name);
- return ret;
-}
-
-/* C++/Objective-C: return the value of the class instance variable,
- if one exists. Flag COMPLAIN signals an error if the request is
- made in an inappropriate context. */
-
-struct value *
-value_of_this (int complain)
-{
- if (current_language->la_language == language_objc)
- return value_of_local ("self", complain);
- else
- return value_of_local ("this", complain);
+ this = read_var_value (sym, selected_frame);
+ if (this == 0 && complain)
+ error ("`this' argument at unknown address");
+ return this;
}
/* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements