]>
Commit | Line | Data |
---|---|---|
3a58abaf AM |
1 | --- /dev/null 1 Jan 1970 00:00:00 -0000 |
2 | +++ ./gdb/testsuite/gdb.base/attach-see-vdso.c 6 Jul 2007 14:14:44 -0000 | |
3 | @@ -0,0 +1,25 @@ | |
4 | +/* This testcase is part of GDB, the GNU debugger. | |
5 | + | |
6 | + Copyright 2007 Free Software Foundation, Inc. | |
7 | + | |
8 | + This program is free software; you can redistribute it and/or modify | |
9 | + it under the terms of the GNU General Public License as published by | |
10 | + the Free Software Foundation; either version 2 of the License, or | |
11 | + (at your option) any later version. | |
12 | + | |
13 | + This program is distributed in the hope that it will be useful, | |
14 | + but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | + GNU General Public License for more details. | |
17 | + | |
18 | + You should have received a copy of the GNU General Public License | |
19 | + along with this program; if not, write to the Free Software | |
20 | + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ | |
21 | + | |
22 | +#include <unistd.h> | |
23 | + | |
24 | +int main () | |
25 | +{ | |
26 | + pause (); | |
27 | + return 1; | |
28 | +} | |
29 | --- /dev/null 1 Jan 1970 00:00:00 -0000 | |
30 | +++ ./gdb/testsuite/gdb.base/attach-see-vdso.exp 6 Jul 2007 14:14:44 -0000 | |
51a5ef0f | 31 | @@ -0,0 +1,72 @@ |
3a58abaf AM |
32 | +# Copyright 2007 |
33 | + | |
34 | +# This program is free software; you can redistribute it and/or modify | |
35 | +# it under the terms of the GNU General Public License as published by | |
36 | +# the Free Software Foundation; either version 2 of the License, or | |
37 | +# (at your option) any later version. | |
38 | +# | |
39 | +# This program is distributed in the hope that it will be useful, | |
40 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of | |
41 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
42 | +# GNU General Public License for more details. | |
43 | +# | |
44 | +# You should have received a copy of the GNU General Public License | |
45 | +# along with this program; if not, write to the Free Software | |
46 | +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | |
47 | + | |
48 | +# This file was created by Jan Kratochvil <jan.kratochvil@redhat.com>. | |
49 | + | |
3a58abaf AM |
50 | +# This test only works on Linux |
51 | +if { ![istarget "*-*-linux-gnu*"] } { | |
52 | + return 0 | |
53 | +} | |
54 | + | |
55 | +set testfile "attach-see-vdso" | |
56 | +set srcfile ${testfile}.c | |
57 | +set binfile ${objdir}/${subdir}/${testfile} | |
58 | +set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] | |
59 | + | |
60 | +# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64). | |
61 | +# | |
62 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } { | |
63 | + gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail." | |
64 | +} | |
65 | + | |
66 | +if [get_compiler_info ${binfile}] { | |
67 | + return -1 | |
68 | +} | |
69 | + | |
70 | +# Start the program running and then wait for a bit, to be sure | |
71 | +# that it can be attached to. | |
72 | + | |
73 | +set testpid [eval exec $binfile &] | |
74 | + | |
75 | +# Avoid some race: | |
76 | +sleep 2 | |
77 | + | |
78 | +# Start with clean gdb | |
79 | +gdb_exit | |
80 | +gdb_start | |
81 | +gdb_reinitialize_dir $srcdir/$subdir | |
82 | +# Never call: gdb_load ${binfile} | |
83 | +# as the former problem would not reproduce otherwise. | |
84 | + | |
85 | +set test "attach" | |
86 | +gdb_test_multiple "attach $testpid" "$test" { | |
87 | + -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" { | |
88 | + pass "$test" | |
89 | + } | |
90 | +} | |
91 | + | |
92 | +gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO" | |
93 | + | |
94 | +# Exit and detach the process. | |
95 | + | |
96 | +gdb_exit | |
97 | + | |
98 | +# Make sure we don't leave a process around to confuse | |
99 | +# the next test run (and prevent the compile by keeping | |
100 | +# the text file busy), in case the "set should_exit" didn't | |
101 | +# work. | |
102 | + | |
103 | +remote_exec build "kill -9 ${testpid}" |