]> sourceware.org Git - libabigail.git/commit
ctf-reader: Fix array size representation
authorGuillermo E. Martinez via Libabigail <libabigail@sourceware.org>
Thu, 17 Nov 2022 03:43:05 +0000 (21:43 -0600)
committerDodji Seketeli <dodji@redhat.com>
Wed, 30 Nov 2022 09:49:22 +0000 (10:49 +0100)
commit77ae31417697dde8d3119e042dafd7dddb9538e1
tree6fc504b7217e0eb8dcac5596fe6bcce491c60b5e
parente33a74fb8c096bc190704402983acfeca25fc3ee
ctf-reader: Fix array size representation

A variable length array (VLA), or a flexible array member (with its
size set to zero to recognize such cases) is represented in the
libabigail IR as an array with "non-finite" length.  This is a way to
say that the length of the array is not statically known.

The ABIXML array-type-def element looks like:

<array-type-def dimensions='1' ... size-in-bits='infinite' ...>
    <subrange length='infinite' type-id='type-id-3' .../>
</array-type-def>

The patch teaches the ctf-reader to correctly set the size of the
array for VLAs.

* src/abg-ctf-reader.cc (build_array_ctf_range): Use
* tests/data/Makefile.am: Add new test.
`upper_bound' and number of elements to indicate infinite
array size.
* tests/data/test-read-ctf/test-array-size.abi: New test.
* tests/data/test-read-ctf/test-array-size.c: Likewise.
* tests/data/test-read-ctf/test-array-size.o: Likewise.
* tests/test-read-ctf.cc: Update testsuite.

Signed-off-by: Guillermo E. Martinez <guillermo.e.martinez@oracle.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
src/abg-ctf-reader.cc
tests/data/Makefile.am
tests/data/test-read-ctf/test-array-size.abi [new file with mode: 0644]
tests/data/test-read-ctf/test-array-size.c [new file with mode: 0644]
tests/data/test-read-ctf/test-array-size.o [new file with mode: 0644]
tests/data/test-read-ctf/test9.o.abi
tests/test-read-ctf.cc
This page took 0.033406 seconds and 5 git commands to generate.