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