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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.ada/] [formatted_ref.exp] - Blame information for rev 841

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

Line No. Rev Author Line
1 24 jeremybenn
# 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
# Author: P. N. Hilfinger, AdaCore Inc.
17
 
18
# Note: This test is essentially a transcription of gdb.cp/formatted-ref.exp,
19
# and is thus much more wordy than it needs to be. There are fewer
20
# tests because only a few parameter types in Ada are required to be
21
# passed by reference, and there is no equivalent of &(&x) for reference
22
# values.
23
 
24
if $tracelevel then {
25
        strace $tracelevel
26
}
27
 
28
load_lib "ada.exp"
29
 
30
set testdir "formatted_ref"
31
set testfile "${testdir}/formatted_ref"
32
set srcfile ${srcdir}/${subdir}/${testfile}.adb
33
set binfile ${objdir}/${subdir}/${testfile}
34
 
35
 
36
file mkdir ${objdir}/${subdir}/${testdir}
37
if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug ]] != "" } {
38
    untested formatted-ref.exp
39
    return -1
40
}
41
 
42
proc get_address { var } {
43
    global expect_out
44
    global gdb_prompt
45
 
46
    send_gdb "print $var'access\n"
47
    gdb_expect {
48
        -re "\\$\[0-9\]+ = \\(.*\\) (0x\[0-9a-f\]+).*$gdb_prompt $" {
49
            return $expect_out(1,string)
50
        }
51
        timeout {
52
            perror "couldn't find address of $var"
53
            return ""
54
        }
55
    }
56
}
57
 
58
proc test_p_x { var val addr } {
59
    global gdb_prompt
60
 
61
    set test "print/x $var"
62
    gdb_test_multiple "$test" $test {
63
        -re "\\$\[0-9\]+ = [string_to_regexp $val].*$gdb_prompt $" {
64
            pass $test
65
        }
66
        -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
67
            fail "$test (prints just address)"
68
        }
69
        -re "\\$\[0-9\]+ = 0x\[a-f0-9\]+.*$gdb_prompt $" {
70
            fail "$test (prints unexpected address)"
71
        }
72
    }
73
    return 0
74
}
75
 
76
proc test_p_x_addr { var addr } {
77
    global gdb_prompt
78
 
79
    set test "print/x $var'access"
80
    gdb_test_multiple $test $test {
81
        -re "\\$\[0-9\]+ = $addr.*$gdb_prompt $" {
82
            pass $test
83
        }
84
        -re "\\$\[0-9\]+ = 0x\[a-f0-9+\]+.*$gdb_prompt $" {
85
            fail "$test (prints unexpected address)"
86
        }
87
    }
88
    return 0
89
}
90
 
91
gdb_exit
92
gdb_start
93
gdb_reinitialize_dir $srcdir/$subdir
94
gdb_load ${binfile}
95
 
96
runto defs.adb:[gdb_get_line_number "marker here" ${testdir}/defs.adb ]
97
 
98
set s1_address  [get_address "s1"]
99
 
100
test_p_x "s" "(x => 0xd, y => 0x13)" $s1_address
101
 
102
test_p_x_addr "s" $s1_address

powered by: WebSVN 2.1.0

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