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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.cp/] [mb-inline.exp] - Blame information for rev 833

Go to most recent revision | Details | Compare with Previous | View Log

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