1cefb6db90c3b597c7fe70dac5872dc0c45b28cf
[binutils-gdb.git] / gdb / testsuite / gdb.base / info-proc.exp
1 # Copyright 2002-2004, 2007-2012 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 <http://www.gnu.org/licenses/>.
15
16 # This file was written by Michael Snyder (msnyder@redhat.com)
17 # This is a test for the gdb command "info proc"
18
19 set ws "\[ \t\]+"
20
21 set testfile "break"
22 set srcfile ${testfile}.c
23 set srcfile1 ${testfile}1.c
24 set binfile ${objdir}/${subdir}/${testfile}
25
26 if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } {
27 untested info-proc.exp
28 return -1
29 }
30
31 if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } {
32 untested info-proc.exp
33 return -1
34 }
35
36 if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } {
37 untested info-proc.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 gdb_test "help info proc" "Show /proc process information about .*"
49
50 gdb_test_multiple "info proc" "info proc without a process" {
51 -re "No current process.*$gdb_prompt $" {
52 pass "info proc without a process"
53 }
54 -re "Not supported on this target.*$gdb_prompt $" {
55 # info proc command not supported -- nothing to test here.
56 unsupported "gdb does not support info proc on this target"
57 return -1;
58 }
59 }
60
61 if { ! [ runto_main ] } then {
62 untested info-proc.exp
63 return -1
64 }
65
66 gdb_test "info proc" "process ${decimal}.*" "info proc with process"
67
68 gdb_test "info proc mapping" \
69 ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \
70 "info proc mapping"