]>
Commit | Line | Data |
---|---|---|
e48883f7 | 1 | # Test for prologue skipping in minimal symbols with line info. |
0fb0cc75 | 2 | # Copyright 2007, 2008, 2009 Free Software Foundation, Inc. |
e48883f7 DJ |
3 | |
4 | # This program is free software; you can redistribute it and/or modify | |
5 | # it under the terms of the GNU General Public License as published by | |
e22f8b7c | 6 | # the Free Software Foundation; either version 3 of the License, or |
e48883f7 | 7 | # (at your option) any later version. |
e22f8b7c | 8 | # |
e48883f7 DJ |
9 | # This program is distributed in the hope that it will be useful, |
10 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | # GNU General Public License for more details. | |
e22f8b7c | 13 | # |
e48883f7 | 14 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 15 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
e48883f7 DJ |
16 | |
17 | if { [skip_cplus_tests] } { continue } | |
18 | ||
19 | set testfile "prologue" | |
20 | set srcfile ${testfile}.c | |
21 | set binfile ${objdir}/${subdir}/${testfile} | |
22 | ||
23 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { | |
24 | untested prologue.exp | |
25 | return -1 | |
26 | } | |
27 | ||
28 | gdb_exit | |
29 | gdb_start | |
30 | gdb_reinitialize_dir $srcdir/$subdir | |
31 | gdb_load ${binfile} | |
32 | ||
33 | if ![runto_main] then { | |
34 | perror "couldn't run to breakpoint" | |
35 | continue | |
36 | } | |
37 | ||
38 | proc find_breakpoint_pc { sym } { | |
39 | global decimal hex gdb_prompt | |
40 | ||
41 | if { [gdb_breakpoint $sym temporary] } { | |
42 | pass "setting breakpoint at $sym" | |
43 | } | |
44 | ||
45 | gdb_test "continue" "marker \\(.*\\) at.*" "continue to $sym" | |
46 | ||
47 | set pc 0 | |
48 | set msg "reading \$pc: $sym" | |
49 | gdb_test_multiple "print/x \$pc" $msg { | |
50 | -re "\\\$$decimal = ($hex)\r\n$gdb_prompt $" { | |
51 | set pc $expect_out(1,string) | |
52 | pass $msg | |
53 | } | |
54 | } | |
55 | ||
56 | return $pc | |
57 | } | |
58 | ||
59 | # GDB would skip the prologue differently when given a symbol with | |
60 | # debug info than when given a minimal symbol from the symbol table. | |
61 | # Make sure this is fixed. | |
62 | ||
63 | set pc1 [find_breakpoint_pc "marker"] | |
64 | ||
65 | set pc2 [find_breakpoint_pc "other"] | |
66 | ||
67 | gdb_test "print $pc1 == $pc2" "\\\$$decimal = 1" "same pc from minimal symbol" |