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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gdb-6.8/] [gdb/] [testsuite/] [gdb.base/] [gcore-buffer-overflow.exp] - Blame information for rev 840

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 2 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, write to the Free Software
15
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
16
 
17
# Please email any bugs, comments, and/or additions to this file to:
18
# bug-gdb@prep.ai.mit.edu
19
 
20
# Test GDB's internal buffers safety for the GCORE command.
21
 
22
if $tracelevel then {
23
        strace $tracelevel
24
}
25
 
26
set prms_id 0
27
set bug_id 0
28
 
29
set testfile "gcore-buffer-overflow"
30
set srcfile  ${testfile}.c
31
# The ${binfile} basename needs to exceed 80 characters (`sizeof (psargs)')
32
# plus some additional data to overwrite the stack frame.
33
set pattern  01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789
34
set binfile  ${objdir}/${subdir}/${testfile}-${pattern}
35
 
36
if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
37
     untested gcore.exp
38
     return -1
39
}
40
 
41
# Start with a fresh gdb.
42
 
43
gdb_exit
44
gdb_start
45
gdb_reinitialize_dir $srcdir/$subdir
46
gdb_load ${binfile}
47
 
48
# Does this gdb support gcore?
49
send_gdb "help gcore\n"
50
gdb_expect {
51
    -re "Undefined command: .gcore.*$gdb_prompt $" {
52
        # gcore command not supported -- nothing to test here.
53
        unsupported "gdb does not support gcore on this target"
54
        return -1;
55
    }
56
    -re "Save a core file .*$gdb_prompt $" {
57
        pass "help gcore"
58
    }
59
    -re ".*$gdb_prompt $" {
60
        fail "help gcore"
61
    }
62
    timeout {
63
        fail "help gcore (timeout)"
64
    }
65
}
66
 
67
gdb_test "set args ${pattern}"  \
68
         ""                     \
69
         "Set buffer exceeding arguments"
70
 
71
if { ! [ runto_main ] } then {
72
    untested gcore-buffer-overflow.exp
73
    return -1
74
}
75
 
76
set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore-buffer-overflow.test]
77
 
78
set test "save a corefile"
79
gdb_test_multiple "gcore ${objdir}/${subdir}/gcore-buffer-overflow.test" $test {
80
    -re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
81
        pass $test
82
    }
83
    -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
84
        unsupported $test
85
    }
86
    eof {
87
        fail $test
88
    }
89
}

powered by: WebSVN 2.1.0

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