diff options
author | Tom Tromey <tom@tromey.com> | 2018-04-20 15:43:56 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-04-30 11:25:31 -0600 |
commit | 6d7bb8246b3beaf60ea9c2abe183705e876519cd (patch) | |
tree | 57eeee53543aa1091d282fc6ffe553902446b706 /gdb/testsuite | |
parent | 007e1530347330d4dbba387c4e35aae05bc06498 (diff) | |
download | binutils-6d7bb8246b3beaf60ea9c2abe183705e876519cd.zip binutils-6d7bb8246b3beaf60ea9c2abe183705e876519cd.tar.gz binutils-6d7bb8246b3beaf60ea9c2abe183705e876519cd.tar.bz2 |
Expose type alignment on gdb.Type
This adds an "alignof" attribute to gdb.Type in the Python API.
2018-04-30 Tom Tromey <tom@tromey.com>
* NEWS: Mention Type.align.
* python/py-type.c (typy_get_alignof): New function.
(type_object_getset): Add "alignof".
2018-04-30 Tom Tromey <tom@tromey.com>
* python.texi (Types In Python): Document Type.align.
2018-04-30 Tom Tromey <tom@tromey.com>
* gdb.python/py-type.exp: Check align attribute.
* gdb.python/py-type.c: New "aligncheck" global.
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.c | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-type.exp | 4 |
3 files changed, 11 insertions, 0 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index e8b55aa..4e48934 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,10 @@ 2018-04-30 Tom Tromey <tom@tromey.com> + * gdb.python/py-type.exp: Check align attribute. + * gdb.python/py-type.c: New "aligncheck" global. + +2018-04-30 Tom Tromey <tom@tromey.com> + PR exp/17095: * gdb.dwarf2/dw2-align.exp: New file. * gdb.cp/align.exp: New file. diff --git a/gdb/testsuite/gdb.python/py-type.c b/gdb/testsuite/gdb.python/py-type.c index 2626d4e..9531c9e 100644 --- a/gdb/testsuite/gdb.python/py-type.c +++ b/gdb/testsuite/gdb.python/py-type.c @@ -30,6 +30,8 @@ struct SS typedef struct s TS; TS ts; +int aligncheck; + #ifdef __cplusplus struct C { diff --git a/gdb/testsuite/gdb.python/py-type.exp b/gdb/testsuite/gdb.python/py-type.exp index b87e86c..8fe0221 100644 --- a/gdb/testsuite/gdb.python/py-type.exp +++ b/gdb/testsuite/gdb.python/py-type.exp @@ -278,6 +278,10 @@ if { [build_inferior "${binfile}" "c"] == 0 } { gdb_test "python print(gdb.lookup_type('int').optimized_out())" \ "<optimized out>" + set sint [get_sizeof int 0] + gdb_test "python print(gdb.parse_and_eval('aligncheck').type.alignof)" \ + $sint + with_test_prefix "lang_c" { runto_bp "break to inspect struct and array." test_fields "c" |