]>
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 | |
31 | @@ -0,0 +1,79 @@ | |
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 | + | |
50 | +if $tracelevel then { | |
51 | + strace $tracelevel | |
52 | +} | |
53 | + | |
54 | +set prms_id 0 | |
55 | +set bug_id 0 | |
56 | + | |
57 | +# This test only works on Linux | |
58 | +if { ![istarget "*-*-linux-gnu*"] } { | |
59 | + return 0 | |
60 | +} | |
61 | + | |
62 | +set testfile "attach-see-vdso" | |
63 | +set srcfile ${testfile}.c | |
64 | +set binfile ${objdir}/${subdir}/${testfile} | |
65 | +set escapedbinfile [string_to_regexp ${objdir}/${subdir}/${testfile}] | |
66 | + | |
67 | +# The kernel VDSO is used for the syscalls returns only on i386 (not x86_64). | |
68 | +# | |
69 | +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-m32}] != "" } { | |
70 | + gdb_suppress_entire_file "Testcase nonthraded compile failed, so all tests in this file will automatically fail." | |
71 | +} | |
72 | + | |
73 | +if [get_compiler_info ${binfile}] { | |
74 | + return -1 | |
75 | +} | |
76 | + | |
77 | +# Start the program running and then wait for a bit, to be sure | |
78 | +# that it can be attached to. | |
79 | + | |
80 | +set testpid [eval exec $binfile &] | |
81 | + | |
82 | +# Avoid some race: | |
83 | +sleep 2 | |
84 | + | |
85 | +# Start with clean gdb | |
86 | +gdb_exit | |
87 | +gdb_start | |
88 | +gdb_reinitialize_dir $srcdir/$subdir | |
89 | +# Never call: gdb_load ${binfile} | |
90 | +# as the former problem would not reproduce otherwise. | |
91 | + | |
92 | +set test "attach" | |
93 | +gdb_test_multiple "attach $testpid" "$test" { | |
94 | + -re "Attaching to process $testpid\r?\n.*$gdb_prompt $" { | |
95 | + pass "$test" | |
96 | + } | |
97 | +} | |
98 | + | |
99 | +gdb_test "bt" "#0 *0x\[0-9a-f\]* in \[^?\].*" "backtrace decodes VDSO" | |
100 | + | |
101 | +# Exit and detach the process. | |
102 | + | |
103 | +gdb_exit | |
104 | + | |
105 | +# Make sure we don't leave a process around to confuse | |
106 | +# the next test run (and prevent the compile by keeping | |
107 | +# the text file busy), in case the "set should_exit" didn't | |
108 | +# work. | |
109 | + | |
110 | +remote_exec build "kill -9 ${testpid}" |