OSDN Git Service

insight/347
authorkseitz <kseitz>
Thu, 29 Apr 2010 21:00:51 +0000 (21:00 +0000)
committerkseitz <kseitz>
Thu, 29 Apr 2010 21:00:51 +0000 (21:00 +0000)
  * generic/gdbtk-varobj.c (variable_value): Use TRY_CATCH
  when calling varobj_set_value.
  * library/vartree.itb (changeValue): Make note of new
  assumption that input is decimal (unless prefixed to change
  the input radix).

gdb/gdbtk/ChangeLog
gdb/gdbtk/generic/gdbtk-varobj.c
gdb/gdbtk/library/vartree.itb

index 9ca790e..9d0d2d6 100644 (file)
@@ -1,3 +1,12 @@
+2010-04-29  Keith Seitz  <keiths@redhat.com>
+
+       insight/347
+       * generic/gdbtk-varobj.c (variable_value): Use TRY_CATCH
+       when calling varobj_set_value.
+       * library/vartree.itb (changeValue): Make note of new
+       assumption that input is decimal (unless prefixed to change
+       the input radix).
+
 2010-04-02  Keith Seitz  <keiths@redhat.com>
 
        * generic/gdbtk-bp.c (gdb_get_breakpoint_info): Use
index 2a6f9fc..453a64f 100644 (file)
@@ -1,5 +1,6 @@
 /* Variable user interface layer for GDB, the GNU debugger.
-   Copyright (C) 1999, 2000, 2001, 2002, 2008 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002, 2008, 2010
+   Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -22,6 +23,7 @@
 #include "value.h"
 #include "gdb_string.h"
 #include "varobj.h"
+#include "exceptions.h"
 
 #include <tcl.h>
 #include "gdbtk.h"
@@ -574,9 +576,16 @@ variable_value (Tcl_Interp *interp, int objc,
       if (varobj_get_attributes (var) & 0x00000001 /* Editable? */ )
        {
          char *s;
+         int ok = 0;
+         struct gdb_exception e;
 
          s = Tcl_GetStringFromObj (objv[2], NULL);
-         if (!varobj_set_value (var, s))
+         TRY_CATCH (e, RETURN_MASK_ERROR)
+           {
+             ok = varobj_set_value (var, s);
+           }
+
+         if (e.reason < 0 || !ok)
             {
              gdbtk_set_result (interp, "Could not assign expression to variable object");
              return TCL_ERROR;
index 4c6a93f..7197f60 100644 (file)
@@ -1,5 +1,5 @@
 # Variable tree implementation for Insight.
-# Copyright (C) 2002, 2009 Red Hat, Inc.
+# Copyright (C) 2002, 2009, 2010 Red Hat, Inc.
 #
 # This program is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License (GPL) as published by
@@ -286,6 +286,14 @@ itcl::body  VarTree::changeValue {j} {
     unedit $j
     return
   }
+
+  # NOTE: Varobj requires decimal input radix. So either
+  # we must assume that all input is decimal (unless prefixed by
+  # "0x"), or we assume that the input radix is the same as the
+  # variable's display radix.
+  #
+  # I think that consistency wins out over convenience here. We will
+  # require users to prefix non-decimal expressions.
   if {[catch {$entryobj value $new} errTxt]} {
     # gdbtk-varobj doesn't actually return meaningful error messages
     # so use a generic one.