diff options
author | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-02-16 22:45:41 +0000 |
---|---|---|
committer | Andrew Burgess <andrew.burgess@embecosm.com> | 2019-04-30 10:10:31 +0100 |
commit | 1db455a76c39e2be6a8a9613b7a19439f24722d0 (patch) | |
tree | 80df9448123cfcc3c159f5e209c2ba94ddd805cc /gdb/dwarf2read.c | |
parent | b6d03bb2b65ac5c919f1d08674bbaa2a9bfb2d0c (diff) | |
download | gdb-1db455a76c39e2be6a8a9613b7a19439f24722d0.zip gdb-1db455a76c39e2be6a8a9613b7a19439f24722d0.tar.gz gdb-1db455a76c39e2be6a8a9613b7a19439f24722d0.tar.bz2 |
gdb/fortran: better types for components of complex numbers
Currently when using $_creal and $_cimag to access the components of a
complex number the types of these components will have C type names
'float', 'double', etc. This is because the components of a complex
number are not given type names in DWARF, so GDB has to pick some
suitable names, and currently we always use the C names.
This commit changes the type names used based on the language, so for
Fortran we will now use the Fortran float types, and so will get the
Fortran float type names 'real', 'real*8', etc.
gdb/ChangeLog:
* dwarf2read.c (dwarf2_init_complex_target_type): Use different
types for Fortran.
gdb/testsuite/ChangeLog:
* gdb.fortran/complex.exp: Expand.
* gdb.fortran/complex.f: Renamed to...
* gdb.fortran/complex.f90: ...this, and extended to add more
complex values.
Diffstat (limited to 'gdb/dwarf2read.c')
-rw-r--r-- | gdb/dwarf2read.c | 38 |
1 files changed, 29 insertions, 9 deletions
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c index 4259c38..571fe1e 100644 --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -17545,17 +17545,37 @@ dwarf2_init_complex_target_type (struct dwarf2_cu *cu, /* Try to find a suitable floating point builtin type of size BITS. We're going to use the name of this type as the name for the complex target type that we are about to create. */ - switch (bits) + switch (cu->language) { - case 32: - tt = builtin_type (gdbarch)->builtin_float; - break; - case 64: - tt = builtin_type (gdbarch)->builtin_double; + case language_fortran: + switch (bits) + { + case 32: + tt = builtin_f_type (gdbarch)->builtin_real; + break; + case 64: + tt = builtin_f_type (gdbarch)->builtin_real_s8; + break; + case 96: /* The x86-32 ABI specifies 96-bit long double. */ + case 128: + tt = builtin_f_type (gdbarch)->builtin_real_s16; + break; + } break; - case 96: /* The x86-32 ABI specifies 96-bit long double. */ - case 128: - tt = builtin_type (gdbarch)->builtin_long_double; + default: + switch (bits) + { + case 32: + tt = builtin_type (gdbarch)->builtin_float; + break; + case 64: + tt = builtin_type (gdbarch)->builtin_double; + break; + case 96: /* The x86-32 ABI specifies 96-bit long double. */ + case 128: + tt = builtin_type (gdbarch)->builtin_long_double; + break; + } break; } |