X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Ftestsuite%2Fgdb.python%2Fpy-prettyprint.exp;h=02300e9ecd430410fe232366a81a87f6ebad3e7e;hb=c973d0aa4a2c737ab527ae44a617f1c357e07364;hp=399f0418b52165cd9d9d9722beb693c16496d5cf;hpb=4ea6efe9365f8a87723fe01a2dd8ddf5cdec1498;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/testsuite/gdb.python/py-prettyprint.exp b/gdb/testsuite/gdb.python/py-prettyprint.exp index 399f0418b5..02300e9ecd 100644 --- a/gdb/testsuite/gdb.python/py-prettyprint.exp +++ b/gdb/testsuite/gdb.python/py-prettyprint.exp @@ -1,4 +1,4 @@ -# 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 @@ -30,7 +30,7 @@ if { [skip_python_tests] } { continue } 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 } @@ -56,8 +56,7 @@ proc run_lang_tests {exefile lang} { 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>>" @@ -92,8 +91,10 @@ proc run_lang_tests {exefile lang} { gdb_test "print cstring" " = \"const string\"" gdb_test "print estring" " = \"embedded x\\\\201\\\\202\\\\203\\\\204\"" - gdb_test "print estring3" \ - " = " + if { ![is_address_zero_readable] } { + gdb_test "print estring3" \ + " = " + } gdb_test_no_output "python pp_ls_encoding = 'UTF-8'" gdb_test "print estring2" "\"embedded \", " @@ -109,11 +110,28 @@ proc run_lang_tests {exefile lang} { 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. @@ -131,8 +149,7 @@ if ![runto_main ] then { 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 .*"