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