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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.2/] [gdb/] [testsuite/] [gdb.cp/] [mb-inline.exp] - Blame information for rev 330

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 330 jeremybenn
# Copyright 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
# This file is part of the gdb testsuite.
17
 
18
# This test verifies that setting breakpoint on line in inline
19
# function will fire in all instantiations of that function.
20
 
21
if $tracelevel then {
22
    strace $tracelevel
23
}
24
 
25
if { [skip_cplus_tests] } { continue }
26
 
27
 
28
set testfile "mb-inline"
29
set hdrfile "${testfile}.h"
30
set srcfile1 "${testfile}1.cc"
31
set objfile1 "${testfile}1.o"
32
set srcfile2 "${testfile}2.cc"
33
set objfile2 "${testfile}2.o"
34
set binfile  "${objdir}/${subdir}/${testfile}"
35
 
36
if  { [gdb_compile "$srcdir/$subdir/$srcfile1" "$objdir/$subdir/$objfile1" object {debug c++}] != "" } {
37
     untested mb-inline.exp
38
     return -1
39
}
40
 
41
if  { [gdb_compile "$srcdir/$subdir/$srcfile2" "$objdir/$subdir/$objfile2" object {debug c++}] != "" } {
42
     untested mb-inline.exp
43
     return -1
44
}
45
 
46
if  { [gdb_compile "$objdir/$subdir/$objfile1 $objdir/$subdir/$objfile2" "${binfile}" executable {debug c++}] != "" } {
47
     untested mb-inline.exp
48
     return -1
49
}
50
 
51
if [get_compiler_info ${binfile} "c++"] {
52
    return -1
53
}
54
 
55
gdb_exit
56
gdb_start
57
gdb_reinitialize_dir $srcdir/$subdir
58
gdb_load ${binfile}
59
 
60
set bp_location [gdb_get_line_number "set breakpoint here" $hdrfile]
61
 
62
# Set a breakpoint with multiple locations.
63
 
64
gdb_test "break $hdrfile:$bp_location" \
65
    "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \
66
    "set breakpoint"
67
 
68
gdb_run_cmd
69
gdb_expect {
70
    -re "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" {
71
        pass "run to breakpoint"
72
    }
73
    -re "$gdb_prompt $" {
74
        fail "run to breakpoint"
75
    }
76
    timeout {
77
        fail "run to breakpoint (timeout)"
78
    }
79
}
80
 
81
gdb_test "continue" \
82
    ".*Breakpoint.*foo \\(i=1\\).*" \
83
    "run to breakpoint 2"
84
 
85
# Try disabling a single location. We also test
86
# that at least in simple cases, the enable/disable
87
# state of locations survive "run".
88
# Early bug would disable 1.1 and enable 1.2 when program is run.
89
gdb_test_no_output "disable 1.2" "disabling location: disable"
90
 
91
gdb_run_cmd
92
gdb_expect {
93
    -re "Breakpoint \[0-9\]+,.*foo \\(i=0\\).*$gdb_prompt $" {
94
        pass "disabling location: run to breakpoint"
95
    }
96
    -re "$gdb_prompt $" {
97
        fail "disabling location: run to breakpoint"
98
    }
99
    timeout {
100
        fail "disabling location: run to breakpoint (timeout)"
101
    }
102
}
103
 
104
gdb_test "continue" \
105
    ".*Program exited normally.*" \
106
    "continue with disabled breakpoint 1.2"
107
 
108
# Make sure we can set a breakpoint on a source statement that spans
109
# multiple lines.
110
 
111
delete_breakpoints
112
 
113
set bp_location [gdb_get_line_number "set multi-line breakpoint here" $hdrfile]
114
 
115
if { ![runto_main] } {
116
    fail "Can't run to main for multi_line_foo tests."
117
    return 0
118
}
119
 
120
gdb_test "break $hdrfile:$bp_location" \
121
    "Breakpoint.*at.* file .*$hdrfile, line.*\\(2 locations\\).*" \
122
    "set multi_line_foo breakpoint"
123
gdb_test "continue" \
124
    ".*Breakpoint.*multi_line_foo \\(i=0\\).*" \
125
    "run to multi_line_foo breakpoint 4 afn"
126
gdb_test "continue" \
127
    ".*Breakpoint.*multi_line_foo \\(i=1\\).*" \
128
    "run to multi_line_foo breakpoint 4 bfn"

powered by: WebSVN 2.1.0

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