aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/jit-reader.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/jit-reader.exp')
-rw-r--r--gdb/testsuite/gdb.base/jit-reader.exp79
1 files changed, 79 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/jit-reader.exp b/gdb/testsuite/gdb.base/jit-reader.exp
new file mode 100644
index 0000000..b5e297a
--- /dev/null
+++ b/gdb/testsuite/gdb.base/jit-reader.exp
@@ -0,0 +1,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