| OLD | NEW |
| 1 # Copyright 2007-2012 Free Software Foundation, Inc. | 1 # Copyright 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 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 | 31 |
| 32 set libsrc "${srcdir}/${subdir}/${libfile}.c" | 32 set libsrc "${srcdir}/${subdir}/${libfile}.c" |
| 33 set libname "${libfile}.so" | 33 set libname "${libfile}.so" |
| 34 set libobj "${objdir}/${subdir}/${libname}" | 34 set libobj "${objdir}/${subdir}/${libname}" |
| 35 set execsrc "${srcdir}/${subdir}/${srcfile}" | 35 set execsrc "${srcdir}/${subdir}/${srcfile}" |
| 36 set lib_dlopen [shlib_target_file ${libname}] | 36 set lib_dlopen [shlib_target_file ${libname}] |
| 37 set lib_syms [shlib_symbol_file ${libname}] | 37 set lib_syms [shlib_symbol_file ${libname}] |
| 38 | 38 |
| 39 remote_exec build "rm -f ${binfile}" | 39 remote_exec build "rm -f ${binfile}" |
| 40 | 40 |
| 41 if [get_compiler_info ${binfile}] { | 41 if [get_compiler_info] { |
| 42 return -1 | 42 return -1 |
| 43 } | 43 } |
| 44 | 44 |
| 45 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME\=\"${lib_dlop
en}\"] | 45 set exec_opts [list debug shlib_load additional_flags=-DSHLIB_NAME\=\"${lib_dlop
en}\"] |
| 46 | 46 |
| 47 if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" | 47 if { [gdb_compile_shlib $libsrc $libobj {debug}] != "" |
| 48 || [gdb_compile $execsrc ${binfile} executable $exec_opts] != "" } { | 48 || [gdb_compile $execsrc ${binfile} executable $exec_opts] != "" } { |
| 49 return -1 | 49 return -1 |
| 50 } | 50 } |
| 51 | 51 |
| 52 gdb_exit | 52 gdb_exit |
| 53 gdb_start | 53 gdb_start |
| 54 gdb_reinitialize_dir $srcdir/$subdir | 54 gdb_reinitialize_dir $srcdir/$subdir |
| 55 gdb_load ${binfile} | 55 gdb_load ${binfile} |
| 56 gdb_load_shlibs $libobj | 56 gdb_load_shlibs $libobj |
| 57 | 57 |
| 58 if ![runto_main] then { | 58 if ![runto_main] then { |
| 59 fail "Can't run to main" | 59 fail "Can't run to main" |
| 60 return 0 | 60 return 0 |
| 61 } | 61 } |
| 62 | 62 |
| 63 gdb_test_no_output "set stop-on-solib-events 1" | 63 gdb_test_no_output "set stop-on-solib-events 1" |
| 64 | 64 |
| 65 gdb_test "continue" "Stopped due to shared library event" "continue to load" | 65 gdb_test "continue" "Stopped due to shared library event.*" "continue to load" |
| 66 | 66 |
| 67 set msg "save \$pc after load" | 67 set msg "save \$pc after load" |
| 68 set saved_pc "" | 68 set saved_pc "" |
| 69 gdb_test_multiple "print/x \$pc" $msg { | 69 gdb_test_multiple "print/x \$pc" $msg { |
| 70 -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" { | 70 -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" { |
| 71 set saved_pc $expect_out(1,string) | 71 set saved_pc $expect_out(1,string) |
| 72 pass $msg | 72 pass $msg |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 | 75 |
| 76 gdb_test "disconnect" "Ending remote debugging\\." "disconnect after load" | 76 gdb_test "disconnect" "Ending remote debugging\\." "disconnect after load" |
| 77 if { [gdb_reconnect] == 0 } { | 77 if { [gdb_reconnect] == 0 } { |
| 78 pass "reconnect after load" | 78 pass "reconnect after load" |
| 79 } else { | 79 } else { |
| 80 fail "reconnect after load" | 80 fail "reconnect after load" |
| 81 return 0 | 81 return 0 |
| 82 } | 82 } |
| 83 | 83 |
| 84 gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after load" | 84 gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after load" |
| 85 | 85 |
| 86 | 86 |
| 87 gdb_test "continue" "Stopped due to shared library event" "continue to unload" | 87 gdb_test "continue" "Stopped due to shared library event.*" "continue to unload" |
| 88 | 88 |
| 89 set msg "save \$pc after unload" | 89 set msg "save \$pc after unload" |
| 90 set saved_pc "" | 90 set saved_pc "" |
| 91 gdb_test_multiple "print/x \$pc" $msg { | 91 gdb_test_multiple "print/x \$pc" $msg { |
| 92 -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" { | 92 -re "\\\$$decimal = (\[^\r\n\]*)\r\n$gdb_prompt $" { |
| 93 set saved_pc $expect_out(1,string) | 93 set saved_pc $expect_out(1,string) |
| 94 pass $msg | 94 pass $msg |
| 95 } | 95 } |
| 96 } | 96 } |
| 97 | 97 |
| 98 gdb_test "disconnect" "Ending remote debugging\\." "disconnect after unload" | 98 gdb_test "disconnect" "Ending remote debugging\\." "disconnect after unload" |
| 99 if { [gdb_reconnect] == 0 } { | 99 if { [gdb_reconnect] == 0 } { |
| 100 pass "reconnect after unload" | 100 pass "reconnect after unload" |
| 101 } else { | 101 } else { |
| 102 fail "reconnect after unload" | 102 fail "reconnect after unload" |
| 103 return 0 | 103 return 0 |
| 104 } | 104 } |
| 105 | 105 |
| 106 gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after unload" | 106 gdb_test "print/x \$pc" "\\\$$decimal = $saved_pc" "check \$pc after unload" |
| OLD | NEW |