From aee28ec61ad1d4027a78cdbc1da0dcd9f43e2374 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 17 Jun 2011 20:24:22 +0000 Subject: [PATCH] * valops.c (value_of_local): Complain if NAME is NULL. * std-operator.def (OP_OBJC_SELF): Remove. * parse.c (operator_length_standard) : Remove. * objc-exp.y (name_not_typename): Use OP_THIS. * expprint.c (print_subexp_standard) : Print language's name for "this". : Remove. * eval.c (evaluate_subexp_standard) : Remove. --- gdb/ChangeLog | 11 +++++++++++ gdb/eval.c | 6 +----- gdb/expprint.c | 13 +++++-------- gdb/objc-exp.y | 4 ++-- gdb/parse.c | 1 - gdb/std-operator.def | 5 ----- gdb/valops.c | 7 +++++++ 7 files changed, 26 insertions(+), 21 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8db242a048e..418e1d15786 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2011-06-17 Tom Tromey + + * valops.c (value_of_local): Complain if NAME is NULL. + * std-operator.def (OP_OBJC_SELF): Remove. + * parse.c (operator_length_standard) : Remove. + * objc-exp.y (name_not_typename): Use OP_THIS. + * expprint.c (print_subexp_standard) : Print language's + name for "this". + : Remove. + * eval.c (evaluate_subexp_standard) : Remove. + 2011-06-16 Tristan Gingold * python/py-events.h (gdb_py_events): Make it extern. diff --git a/gdb/eval.c b/gdb/eval.c index bbc7b8a71f8..22ca8819f34 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -2830,11 +2830,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_local (exp->language_defn->la_name_of_this, 1); case OP_TYPE: /* The value is not supposed to be used. This is here to make it diff --git a/gdb/expprint.c b/gdb/expprint.c index a52dee3a91c..2b6e4160676 100644 --- a/gdb/expprint.c +++ b/gdb/expprint.c @@ -499,14 +499,11 @@ print_subexp_standard (struct expression *exp, int *pos, case OP_THIS: ++(*pos); - fputs_filtered ("this", stream); - return; - - /* Objective-C ops */ - - case OP_OBJC_SELF: - ++(*pos); - fputs_filtered ("self", stream); /* The ObjC equivalent of "this". */ + if (exp->language_defn->la_name_of_this) + fputs_filtered (exp->language_defn->la_name_of_this, stream); + else + fprintf_filtered (stream, _(""), + exp->language_defn->la_name); return; /* Modula-2 ops */ diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y index 852adff6428..881542fccad 100644 --- a/gdb/objc-exp.y +++ b/gdb/objc-exp.y @@ -755,8 +755,8 @@ variable: name_not_typename if (innermost_block == 0 || contained_in (block_found, innermost_block)) innermost_block = block_found; - write_exp_elt_opcode (OP_OBJC_SELF); - write_exp_elt_opcode (OP_OBJC_SELF); + write_exp_elt_opcode (OP_THIS); + write_exp_elt_opcode (OP_THIS); write_exp_elt_opcode (STRUCTOP_PTR); write_exp_string ($1.stoken); write_exp_elt_opcode (STRUCTOP_PTR); diff --git a/gdb/parse.c b/gdb/parse.c index 4815854c831..a8523e62055 100644 --- a/gdb/parse.c +++ b/gdb/parse.c @@ -963,7 +963,6 @@ operator_length_standard (const struct expression *expr, int endpos, /* C++ */ case OP_THIS: - case OP_OBJC_SELF: oplen = 2; break; diff --git a/gdb/std-operator.def b/gdb/std-operator.def index 267215c8e8b..2c771415b78 100644 --- a/gdb/std-operator.def +++ b/gdb/std-operator.def @@ -277,11 +277,6 @@ OP (STRUCTOP_PTR) It just comes in a tight (OP_THIS, OP_THIS) pair. */ OP (OP_THIS) -/* Objective-C: OP_OBJC_SELF is just a placeholder for the class - instance variable. It just comes in a tight (OP_OBJC_SELF, - OP_OBJC_SELF) pair. */ -OP (OP_OBJC_SELF) - /* Objective C: "@selector" pseudo-operator. */ OP (OP_OBJC_SELECTOR) diff --git a/gdb/valops.c b/gdb/valops.c index 36761039c21..6129bfef4c0 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3608,6 +3608,13 @@ value_of_local (const char *name, int complain) struct value * ret; struct frame_info *frame; + if (!name) + { + if (complain) + error (_("no `this' in current language")); + return 0; + } + if (complain) frame = get_selected_frame (_("no frame selected")); else -- 2.30.2