-# Copyright (C) 2008-2015 Free Software Foundation, Inc.
+# Copyright (C) 2008-2017 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
proc run_lang_tests {exefile lang} {
global srcdir subdir srcfile testfile hex
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${exefile}" executable "debug $lang"] != "" } {
- untested "Couldn't compile ${srcfile} in $lang mode"
+ untested "failed to compile in $lang mode"
return -1
}
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
- gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
- "python exec (open ('[file tail ${remote_python_file}]').read ())"
+ gdb_test_no_output "source ${remote_python_file}" "load python file"
gdb_test "print ss" " = a=< a=<1> b=<$hex>> b=< a=<2> b=<$hex>>"
gdb_test "print ssa\[1\]" " = a=< a=<5> b=<$hex>> b=< a=<6> b=<$hex>>"
gdb_test "print cstring" " = \"const string\""
gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\""
- gdb_test "print estring3" \
- " = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>"
+ if { ![is_address_zero_readable] } {
+ gdb_test "print estring3" \
+ " = <error reading variable: Cannot create a lazy string with address 0x0, and a non-zero length.>"
+ }
gdb_test_no_output "python pp_ls_encoding = 'UTF-8'"
gdb_test "print estring2" "\"embedded \", <incomplete sequence \\\\302>"
gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
"print nstype on one line"
+ # Check that GDB doesn't lose typedefs when looking for a printer.
+ gdb_test "print an_int" " = -1"
+ gdb_test "print (int) an_int" " = -1"
+ gdb_test "print (int_type) an_int" " = type=int_type, val=-1"
+
+ gdb_test "print an_int_type" " = type=int_type, val=1"
+ gdb_test "print (int_type) an_int_type" " = type=int_type, val=1"
+
+ gdb_test "print an_int_type2" " = type=int_type2, val=2"
+ gdb_test "print (int) an_int_type2" " = 2"
+ gdb_test "print (int_type) an_int_type2" " = type=int_type, val=2"
+ gdb_test "print (int_type2) an_int_type2" " = type=int_type2, val=2"
+
gdb_continue_to_end
}
-run_lang_tests "${binfile}" "c"
-run_lang_tests "${binfile}-cxx" "c++"
+if { [run_lang_tests "${binfile}" "c"] == -1 } {
+ return
+}
+if { [run_lang_tests "${binfile}-cxx" "c++"] == -1 } {
+ return
+}
# Run various other tests.
set remote_python_file [gdb_remote_download host \
${srcdir}/${subdir}/${testfile}.py]
-gdb_test_no_output "python exec (open ('${remote_python_file}').read ())" \
- "python exec (open ('[file tail ${remote_python_file}]').read ())"
+gdb_test_no_output "source ${remote_python_file}" "load python file"
gdb_breakpoint [gdb_get_line_number "eval-break"]
gdb_continue_to_breakpoint "eval-break" ".* eval-break .*"