This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Issues with read_tag_string_type() in dwarf2read.c

Hi All,

The routine read_tag_string_type() in dwarf2read.c has some missing
capabilities and concerns.

1) It retrieves the the length of the string by querying only the Dwarf
attribute DW_AT_string_length. However, according to the Dwarf standard,
DW_AT_byte_size is acceptable as well. The main concern, of course, is
for compilers that generate the DW_AT_byte_size, rather than
DW_AT_string_length otherwise the string length is considered to be 1.

2) The routine ends up returning the same type for each call, with the
values initialized to the first call to read_tag_string_type (). The
reason this does not seem to be a problem with C/C++ is that strings are
considered pointers and are terminated by 0. Other languages, such as
FORTRAN, consider (to some level) strings as arrays of characters that
do not have a terminating symbol and the type information is extremely
important in determining the length of an array. Currently this
oversight causes certain FORTRAN compiler's code to have all strings
considered to be the same length as the very first string type read in
the Dwarf information. This undoubtedly causes major problems and
compromises the stability of gdb when querying the contents of strings.

I have a patch but would prefer a discussion concerning this problem
before I submit it.

Petr Sorfa                  Senior Software Engineer
430 Mountain Ave. 
Murray Hill 07974
Disclaimer: All my comments are my own and nobody else's

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]