mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-18 16:53:50 +08:00
2013-12-12 Siva Chandra Reddy <sivachandra@google.com>
PR python/16113 * NEWS (Python Scripting): Add entry for the new feature and the new attribute of gdb.Field objects. * python/py-type.c (gdbpy_is_field): New function (convert_field): Add 'parent_type' attribute to gdb.Field objects. * python/py-value.c (valpy_getitem): Allow subscript value to be a gdb.Field object. (value_has_field): New function (get_field_flag): New function * python/python-internal.h (gdbpy_is_field): Add declaration. testsuite/ * gdb.python/py-value-cc.cc: Improve test case. * gdb.python/py-value-cc.exp: Add new tests to test usage of gdb.Field objects as subscripts on gdb.Value objects. doc/ * gdb.texinfo (Values From Inferior): Add a note about using gdb.Field objects as subscripts on gdb.Value objects. (Types In Python): Add description about the new attribute "parent_type" of gdb.Field objects.
This commit is contained in:
@ -16,8 +16,21 @@
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||
|
||||
class A {
|
||||
public:
|
||||
int a;
|
||||
};
|
||||
|
||||
union U {
|
||||
int a;
|
||||
char c;
|
||||
};
|
||||
|
||||
class B : public A {
|
||||
public:
|
||||
char a;
|
||||
};
|
||||
|
||||
typedef B Btd;
|
||||
typedef int *int_ptr;
|
||||
|
||||
int
|
||||
@ -28,6 +41,22 @@ func (const A &a)
|
||||
int_ptr ptr = &val;
|
||||
int_ptr &int_ptr_ref = ptr;
|
||||
|
||||
B b;
|
||||
B b1;
|
||||
|
||||
b.a = 'a';
|
||||
b.A::a = 10;
|
||||
|
||||
B *b_obj = &b1;
|
||||
b_obj->a = 'b';
|
||||
b_obj->A::a = 100;
|
||||
|
||||
B &b_ref = b1;
|
||||
Btd &b_td = b1;
|
||||
|
||||
U u;
|
||||
u.a = 99;
|
||||
|
||||
return 0; /* Break here. */
|
||||
}
|
||||
|
||||
@ -35,5 +64,6 @@ int
|
||||
main ()
|
||||
{
|
||||
A obj;
|
||||
|
||||
return func (obj);
|
||||
}
|
||||
|
Reference in New Issue
Block a user