1# Copyright 2002, 2003, 2004 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# This file was written by Michael Snyder (msnyder@redhat.com)
21# This is a test for the gdb command "info proc"
22
23if $tracelevel then {
24	strace $tracelevel
25}
26
27set prms_id 0
28set bug_id 0
29
30set ws "\[ \t\]+"
31
32set testfile "break"
33set srcfile ${testfile}.c
34set srcfile1 ${testfile}1.c
35set binfile ${objdir}/${subdir}/${testfile}
36
37if  { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug additional_flags=-w}] != "" } {
38     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
39}
40
41if  { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug additional_flags=-w}] != "" } {
42     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
43}
44
45if  { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug additional_flags=-w}] != "" } {
46     gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
47}
48
49# Start with a fresh gdb.
50
51gdb_exit
52gdb_start
53gdb_reinitialize_dir $srcdir/$subdir
54gdb_load ${binfile}
55
56# Does this gdb support info proc?
57send_gdb "help info proc\n"
58gdb_expect {
59    -re "Undefined info command: .proc..  Try .help info.*$gdb_prompt $" {
60	# info proc command not supported -- nothing to test here.
61	unsupported "gdb does not support info proc on this target"
62	return -1;
63    }
64    -re "Show /proc process information about .*$gdb_prompt $" {
65	pass "help info proc"
66    }
67    -re ".*$gdb_prompt $" {
68	fail "help info proc"
69    }
70    timeout {
71	fail "help info proc (timeout)"
72    }
73}
74
75gdb_test "info proc" "No current process.*" "info proc without a process"
76
77if { ! [ runto_main ] } then {
78    gdb_suppress_entire_file "Run to main failed, so all tests in this file will automatically fail."
79}
80
81gdb_test "info proc" "process ${decimal}.*" "info proc with process"
82
83gdb_test "info proc mapping" \
84	".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \
85	"info proc mapping"
86