Index: gdb/eval.c |
diff --git a/gdb/eval.c b/gdb/eval.c |
index d48b450e92f9b4ab49febbcc33738fe113c4ee95..7d3a8b96e3628237b7e644008ed3470538f0a2ec 100644 |
--- a/gdb/eval.c |
+++ b/gdb/eval.c |
@@ -41,7 +41,6 @@ |
#include "gdb_obstack.h" |
#include "objfiles.h" |
#include "python/python.h" |
-#include "wrapper.h" |
#include "gdb_assert.h" |
@@ -126,7 +125,7 @@ parse_and_eval (char *exp) |
struct value * |
parse_to_comma_and_eval (char **expp) |
{ |
- struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1); |
+ struct expression *expr = parse_exp_1 (expp, 0, (struct block *) 0, 1); |
struct value *val; |
struct cleanup *old_chain = |
make_cleanup (free_current_contents, &expr); |
@@ -234,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) |
{ |
@@ -324,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) |
{ |
@@ -337,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') |
@@ -756,6 +769,23 @@ make_params (int num_types, struct type **param_types) |
TYPE_CODE (type) = TYPE_CODE_METHOD; |
TYPE_VPTR_FIELDNO (type) = -1; |
TYPE_CHAIN (type) = type; |
+ if (num_types > 0) |
+ { |
+ if (param_types[num_types - 1] == NULL) |
+ { |
+ --num_types; |
+ TYPE_VARARGS (type) = 1; |
+ } |
+ else if (TYPE_CODE (check_typedef (param_types[num_types - 1])) |
+ == TYPE_CODE_VOID) |
+ { |
+ --num_types; |
+ /* Caller should have ensured this. */ |
+ gdb_assert (num_types == 0); |
+ TYPE_PROTOTYPED (type) = 1; |
+ } |
+ } |
+ |
TYPE_NFIELDS (type) = num_types; |
TYPE_FIELDS (type) = (struct field *) |
TYPE_ZALLOC (type, sizeof (struct field) * num_types); |
@@ -780,7 +810,7 @@ evaluate_subexp_standard (struct type *expect_type, |
struct type *type; |
int nargs; |
struct value **argvec; |
- int upper, lower; |
+ int lower; |
int code; |
int ix; |
long mem_offset; |
@@ -1345,8 +1375,7 @@ evaluate_subexp_standard (struct type *expect_type, |
val_type = expect_type; |
} |
- struct_return = using_struct_return (exp->gdbarch, |
- value_type (method), |
+ struct_return = using_struct_return (exp->gdbarch, method, |
val_type); |
} |
else if (expect_type != NULL) |
@@ -1988,16 +2017,10 @@ evaluate_subexp_standard (struct type *expect_type, |
if (opts.objectprint && TYPE_TARGET_TYPE(type) |
&& (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CLASS)) |
{ |
- real_type = value_rtti_target_type (arg1, &full, &top, &using_enc); |
+ real_type = value_rtti_indirect_type (arg1, &full, &top, |
+ &using_enc); |
if (real_type) |
- { |
- if (TYPE_CODE (type) == TYPE_CODE_PTR) |
- real_type = lookup_pointer_type (real_type); |
- else |
- real_type = lookup_reference_type (real_type); |
- |
arg1 = value_cast (real_type, arg1); |
- } |
} |
} |
@@ -2041,8 +2064,8 @@ evaluate_subexp_standard (struct type *expect_type, |
case TYPE_CODE_MEMBERPTR: |
/* Now, convert these values to an address. */ |
- arg1 = value_cast (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)), |
- arg1); |
+ arg1 = value_cast_pointers (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)), |
+ arg1, 1); |
mem_offset = value_as_long (arg2); |