]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb/
authorJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 8 Sep 2011 14:54:20 +0000 (14:54 +0000)
committerJan Kratochvil <jan.kratochvil@redhat.com>
Thu, 8 Sep 2011 14:54:20 +0000 (14:54 +0000)
* eval.c (evaluate_subexp_standard) <OP_THIS>: Update the value_of_this
caller to value_of_this.
* p-exp.y: Update the value_of_this caller to value_of_this_silent.
Twice.
* valops.c (value_of_this): Remove parameter complain and variable ret.
Update function comment.  Never return NULL by this code.
(value_of_this_silent): New function.
* value.h (value_of_this): Remove parameter complain.
(value_of_this_silent): New declaration.

gdb/ChangeLog
gdb/eval.c
gdb/p-exp.y
gdb/valops.c
gdb/value.h

index 43d4a06638e87c55b8ab8097e34c45693a311751..84a5193d9a9e765d497769dbe813b88589fb9708 100644 (file)
@@ -1,3 +1,15 @@
+2011-09-08  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
+       * eval.c (evaluate_subexp_standard) <OP_THIS>: Update the value_of_this
+       caller to value_of_this.
+       * p-exp.y: Update the value_of_this caller to value_of_this_silent.
+       Twice.
+       * valops.c (value_of_this): Remove parameter complain and variable ret.
+       Update function comment.  Never return NULL by this code.
+       (value_of_this_silent): New function.
+       * value.h (value_of_this): Remove parameter complain.
+       (value_of_this_silent): New declaration.
+
 2011-09-07  Yao Qi  <yao@codesourcery.com>
 
        * gdbthread.h (struct thread_info): Remove fields
index c1c028011688594899f551b587940dc321bdd47b..af225c4670ae6339c34fab85315540eda39e3b6e 100644 (file)
@@ -2830,7 +2830,7 @@ evaluate_subexp_standard (struct type *expect_type,
 
     case OP_THIS:
       (*pos) += 1;
-      return value_of_this (exp->language_defn, 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
index 0a384e146dd03c94a53bb1374c97ca6b00115b00..312b8310d8a2bf02e95301b9f51a13f697c0f7a9 100644 (file)
@@ -612,7 +612,7 @@ exp :       THIS
                          write_exp_elt_opcode (OP_THIS);
                          write_exp_elt_opcode (OP_THIS);
                          /* We need type of this.  */
-                         this_val = value_of_this (parse_language, 0);
+                         this_val = value_of_this_silent (parse_language);
                          if (this_val)
                            this_type = value_type (this_val);
                          else
@@ -760,7 +760,7 @@ variable:   name_not_typename
                              write_exp_string ($1.stoken);
                              write_exp_elt_opcode (STRUCTOP_PTR);
                              /* We need type of this.  */
-                             this_val = value_of_this (parse_language, 0);
+                             this_val = value_of_this_silent (parse_language);
                              if (this_val)
                                this_type = value_type (this_val);
                              else
index cd40c222d373c139ecf2a49d2c282ac4e2d8951e..25e0fc3c25f1ad07cd25176062de20f7ce2caed0 100644 (file)
@@ -3600,49 +3600,45 @@ value_full_object (struct value *argp,
 }
 
 
-/* Return the value of the local variable, if one exists.
-   Flag COMPLAIN signals an error if the request is made in an
-   inappropriate context.  */
+/* Return the value of the local variable, if one exists.  Throw error
+   otherwise, such as if the request is made in an inappropriate context.  */
 
 struct value *
-value_of_this (const struct language_defn *lang, int complain)
+value_of_this (const struct language_defn *lang)
 {
   struct symbol *sym;
   struct block *b;
-  struct value * ret;
   struct frame_info *frame;
 
   if (!lang->la_name_of_this)
-    {
-      if (complain)
-       error (_("no `this' in current language"));
-      return 0;
-    }
+    error (_("no `this' in current language"));
 
-  if (complain)
-    frame = get_selected_frame (_("no frame selected"));
-  else
-    {
-      frame = deprecated_safe_get_selected_frame ();
-      if (frame == 0)
-       return 0;
-    }
+  frame = get_selected_frame (_("no frame selected"));
 
   b = get_frame_block (frame, NULL);
 
   sym = lookup_language_this (lang, b);
   if (sym == NULL)
+    error (_("current stack frame does not contain a variable named `%s'"),
+          lang->la_name_of_this);
+
+  return read_var_value (sym, frame);
+}
+
+/* Return the value of the local variable, if one exists.  Return NULL
+   otherwise.  Never throw error.  */
+
+struct value *
+value_of_this_silent (const struct language_defn *lang)
+{
+  struct value *ret = NULL;
+  volatile struct gdb_exception except;
+
+  TRY_CATCH (except, RETURN_MASK_ERROR)
     {
-      if (complain)
-       error (_("current stack frame does not contain a variable named `%s'"),
-              lang->la_name_of_this);
-      else
-       return NULL;
+      ret = value_of_this (lang);
     }
 
-  ret = read_var_value (sym, frame);
-  if (ret == 0 && complain)
-    error (_("`%s' argument unreadable"), lang->la_name_of_this);
   return ret;
 }
 
index 960384ee21e6219adf63c37676459d8676496849..5d61a0b06586402f0b9253554caf057202a28e6a 100644 (file)
@@ -717,8 +717,9 @@ extern int value_logical_not (struct value *arg1);
 
 /* C++ */
 
-extern struct value *value_of_this (const struct language_defn *lang,
-                                   int complain);
+extern struct value *value_of_this (const struct language_defn *lang);
+
+extern struct value *value_of_this_silent (const struct language_defn *lang);
 
 extern struct value *value_x_binop (struct value *arg1, struct value *arg2,
                                    enum exp_opcode op,