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

Subversion Repositories scarts

[/] [scarts/] [trunk/] [toolchain/] [scarts-gdb/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.mi/] [mi-var-invalidate.exp] - Blame information for rev 25

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 25 jlechner
# Copyright 2007, 2008 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 essential Machine interface (MI) operations
17
#
18
# Verify that once binary file has changed, GDB correctly handles
19
# previously defined MI variables.
20
#
21
 
22
 
23
load_lib mi-support.exp
24
set MIFLAGS "-i=mi"
25
 
26
gdb_exit
27
if [mi_gdb_start] {
28
    continue
29
}
30
 
31
set testfile "var-cmd"
32
set srcfile ${testfile}.c
33
set binfile ${objdir}/${subdir}/${testfile}
34
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
35
    untested mi-var-invalidate.exp
36
    return -1
37
}
38
# Just change the output binary.
39
set binfile_bis ${objdir}/${subdir}/${testfile}_bis
40
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile_bis}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
41
    untested mi-var-invalidate.exp
42
    return -1
43
}
44
 
45
set testfile2 "basics"
46
set srcfile2 ${testfile2}.c
47
set binfile2 ${objdir}/${subdir}/${testfile2}
48
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile2}" "${binfile2}" executable {debug additional_flags=-DFAKEARGV}] != "" } {
49
    untested mi-var-invalidate.exp
50
    return -1
51
}
52
 
53
mi_delete_breakpoints
54
mi_gdb_reinitialize_dir $srcdir/$subdir
55
mi_gdb_load ${binfile}
56
 
57
# Desc:  Create global variable.
58
mi_gdb_test "-var-create global_simple * global_simple" \
59
        "\\^done,name=\"global_simple\",numchild=\"6\",value=\".*\",type=\"simpleton\"" \
60
        "create global variable"
61
 
62
mi_runto do_locals_tests
63
 
64
# Desc: create local variables
65
mi_gdb_test "-var-create linteger * linteger" \
66
        "\\^done,name=\"linteger\",numchild=\"0\",value=\".*\",type=\"int\"" \
67
        "create local variable linteger"
68
 
69
#
70
# Reload the same binary.
71
# Global variable should remain, local should be invalidated.
72
#
73
mi_delete_breakpoints
74
mi_gdb_load ${binfile_bis}
75
mi_runto main
76
 
77
# Check local variable is "invalid".
78
mi_gdb_test "-var-update linteger" \
79
        "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\"\}\\\]" \
80
        "linteger not anymore in scope due to binary changes"
81
 
82
mi_gdb_test "-var-info-type linteger" \
83
        "\\^done,type=\"\"" \
84
        "no type for invalid variable linteger (1)"
85
 
86
# Check global variable is still correct.
87
mi_gdb_test "-var-update global_simple" \
88
        "\\^done,changelist=\\\[\]" \
89
        "global_simple still alive"
90
 
91
mi_gdb_test "-var-info-type global_simple" \
92
        "\\^done,type=\"simpleton\"" \
93
        "type simpleton for valid variable global_simple"
94
 
95
 
96
#
97
# Load an other binary.
98
# All variables must be invalidated.
99
#
100
mi_delete_breakpoints
101
mi_gdb_load ${binfile2}
102
# Check local variable are "invalid"
103
mi_gdb_test "-var-update linteger" \
104
        "\\^done,changelist=\\\[\{name=\"linteger\",in_scope=\"invalid\"\}\\\]" \
105
        "linteger not valid anymore due to binary changes"
106
 
107
mi_gdb_test "-var-info-type linteger" \
108
        "\\^done,type=\"\"" \
109
        "no type for invalid variable linteger (2)"
110
 
111
# Check global variable are still correct.
112
mi_gdb_test "-var-update global_simple" \
113
        "\\^done,changelist=\\\[\{name=\"global_simple\",in_scope=\"invalid\"\}\\\]" \
114
        "global_simple not anymore in scope due to binary changes"
115
 
116
mi_gdb_test "-var-info-type global_simple" \
117
        "\\^done,type=\"\"" \
118
        "no type for invalid variable global_simple"
119
 
120
mi_gdb_exit
121
return 0

powered by: WebSVN 2.1.0

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