Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 2002-2004, 2007-2012 Free Software Foundation, Inc. |
ca4976a6 MS |
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 | |
e22f8b7c | 5 | # the Free Software Foundation; either version 3 of the License, or |
ca4976a6 | 6 | # (at your option) any later version. |
e22f8b7c | 7 | # |
ca4976a6 MS |
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. | |
e22f8b7c | 12 | # |
ca4976a6 | 13 | # You should have received a copy of the GNU General Public License |
e22f8b7c | 14 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
ca4976a6 | 15 | |
ca4976a6 MS |
16 | # This file was written by Michael Snyder (msnyder@redhat.com) |
17 | # This is a test for the gdb command "info proc" | |
18 | ||
ca4976a6 MS |
19 | set ws "\[ \t\]+" |
20 | ||
a1dea79a FF |
21 | set testfile "break" |
22 | set srcfile ${testfile}.c | |
23 | set srcfile1 ${testfile}1.c | |
24 | set binfile ${objdir}/${subdir}/${testfile} | |
25 | ||
fc91c6c2 | 26 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}0.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
27 | untested info-proc.exp |
28 | return -1 | |
a1dea79a FF |
29 | } |
30 | ||
fc91c6c2 | 31 | if { [gdb_compile "${srcdir}/${subdir}/${srcfile1}" "${binfile}1.o" object {debug nowarnings}] != "" } { |
b60f0898 JB |
32 | untested info-proc.exp |
33 | return -1 | |
a1dea79a FF |
34 | } |
35 | ||
fc91c6c2 | 36 | if { [gdb_compile "${binfile}0.o ${binfile}1.o" "${binfile}" executable {debug nowarnings}] != "" } { |
b60f0898 JB |
37 | untested info-proc.exp |
38 | return -1 | |
ca4976a6 MS |
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 | ||
145b16a9 | 48 | gdb_test "help info proc" "Show /proc process information about .*" |
ca4976a6 | 49 | |
3eca55e8 YQ |
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 | } | |
145b16a9 UW |
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 | } | |
145b16a9 | 59 | } |
ca4976a6 | 60 | |
3eca55e8 YQ |
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 | ||
ca4976a6 MS |
68 | gdb_test "info proc mapping" \ |
69 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ | |
70 | "info proc mapping" | |
451b7c33 TT |
71 | |
72 | if {[istarget "*-*-linux*"]} { | |
73 | set gcorefile [standard_output_file $testfile.gcore] | |
74 | if {[gdb_gcore_cmd $gcorefile "save a core file"]} { | |
75 | clean_restart $binfile | |
76 | ||
77 | gdb_test "core $gcorefile" "Core was generated by.*" \ | |
78 | "core [file tail $gcorefile]" | |
79 | ||
80 | gdb_test "info proc mapping" \ | |
81 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ | |
82 | "info proc mapping with core file" | |
83 | } | |
84 | } |