mirror of
https://github.com/bminor/binutils-gdb.git
synced 2025-12-05 15:15:42 +00:00
gdb/fortran: clean-up Fortran intrinsic types
The currently implemented intrinsic type handling for Fortran missed some tokens and their parsing. While still not all Fortran type kinds are implemented this patch at least makes the currently handled types consistent. As an example for what this patch does, consider the intrinsic type INTEGER. GDB implemented the handling of the keywords "integer" and "integer_2" but missed "integer_4" and "integer_8" even though their corresponding internal types were already available as the Fortran builtin types builtin_integer and builtin_integer_s8. Similar problems applied to LOGICAL, REAL, and COMPLEX. This patch adds all missing tokens and their parsing. Whenever a section containing the type handling was touched, it also was reordered to be in a more easy to grasp order. All INTEGER/REAL/LOGICAL/COMPLEX types were grouped together and ordered ascending in their size making a missing one more easy to spot. Before this change GDB would print the following when tyring to use the INTEGER keywords: (gdb) set language fortran (gdb) ptype integer*1 unsupported kind 1 for type integer (gdb) ptype integer_1 No symbol table is loaded. Use the "file" command. (gdb) ptype integer*2 type = integer*2 (gdb) ptype integer_2 type = integer*2 (gdb) ptype integer*4 type = integer (gdb) ptype integer_4 No symbol table is loaded. Use the "file" command. (gdb) ptype integer*8 type = integer*8 (gdb) ptype integer_8 No symbol table is loaded. Use the "file" command. (gdb) ptype integer type = integer With this patch all keywords are available and the GDB prints: (gdb) set language fortran (gdb) ptype integer*1 type = integer*1 (gdb) ptype integer_1 type = integer*1 (gdb) ptype integer*2 type = integer*2 (gdb) ptype integer_2 type = integer*2 (gdb) ptype integer*4 type = integer*4 (gdb) ptype integer_4 type = integer*4 (gdb) ptype integer*8 type = integer*8 (gdb) ptype integer_8 type = integer*8 (gdb) ptype integer type = integer The described changes have been applied to INTEGER, REAL, COMPLEX, and LOGICAL. Existing testcases have been adapted to reflect the new behavior. Tests for formerly missing types have been added.
This commit is contained in:
26
gdb/f-lang.c
26
gdb/f-lang.c
@@ -1619,28 +1619,28 @@ build_fortran_types (struct gdbarch *gdbarch)
|
||||
builtin_f_type->builtin_logical_s1
|
||||
= arch_boolean_type (gdbarch, TARGET_CHAR_BIT, 1, "logical*1");
|
||||
|
||||
builtin_f_type->builtin_logical_s2
|
||||
= arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2");
|
||||
|
||||
builtin_f_type->builtin_logical
|
||||
= arch_boolean_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "logical*4");
|
||||
|
||||
builtin_f_type->builtin_logical_s8
|
||||
= arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
|
||||
"logical*8");
|
||||
|
||||
builtin_f_type->builtin_integer_s1
|
||||
= arch_integer_type (gdbarch, TARGET_CHAR_BIT, 0, "integer*1");
|
||||
|
||||
builtin_f_type->builtin_integer_s2
|
||||
= arch_integer_type (gdbarch, gdbarch_short_bit (gdbarch), 0, "integer*2");
|
||||
|
||||
builtin_f_type->builtin_integer_s8
|
||||
= arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
|
||||
"integer*8");
|
||||
|
||||
builtin_f_type->builtin_logical_s2
|
||||
= arch_boolean_type (gdbarch, gdbarch_short_bit (gdbarch), 1, "logical*2");
|
||||
|
||||
builtin_f_type->builtin_logical_s8
|
||||
= arch_boolean_type (gdbarch, gdbarch_long_long_bit (gdbarch), 1,
|
||||
"logical*8");
|
||||
|
||||
builtin_f_type->builtin_integer
|
||||
= arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), 0, "integer");
|
||||
|
||||
builtin_f_type->builtin_logical
|
||||
= arch_boolean_type (gdbarch, gdbarch_int_bit (gdbarch), 1, "logical*4");
|
||||
builtin_f_type->builtin_integer_s8
|
||||
= arch_integer_type (gdbarch, gdbarch_long_long_bit (gdbarch), 0,
|
||||
"integer*8");
|
||||
|
||||
builtin_f_type->builtin_real
|
||||
= arch_float_type (gdbarch, gdbarch_float_bit (gdbarch),
|
||||
|
||||
Reference in New Issue
Block a user