]>
Commit | Line | Data |
---|---|---|
ecd75fc8 | 1 | # Copyright (C) 1992-2014 Free Software Foundation, Inc. |
7be570e7 JM |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
7be570e7 JM |
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 | |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
7be570e7 | 15 | |
7be570e7 JM |
16 | # This file was written by Fred Fish. (fnf@cygnus.com) |
17 | ||
7be570e7 JM |
18 | if { [skip_hp_tests] } then { continue } |
19 | ||
20 | global message | |
21 | ||
22 | # | |
23 | # test running programs | |
24 | # | |
7be570e7 JM |
25 | |
26 | set testfile "xdb" | |
27 | set binfile ${objdir}/${subdir}/${testfile} | |
28 | ||
29 | if { [gdb_compile "${srcdir}/${subdir}/xdb0.c" "${binfile}0.o" object {debug}] != "" } { | |
30 | perror "Couldn't compile ${testfile}0.c to object" | |
31 | return -1 | |
32 | } | |
33 | ||
34 | if { [gdb_compile "${srcdir}/${subdir}/xdb1.c" "${binfile}1.o" object {debug}] != "" } { | |
35 | perror "Couldn't compile ${testfile}1.c to object" | |
36 | return -1 | |
37 | } | |
38 | ||
39 | if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } { | |
40 | perror "Couldn't link ${testfile}." | |
41 | return -1 | |
42 | } | |
43 | ||
4c93b1db | 44 | if [get_compiler_info] { |
ae59b1da | 45 | return -1 |
7be570e7 JM |
46 | } |
47 | ||
48 | if { $gcc_compiled } then { continue } | |
49 | ||
50 | global GDBFLAGS | |
51 | set saved_gdbflags $GDBFLAGS | |
52 | set GDBFLAGS "$GDBFLAGS --xdb" | |
53 | ||
54 | gdb_exit | |
55 | gdb_start | |
56 | gdb_reinitialize_dir $srcdir/$subdir | |
57 | gdb_load ${binfile} | |
58 | gdb_test "break main" "" | |
59 | gdb_test "run" "" | |
60 | gdb_test "go +2" "Breakpoint.*at.*file.*xdb0\.c, line 12\.\r\nContinuing at.*\r\nmain \\(\\) at.*xdb0\.c:12\r\n12\[ \t\]+foo \\(x\\+\\+\\);" | |
61 | gdb_test "go -2" "Note: breakpoint.*also set at pc.*\.\r\nBreakpoint.*at.*file.*xdb0\.c, line 10\.\r\nContinuing at.*\.\r\n\r\nBreakpoint.*, main \\(\\) at.*xdb0\.c:10.*" | |
62 | gdb_test "go 16" "Breakpoint.*at.*file.*xdb0\.c, line 16\.\r\nContinuing at.*\.\r\nmain \\(\\) at.*xdb0\.c:16\r\n16\[ \t\]+foo \\(x\\+\\+\\);" | |
63 | ||
64 | send_gdb "go bar\n" | |
65 | gdb_expect { | |
66 | -re ".*Line 5 is not in .main.. Jump anyway.*y or n. $" { | |
67 | send_gdb "y\n" | |
68 | gdb_expect { | |
69 | -re "$gdb_prompt $"\ | |
70 | {pass "go bar"} | |
71 | timeout {fail "(timeout) go bar"} | |
72 | } | |
73 | } | |
74 | -re "Continuing at.*\.\r\nbar \\(x=0\\) at.*xdb1\.c:5" {} | |
75 | timeout { perror "(timeout) go bar" ; return } | |
76 | } | |
77 | ||
78 | # Verify that GDB responds gracefully to a "go" command without | |
79 | # an argument. | |
80 | # | |
81 | gdb_test "go" "Usage: go <location>" | |
82 | ||
83 | gdb_exit | |
84 | gdb_start | |
85 | gdb_reinitialize_dir $srcdir/$subdir | |
86 | gdb_load ${binfile} | |
87 | ||
88 | gdb_test "break bar" "" | |
89 | gdb_test "run" "" | |
90 | gdb_test "backtrace full" ".*bar \\(x=0\\) at.*xdb1\.c:5\r\nNo locals\.\r\n.1.* in foo \\(x=1\\) at.*xdb0\.h:8\r\nNo locals\.\r\n.2.* in main \\(\\) at.*xdb0\.c:11\r\n.*x = 1" | |
91 | gdb_test "bt 1 full" ".*bar \\(x=0\\) at.*xdb1\.c:5\r\nNo locals\.\r\n\\(More stack frames follow\.\.\.\\)" | |
92 | gdb_test "bt full 2" ".*bar \\(x=0\\) at.*xdb1\.c:5\r\nNo locals\.\r\n.1.* in foo \\(x=1\\) at.*xdb0\.h:8\r\nNo locals\.\r\n\\(More stack frames follow\.\.\.\\)" | |
93 | ||
94 | set GDBFLAGS $saved_gdbflags | |
95 | return 0 |