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