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]

[PATCH] The parameter in value_entirely_optimized_out is NULL


Hi:



The GDB(v7.7 onwards) will crash at value_entirely_optimized_out (value=0x0) in some cases.



These cases are reported in GDB Database as Bug 20020,17076,17685 in X86 platform



and other reports that use cross-compiled GDB host(ARM & MIPS) from our side. 




This bug is introduced when the patch https://sourceware.org/ml/gdb-patches/2013-10/msg00353.html  is added.



The code from this patch that caused the regression is listed below:




diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 1d7147c..4b625d1 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -333,12 +333,9 @@ cp_print_value_fields (struct type *type, struct type *real_type,
       fprintf_filtered (stream,
           _("<error reading variable: %s>"),
           ex.message);
-    else if (v == NULL)
-      val_print_optimized_out (NULL, stream);
-    else
-      cp_print_static_field (TYPE_FIELD_TYPE (type, i),
-        v, stream, recurse + 1,
-        options);
+    cp_print_static_field (TYPE_FIELD_TYPE (type, i),
+      v, stream, recurse + 1,
+      options);
   }




Therefore, I propose to partly revert the previous patch and apply the change below.




Is it acceptable ?




diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index effce30..aaf36d1 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -328,9 +328,12 @@ cp_print_value_fields (struct type *type, struct type *real_type,
                    }
                  END_CATCH
 
-                 cp_print_static_field (TYPE_FIELD_TYPE (type, i),
-                                        v, stream, recurse + 1,
-                                        options);
+                 if (v == NULL)
+                     val_print_optimized_out(NULL, stream);
+                 else
+                     cp_print_static_field (TYPE_FIELD_TYPE (type, i),
+                                            v, stream, recurse + 1,
+                                            options);
                }
              else if (i == vptr_fieldno && type == vptr_basetype)
                {




Thanks
Jmqiao 		 	   		  

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