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 |
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 # Test loading symbols from unrelocated C++ object files. | 16 # Test loading symbols from unrelocated C++ object files. |
17 | 17 |
18 set testfile cp-relocate | 18 standard_testfile .cc |
19 set srcfile ${testfile}.cc | 19 append binfile .o |
20 set binfile ${objdir}/${subdir}/${testfile}.o | |
21 | 20 |
22 if { [skip_cplus_tests] } { continue } | 21 if { [skip_cplus_tests] } { continue } |
23 | 22 |
24 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {c++ debu
g}] != "" } { | 23 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" object {c++ debu
g}] != "" } { |
25 untested cp-relocate.exp | 24 untested cp-relocate.exp |
26 return -1 | 25 return -1 |
27 } | 26 } |
28 | 27 |
29 proc get_func_address { func } { | 28 proc get_func_address { func } { |
30 global gdb_prompt hex | 29 global gdb_prompt hex |
31 | 30 |
32 set rfunc [string_to_regexp $func] | 31 set rfunc [string_to_regexp $func] |
33 gdb_test_multiple "print ${func}" "get address of ${func}" { | 32 gdb_test_multiple "print ${func}" "get address of ${func}" { |
34 » -re "\\\$\[0-9\]+ = \\{.*\\} (0|($hex) <${rfunc}>)\[\r\n\]+${gdb_prompt}
$" { | 33 » -re "\\\$\[0-9\]+ = \\{.*\\} (($hex) <${rfunc}.*>)\[\r\n\]+${gdb_prompt}
$" { |
35 # $1 = {int ()} 0x24 <function_bar> | 34 # $1 = {int ()} 0x24 <function_bar> |
36 # But if the function is at zero, the name may be omitted. | 35 # But if the function is at zero, the name may be omitted. |
37 pass "get address of ${func}" | 36 pass "get address of ${func}" |
38 » if { $expect_out(1,string) == "0" } { | 37 » if { $expect_out(1,string) == "0x0" } { |
39 return "0x0" | 38 return "0x0" |
40 } else { | 39 } else { |
41 return $expect_out(2,string) | 40 return $expect_out(2,string) |
42 } | 41 } |
43 } | 42 } |
44 } | 43 } |
45 return "" | 44 return "" |
46 } | 45 } |
47 | 46 |
48 # Load the file as an executable; GDB should assign non-overlapping | 47 # Load the file as an executable; GDB should assign non-overlapping |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 "Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\.(|\r\nUsing host
libthread_db library .*libthread_db.so.*\\.)" \ | 126 "Reading symbols from .*${testfile}\\.o\\.\\.\\.done\\.(|\r\nUsing host
libthread_db library .*libthread_db.so.*\\.)" \ |
128 "add-symbol-file ${testfile}.o" \ | 127 "add-symbol-file ${testfile}.o" \ |
129 "add symbol table from file \".*${testfile}\\.o\" at.*\\(y or n\\) " \ | 128 "add symbol table from file \".*${testfile}\\.o\" at.*\\(y or n\\) " \ |
130 "y" | 129 "y" |
131 | 130 |
132 # Make sure the function addresses were updated. | 131 # Make sure the function addresses were updated. |
133 gdb_test "break *$func1_name" \ | 132 gdb_test "break *$func1_name" \ |
134 "Breakpoint $decimal at 0x1....: file .*" | 133 "Breakpoint $decimal at 0x1....: file .*" |
135 gdb_test "break *$func2_name" \ | 134 gdb_test "break *$func2_name" \ |
136 "Breakpoint $decimal at 0x2....: file .*" | 135 "Breakpoint $decimal at 0x2....: file .*" |
OLD | NEW |