aboutsummaryrefslogtreecommitdiff
path: root/gdb/eval.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-15 17:36:14 +0000
committerTom Tromey <tromey@redhat.com>2013-04-15 17:36:14 +0000
commit6e72ca205c018b9906fa2047ffb1be7f546e0643 (patch)
treef3a97011f1f148c9d0609bf241e87ef54e32779d /gdb/eval.c
parent715c6909e29a233406d54739976bb8674fa6b836 (diff)
downloadgdb-6e72ca205c018b9906fa2047ffb1be7f546e0643.zip
gdb-6e72ca205c018b9906fa2047ffb1be7f546e0643.tar.gz
gdb-6e72ca205c018b9906fa2047ffb1be7f546e0643.tar.bz2
PR c++/9065:
* NEWS: Update. * breakpoint.c (watchpoint_exp_is_const): Add OP_TYPEID. * c-exp.y (TYPEID): New token. (exp): Add new TYPEID productions. (ident_tokens): Add "typeid". * cp-abi.c (cplus_typeid, cplus_typeid_type): New functions. * cp-abi.h (cplus_typeid, cplus_typeid_type): Declare. (struct cp_abi_ops) <get_typeid, get_typeid_type>: New fields. * eval.c (evaluate_subexp_standard) <OP_TYPEID>: New case. * expprint.c (dump_subexp_body_standard) <OP_TYPEID>: New case. * gnu-v3-abi.c (std_type_info_gdbarch_data): New global. (build_std_type_info_type, gnuv3_get_typeid_type) (gnuv3_get_typeid): New functions. (init_gnuv3_ops): Initialize std_type_info_gdbarch_data. Set new fields on ABI object. * parse.c (operator_length_standard) <OP_TYPEID>: New case. * std-operator.def (OP_TYPEID): New. gdb/testsuite * gdb.cp/typeid.cc: New file. * gdb.cp/typeid.exp: New file.
Diffstat (limited to 'gdb/eval.c')
-rw-r--r--gdb/eval.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/eval.c b/gdb/eval.c
index a91ba22..f04baee 100644
--- a/gdb/eval.c
+++ b/gdb/eval.c
@@ -2798,6 +2798,23 @@ evaluate_subexp_standard (struct type *expect_type,
else
error (_("Attempt to use a type as an expression"));
+ case OP_TYPEID:
+ {
+ struct value *result;
+ enum exp_opcode sub_op = exp->elts[*pos].opcode;
+
+ if (sub_op == OP_TYPE || sub_op == OP_DECLTYPE || sub_op == OP_TYPEOF)
+ result = evaluate_subexp (NULL_TYPE, exp, pos,
+ EVAL_AVOID_SIDE_EFFECTS);
+ else
+ result = evaluate_subexp (NULL_TYPE, exp, pos, noside);
+
+ if (noside != EVAL_NORMAL)
+ return allocate_value (cplus_typeid_type (exp->gdbarch));
+
+ return cplus_typeid (result);
+ }
+
default:
/* Removing this case and compiling with gcc -Wall reveals that
a lot of cases are hitting this case. Some of these should