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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gdb-7.1/] [gdb/] [testsuite/] [gdb.base/] [valgrind-db-attach.exp] - Blame information for rev 227

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 227 jeremybenn
# Copyright 2009 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
set test valgrind-db-attach
17
set srcfile $test.c
18
set executable $test
19
set binfile ${objdir}/${subdir}/${executable}
20
if {[build_executable $test.exp $executable $srcfile {debug}] == -1} {
21
    return -1
22
}
23
 
24
gdb_exit
25
 
26
# remote_spawn breaks the command on each whitespace despite possible quoting.
27
# Use backslash-escaped whitespace there instead:
28
 
29
set db_command "--db-command=$GDB $INTERNAL_GDBFLAGS $GDBFLAGS [host_info gdb_opts] %f %p"
30
regsub -all " " $db_command "\\ " db_command
31
 
32
set test "spawn valgrind"
33
set cmd "valgrind --db-attach=yes $db_command $binfile"
34
set res [remote_spawn host $cmd];
35
if { $res < 0 || $res == "" } {
36
    verbose -log "Spawning $cmd failed."
37
    unsupported $test
38
    return -1
39
}
40
pass $test
41
# Declare GDB now as running.
42
set gdb_spawn_id -1
43
 
44
set test "valgrind started"
45
# The trailing '.' differs for different memcheck versions.
46
gdb_test_multiple "" $test {
47
    -re "Memcheck, a memory error detector\\.?\r\n" {
48
        pass $test
49
    }
50
    -re "valgrind: failed to start tool 'memcheck' for platform '.*': No such file or directory" {
51
        unsupported $test
52
        return -1
53
    }
54
    -re "command not found" {
55
        # The spawn succeeded, but then valgrind was not found - e.g. if
56
        # we spawned SSH to a remote system.
57
        unsupported $test
58
        return -1
59
    }
60
}
61
 
62
set double_free [gdb_get_line_number "double-free"]
63
 
64
gdb_test_multiple "" $test {
65
    -re "Invalid free\\(\\) / delete / delete\\\[\\\]\r\n.*: main \\(${srcfile}:$double_free\\)\r\n.*---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
66
        send_gdb "y\r"
67
    }
68
    -re "---- Attach to debugger \\? --- \[^\r\n\]* ---- " {
69
        send_gdb "n\r"
70
        exp_continue
71
    }
72
}
73
 
74
gdb_test "" "" "eat first prompt"
75
 
76
# Initialization from default_gdb_start.
77
gdb_test "set height 0"
78
gdb_test "set width 0"
79
 
80
gdb_test "bt" "in main \\(.*\\) at .*${srcfile}:$double_free"

powered by: WebSVN 2.1.0

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