From b5b08fb4ffa53ec088f8ad865bee0fd6edb2906f Mon Sep 17 00:00:00 2001 From: Siva Chandra Date: Fri, 27 Dec 2013 12:20:59 -0800 Subject: Use bitpos and type to lookup a gdb.Field object when its name is 'None'. PR python/15464 PR python/16113 * valops.c (value_struct_elt_bitpos): New function * py-type.c (convert_field): Set 'name' attribute of a gdb.Field object to 'None' if the field name is an empty string (""). * python/py-value.c (valpy_getitem): Use 'bitpos' and 'type' attribute to look for a field when 'name' is 'None'. (get_field_type): New function testsuite/ * gdb.python/py-type.c: Enhance test case. * gdb.python/py-value-cc.cc: Likewise * gdb.python/py-type.exp: Add new tests. * gdb.python/py-value-cc.exp: Likewise --- gdb/testsuite/gdb.python/py-value-cc.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'gdb/testsuite/gdb.python/py-value-cc.cc') diff --git a/gdb/testsuite/gdb.python/py-value-cc.cc b/gdb/testsuite/gdb.python/py-value-cc.cc index 59f1dec..ace957a 100644 --- a/gdb/testsuite/gdb.python/py-value-cc.cc +++ b/gdb/testsuite/gdb.python/py-value-cc.cc @@ -30,8 +30,21 @@ class B : public A { char a; }; +struct X +{ + union { int x; char y; }; + union { int a; char b; }; +}; + +union UU +{ + union { int x; char y; }; + union { int a; char b; }; +}; + typedef B Btd; typedef int *int_ptr; +typedef X Xtd; int func (const A &a) @@ -57,6 +70,16 @@ func (const A &a) U u; u.a = 99; + X x; + x.x = 101; + x.a = 102; + + UU uu; + uu.x = 1000; + + X *x_ptr = &x; + Xtd *xtd = &x; + return 0; /* Break here. */ } -- cgit v1.1