OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [gdb-7.2/] [gdb-7.2-or32-1.0rc3/] [gdb/] [testsuite/] [gdb.base/] [trace-commands.exp] - Blame information for rev 513

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 2006, 2007, 2008, 2009, 2010 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 .
15
 
16
# Test that the source command's verbose mode works, the 'set trace-commands'
17
# command works, and that the nest depth is correct in various circumstances.
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
gdb_exit
24
gdb_start
25
 
26
# Create a file to source
27
set fd [open "tracecommandsscript" w]
28
puts $fd "\
29
echo in tracecommandsscript\\n
30
define func
31
 echo in func \$arg0\\n
32
end
33
if 1
34
 if 2
35
  if 3
36
   if 4
37
    echo deep\\n
38
    func 999
39
   end
40
  end
41
 end
42
end
43
"
44
close $fd
45
 
46
# Make sure that the show trace-commands exists and the default is 'off'.
47
gdb_test "show trace-commands" "State of GDB CLI command tracing is off\\." \
48
         "show trace-commands says off"
49
 
50
# Source the script with verbose mode.
51
send_gdb "source -v tracecommandsscript\n"
52
gdb_expect_list "source -v" ".*$gdb_prompt $" {
53
  {[\r\n]\+echo in tracecommandsscript\\n}
54
  {[\r\n]\+define func}
55
  {[\r\n]\+if 1}
56
  {[\r\n]\+\+if 2}
57
  {[\r\n]\+\+\+if 3}
58
  {[\r\n]\+\+\+\+if 4}
59
  {[\r\n]\+\+\+\+\+echo deep\\n}
60
  {[\r\n]\+\+\+\+\+func 999}
61
  {[\r\n]\+\+\+\+\+\+echo in func 999\\n}
62
}
63
 
64
# Turn on command tracing.
65
gdb_test_no_output "set trace-commands" "set trace-commands"
66
 
67
# Make sure show trace-commands now gives 'on'.
68
gdb_test "show trace-commands" \
69
    {\+show trace-commands[\r\n]+State of GDB CLI command tracing is on\.} \
70
         "show trace-commands says on"
71
 
72
# Simple test
73
gdb_test "echo hi\\n" {\+echo hi\\n[\r\n]+hi} "simple trace-commands test"
74
 
75
# Nested test
76
send_gdb "if 1\nset \$i = 0\nwhile \$i < 5\nfunc \$i\nset \$i += 1\nend\nend\n"
77
gdb_expect_list "nested trace-commands test" ".*$gdb_prompt $" {
78
  {[\r\n]\+if 1}
79
  {[\r\n]\+\+set \$i = 0}
80
  {[\r\n]\+\+while \$i < 5}
81
  {[\r\n]\+\+\+func \$i}
82
  {[\r\n]\+\+\+\+echo in func \$i\\n}
83
  {[\r\n]\+\+\+set \$i \+= 1}
84
  {[\r\n]\+\+\+func \$i}
85
  {[\r\n]\+\+\+\+echo in func \$i\\n}
86
  {[\r\n]\+\+\+set \$i \+= 1}
87
  {[\r\n]\+\+\+func \$i}
88
  {[\r\n]\+\+\+\+echo in func \$i\\n}
89
  {[\r\n]\+\+\+set \$i \+= 1}
90
  {[\r\n]\+\+\+func \$i}
91
  {[\r\n]\+\+\+\+echo in func \$i\\n}
92
  {[\r\n]\+\+\+set \$i \+= 1}
93
  {[\r\n]\+\+\+func \$i}
94
  {[\r\n]\+\+\+\+echo in func \$i\\n}
95
  {[\r\n]\+\+\+set \$i \+= 1}
96
}
97
 
98
# Function with source works
99
send_gdb "define topfunc\nsource tracecommandsscript\nend\n"
100
gdb_expect_list "define user command" ".*$gdb_prompt $" {
101
  {[\r\n]\+define topfunc}
102
}
103
send_gdb "topfunc\n"
104
gdb_expect_list "nested trace-commands test with source" ".*$gdb_prompt $" {
105
  {[\r\n]\+topfunc}
106
  {[\r\n]\+\+source tracecommandsscript}
107
  {[\r\n]\+\+echo in tracecommandsscript\\n}
108
  {[\r\n]\+\+define func}
109
  {[\r\n]\+\+if 1}
110
  {[\r\n]\+\+\+if 2}
111
  {[\r\n]\+\+\+\+if 3}
112
  {[\r\n]\+\+\+\+\+if 4}
113
  {[\r\n]\+\+\+\+\+\+echo deep\\n}
114
  {[\r\n]\+\+\+\+\+\+func 999}
115
  {[\r\n]\+\+\+\+\+\+\+echo in func 999\\n}
116
}
117
 
118
# Test nest depth resets properly on error
119
send_gdb "if 1\nif 2\nload\necho should not get here\\n\nend\nend\n"
120
gdb_expect_list "depth resets on error part 1" ".*$gdb_prompt $" {
121
  {[\r\n]\+if 1}
122
  {[\r\n]\+\+if 2}
123
  {[\r\n]\+\+\+load}
124
  {[\r\n]No executable file specified\.}
125
  {[\r\n]Use the "file" or "exec-file" command\.}
126
}
127
gdb_test "echo hi\\n" {[\r\n]\+echo hi\\n[\r\n]+hi} \
128
         "depth resets on error part 2"

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.