Update copyright year in most headers.
[external/binutils.git] / gdb / testsuite / gdb.base / info-proc.exp
1 # Copyright 2002, 2003, 2004, 2007, 2008, 2009, 2010
2 # Free Software Foundation, Inc.
3
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 3 of the License, or
7 # (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
16
17 # This file was written by Michael Snyder (msnyder@redhat.com)
18 # This is a test for the gdb command "info proc"
19
20 if $tracelevel then {
21         strace $tracelevel
22 }
23
24 if { [is_remote target] } then {
25   continue
26 }
27
28 set prms_id 0
29 set bug_id 0
30
31 set ws "\[ \t\]+"
32
33 set testfile "break"
34 set srcfile ${testfile}.c
35 set srcfile1 ${testfile}1.c
36 set binfile ${objdir}/${subdir}/${testfile}
37
38 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
39      untested info-proc.exp
40      return -1
41 }
42
43 if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
44      untested info-proc.exp
45      return -1
46 }
47
48 if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
49      untested info-proc.exp
50      return -1
51 }
52
53 # Start with a fresh gdb.
54
55 gdb_exit
56 gdb_start
57 gdb_reinitialize_dir $srcdir/$subdir
58 gdb_load ${binfile}
59
60 # Does this gdb support info proc?
61 send_gdb "help info proc\n"
62 gdb_expect {
63     -re "Undefined info command: .proc..  Try .help info.*$gdb_prompt $" {
64         # info proc command not supported -- nothing to test here.
65         unsupported "gdb does not support info proc on this target"
66         return -1;
67     }
68     -re "Show /proc process information about .*$gdb_prompt $" {
69         pass "help info proc"
70     }
71     -re ".*$gdb_prompt $" {
72         fail "help info proc"
73     }
74     timeout {
75         fail "help info proc (timeout)"
76     }
77 }
78
79 gdb_test "info proc" "No current process.*" "info proc without a process"
80
81 if { ! [ runto_main ] } then {
82     untested info-proc.exp
83     return -1
84 }
85
86 gdb_test "info proc" "process ${decimal}.*" "info proc with process"
87
88 gdb_test "info proc mapping" \
89         ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \
90         "info proc mapping"