| OLD | NEW |
| 1 # Copyright 2003-2005, 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 2003-2005, 2007-2012 Free Software Foundation, Inc. |
| 2 | 2 |
| 3 # This program is free software; you can redistribute it and/or modify | 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 | 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 | 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. | 6 # (at your option) any later version. |
| 7 # | 7 # |
| 8 # This program is distributed in the hope that it will be useful, | 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of | 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. | 11 # GNU General Public License for more details. |
| 12 # | 12 # |
| 13 # You should have received a copy of the GNU General Public License | 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/>. | 14 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 15 | 15 |
| 16 # This file was created by Jeff Johnston. (jjohnstn@redhat.com) | 16 # This file was created by Jeff Johnston. (jjohnstn@redhat.com) |
| 17 | 17 |
| 18 if $tracelevel then { | |
| 19 strace $tracelevel | |
| 20 } | |
| 21 | |
| 22 # | 18 # |
| 23 # test running programs | 19 # test running programs |
| 24 # | 20 # |
| 25 | 21 |
| 26 if {[skip_shlib_tests]} { | 22 if {[skip_shlib_tests]} { |
| 27 return 0 | 23 return 0 |
| 28 } | 24 } |
| 29 | 25 |
| 30 set testfile "unload" | 26 set testfile "unload" |
| 31 set libfile "unloadshr" | 27 set libfile "unloadshr" |
| 32 set libfile2 "unloadshr2" | 28 set libfile2 "unloadshr2" |
| 33 set libname "${libfile}.sl" | 29 set libname "${libfile}.sl" |
| 34 set libname2 "${libfile2}.sl" | 30 set libname2 "${libfile2}.sl" |
| 35 set libsrcfile ${libfile}.c | 31 set libsrcfile ${libfile}.c |
| 36 set libsrcfile2 ${libfile2}.c | 32 set libsrcfile2 ${libfile2}.c |
| 37 set srcfile $srcdir/$subdir/$testfile.c | 33 set srcfile $srcdir/$subdir/$testfile.c |
| 38 set binfile $objdir/$subdir/$testfile | 34 set binfile $objdir/$subdir/$testfile |
| 39 set shlibdir ${objdir}/${subdir} | 35 set shlibdir ${objdir}/${subdir} |
| 40 set libsrc $srcdir/$subdir/$libfile.c | 36 set libsrc $srcdir/$subdir/$libfile.c |
| 41 set libsrc2 $srcdir/$subdir/$libfile2.c | 37 set libsrc2 $srcdir/$subdir/$libfile2.c |
| 42 set lib_sl $objdir/$subdir/$libname | 38 set lib_sl $objdir/$subdir/$libname |
| 43 set lib_sl2 $objdir/$subdir/$libname2 | 39 set lib_sl2 $objdir/$subdir/$libname2 |
| 44 set lib_dlopen [shlib_target_file ${libname}] | 40 set lib_dlopen [shlib_target_file ${libname}] |
| 45 set lib_dlopen2 [shlib_target_file ${libname2}] | 41 set lib_dlopen2 [shlib_target_file ${libname2}] |
| 46 set lib_syms [shlib_symbol_file ${libname}] | 42 set lib_syms [shlib_symbol_file ${libname}] |
| 47 set lib_syms2 [shlib_symbol_file ${libname2}] | 43 set lib_syms2 [shlib_symbol_file ${libname2}] |
| 48 | 44 |
| 49 if [get_compiler_info ${binfile}] { | 45 if [get_compiler_info] { |
| 50 return -1 | 46 return -1 |
| 51 } | 47 } |
| 52 | 48 |
| 53 set lib_opts debug | 49 set lib_opts debug |
| 54 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME\=\"${lib_dlop
en}\" additional_flags=-DSHLIB_NAME2\=\"${lib_dlopen2}\"] | 50 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME\=\"${lib_dlop
en}\" additional_flags=-DSHLIB_NAME2\=\"${lib_dlopen2}\"] |
| 55 | 51 |
| 56 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != "" | 52 if { [gdb_compile_shlib $libsrc $lib_sl $lib_opts] != "" |
| 57 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != "" | 53 || [gdb_compile_shlib $libsrc2 $lib_sl2 $lib_opts] != "" |
| 58 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} { | 54 || [gdb_compile $srcfile $binfile executable $exec_opts] != ""} { |
| 59 untested "Couldn't compile $libsrc or $libsrc2 or $srcfile." | 55 untested "Couldn't compile $libsrc or $libsrc2 or $srcfile." |
| 60 return -1 | 56 return -1 |
| 61 } | 57 } |
| 62 | 58 |
| 63 # Start with a fresh gdb. | 59 # Start with a fresh gdb. |
| 64 | 60 |
| 65 gdb_exit | 61 gdb_exit |
| 66 gdb_start | 62 gdb_start |
| 67 gdb_reinitialize_dir $srcdir/$subdir | 63 gdb_reinitialize_dir $srcdir/$subdir |
| 68 gdb_load ${binfile} | 64 gdb_load ${binfile} |
| 69 gdb_load_shlibs $lib_sl $lib_sl2 | 65 gdb_load_shlibs $lib_sl $lib_sl2 |
| 70 | 66 |
| 71 if [target_info exists gdb_stub] { | |
| 72 gdb_step_for_stub; | |
| 73 } | |
| 74 | |
| 75 # | 67 # |
| 76 # Test setting a breakpoint in a dynamically loaded library which is | 68 # Test setting a breakpoint in a dynamically loaded library which is |
| 77 # manually loaded and unloaded | 69 # manually loaded and unloaded |
| 78 # | 70 # |
| 79 | 71 |
| 80 gdb_breakpoint "shrfunc1" allow-pending | 72 gdb_breakpoint "shrfunc1" allow-pending |
| 81 gdb_breakpoint "shrfunc2" allow-pending | 73 gdb_breakpoint "shrfunc2" allow-pending |
| 82 | 74 |
| 83 gdb_test "info break" \ | 75 gdb_test "info break" \ |
| 84 "Num Type\[ \]+Disp Enb Address\[ \]+What\r? | 76 "Num Type\[ \]+Disp Enb Address\[ \]+What\r? |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 2\[\t \]+breakpoint keep y *0x\[0-9a-f\]+ *in shrfunc2 at .*" \ | 133 2\[\t \]+breakpoint keep y *0x\[0-9a-f\]+ *in shrfunc2 at .*" \ |
| 142 "pending breakpoint info on second run at shrfunc2" | 134 "pending breakpoint info on second run at shrfunc2" |
| 143 | 135 |
| 144 gdb_breakpoint "$testfile.c:[gdb_get_line_number "y-set-2" $testfile.c]" | 136 gdb_breakpoint "$testfile.c:[gdb_get_line_number "y-set-2" $testfile.c]" |
| 145 | 137 |
| 146 gdb_test "continue" \ | 138 gdb_test "continue" \ |
| 147 "Continuing.*warning: Temporarily disabling breakpoints for.*${lib_syms2}.*y-set
-2.*" \ | 139 "Continuing.*warning: Temporarily disabling breakpoints for.*${lib_syms2}.*y-set
-2.*" \ |
| 148 "continuing to unloaded libfile2" | 140 "continuing to unloaded libfile2" |
| 149 | 141 |
| 150 gdb_test "print y" " = 200" "print y from libfile2" | 142 gdb_test "print y" " = 200" "print y from libfile2" |
| OLD | NEW |