Commit | Line | Data |
---|---|---|
e2882c85 | 1 | # Copyright 2002-2018 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 | ||
f8b41b00 | 21 | standard_testfile break.c break1.c |
a1dea79a | 22 | |
5b362f04 | 23 | if {[prepare_for_testing "failed to prepare" $testfile \ |
f8b41b00 | 24 | [list $srcfile $srcfile2] {debug nowarnings}]} { |
f8b41b00 | 25 | return -1 |
a1dea79a FF |
26 | } |
27 | ||
e04caa70 | 28 | gdb_test "help info proc" "Show additional information about a process.*" |
ca4976a6 | 29 | |
3eca55e8 YQ |
30 | gdb_test_multiple "info proc" "info proc without a process" { |
31 | -re "No current process.*$gdb_prompt $" { | |
32 | pass "info proc without a process" | |
33 | } | |
145b16a9 UW |
34 | -re "Not supported on this target.*$gdb_prompt $" { |
35 | # info proc command not supported -- nothing to test here. | |
36 | unsupported "gdb does not support info proc on this target" | |
ae59b1da | 37 | return -1 |
145b16a9 | 38 | } |
145b16a9 | 39 | } |
ca4976a6 | 40 | |
26d6cec4 AA |
41 | # Set command line arguments to be verified later with "info proc |
42 | # cmdline". However, if we're using a stub, then "set args" would not | |
43 | # have any effect, so then just skip this. | |
44 | ||
45 | set cmdline "" | |
46 | if { ! [use_gdb_stub] } { | |
47 | set cmdline "-i foo bar -o baz 1234" | |
48 | gdb_test_no_output "set args $cmdline" "set args" | |
49 | } | |
50 | ||
3eca55e8 | 51 | if { ! [ runto_main ] } then { |
5b362f04 | 52 | untested "could not run to main" |
3eca55e8 YQ |
53 | return -1 |
54 | } | |
55 | ||
56 | gdb_test "info proc" "process ${decimal}.*" "info proc with process" | |
57 | ||
ca4976a6 MS |
58 | gdb_test "info proc mapping" \ |
59 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ | |
60 | "info proc mapping" | |
451b7c33 TT |
61 | |
62 | if {[istarget "*-*-linux*"]} { | |
26d6cec4 AA |
63 | if { $cmdline != "" } { |
64 | gdb_test "info proc cmdline" "cmdline = '.* $cmdline'" | |
65 | } | |
451b7c33 TT |
66 | set gcorefile [standard_output_file $testfile.gcore] |
67 | if {[gdb_gcore_cmd $gcorefile "save a core file"]} { | |
68 | clean_restart $binfile | |
69 | ||
70 | gdb_test "core $gcorefile" "Core was generated by.*" \ | |
71 | "core [file tail $gcorefile]" | |
72 | ||
73 | gdb_test "info proc mapping" \ | |
74 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ | |
75 | "info proc mapping with core file" | |
76 | } | |
77 | } |