aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.fortran/complex.exp
diff options
context:
space:
mode:
authorAndrew Burgess <andrew.burgess@embecosm.com>2019-02-16 22:45:41 +0000
committerAndrew Burgess <andrew.burgess@embecosm.com>2019-04-30 10:10:31 +0100
commit1db455a76c39e2be6a8a9613b7a19439f24722d0 (patch)
tree80df9448123cfcc3c159f5e209c2ba94ddd805cc /gdb/testsuite/gdb.fortran/complex.exp
parentb6d03bb2b65ac5c919f1d08674bbaa2a9bfb2d0c (diff)
downloadfsf-binutils-gdb-1db455a76c39e2be6a8a9613b7a19439f24722d0.zip
fsf-binutils-gdb-1db455a76c39e2be6a8a9613b7a19439f24722d0.tar.gz
fsf-binutils-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/testsuite/gdb.fortran/complex.exp')
-rw-r--r--gdb/testsuite/gdb.fortran/complex.exp41
1 files changed, 32 insertions, 9 deletions
diff --git a/gdb/testsuite/gdb.fortran/complex.exp b/gdb/testsuite/gdb.fortran/complex.exp
index 3fbbf71..136f1c4 100644
--- a/gdb/testsuite/gdb.fortran/complex.exp
+++ b/gdb/testsuite/gdb.fortran/complex.exp
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-standard_testfile .f
+standard_testfile .f90
if {[prepare_for_testing "failed to prepare" $testfile $srcfile {debug f90 quiet}]} {
return -1
@@ -24,13 +24,36 @@ if ![runto MAIN__] then {
continue
}
-set bp_location [gdb_get_line_number "stop"]
-gdb_test "break $bp_location" \
- "Breakpoint.*at.* file .*$srcfile, line $bp_location\\." \
- "breakpoint at stop"
-gdb_test "continue" \
- "Continuing\\..*Breakpoint.*" \
- "continue to breakpoint"
+gdb_breakpoint [gdb_get_line_number "stop"]
+gdb_continue_to_breakpoint "continue"
+
+gdb_test "print c" " = \\(1000,-50\\)"
+gdb_test "print c4" " = \\(1000,-50\\)"
+gdb_test "print c8" " = \\(321,-22\\)"
+gdb_test "print dc" " = \\(321,-22\\)"
+
+setup_kfail gdb/18644 "*-*-*"
+gdb_test "print c16" " = \\(-874,19\\)"
+
+gdb_test "whatis c" "type = complex\\(kind=4\\)"
+gdb_test "print \$_creal (c)" " = 1000"
+gdb_test "whatis \$" " = real"
+
+gdb_test "whatis c4" "type = complex\\(kind=4\\)"
+gdb_test "print \$_creal (c4)" " = 1000"
+gdb_test "whatis \$" " = real"
+
+gdb_test "whatis c8" "type = complex\\(kind=8\\)"
+gdb_test "print \$_creal (c8)" " = 321"
+gdb_test "whatis \$" " = real\\*8"
+
+gdb_test "whatis dc" "type = complex\\(kind=8\\)"
+gdb_test "print \$_creal (dc)" " = 321"
+gdb_test "whatis \$" " = real\\*8"
+
+gdb_test "whatis c16" "type = complex\\(kind=16\\)"
+setup_kfail gdb/18644 "*-*-*"
+gdb_test "print \$_creal (c16)" " = -874"
+gdb_test "whatis \$" " = real\\*16"
-gdb_test "print c" "\\\$$decimal = \\(1000,-50\\)"