mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-01-06 12:09:26 +08:00
* gdb.base/jit.exp: Download solib_binfile to target.
* gdb.base/jit-so.exp: Likewise. Also, use gdb_load_shlibs and call dlopen without full path name. * gdb.cp/infcall-dlopen.exp: Use gdb_load_shlibs and call dlopen without full path name.
This commit is contained in:
parent
5e9f6467f7
commit
724f4f803f
@ -1,3 +1,11 @@
|
||||
2011-08-04 Ulrich Weigand <ulrich.weigand@linaro.org>
|
||||
|
||||
* gdb.base/jit.exp: Download solib_binfile to target.
|
||||
* gdb.base/jit-so.exp: Likewise. Also, use gdb_load_shlibs
|
||||
and call dlopen without full path name.
|
||||
* gdb.cp/infcall-dlopen.exp: Use gdb_load_shlibs and call
|
||||
dlopen without full path name.
|
||||
|
||||
2011-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
|
||||
|
||||
* gdb.base/break-always.exp: Complete the test
|
||||
|
@ -46,6 +46,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
set testfile2 jit-main
|
||||
set srcfile2 ${testfile2}.c
|
||||
set binfile2 ${objdir}/${subdir}/${testfile2}.so
|
||||
set binfile2_dlopen [shlib_target_file ${testfile2}.so]
|
||||
if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug additional_flags="-DMAIN=jit_dl_main"}] != "" } {
|
||||
untested jit.exp
|
||||
return -1
|
||||
@ -54,7 +55,7 @@ if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcfile2}" ${binfile2} {debug add
|
||||
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 "OBJDIR/${subdir}/${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
|
||||
@ -64,13 +65,16 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {}] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
set solib_binfile_target [gdb_download ${solib_binfile}]
|
||||
|
||||
proc one_jit_test {count match_str} {
|
||||
global verbose testfile srcfile2 binfile2 solib_binfile solib_binfile_test_msg pf_prefix
|
||||
global verbose testfile srcfile2 binfile2 binfile2_dlopen solib_binfile_target solib_binfile_test_msg pf_prefix
|
||||
|
||||
set old_pf_prefix $pf_prefix
|
||||
set pf_prefix "one_jit_test-$count"
|
||||
|
||||
clean_restart $testfile
|
||||
gdb_load_shlibs $binfile2
|
||||
|
||||
# This is just to help debugging when things fail
|
||||
if {$verbose > 0} {
|
||||
@ -86,7 +90,7 @@ proc one_jit_test {count match_str} {
|
||||
gdb_continue_to_breakpoint "break here before-dlopen"
|
||||
# Poke desired values directly into inferior instead of using "set args"
|
||||
# because "set args" does not work under gdbserver.
|
||||
gdb_test_no_output "set var jit_libname = \"$binfile2\""
|
||||
gdb_test_no_output "set var jit_libname = \"$binfile2_dlopen\""
|
||||
|
||||
gdb_breakpoint [gdb_get_line_number "break here after-dlopen" ]
|
||||
gdb_continue_to_breakpoint "break here after-dlopen"
|
||||
@ -95,7 +99,7 @@ proc one_jit_test {count match_str} {
|
||||
gdb_continue_to_breakpoint "break here 0"
|
||||
|
||||
gdb_test_no_output "set var argc = 2"
|
||||
gdb_test_no_output "set var libname = \"$solib_binfile\"" "set var libname = \"$solib_binfile_test_msg\""
|
||||
gdb_test_no_output "set var libname = \"$solib_binfile_target\"" "set var libname = \"$solib_binfile_test_msg\""
|
||||
gdb_test_no_output "set var count = $count"
|
||||
|
||||
gdb_breakpoint "$srcfile2:[gdb_get_line_number {break here 1} $srcfile2]"
|
||||
|
@ -43,7 +43,7 @@ if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {deb
|
||||
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 "OBJDIR/${subdir}/${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
|
||||
@ -53,8 +53,10 @@ if { [gdb_compile_shlib ${solib_srcfile} ${solib_binfile} {-fPIC}] != "" } {
|
||||
return -1
|
||||
}
|
||||
|
||||
set solib_binfile_target [gdb_download ${solib_binfile}]
|
||||
|
||||
proc one_jit_test {count match_str} {
|
||||
global verbose testfile solib_binfile solib_binfile_test_msg pf_prefix
|
||||
global verbose testfile solib_binfile_target solib_binfile_test_msg pf_prefix
|
||||
|
||||
set old_pf_prefix $pf_prefix
|
||||
set pf_prefix "one_jit_test-$count"
|
||||
@ -77,7 +79,7 @@ proc one_jit_test {count match_str} {
|
||||
# Poke desired values directly into inferior instead of using "set args"
|
||||
# because "set args" does not work under gdbserver.
|
||||
gdb_test_no_output "set var argc = 2"
|
||||
gdb_test_no_output "set var libname = \"$solib_binfile\"" "set var libname = \"$solib_binfile_test_msg\""
|
||||
gdb_test_no_output "set var libname = \"$solib_binfile_target\"" "set var libname = \"$solib_binfile_test_msg\""
|
||||
gdb_test_no_output "set var count = $count"
|
||||
|
||||
gdb_breakpoint [gdb_get_line_number "break here 1"]
|
||||
|
@ -27,6 +27,7 @@ set srclibfile ${testfile}-lib.cc
|
||||
set executable ${testfile}
|
||||
set libfile ${objdir}/${subdir}/${executable}.so
|
||||
set binfile ${objdir}/${subdir}/${executable}
|
||||
set lib_dlopen [shlib_target_file ${executable}.so]
|
||||
|
||||
# Use completely arbitrary file for $libfile source.
|
||||
if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug c++}] != ""
|
||||
@ -34,12 +35,14 @@ if { [gdb_compile_shlib ${srcdir}/${subdir}/${srclibfile} ${libfile} {debug c++}
|
||||
return -1
|
||||
}
|
||||
|
||||
gdb_load_shlibs $libfile
|
||||
|
||||
if { ![runto_main] } {
|
||||
return -1
|
||||
}
|
||||
|
||||
for {set i 0} {$i < 10} {incr i} {
|
||||
gdb_test "p openlib (\"${libfile}\")" " = 1" "test $i"
|
||||
gdb_test "p openlib (\"${lib_dlopen}\")" " = 1" "test $i"
|
||||
# Try to exploit the GDB trashed memory.
|
||||
gdb_test "b openlib" {Breakpoint [0-9]+ at .*} "test $i stub 1"
|
||||
gdb_test_no_output {delete $bpnum} "test $i stub 2"
|
||||
|
Loading…
Reference in New Issue
Block a user