aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorMichael Snyder <msnyder@vmware.com>2011-01-05 22:22:53 +0000
committerMichael Snyder <msnyder@vmware.com>2011-01-05 22:22:53 +0000
commit3e43a32aaa2d78fca10dea6746b820176f39bcc8 (patch)
tree32cf854a33e1036a2e60037dabd2aaf4b4e81e03 /gdb/eval.c
parent9689e3a3a7895308b7b2eac3fa6e4d560cf4b8c7 (diff)
downloadgdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.zip
gdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.tar.gz
gdb-3e43a32aaa2d78fca10dea6746b820176f39bcc8.tar.bz2
2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns. * arch-utils.c: Ditto. * arch-utils.h: Ditto. * ax-gdb.c: Ditto. * ax-general.c: Ditto. * bcache.c: Ditto. * blockframe.c: Ditto. * breakpoint.c: Ditto. * buildsym.c: Ditto. * c-lang.c: Ditto. * c-typeprint.c: Ditto. * charset.c: Ditto. * coffread.c: Ditto. * command.h: Ditto. * corelow.c: Ditto. * cp-abi.c: Ditto. * cp-namespace.c: Ditto. * cp-support.c: Ditto. * dbug-rom.c: Ditto. * dbxread.c: Ditto. * defs.h: Ditto. * dfp.c: Ditto. * dfp.h: Ditto. * dictionary.c: Ditto. * disasm.c: Ditto. * doublest.c: Ditto. * dwarf2-frame.c: Ditto. * dwarf2expr.c: Ditto. * dwarf2loc.c: Ditto. * dwarf2read.c: Ditto. * elfread.c: Ditto. * eval.c: Ditto. * event-loop.c: Ditto. * event-loop.h: Ditto. * exceptions.h: Ditto. * exec.c: Ditto. * expprint.c: Ditto. * expression.h: Ditto. * f-lang.c: Ditto. * f-valprint.c: Ditto. * findcmd.c: Ditto. * frame-base.c: Ditto. * frame-unwind.c: Ditto. * frame-unwind.h: Ditto. * frame.c: Ditto. * frame.h: Ditto. * gcore.c: Ditto. * gdb-stabs.h: Ditto. * gdb_assert.h: Ditto. * gdb_dirent.h: Ditto. * gdb_obstack.h: Ditto. * gdbcore.h: Ditto. * gdbtypes.c: Ditto. * gdbtypes.h: Ditto. * inf-ttrace.c: Ditto. * infcall.c: Ditto. * infcmd.c: Ditto. * inflow.c: Ditto. * infrun.c: Ditto. * inline-frame.h: Ditto. * language.c: Ditto. * language.h: Ditto. * libunwind-frame.c: Ditto. * libunwind-frame.h: Ditto. * linespec.c: Ditto. * linux-nat.c: Ditto. * linux-nat.h: Ditto. * linux-thread-db.c: Ditto. * machoread.c: Ditto. * macroexp.c: Ditto. * macrotab.c: Ditto. * main.c: Ditto. * maint.c: Ditto. * mdebugread.c: Ditto. * memattr.c: Ditto. * minsyms.c: Ditto. * monitor.c: Ditto. * monitor.h: Ditto. * objfiles.c: Ditto. * objfiles.h: Ditto. * osabi.c: Ditto. * p-typeprint.c: Ditto. * p-valprint.c: Ditto. * parse.c: Ditto. * printcmd.c: Ditto. * proc-events.c: Ditto. * procfs.c: Ditto. * progspace.c: Ditto. * progspace.h: Ditto. * psympriv.h: Ditto. * psymtab.c: Ditto. * record.c: Ditto. * regcache.c: Ditto. * regcache.h: Ditto. * remote-fileio.c: Ditto. * remote.c: Ditto. * ser-mingw.c: Ditto. * ser-tcp.c: Ditto. * ser-unix.c: Ditto. * serial.c: Ditto. * serial.h: Ditto. * solib-frv.c: Ditto. * solib-irix.c: Ditto. * solib-osf.c: Ditto. * solib-pa64.c: Ditto. * solib-som.c: Ditto. * solib-sunos.c: Ditto. * solib-svr4.c: Ditto. * solib-target.c: Ditto. * solib.c: Ditto. * somread.c: Ditto. * source.c: Ditto. * stabsread.c: Ditto. * stabsread.c: Ditto. * stack.c: Ditto. * stack.h: Ditto. * symfile-mem.c: Ditto. * symfile.c: Ditto. * symfile.h: Ditto. * symmisc.c: Ditto. * symtab.c: Ditto. * symtab.h: Ditto. * target-descriptions.c: Ditto. * target-memory.c: Ditto. * target.c: Ditto. * target.h: Ditto. * terminal.h: Ditto. * thread.c: Ditto. * top.c: Ditto. * tracepoint.c: Ditto. * tracepoint.h: Ditto. * ui-file.c: Ditto. * ui-file.h: Ditto. * ui-out.h: Ditto. * user-regs.c: Ditto. * user-regs.h: Ditto. * utils.c: Ditto. * valarith.c: Ditto. * valops.c: Ditto. * valprint.c: Ditto. * valprint.h: Ditto. * value.c: Ditto. * varobj.c: Ditto. * varobj.h: Ditto. * vec.h: Ditto. * xcoffread.c: Ditto. * xcoffsolib.c: Ditto. * xcoffsolib.h: Ditto. * xml-syscall.c: Ditto. * xml-tdesc.c: Ditto.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c118
1 files changed, 75 insertions, 43 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index fbd3698..8394623 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -867,7 +867,8 @@ evaluate_subexp_standard (struct type *expect_type,
if (except.reason < 0)
{
if (noside == EVAL_AVOID_SIDE_EFFECTS)
- ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol), not_lval);
+ ret = value_zero (SYMBOL_TYPE (exp->elts[pc + 2].symbol),
+ not_lval);
else
throw_exception (except);
}
@@ -926,7 +927,8 @@ evaluate_subexp_standard (struct type *expect_type,
type = language_string_char_type (exp->language_defn, exp->gdbarch);
return value_string (&exp->elts[pc + 2].string, tem, type);
- case OP_OBJC_NSSTRING: /* Objective C Foundation Class NSString constant. */
+ case OP_OBJC_NSSTRING: /* Objective C Foundation Class
+ NSString constant. */
tem = longest_to_int (exp->elts[pc + 1].longconst);
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
if (noside == EVAL_SKIP)
@@ -1341,7 +1343,8 @@ evaluate_subexp_standard (struct type *expect_type,
}
struct_return = using_struct_return (exp->gdbarch,
- value_type (method), val_type);
+ value_type (method),
+ val_type);
}
else if (expect_type != NULL)
{
@@ -1365,12 +1368,14 @@ evaluate_subexp_standard (struct type *expect_type,
if (method)
{
if (TYPE_CODE (value_type (method)) != TYPE_CODE_FUNC)
- error (_("method address has symbol information with non-function type; skipping"));
-
- /* Create a function pointer of the appropriate type, and replace
- its value with the value of msg_send or msg_send_stret. We must
- use a pointer here, as msg_send and msg_send_stret are of pointer
- type, and the representation may be different on systems that use
+ error (_("method address has symbol information "
+ "with non-function type; skipping"));
+
+ /* Create a function pointer of the appropriate type, and
+ replace its value with the value of msg_send or
+ msg_send_stret. We must use a pointer here, as
+ msg_send and msg_send_stret are of pointer type, and
+ the representation may be different on systems that use
function descriptors. */
if (struct_return)
called_method
@@ -1416,7 +1421,8 @@ evaluate_subexp_standard (struct type *expect_type,
return allocate_value (type);
}
else
- error (_("Expression of type other than \"method returning ...\" used as a method"));
+ error (_("Expression of type other than "
+ "\"method returning ...\" used as a method"));
}
/* Now depending on whether we found a symbol for the method,
@@ -1436,7 +1442,8 @@ evaluate_subexp_standard (struct type *expect_type,
/* Function objc_msg_lookup returns a pointer. */
deprecated_set_value_type (argvec[0],
lookup_pointer_type (lookup_function_type (value_type (argvec[0]))));
- argvec[0] = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
+ argvec[0]
+ = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
}
ret = call_function_by_hand (argvec[0], nargs + 2, argvec + 1);
@@ -1450,7 +1457,8 @@ evaluate_subexp_standard (struct type *expect_type,
nargs = longest_to_int (exp->elts[pc + 1].longconst);
/* Allocate arg vector, including space for the function to be
called in argvec[0] and a terminating NULL */
- argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 3));
+ argvec = (struct value **)
+ alloca (sizeof (struct value *) * (nargs + 3));
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
{
nargs++;
@@ -1529,8 +1537,9 @@ evaluate_subexp_standard (struct type *expect_type,
{
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
- /* Check to see if the operator '->' has been overloaded. If the operator
- has been overloaded replace arg2 with the value returned by the custom
+ /* Check to see if the operator '->' has been
+ overloaded. If the operator has been overloaded
+ replace arg2 with the value returned by the custom
operator and continue evaluation. */
while (unop_user_defined_p (op, arg2))
{
@@ -1630,7 +1639,8 @@ evaluate_subexp_standard (struct type *expect_type,
{
for (; tem <= nargs && tem <= TYPE_NFIELDS (type); tem++)
{
- argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type, tem - 1),
+ argvec[tem] = evaluate_subexp (TYPE_FIELD_TYPE (type,
+ tem - 1),
exp, pos, noside);
}
}
@@ -1659,13 +1669,16 @@ evaluate_subexp_standard (struct type *expect_type,
strcpy (func_name, &exp->elts[string_pc + 1].string);
/* Prepare list of argument types for overload resolution */
- arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
+ arg_types = (struct type **)
+ alloca (nargs * (sizeof (struct type *)));
for (ix = 1; ix <= nargs; ix++)
arg_types[ix - 1] = value_type (argvec[ix]);
find_overload_match (arg_types, nargs, func_name,
- NON_METHOD /* not method */ , 0 /* strict match */ ,
- NULL, NULL /* pass NULL symbol since symbol is unknown */ ,
+ NON_METHOD, /* not method */
+ 0, /* strict match */
+ NULL, NULL, /* pass NULL symbol since
+ symbol is unknown */
NULL, &symp, NULL, 0);
/* Now fix the expression being evaluated. */
@@ -1690,20 +1703,25 @@ evaluate_subexp_standard (struct type *expect_type,
else
tstr = function_name;
- if (overload_resolution && (exp->language_defn->la_language == language_cplus))
+ if (overload_resolution && (exp->language_defn->la_language
+ == language_cplus))
{
- /* Language is C++, do some overload resolution before evaluation */
+ /* Language is C++, do some overload resolution before
+ evaluation */
struct value *valp = NULL;
/* Prepare list of argument types for overload resolution */
- arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
+ arg_types = (struct type **)
+ alloca (nargs * (sizeof (struct type *)));
for (ix = 1; ix <= nargs; ix++)
arg_types[ix - 1] = value_type (argvec[ix]);
(void) find_overload_match (arg_types, nargs, tstr,
- METHOD /* method */ , 0 /* strict match */ ,
- &arg2 /* the object */ , NULL,
- &valp, NULL, &static_memfuncp, 0);
+ METHOD, /* method */
+ 0, /* strict match */
+ &arg2, /* the object */
+ NULL, &valp, NULL,
+ &static_memfuncp, 0);
if (op == OP_SCOPE && !static_memfuncp)
{
@@ -1713,7 +1731,8 @@ evaluate_subexp_standard (struct type *expect_type,
function_name);
}
argvec[1] = arg2; /* the ``this'' pointer */
- argvec[0] = valp; /* use the method found after overload resolution */
+ argvec[0] = valp; /* use the method found after overload
+ resolution */
}
else
/* Non-C++ case -- or no overload resolution */
@@ -1727,9 +1746,10 @@ evaluate_subexp_standard (struct type *expect_type,
/* value_struct_elt updates temp with the correct value
of the ``this'' pointer if necessary, so modify argvec[1] to
reflect any ``this'' changes. */
- arg2 = value_from_longest (lookup_pointer_type(value_type (temp)),
- value_address (temp)
- + value_embedded_offset (temp));
+ arg2
+ = value_from_longest (lookup_pointer_type(value_type (temp)),
+ value_address (temp)
+ + value_embedded_offset (temp));
argvec[1] = arg2; /* the ``this'' pointer */
}
@@ -1752,9 +1772,11 @@ evaluate_subexp_standard (struct type *expect_type,
in a C++ program, for instance, does not have the fields that
are expected here */
- if (overload_resolution && (exp->language_defn->la_language == language_cplus))
+ if (overload_resolution && (exp->language_defn->la_language
+ == language_cplus))
{
- /* Language is C++, do some overload resolution before evaluation */
+ /* Language is C++, do some overload resolution before
+ evaluation */
struct symbol *symp;
int no_adl = 0;
@@ -1766,13 +1788,16 @@ evaluate_subexp_standard (struct type *expect_type,
function = exp->elts[save_pos1+2].symbol;
/* Prepare list of argument types for overload resolution */
- arg_types = (struct type **) alloca (nargs * (sizeof (struct type *)));
+ arg_types = (struct type **)
+ alloca (nargs * (sizeof (struct type *)));
for (ix = 1; ix <= nargs; ix++)
arg_types[ix - 1] = value_type (argvec[ix]);
- (void) find_overload_match (arg_types, nargs, NULL /* no need for name */ ,
- NON_METHOD /* not method */ , 0 /* strict match */ ,
- NULL, function /* the function */ ,
+ (void) find_overload_match (arg_types, nargs,
+ NULL, /* no need for name */
+ NON_METHOD, /* not method */
+ 0, /* strict match */
+ NULL, function, /* the function */
NULL, &symp, NULL, no_adl);
if (op == OP_VAR_VALUE)
@@ -1825,14 +1850,16 @@ evaluate_subexp_standard (struct type *expect_type,
else if (TYPE_TARGET_TYPE (ftype))
return allocate_value (TYPE_TARGET_TYPE (ftype));
else
- error (_("Expression of type other than \"Function returning ...\" used as function"));
+ error (_("Expression of type other than "
+ "\"Function returning ...\" used as function"));
}
if (TYPE_CODE (value_type (argvec[0])) == TYPE_CODE_INTERNAL_FUNCTION)
return call_internal_function (exp->gdbarch, exp->language_defn,
argvec[0], nargs, argvec + 1);
return call_function_by_hand (argvec[0], nargs, argvec + 1);
- /* pai: FIXME save value from call_function_by_hand, then adjust pc by adjust_fn_pc if +ve */
+ /* pai: FIXME save value from call_function_by_hand, then adjust
+ pc by adjust_fn_pc if +ve. */
case OP_F77_UNDETERMINED_ARGLIST:
@@ -1891,7 +1918,8 @@ evaluate_subexp_standard (struct type *expect_type,
/* It's a function call. */
/* Allocate arg vector, including space for the function to be
called in argvec[0] and a terminating NULL */
- argvec = (struct value **) alloca (sizeof (struct value *) * (nargs + 2));
+ argvec = (struct value **)
+ alloca (sizeof (struct value *) * (nargs + 2));
argvec[0] = arg1;
tem = 1;
for (; tem <= nargs; tem++)
@@ -2035,7 +2063,8 @@ evaluate_subexp_standard (struct type *expect_type,
return value_ind (arg3);
default:
- error (_("non-pointer-to-member value used in pointer-to-member construct"));
+ error (_("non-pointer-to-member value used "
+ "in pointer-to-member construct"));
}
case TYPE_INSTANCE:
@@ -2632,7 +2661,8 @@ evaluate_subexp_standard (struct type *expect_type,
type = check_typedef (value_type (arg1));
if (TYPE_CODE (type) == TYPE_CODE_METHODPTR
|| TYPE_CODE (type) == TYPE_CODE_MEMBERPTR)
- error (_("Attempt to dereference pointer to member without an object"));
+ error (_("Attempt to dereference pointer "
+ "to member without an object"));
if (noside == EVAL_SKIP)
goto nosideret;
if (unop_user_defined_p (op, arg1))
@@ -2676,7 +2706,8 @@ evaluate_subexp_standard (struct type *expect_type,
}
else
{
- struct value *retvalp = evaluate_subexp_for_address (exp, pos, noside);
+ struct value *retvalp = evaluate_subexp_for_address (exp, pos,
+ noside);
return retvalp;
}
@@ -2884,8 +2915,8 @@ evaluate_subexp_standard (struct type *expect_type,
then they should be separate cases, with more descriptive
error messages. */
- error (_("\
-GDB does not (yet) know how to evaluate that kind of expression"));
+ error (_("GDB does not (yet) know how to "
+ "evaluate that kind of expression"));
}
nosideret:
@@ -2983,7 +3014,8 @@ evaluate_subexp_for_address (struct expression *exp, int *pos,
return value_zero (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
not_lval);
else
- error (_("Attempt to take address of value not located in memory."));
+ error (_("Attempt to take address of "
+ "value not located in memory."));
}
return value_addr (x);
}