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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.python/] [py-template.exp] - Blame information for rev 816

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

Line No. Rev Author Line
1 227 jeremybenn
# Copyright (C) 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.  It tests the mechanism
17
# exposing values to Python.
18
 
19
if $tracelevel then {
20
    strace $tracelevel
21
}
22
 
23
set testfile "py-template"
24
set srcfile ${testfile}.cc
25
set binfile ${objdir}/${subdir}/${testfile}
26
if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable \
27
          {debug c++}] != "" } {
28
    untested "Couldn't compile ${srcfile}"
29
    return -1
30
}
31
 
32
# Start with a fresh gdb.
33
 
34
gdb_exit
35
gdb_start
36
gdb_reinitialize_dir $srcdir/$subdir
37
 
38
gdb_test_multiple "python print 23" "verify python support" {
39
    -re "not supported.*$gdb_prompt $"  {
40
      unsupported "python support is disabled"
41
      return -1
42
    }
43
    -re "$gdb_prompt $" {}
44
}
45
 
46
proc test_template_arg {type} {
47
    global testfile srcdir subdir srcfile binfile
48
    if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \
49
                executable \
50
                [list debug c++ additional_flags="-DTYPE=$type"]] != "" } {
51
        untested $type
52
        return -1
53
    }
54
    gdb_load ${binfile}
55
    if ![runto_main ] then {
56
        perror "couldn't run to breakpoint"
57
        return
58
    }
59
    # There is no executable code in main(), so we are where we want to be
60
    gdb_test "print foo" ""
61
    gdb_test "python foo = gdb.history(0)" ""
62
 
63
    # Replace '*' with '\*' in regex.
64
    regsub -all {\*} $type {\*} t
65
    gdb_test "python print foo.type.template_argument(0)" $t $type
66
}
67
 
68
test_template_arg "const int"
69
test_template_arg "volatile int"
70
test_template_arg "const int &"
71
test_template_arg "volatile int &"
72
test_template_arg "volatile int * const"
73
test_template_arg "volatile int * const *"
74
test_template_arg "const int * volatile"
75
test_template_arg "const int * volatile * const * volatile *"

powered by: WebSVN 2.1.0

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