From ffcd12f69ecfc08ee012f1cad5c6791f46ad3f04 Mon Sep 17 00:00:00 2001
From: hjk <qtc-committer@nokia.com>
Date: Wed, 14 Dec 2011 08:12:00 +0100
Subject: [PATCH] debugger: add semi-automated test for display of anon
 structs.

http://sourceware.org/bugzilla/show_bug.cgi?id=10586. fsf gdb errors out
on -var-list-children on an anonymous union. The proposed fix has been
reported to crash gdb steered from eclipse.
(http://sourceware.org/ml/gdb-patches/2011-12/msg00420.html).
We should not be affected as mac gdb was fixed in 2006 and we avoid
using varobjs when we have python.

Change-Id: I2698d6762ed8757549bad304c6cd23d9150460fd
Reviewed-by: hjk <qthjk@ovi.com>
---
 .../debugger/simple/simple_test_app.cpp       | 45 +++++++++++++++++++
 1 file changed, 45 insertions(+)

diff --git a/tests/manual/debugger/simple/simple_test_app.cpp b/tests/manual/debugger/simple/simple_test_app.cpp
index 1bbe5ef4a54..ebb3ec5389c 100644
--- a/tests/manual/debugger/simple/simple_test_app.cpp
+++ b/tests/manual/debugger/simple/simple_test_app.cpp
@@ -5796,6 +5796,50 @@ namespace gdb13393 {
 } // namespace gdb13393
 
 
+namespace gdb10586 {
+
+    // http://sourceware.org/bugzilla/show_bug.cgi?id=10586. fsf/MI errors out
+    // on -var-list-children on an anonymous union. mac/MI was fixed in 2006.
+    // The proposed fix has been reported to crash gdb steered from eclipse.
+    // http://sourceware.org/ml/gdb-patches/2011-12/msg00420.html
+    // Check we are not harmed by either version.
+    void testmi()
+    {
+        struct test {
+            struct { int a; float b; };
+            struct { int c; float d; };
+        } v = {{1, 2}, {3, 4}};
+        BREAK_HERE;
+        // Expand v.
+        // Check v gdb10586::test.
+        // Check a 1 int.
+        // Continue.
+        dummyStatement(&v);
+    }
+
+    void testeclipse()
+    {
+        struct { int x; struct { int a; }; struct { int b; }; } v = {1, {2}, {3}};
+        struct s { int x, y; } n = {10, 20};
+        BREAK_HERE;
+        // Expand v n.
+        // Check v {...}.
+        // Check n gdb10586.
+        // Check a 2.
+        // Check x 1.
+        // Continue.
+        dummyStatement(&v, &n);
+    }
+
+    void test10586()
+    {
+        testmi();
+        testeclipse();
+    }
+
+} // namespace gdb10586
+
+
 namespace valgrind {
 
     void testLeak()
@@ -5939,6 +5983,7 @@ int main(int argc, char *argv[])
     bug5799::test5799();
     bug6465::test6465();
     gdb13393::test13393();
+    gdb10586::test10586();
 
     final::testFinal(&app);
 
-- 
GitLab