]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Implement 'Object_Size
authorTom Tromey <tromey@adacore.com>
Wed, 18 Sep 2024 18:44:42 +0000 (12:44 -0600)
committerTom Tromey <tromey@adacore.com>
Tue, 22 Oct 2024 18:04:06 +0000 (12:04 -0600)
commit04ce6b03d9e940b6fb2ccd54539357714e7550bd
tree68c3fc221b0127ac3d1aae149bd7dd7e588f05a2
parent8483536dea6e36e9f4a0949ecad0fcaafd62cf54
Implement 'Object_Size

This patch started as an attempt to allow the 'Size attribute to be
applied to types, and not just objects.

However, that turns out to be difficult due to the Ada semantcs of
'Size.  In particular, Ada requires 'Size to denote the size of the
representation of the value, so for example Boolean'Size must be 1.
Implementing this properly requires information not readily available
to gdb... and while we could synthesize this information in many
cases, it also seemed to me that this wasn't strictly very useful when
debugging.

So instead, this patch adds support for the 'Object_Size attribute,
which is somewhat closer to 'sizeof'.

Note also that while 'Object_Size is defined for some dynamic types, I
chose not to implement this here, as again this information is not
readily available -- and I think it's preferable to error than to
print something that might be incorrect.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
12 files changed:
gdb/NEWS
gdb/ada-exp.h
gdb/ada-exp.y
gdb/ada-lang.c
gdb/ada-lex.l
gdb/doc/gdb.texinfo
gdb/testsuite/gdb.ada/type-tick-size.exp [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/pck.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/pck.ads [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/prog.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/support.adb [new file with mode: 0644]
gdb/testsuite/gdb.ada/type-tick-size/support.ads [new file with mode: 0644]