I am debugging a Fortran program with DDT, but the value of an allocatable character variable (character(len = :), allocatable :: s) appears to be empty until it is passed into a subroutine. Is there a way to show the value in DDT?
Hi John,
Development team has successfully identified the root cause being associated with GDB patch-set and some planning is ongoing on the possible fixes. At this point, I can not commit a timeline or the vehicle for the fix, but I should be back with some news within some time again.
Thank You for your patience!
Suyash
Hi John,We have looked into the root cause and it turns out that, for derived types in fortran, the deferred length string property is unavailable and instead there is another particular non-standard value available i.e. _in_derived_type_length. This value can be cast on a character pointer - char* - and accessed indirectly that way at-least when using gcc. (Image attached)
For standard data types in fortran, DW_AT_string_length value is available in general for gcc compilers but unfortunately not for the intel ones. So going ahead if gcc(gfortran) is your primary compiler of choice, there is a clear fix available ahead but not in case of an Intel compiler, which doesn't have the standard length value as mentioned above.Let me know if you're ok with this.
RegardsSuyash
Hi Suyash,
Thank you for the update. It's good to know there is a workaround for gfortran. Unfortunately, I am mainly using the Intel compiler. In the Intel implementation, the derived type seems to hold a pointer to a null terminated string. Is there a way to view that string using casting?
Regards,
John
Hi John,Unfortunately for Intel the DW_AT_string_length field doesn't even exist which can only happen when Intel provides the DWARF information which would be a decision of the DWARF committee. Until then it will not be possible to useany kind of workaround to get the string.Sorry about that.RegardsSuyash