diff options
| author | Abid Qadeer <haqadeer@amd.com> | 2024-08-27 10:30:49 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-27 10:30:49 +0100 |
| commit | d07dc73bcfcd4026b956eb08b770ff0c47546b66 (patch) | |
| tree | becea3756e59494c50051a6cd5b03a60f2253967 /lldb/source/Plugins/ScriptInterpreter/Python | |
| parent | 1e153461c66bf517097168790cdcb9418af6b623 (diff) | |
| download | llvm-d07dc73bcfcd4026b956eb08b770ff0c47546b66.zip llvm-d07dc73bcfcd4026b956eb08b770ff0c47546b66.tar.gz llvm-d07dc73bcfcd4026b956eb08b770ff0c47546b66.tar.bz2 | |
[flang][debug] Support derived types. (#99476)
This PR adds initial debug support for derived type. It handles
`RecordType` and generates appropriate `DICompositeTypeAttr`. The
`TypeInfoOp` is used to get information about the parent and location of
the derived type.
We use `getTypeSizeAndAlignment` to get the size and alignment of the
components of the derived types. This function needed a few changes to
be suitable to be used here:
1. The `getTypeSizeAndAlignment` errored out on unsupported type which
would not work with incremental way we are building debug support. A new
variant of this function has been that returns an std::optional. The original
function has been renamed to `getTypeSizeAndAlignmentOrCrash` as it
will call `TODO()` for unsupported types.
2. The Character type was returning size of just element and not the
whole string which has been fixed.
The testcase checks for offsets of the components which had to be
hardcoded in the test. So the testcase is currently enabled on x86_64.
With this PR in place, this is how the debugging of derived types look
like:
```
type :: t_date
integer :: year, month, day
end type
type :: t_address
integer :: house_number
end type
type, extends(t_address) :: t_person
character(len=20) name
end type
type, extends(t_person) :: t_employee
type(t_date) :: hired_date
real :: monthly_salary
end type
type(t_employee) :: employee
(gdb) p employee
$1 = ( t_person = ( t_address = ( house_number = 1 ), name = 'John', ' ' <repeats 16 times> ), hired_date = ( year = 2020, month = 1, day = 20 ), monthly_salary = 3.1400001 )
```
Diffstat (limited to 'lldb/source/Plugins/ScriptInterpreter/Python')
0 files changed, 0 insertions, 0 deletions
