2012-02-21 Pedro Alves <palves@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / jit.exp
CommitLineData
0b302171 1# Copyright 2011-2012 Free Software Foundation, Inc.
d3f0f853
PP
2
3# This program is free software; you can redistribute it and/or modify
4# it under the terms of the GNU General Public License as published by
5# the Free Software Foundation; either version 3 of the License, or
6# (at your option) any later version.
7#
8# This program is distributed in the hope that it will be useful,
9# but WITHOUT ANY WARRANTY; without even the implied warranty of
10# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11# GNU General Public License for more details.
12#
13# You should have received a copy of the GNU General Public License
14# along with this program. If not, see <http://www.gnu.org/licenses/>.
15
d3f0f853
PP
16if {[skip_shlib_tests]} {
17 untested jit.exp
18 return -1
19}
20
21if {[get_compiler_info not-used]} {
22 warning "Could not get compiler info"
23 untested jit.exp
24 return 1
25}
26
27#
28# test running programs
29#
30
31set testfile jit-main
32set srcfile ${testfile}.c
33set binfile ${objdir}/${subdir}/${testfile}
34if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
35 untested jit.exp
36 return -1
37}
38
39set solib_testfile "jit-solib"
40set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c"
41set solib_binfile "${objdir}/${subdir}/${solib_testfile}.so"
724f4f80 42set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}.so"
d3f0f853
PP
43
44# Note: compiling without debug info: the library goes through symbol
45# renaming by munging on its symbol table, and that wouldn't work for .debug
46# sections. Also, output for "info function" changes when debug info is resent.
47if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
48 untested jit.exp
49 return -1
50}
51
724f4f80
UW
52set solib_binfile_target [gdb_download ${solib_binfile}]
53
0f4d39d5 54proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
6a5870ce 55 global verbose testfile solib_binfile_target solib_binfile_test_msg
d3f0f853
PP
56
57 clean_restart $testfile
58
59 # This is just to help debugging when things fail
60 if {$verbose > 0} {
61 gdb_test "set debug jit 1"
62 }
63
64 if { ![runto_main] } {
65 fail "Can't run to main"
66 return
67 }
68
69 gdb_breakpoint [gdb_get_line_number "break here 0"]
70 gdb_continue_to_breakpoint "break here 0"
71
72 # Poke desired values directly into inferior instead of using "set args"
73 # because "set args" does not work under gdbserver.
a449c2d8 74 gdb_test_no_output "set var argc = 2"
724f4f80 75 gdb_test_no_output "set var libname = \"$solib_binfile_target\"" "set var libname = \"$solib_binfile_test_msg\""
a449c2d8 76 gdb_test_no_output "set var count = $count"
d3f0f853
PP
77
78 gdb_breakpoint [gdb_get_line_number "break here 1"]
79 gdb_continue_to_breakpoint "break here 1"
80
81 gdb_test "info function jit_function" "$match_str"
82
83 # This is just to help debugging when things fail
84 if {$verbose > 0} {
85 gdb_test "maintenance print objfiles"
86 gdb_test "maintenance info break"
87 }
88
89 gdb_breakpoint [gdb_get_line_number "break here 2"]
90 gdb_continue_to_breakpoint "break here 2"
91 # All jit librares must have been unregistered
92 gdb_test "info function jit_function" \
6a5870ce
PA
93 "All functions matching regular expression \"jit_function\":"
94}}
d3f0f853
PP
95
96one_jit_test 1 "${hex} jit_function_0000"
97one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
This page took 0.240202 seconds and 4 git commands to generate.