[PATCH][gdb/symtab] Handle DW_AT_string_length with location list

Tom de Vries tdevries@suse.de
Fri Oct 15 16:08:36 GMT 2021


On 10/15/21 5:22 PM, Simon Marchi wrote:
> On 2021-10-14 3:58 p.m., Tom de Vries via Gdb-patches wrote:
>> Hi,
>>
>> Consider a fortran routine where a string variable s is modified:
>> ...
>> subroutine f(s)
>>   character*(*) s
>>   print *, s
>>   s(1:3) = 'oof'
>>   print *, s
>> end subroutine f
>> ...
>>
>> When compiling with optimization level -O1 and printing the type of
>> variable s we get:
>> ...
>> $ gdb -q -batch outputs/gdb.opt/fortran-string/fortran-string \
>>   -ex "b f" \
>>   -ex run \
>>   -ex "ptype s"
>> Breakpoint 1 at 0x4006f7: file fortran-string.f90, line 21.
>>
>> Breakpoint 1, f (s=..., _s=_s@entry=3) at fortran-string.f90:21
>> 21      subroutine f(s)
>> type = character*1
> 
> I'm not familiar with fortran, does this notation ("character*1") have a
> meaning in fortran?
> 

I'm not very familiar with fortran either, but AFAIU the meaning is:
character string of length one.

> Again, I don't know anything about fortran, but the change in dwarf2/read.c
> looks good to me.

Thanks for the review.

- Tom


More information about the Gdb-patches mailing list