X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Feval.c;h=9913a72b0e79b54844a8132b31f2bae6f5c7ec42;hb=0d5cff5020224cfd67bc3d6e30b158105d03a324;hp=bbc7b8a71f80661438d9a4d6a1c9cd3e7e1fedb2;hpb=0875794a962c041bde76423e980875a467bb0bbe;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/eval.c b/gdb/eval.c index bbc7b8a71f..9913a72b0e 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -1,8 +1,6 @@ /* Evaluate expressions for GDB. - Copyright (C) 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, - 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, - 2009, 2010, 2011 Free Software Foundation, Inc. + Copyright (C) 1986-2003, 2005-2012 Free Software Foundation, Inc. This file is part of GDB. @@ -43,7 +41,6 @@ #include "gdb_obstack.h" #include "objfiles.h" #include "python/python.h" -#include "wrapper.h" #include "gdb_assert.h" @@ -236,9 +233,21 @@ fetch_subexp_value (struct expression *exp, int *pc, struct value **valp, /* Make sure it's not lazy, so that after the target stops again we have a non-lazy previous value to compare with. */ - if (result != NULL - && (!value_lazy (result) || gdb_value_fetch_lazy (result))) - *valp = result; + if (result != NULL) + { + if (!value_lazy (result)) + *valp = result; + else + { + volatile struct gdb_exception except; + + TRY_CATCH (except, RETURN_MASK_ERROR) + { + value_fetch_lazy (result); + *valp = result; + } + } + } if (val_chain) { @@ -326,7 +335,8 @@ evaluate_struct_tuple (struct value *struct_val, for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type); fieldno++) { - char *field_name = TYPE_FIELD_NAME (struct_type, fieldno); + const char *field_name = + TYPE_FIELD_NAME (struct_type, fieldno); if (field_name != NULL && strcmp (field_name, label) == 0) { @@ -339,7 +349,8 @@ evaluate_struct_tuple (struct value *struct_val, for (fieldno = 0; fieldno < TYPE_NFIELDS (struct_type); fieldno++) { - char *field_name = TYPE_FIELD_NAME (struct_type, fieldno); + const char *field_name = + TYPE_FIELD_NAME (struct_type, fieldno); field_type = TYPE_FIELD_TYPE (struct_type, fieldno); if ((field_name == 0 || *field_name == '\0') @@ -860,6 +871,27 @@ evaluate_subexp_standard (struct type *expect_type, return ret; } + case OP_VAR_ENTRY_VALUE: + (*pos) += 2; + if (noside == EVAL_SKIP) + goto nosideret; + + { + struct symbol *sym = exp->elts[pc + 1].symbol; + struct frame_info *frame; + + if (noside == EVAL_AVOID_SIDE_EFFECTS) + return value_zero (SYMBOL_TYPE (sym), not_lval); + + if (SYMBOL_CLASS (sym) != LOC_COMPUTED + || SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry == NULL) + error (_("Symbol \"%s\" does not have any specific entry value"), + SYMBOL_PRINT_NAME (sym)); + + frame = get_selected_frame (NULL); + return SYMBOL_COMPUTED_OPS (sym)->read_variable_at_entry (sym, frame); + } + case OP_LAST: (*pos) += 2; return @@ -1653,13 +1685,7 @@ evaluate_subexp_standard (struct type *expect_type, func_name = (char *) alloca (name_len + 1); 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 *))); - for (ix = 1; ix <= nargs; ix++) - arg_types[ix - 1] = value_type (argvec[ix]); - - find_overload_match (arg_types, nargs, func_name, + find_overload_match (&argvec[1], nargs, func_name, NON_METHOD, /* not method */ 0, /* strict match */ NULL, NULL, /* pass NULL symbol since @@ -1695,13 +1721,7 @@ evaluate_subexp_standard (struct type *expect_type, evaluation. */ struct value *valp = NULL; - /* Prepare list of argument types for overload resolution. */ - 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, + (void) find_overload_match (&argvec[1], nargs, tstr, METHOD, /* method */ 0, /* strict match */ &arg2, /* the object */ @@ -1772,13 +1792,7 @@ evaluate_subexp_standard (struct type *expect_type, if (op == OP_VAR_VALUE) function = exp->elts[save_pos1+2].symbol; - /* Prepare list of argument types for overload resolution. */ - 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, + (void) find_overload_match (&argvec[1], nargs, NULL, /* no need for name */ NON_METHOD, /* not method */ 0, /* strict match */ @@ -2198,7 +2212,7 @@ evaluate_subexp_standard (struct type *expect_type, { struct value *v_one, *retval; - v_one = value_one (value_type (arg2), not_lval); + v_one = value_one (value_type (arg2)); binop_promote (exp->language_defn, exp->gdbarch, &arg1, &v_one); retval = value_binop (arg1, v_one, op); return retval; @@ -2742,7 +2756,7 @@ evaluate_subexp_standard (struct type *expect_type, { struct value *tmp = arg1; - arg2 = value_one (value_type (arg1), not_lval); + arg2 = value_one (value_type (arg1)); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); arg2 = value_binop (tmp, arg2, BINOP_ADD); } @@ -2766,7 +2780,7 @@ evaluate_subexp_standard (struct type *expect_type, { struct value *tmp = arg1; - arg2 = value_one (value_type (arg1), not_lval); + arg2 = value_one (value_type (arg1)); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); arg2 = value_binop (tmp, arg2, BINOP_SUB); } @@ -2792,7 +2806,7 @@ evaluate_subexp_standard (struct type *expect_type, { struct value *tmp = arg1; - arg2 = value_one (value_type (arg1), not_lval); + arg2 = value_one (value_type (arg1)); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); arg2 = value_binop (tmp, arg2, BINOP_ADD); } @@ -2819,7 +2833,7 @@ evaluate_subexp_standard (struct type *expect_type, { struct value *tmp = arg1; - arg2 = value_one (value_type (arg1), not_lval); + arg2 = value_one (value_type (arg1)); binop_promote (exp->language_defn, exp->gdbarch, &tmp, &arg2); arg2 = value_binop (tmp, arg2, BINOP_SUB); } @@ -2830,11 +2844,7 @@ evaluate_subexp_standard (struct type *expect_type, case OP_THIS: (*pos) += 1; - return value_of_this (1); - - case OP_OBJC_SELF: - (*pos) += 1; - return value_of_local ("self", 1); + return value_of_this (exp->language_defn); case OP_TYPE: /* The value is not supposed to be used. This is here to make it