]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2011-04-29 Phil Muldoon <pmuldoon@redhat.com>
authorPhil Muldoon <pmuldoon@redhat.com>
Fri, 29 Apr 2011 12:50:39 +0000 (12:50 +0000)
committerPhil Muldoon <pmuldoon@redhat.com>
Fri, 29 Apr 2011 12:50:39 +0000 (12:50 +0000)
PR mi/12531

* varobj.c (install_default_visualizer): Do not install a
visualizer if the varobj is CPLUS_FAKE_CHILD.
(construct_visualizer): Likewise.

2011-04-29  Phil Muldoon  <pmuldoon@redhat.com>

PR mi/12531

* gdb.python/py-mi.exp: Add CPLUS_FAKE_CHILD tests and a C++
compile target.
* gdb.python/py-prettyprint.exp: Add C++ object for
CPLUS_FAKE_CHILD test.

gdb/ChangeLog
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.python/py-mi.exp
gdb/testsuite/gdb.python/py-prettyprint.c
gdb/varobj.c

index bbf2034f4ada9a3221d5e6ee998d8698dd7b4f86..53623c0bf9dc75e3a4b5ee869b6d6326c5f9c9cc 100644 (file)
@@ -1,3 +1,11 @@
+2011-04-29  Phil Muldoon  <pmuldoon@redhat.com>
+
+       PR mi/12531
+
+       * varobj.c (install_default_visualizer): Do not install a
+       visualizer if the varobj is CPLUS_FAKE_CHILD.
+       (construct_visualizer): Likewise.
+
 2011-04-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix Python access to inlined frames.
index 590df5683876b28b6c19e1c2f032876e42b3d200..4360a989f5c25d6a297558f7b21a006e18f205cd 100644 (file)
@@ -1,3 +1,12 @@
+2011-04-29  Phil Muldoon  <pmuldoon@redhat.com>
+
+       PR mi/12531
+
+       * gdb.python/py-mi.exp: Add CPLUS_FAKE_CHILD tests and a C++
+       compile target.
+       * gdb.python/py-prettyprint.exp: Add C++ object for
+       CPLUS_FAKE_CHILD test.
+
 2011-04-29  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        Fix Python access to inlined frames.
index 629417b5dd6c20cc16fc814582054e0369c324bb..37359e9807f8a49417d103f5d3964488471eb1fe 100644 (file)
@@ -283,4 +283,44 @@ mi_list_varobj_children nstype2 {
     { {nstype2.<error at 0>} {<error at 0>} 6 {char \[6\]} }
 } "list children after setting exception flag"
 
+# C++ MI tests
+gdb_exit
+if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+          executable {debug c++ additional_flags=-DMI}] != "" } {
+    untested "Couldn't compile ${srcfile} in c++ mode"
+    return -1
+}
+
+if [mi_gdb_start] {
+    continue
+}
+mi_delete_breakpoints
+mi_gdb_reinitialize_dir $srcdir/$subdir
+mi_gdb_load ${binfile}
+
+if {[lsearch -exact [mi_get_features] python] < 0} {
+    unsupported "python support is disabled"
+    return -1
+}
+
+mi_runto main
+mi_continue_to_line \
+    [gdb_get_line_number {break to inspect struct and union} ${testfile}.c] \
+    "step to breakpoint"
+
+# Test python/12531.  Install visualizer on a cplus_fake_child.
+mi_create_varobj fake fake \
+  "create fake varobj"
+
+mi_list_varobj_children fake {
+    { fake.private private 1 }
+} "list children of fake"
+
+mi_list_varobj_children fake.private {
+    { fake.private.sname sname 0 int }
+} "list children fake.private"
+
+mi_gdb_test "-var-set-visualizer fake.private gdb.default_visualizer" \
+    "\\^done" "Install visualizer on a cplus_fake_child"
+
 remote_file host delete ${remote_python_file}
index 5f984338c3c9cc69d46e905e35e53c9d1eda1fe5..2201ecffbe6a07fac413ed82e7be056f59967e1d 100644 (file)
@@ -90,6 +90,16 @@ class Derived : public Vbase1, public Vbase2, public Vbase3
     }
 };
 
+class Fake
+{
+  int sname;
+  
+ public:
+  Fake (const int name = 0):
+  sname (name)
+  {
+  }
+};
 #endif
 
 struct substruct {
@@ -262,6 +272,7 @@ main ()
 
   Derived derived;
   
+  Fake fake (42);
 #endif
 
   add_item (&c, 23);           /* MI breakpoint here */
index bfb3851d75790a9ad28f3b6ab76ae61d58469b86..e068823d55893bf939985e845019aca9ecd882ed 100644 (file)
@@ -1397,6 +1397,10 @@ install_visualizer (struct varobj *var, PyObject *constructor,
 static void
 install_default_visualizer (struct varobj *var)
 {
+  /* Do not install a visualizer on a CPLUS_FAKE_CHILD.  */
+  if (CPLUS_FAKE_CHILD (var))
+    return;
+
   if (pretty_printing)
     {
       PyObject *pretty_printer = NULL;
@@ -1429,6 +1433,10 @@ construct_visualizer (struct varobj *var, PyObject *constructor)
 {
   PyObject *pretty_printer;
 
+  /* Do not install a visualizer on a CPLUS_FAKE_CHILD.  */
+  if (CPLUS_FAKE_CHILD (var))
+    return;
+
   Py_INCREF (constructor);
   if (constructor == Py_None)
     pretty_printer = NULL;