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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-7.1/] [gdb/] [testsuite/] [config/] [sim.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
# Test Framework Driver for GDB driving a builtin simulator
2
#   Copyright 1994, 1997, 1998, 2004, 2007, 2008, 2009, 2010
3
#   Free Software Foundation, Inc.
4
#
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# This program is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with this program.  If not, see .
17
 
18
load_lib gdb.exp
19
 
20
#
21
# gdb_target_sim
22
# Set gdb to target the simulator
23
#
24
proc gdb_target_sim { } {
25
    global gdb_prompt
26
 
27
    set target_sim_options "[board_info target gdb,target_sim_options]";
28
 
29
    send_gdb "target sim $target_sim_options\n"
30
    set timeout 60
31
    verbose "Timeout is now $timeout seconds" 2
32
    gdb_expect {
33
        -re "Connected to the simulator.*$gdb_prompt $" {
34
            verbose "Set target to sim"
35
        }
36
        timeout {
37
            perror "Couldn't set target for simulator."
38
            cleanup
39
            return -1
40
        }
41
    }
42
    set timeout 10
43
    verbose "Timeout is now $timeout seconds" 2
44
    return 0
45
}
46
 
47
#
48
# gdb_load -- load a file into the debugger.
49
#             return a -1 if anything goes wrong.
50
#
51
proc gdb_load { arg } {
52
    global verbose
53
    global loadpath
54
    global loadfile
55
    global GDB
56
    global gdb_prompt
57
 
58
    if { $arg != "" } {
59
        if [gdb_file_cmd $arg] then { return -1 }
60
    }
61
 
62
    if [gdb_target_sim] then { return -1 }
63
 
64
    send_gdb "load\n"
65
    set timeout 2400
66
    verbose "Timeout is now $timeout seconds" 2
67
    gdb_expect {
68
        -re ".*$gdb_prompt $" {
69
            if $verbose>1 then {
70
                send_user "Loaded $arg into $GDB\n"
71
            }
72
            set timeout 30
73
            verbose "Timeout is now $timeout seconds" 2
74
            return 0
75
        }
76
        -re "$gdb_prompt $"     {
77
            if $verbose>1 then {
78
                perror "GDB couldn't load."
79
            }
80
        }
81
        timeout {
82
            if $verbose>1 then {
83
                perror "Timed out trying to load $arg."
84
            }
85
        }
86
    }
87
    return -1
88
}

powered by: WebSVN 2.1.0

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