run copyright.sh for 2011.
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.hp / gdb.compat / xdb2.exp
CommitLineData
7b6bb8da 1# Copyright (C) 1992, 1994, 1995, 2007, 2008, 2009, 2010, 2011
0fb0cc75 2# Free Software Foundation, Inc.
7be570e7
JM
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
7be570e7
JM
7# (at your option) any later version.
8#
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.
13#
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/>. */
7be570e7 16
7be570e7
JM
17# This file was written by Fred Fish. (fnf@cygnus.com)
18
19if $tracelevel then {
20 strace $tracelevel
21 }
22
23if { [skip_hp_tests] } then { continue }
24
25global message
26
27#
28# test running programs
29#
7be570e7
JM
30
31set testfile "xdb"
32set binfile ${objdir}/${subdir}/${testfile}
33
34if { [gdb_compile "${srcdir}/${subdir}/xdb0.c" "${binfile}0.o" object {debug}] != "" } {
35 perror "Couldn't compile ${testfile}0.c to object"
36 return -1
37}
38
39if { [gdb_compile "${srcdir}/${subdir}/xdb1.c" "${binfile}1.o" object {debug}] != "" } {
40 perror "Couldn't compile ${testfile}1.c to object"
41 return -1
42}
43
44if { [gdb_compile "${binfile}0.o ${binfile}1.o" ${binfile} executable {debug}] != "" } {
45 perror "Couldn't link ${testfile}."
46 return -1
47}
48
49if [get_compiler_info ${binfile}] {
50 return -1;
51}
52
53if { $gcc_compiled } then { continue }
54
55global GDBFLAGS
56set saved_gdbflags $GDBFLAGS
57set GDBFLAGS "$GDBFLAGS --xdb"
58
59gdb_exit
60gdb_start
61gdb_reinitialize_dir $srcdir/$subdir
62gdb_load ${binfile}
63gdb_test "break main" ""
64gdb_test "run" ""
65gdb_test "go +2" "Breakpoint.*at.*file.*xdb0\.c, line 12\.\r\nContinuing at.*\r\nmain \\(\\) at.*xdb0\.c:12\r\n12\[ \t\]+foo \\(x\\+\\+\\);"
66gdb_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.*"
67gdb_test "go 16" "Breakpoint.*at.*file.*xdb0\.c, line 16\.\r\nContinuing at.*\.\r\nmain \\(\\) at.*xdb0\.c:16\r\n16\[ \t\]+foo \\(x\\+\\+\\);"
68
69send_gdb "go bar\n"
70 gdb_expect {
71 -re ".*Line 5 is not in .main.. Jump anyway.*y or n. $" {
72 send_gdb "y\n"
73 gdb_expect {
74 -re "$gdb_prompt $"\
75 {pass "go bar"}
76 timeout {fail "(timeout) go bar"}
77 }
78 }
79 -re "Continuing at.*\.\r\nbar \\(x=0\\) at.*xdb1\.c:5" {}
80 timeout { perror "(timeout) go bar" ; return }
81 }
82
83# Verify that GDB responds gracefully to a "go" command without
84# an argument.
85#
86gdb_test "go" "Usage: go <location>"
87
88gdb_exit
89gdb_start
90gdb_reinitialize_dir $srcdir/$subdir
91gdb_load ${binfile}
92
93gdb_test "break bar" ""
94gdb_test "run" ""
95gdb_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"
96gdb_test "bt 1 full" ".*bar \\(x=0\\) at.*xdb1\.c:5\r\nNo locals\.\r\n\\(More stack frames follow\.\.\.\\)"
97gdb_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\.\.\.\\)"
98
99set GDBFLAGS $saved_gdbflags
100return 0
This page took 1.071022 seconds and 4 git commands to generate.