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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.hp/] [gdb.aCC/] [watch-cmd.exp] - Blame information for rev 841

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright (C) 1998, 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
if $tracelevel then {
17
    strace $tracelevel
18
}
19
 
20
#
21
# test special commands
22
#
23
 
24
if { [skip_hp_tests] } then { continue }
25
 
26
set testfile "run"
27
set srcfile ${testfile}.c
28
set binfile ${objdir}/${subdir}/${testfile}
29
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
30
     untested watch-cmd.exp
31
     return -1
32
 
33
}
34
 
35
if [get_compiler_info ${binfile}] {
36
    return -1;
37
}
38
if { $gcc_compiled } then { continue }
39
 
40
 
41
gdb_exit
42
gdb_start
43
delete_breakpoints
44
gdb_reinitialize_dir $srcdir/$subdir
45
gdb_load ${binfile}
46
 
47
 
48
 
49
proc watchpoint_command_test {} {
50
    global gdb_prompt
51
 
52
    if [target_info exists noargs] {
53
        verbose "Skipping watchpoint_command_test because of noargs."
54
        return
55
    }
56
 
57
    if { ![runto factorial] } then { gdb_suppress_tests }
58
    # Don't depend upon argument passing, since most simulators don't currently
59
    # support it.  Bash value variable to be what we want.
60
    gdb_test "p value=6" "" "set value to 6 in watchpoint_command_test"
61
    delete_breakpoints
62
 
63
    # Verify that we can create a watchpoint, and give it a commands
64
    # list that continues the inferior.  We set the watchpoint on a
65
    # local variable, too, so that it self-deletes when the watched
66
    # data goes out of scope.
67
    #
68
    # What should happen is: Each time the watchpoint triggers, it
69
    # continues the inferior.  Eventually, the watchpoint will self-
70
    # delete, when the watched variable is out of scope.  But by that
71
    # time, the inferior should have exited.  GDB shouldn't crash or
72
    # anything untoward as a result of this.
73
    #
74
    send_gdb "watch local_var\n"
75
    gdb_expect {
76
      -re ".*\[Ww\]atchpoint (\[0-9\]*): local_var.*$gdb_prompt $"\
77
              { pass "watch local_var"
78
                set wp_id $expect_out(1,string)
79
                send_gdb "commands $wp_id\n"
80
                gdb_expect {
81
                  -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
82
                          { pass "begin commands on watch"}
83
                  -re "$gdb_prompt $"\
84
                          {fail "begin commands on watch"}
85
                  timeout {fail "(timeout) begin commands on watch"}
86
                }
87
              }
88
    -re "$gdb_prompt $"\
89
              {fail "watch local_var"}
90
      timeout {fail "(timeout) watch local_var"}
91
    }
92
#    set wp_id $expect_out(1,string)
93
#    send_gdb "commands $wp_id\n"
94
#    gdb_expect {
95
#      -re "Type commands for when breakpoint $wp_id is hit, one per line.*>"\
96
#              {pass "begin commands on watch"}
97
#      -re "$gdb_prompt $"\
98
#              {fail "begin commands on watch"}
99
#      timeout {fail "(timeout) begin commands on watch"}
100
#    }
101
    send_gdb "print value\n"
102
    gdb_expect {
103
      -re ">"\
104
              {pass "add print command to watch"}
105
      -re "$gdb_prompt $"\
106
              {fail "add print command to watch"}
107
      timeout {fail "(timeout) add print command to watch"}
108
    }
109
    send_gdb "continue\n"
110
    gdb_expect {
111
      -re ">"\
112
              {pass "add continue command to watch"}
113
      -re "$gdb_prompt $"\
114
              {fail "add continue command to watch"}
115
      timeout {fail "(timeout) add continue command to watch"}
116
    }
117
    send_gdb "end\n"
118
    gdb_expect {
119
      -re "$gdb_prompt $"\
120
              {pass "begin commands on watch"}
121
      timeout {fail "(timeout) begin commands on watch"}
122
    }
123
    send_gdb "continue\n"
124
    gdb_expect {
125
      -re "Continuing.*\[Ww\]atchpoint $wp_id deleted because the program has left the block in.*which its expression is valid.*in main.*$gdb_prompt $"\
126
              {pass "continue with watch"}
127
      -re "$gdb_prompt $"\
128
              {fail "continue with watch"}
129
      timeout {fail "(timeout) continue with watch"}
130
    }
131
    send_gdb "continue\n"
132
    gdb_expect {
133
      -re "Continuing.*$gdb_prompt $"\
134
              {pass "continue until exit"}
135
      -re "$gdb_prompt $"\
136
              {fail "continue until exit"}
137
      timeout {fail "(timeout) continue until exit"}
138
    }
139
}
140
 
141
watchpoint_command_test
142
 
143
 
144
 
145
 
146
 
147
 
148
 
149
 
150
 
151
 
152
 

powered by: WebSVN 2.1.0

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