aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/jit-reader.exp
blob: b5e297aaf7f6395630e00b8dd7657d4dc8fb731b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 2012-2016 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/>.

standard_testfile jithost.c

if { (![istarget x86_64-*-*] && ![istarget i?86-*-*]) || ![is_lp64_target] } {
    return -1;
}

if {[skip_shlib_tests]} {
    return -1
}

if { ![isnative] } {
    return -1
}

if {[get_compiler_info]} {
    untested "could not get compiler info"
    return 1
}

set jit_host_src $srcfile
set jit_host_bin $binfile

# We inject the complete path to jit-reader.h into the source file
# lest we end up (incorrectly) building against a system-installed
# version.
set jit_reader_header [standard_output_file "../../../../../gdb/jit-reader.h"]
set jit_reader_flag "-DJIT_READER_H=\"$jit_reader_header\""

if  { [gdb_compile "${srcdir}/${subdir}/${jit_host_src}" "${jit_host_bin}" \
       executable  [list debug additional_flags=$jit_reader_flag]] != "" } {
    untested jit-reader.exp
    return -1
}

set jit_reader jitreader
set jit_reader_src ${jit_reader}.c
set jit_reader_bin [standard_output_file ${jit_reader}.so]

if { [gdb_compile_shlib "${srcdir}/${subdir}/${jit_reader_src}" "${jit_reader_bin}" \
	  [list debug additional_flags=$jit_reader_flag]] != "" } {
    untested jit-reader.exp
    return -1
}

proc jit_reader_test {} {
    global jit_host_bin
    global jit_reader_bin
    global verbose

    clean_restart $jit_host_bin
    gdb_load_shlib $jit_reader_bin

    if {$verbose > 0} {
	gdb_test_no_output "set debug jit 1"
    }

    gdb_test_no_output "jit-reader-load ${jit_reader_bin}" "jit-reader-load"
    gdb_run_cmd
    gdb_test "" "Program received signal SIGTRAP, .*" "expect SIGTRAP"

    gdb_test "bt" "jit_function_00.*"
}

jit_reader_test