This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] PR python/11407


On 06/24/2010 11:01 PM, Phil Muldoon wrote:
> On 06/24/2010 07:10 PM, Tom Tromey wrote:
>>>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
>>
>> Phil> This patch is for PR 11407. It also cures the ills in Jan's
>> Phil> test-case from last night:
>>
>> Phil> 2010-06-24  Phil Muldoon  <pmuldoon@redhat.com>
>> Phil> 	PR python/11407
>> Phil> 	* printcmd.c (print_variable_and_value): Print error message on
>> Phil> 	caught exception.
>>
>> This is ok with the changes Jan suggested.
>>
>> I think the MI commands -stack-list-variables and friends will need
>> similar treatment.  See mi-cmd-stack.c:list_args_or_locals.
> 
> Sorry for missing this, I was running 'info locals' in the MI
> interpreter.  The MI -stack-list-locals case (as you noted) takes a
> different direction from the CLI in printing these cases.

> 
> WDYT?

Oops in the last patch, I forgot to include

 ui_out_field_stream (uiout, "value", stb);

in both cases.  Here is a corrected patch:

--
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c
index 6797055..e67d085 100644
--- a/gdb/mi/mi-cmd-stack.c
+++ b/gdb/mi/mi-cmd-stack.c
@@ -31,7 +31,7 @@
 #include "gdb_string.h"
 #include "language.h"
 #include "valprint.h"
-
+#include "exceptions.h"
 
 enum what_to_list { locals, arguments, all };
 
@@ -335,26 +335,41 @@ list_args_or_locals (enum what_to_list what, int values, struct frame_info *fi)
 		      && TYPE_CODE (type) != TYPE_CODE_UNION)
 		    {
 		      struct value_print_options opts;
-
-		      val = read_var_value (sym2, fi);
-		      get_raw_print_options (&opts);
-		      opts.deref_ref = 1;
-		      common_val_print
-			(val, stb->stream, 0, &opts,
-			 language_def (SYMBOL_LANGUAGE (sym2)));
+		      volatile struct gdb_exception except;
+
+		      TRY_CATCH (except, RETURN_MASK_ERROR)
+			{
+
+			  val = read_var_value (sym2, fi);
+			  get_raw_print_options (&opts);
+			  opts.deref_ref = 1;
+			  common_val_print
+			    (val, stb->stream, 0, &opts,
+			     language_def (SYMBOL_LANGUAGE (sym2)));
+			}
+		      if (except.reason < 0)
+			warning (_("<error reading variable>"));
+		      
 		      ui_out_field_stream (uiout, "value", stb);
 		    }
 		  break;
 		case PRINT_ALL_VALUES:
 		  {
 		    struct value_print_options opts;
-
-		    val = read_var_value (sym2, fi);
-		    get_raw_print_options (&opts);
-		    opts.deref_ref = 1;
-		    common_val_print
-		      (val, stb->stream, 0, &opts,
-		       language_def (SYMBOL_LANGUAGE (sym2)));
+		    volatile struct gdb_exception except;
+		    
+		    TRY_CATCH (except, RETURN_MASK_ERROR)
+		      {
+			val = read_var_value (sym2, fi);
+			get_raw_print_options (&opts);
+			opts.deref_ref = 1;
+			common_val_print
+			  (val, stb->stream, 0, &opts,
+			   language_def (SYMBOL_LANGUAGE (sym2)));
+		      }
+		    if (except.reason < 0)
+		      warning (_("<error reading variable>"));
+		    
 		    ui_out_field_stream (uiout, "value", stb);
 		  }
 		  break;



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]