diff options
author | Paul Pluzhnikov <ppluzhnikov@google.com> | 2011-01-31 21:44:52 +0000 |
---|---|---|
committer | Paul Pluzhnikov <ppluzhnikov@google.com> | 2011-01-31 21:44:52 +0000 |
commit | d3f0f8534198879e5fdc771d517dc3286fc53516 (patch) | |
tree | a39d79417be70c4940ea181242ba5251c82167ff /gdb/testsuite/gdb.base/jit.exp | |
parent | c52b559d6695dbd10952b9a52bea38cf94d4e528 (diff) | |
download | gdb-d3f0f8534198879e5fdc771d517dc3286fc53516.zip gdb-d3f0f8534198879e5fdc771d517dc3286fc53516.tar.gz gdb-d3f0f8534198879e5fdc771d517dc3286fc53516.tar.bz2 |
2011-01-31 Paul Pluzhnikov <ppluzhnikov@google.com>
* gdb.base/jit.exp: New file.
* gdb.base/jit-main.c: New file.
* gdb.base/jit-solib.c: New file.
Diffstat (limited to 'gdb/testsuite/gdb.base/jit.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/jit.exp | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp new file mode 100644 index 0000000..6b232ba --- /dev/null +++ b/gdb/testsuite/gdb.base/jit.exp @@ -0,0 +1,102 @@ +# Copyright 2011 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 +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +if $tracelevel { + strace $tracelevel +} + +if {[skip_shlib_tests]} { + untested jit.exp + return -1 +} + +if {[get_compiler_info not-used]} { + warning "Could not get compiler info" + untested jit.exp + return 1 +} + +# +# test running programs +# + +set testfile jit-main +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + untested jit.exp + return -1 +} + +set solib_testfile "jit-solib" +set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c" +set solib_binfile "${objdir}/${subdir}/${solib_testfile}.so" + +# Note: compiling without debug info: the library goes through symbol +# renaming by munging on its symbol table, and that wouldn't work for .debug +# sections. Also, output for "info function" changes when debug info is resent. +if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } { + untested jit.exp + return -1 +} + +proc one_jit_test {count match_str} { + global verbose testfile solib_binfile pf_prefix + + set old_pf_prefix $pf_prefix + set pf_prefix "one_jit_test-$count" + + clean_restart $testfile + + # This is just to help debugging when things fail + if {$verbose > 0} { + gdb_test "set debug jit 1" + } + + if { ![runto_main] } { + fail "Can't run to main" + return + } + + gdb_breakpoint [gdb_get_line_number "break here 0"] + gdb_continue_to_breakpoint "break here 0" + + # Poke desired values directly into inferior instead of using "set args" + # because "set args" does not work under gdbserver. + gdb_test "set var argc = 2" + gdb_test "set var libname = \"$solib_binfile\"" + gdb_test "set var count = $count" + + gdb_breakpoint [gdb_get_line_number "break here 1"] + gdb_continue_to_breakpoint "break here 1" + + gdb_test "info function jit_function" "$match_str" + + # This is just to help debugging when things fail + if {$verbose > 0} { + gdb_test "maintenance print objfiles" + gdb_test "maintenance info break" + } + + gdb_breakpoint [gdb_get_line_number "break here 2"] + gdb_continue_to_breakpoint "break here 2" + # All jit librares must have been unregistered + gdb_test "info function jit_function" \ + "All functions matching regular expression \"jit_function\":" \ + set pf_prefix $old_pf_prefix +} + +one_jit_test 1 "${hex} jit_function_0000" +one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001" |