OLD | NEW |
(Empty) | |
| 1 # Copyright 2010-2012 Free Software Foundation, Inc. |
| 2 |
| 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 |
| 5 # the Free Software Foundation; either version 3 of the License, or |
| 6 # (at your option) any later version. |
| 7 # |
| 8 # This program is distributed in the hope that it will be useful, |
| 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 11 # GNU General Public License for more details. |
| 12 # |
| 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/>. */ |
| 15 |
| 16 # In some cases gdbserver cannot find the DT_DEBUG library list on its own and |
| 17 # it needs to fall back to GDB solib-svr4.c look up via symbols from the main |
| 18 # executable. |
| 19 # gdbserver :1234 ld-linux-x86-64.so.2 /bin/prog |
| 20 # gdb /bin/prog |
| 21 # (gdb) target remote ... |
| 22 |
| 23 load_lib gdbserver-support.exp |
| 24 load_lib prelink-support.exp |
| 25 |
| 26 if {[skip_gdbserver_tests] || [skip_shlib_tests]} { |
| 27 return |
| 28 } |
| 29 |
| 30 # This test case (currently) does not support remote targets, since it |
| 31 # assumes the ELF interpreter can be found on the host system |
| 32 if [is_remote target] then { |
| 33 return |
| 34 } |
| 35 |
| 36 standard_testfile solib-list-main.c |
| 37 set srclibfile ${testfile}-lib.c |
| 38 set binlibfile [standard_output_file ${testfile}.so] |
| 39 set executable ${testfile} |
| 40 set objfile ${binfile}.o |
| 41 |
| 42 if { [get_compiler_info] |
| 43 || [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" "${binlibfile}" [
list debug ldflags=-Wl,-soname,${binlibfile}]] != "" |
| 44 || [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objfile}" object {debug
}] != "" |
| 45 || [gdb_compile "${objfile} ${binlibfile}" "${binfile}" executable {}] != "
" } { |
| 46 untested "could not compile sources" |
| 47 return -1 |
| 48 } |
| 49 |
| 50 set interp_system [section_get ${binfile} .interp] |
| 51 verbose -log "system interpreter is: $interp_system" |
| 52 |
| 53 foreach nonstop { 0 1 } { with_test_prefix "non-stop $nonstop" { |
| 54 |
| 55 # clean_restart assumes ${objdir}/${subdir}/ which is not applicable |
| 56 # for ${interp_system}. |
| 57 gdb_exit |
| 58 gdb_start |
| 59 gdb_reinitialize_dir $srcdir/$subdir |
| 60 gdb_load ${interp_system} |
| 61 gdb_load_shlibs ${binfile} |
| 62 gdb_load_shlibs ${binlibfile} |
| 63 |
| 64 # Make sure we're disconnected, in case we're testing with an |
| 65 # extended-remote board, therefore already connected. |
| 66 gdb_test "disconnect" ".*" |
| 67 |
| 68 gdb_test "set non-stop $nonstop" |
| 69 gdb_test "set target-async $nonstop" |
| 70 |
| 71 # It is required for the non-stop mode, GDB would try to step over |
| 72 # _dl_debug_state breakpoint will still only ld.so loaded in gdbserver. |
| 73 # But GDB having symbols from the main executable it would try to use |
| 74 # displaced-stepping buffer at unmapped that time address _start. |
| 75 gdb_test "set displaced-stepping off" |
| 76 |
| 77 set res [gdbserver_spawn ${binfile}] |
| 78 set gdbserver_protocol [lindex $res 0] |
| 79 set gdbserver_gdbport [lindex $res 1] |
| 80 |
| 81 # Load BINFILE after gdbserver_spawn (so that gdbserver executes ld.so) |
| 82 # but before "target remote" below so that qSymbol data get already |
| 83 # initialized from BINFILE (and not from ld.so first needing a change to |
| 84 # BINFILE later). |
| 85 gdb_test "file ${binfile}" {Reading symbols from .*\.\.\.done\..*} "file bin
file" \ |
| 86 {(Are you sure you want to change the file|Load new symbol table fr
om ".*")\? \(y or n\) } "y" |
| 87 |
| 88 set test "target $gdbserver_protocol" |
| 89 gdb_test_multiple "target $gdbserver_protocol $gdbserver_gdbport" $test { |
| 90 -re "Remote debugging using .*\r\n$gdb_prompt " { |
| 91 # Do not anchor end, there may be more output in non-stop mode. |
| 92 pass $test |
| 93 } |
| 94 } |
| 95 |
| 96 if $nonstop { |
| 97 set test "non-stop interior stop" |
| 98 gdb_test_multiple "" $test { |
| 99 -re " #1 stopped\\.\r\n" { |
| 100 pass $test |
| 101 } |
| 102 } |
| 103 } |
| 104 |
| 105 gdb_test "continue" "Program received signal SIGUSR1, .*" |
| 106 gdb_test "sharedlibrary" ".*" |
| 107 gdb_test "p libvar" " = 23" |
| 108 }} |
OLD | NEW |