aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/jit.exp
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-01-31 19:52:03 +0000
committerTom Tromey <tromey@redhat.com>2013-01-31 19:52:03 +0000
commitf25c01353c492b47dc6f230257822ed54d554c95 (patch)
tree5120c960969c654229bc8f684fadf15f68510b4a /gdb/testsuite/gdb.base/jit.exp
parent974a734be3dfcbc121c40b227fcd12cf03874ecc (diff)
downloadgdb-f25c01353c492b47dc6f230257822ed54d554c95.zip
gdb-f25c01353c492b47dc6f230257822ed54d554c95.tar.gz
gdb-f25c01353c492b47dc6f230257822ed54d554c95.tar.bz2
PR gdb/13987:
* jit.c (struct jit_inferior_data) <cached_code_address, jit_breakpoint>: New fields. (jit_breakpoint_re_set_internal): Fix logging. Only create breakpoint if cached address has changed. (jit_update_inferior_cache, jit_breakpoint_deleted): New functions. (_initialize_jit): Register breakpoint deleted observer. gdb/testsuite * gdb.base/jit.exp (compile_jit_test): New proc. Add PIE tests.
Diffstat (limited to 'gdb/testsuite/gdb.base/jit.exp')
-rw-r--r--gdb/testsuite/gdb.base/jit.exp60
1 files changed, 41 insertions, 19 deletions
diff --git a/gdb/testsuite/gdb.base/jit.exp b/gdb/testsuite/gdb.base/jit.exp
index b904b78..35840be 100644
--- a/gdb/testsuite/gdb.base/jit.exp
+++ b/gdb/testsuite/gdb.base/jit.exp
@@ -28,28 +28,38 @@ if {[get_compiler_info]} {
# 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
-}
+proc compile_jit_test {testname options} {
+ global testfile srcfile binfile srcdir subdir
+ global solib_testfile solib_srcfile solib_binfile solib_binfile_test_msg
+ global solib_binfile_target
+
+ set testfile jit-main
+ set srcfile ${testfile}.c
+ set binfile [standard_output_file $testfile]
+ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
+ executable [concat debug $options]] != "" } {
+ untested $testname
+ return -1
+ }
-set solib_testfile "jit-solib"
-set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c"
-set solib_binfile "${objdir}/${subdir}/${solib_testfile}.so"
-set solib_binfile_test_msg "SHLIBDIR/${solib_testfile}.so"
+ set solib_testfile "jit-solib"
+ set solib_srcfile "${srcdir}/${subdir}/${solib_testfile}.c"
+ set solib_binfile [standard_output_file ${solib_testfile}.so]
+ set solib_binfile_test_msg "SHLIBDIR/${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 present.
+ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
+ untested $testname
+ return -1
+ }
-# 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
-}
+ set solib_binfile_target [gdb_download ${solib_binfile}]
-set solib_binfile_target [gdb_download ${solib_binfile}]
+ return 0
+}
proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
global verbose testfile solib_binfile_target solib_binfile_test_msg
@@ -93,5 +103,17 @@ proc one_jit_test {count match_str} { with_test_prefix "one_jit_test-$count" {
"All functions matching regular expression \"jit_function\":"
}}
+if {[compile_jit_test jit.exp {}] < 0} {
+ return
+}
one_jit_test 1 "${hex} jit_function_0000"
one_jit_test 2 "${hex} jit_function_0000\[\r\n\]+${hex} jit_function_0001"
+
+with_test_prefix PIE {
+ if {[compile_jit_test "jit.exp PIE tests" \
+ {additional_flags=-fPIE ldflags=-pie}] < 0} {
+ return
+ }
+
+ one_jit_test 1 "${hex} jit_function_0000"
+}