| 1 | # Copyright 2002-2016 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 | standard_testfile break.c break1.c |
| 22 | |
| 23 | if {[prepare_for_testing $testfile.exp $testfile \ |
| 24 | [list $srcfile $srcfile2] {debug nowarnings}]} { |
| 25 | untested $testfile.exp |
| 26 | return -1 |
| 27 | } |
| 28 | |
| 29 | gdb_test "help info proc" "Show /proc process information about .*" |
| 30 | |
| 31 | gdb_test_multiple "info proc" "info proc without a process" { |
| 32 | -re "No current process.*$gdb_prompt $" { |
| 33 | pass "info proc without a process" |
| 34 | } |
| 35 | -re "Not supported on this target.*$gdb_prompt $" { |
| 36 | # info proc command not supported -- nothing to test here. |
| 37 | unsupported "gdb does not support info proc on this target" |
| 38 | return -1 |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | if { ! [ runto_main ] } then { |
| 43 | untested info-proc.exp |
| 44 | return -1 |
| 45 | } |
| 46 | |
| 47 | gdb_test "info proc" "process ${decimal}.*" "info proc with process" |
| 48 | |
| 49 | gdb_test "info proc mapping" \ |
| 50 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ |
| 51 | "info proc mapping" |
| 52 | |
| 53 | if {[istarget "*-*-linux*"]} { |
| 54 | set gcorefile [standard_output_file $testfile.gcore] |
| 55 | if {[gdb_gcore_cmd $gcorefile "save a core file"]} { |
| 56 | clean_restart $binfile |
| 57 | |
| 58 | gdb_test "core $gcorefile" "Core was generated by.*" \ |
| 59 | "core [file tail $gcorefile]" |
| 60 | |
| 61 | gdb_test "info proc mapping" \ |
| 62 | ".*Mapped address spaces:.*${hex}${ws}${hex}${ws}${hex}${ws}${hex}.*" \ |
| 63 | "info proc mapping with core file" |
| 64 | } |
| 65 | } |