| # Copyright (C) 2010-2019 Free Software Foundation, Inc. |
| |
| # This program is free software; you can redistribute it and/or modify |
| # it under the terms of the GNU General Public License as published by |
| # the Free Software Foundation; either version 3 of the License, or |
| # (at your option) any later version. |
| # |
| # This program is distributed in the hope that it will be useful, |
| # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| # GNU General Public License for more details. |
| # |
| # You should have received a copy of the GNU General Public License |
| # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| |
| if { [prepare_for_testing "failed to prepare" ui-redirect start.c] } { |
| return -1 |
| } |
| |
| gdb_breakpoint main |
| |
| set test "commands" |
| gdb_test_multiple $test $test { |
| -re "End with a line saying just \"end\"\\.\r\n>$" { |
| pass $test |
| } |
| } |
| |
| set test "print 1" |
| gdb_test_multiple $test $test { |
| -re "\r\n>$" { |
| pass $test |
| } |
| } |
| gdb_test_no_output "end" |
| |
| if ![runto_main] { |
| fail "can't run to main" |
| return -1 |
| } |
| gdb_breakpoint "foo" |
| gdb_breakpoint "bar" |
| |
| with_test_prefix "logging" { |
| gdb_test_no_output "set logging file /dev/null" |
| gdb_test "set logging on" \ |
| "Copying output to /dev/null.*Copying debug output to /dev/null\\." |
| gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." |
| gdb_test "set logging off" "Done logging to /dev/null\\." |
| gdb_test "help" "List of classes of commands:.*" |
| } |
| |
| with_test_prefix "redirect" { |
| gdb_test "set logging redirect on" |
| gdb_test "set logging on" \ |
| "Redirecting output to /dev/null.*Copying debug output to /dev/null\\." |
| gdb_test_no_output "save breakpoints /dev/null" |
| gdb_test "set logging off" "Done logging to /dev/null\\." |
| gdb_test "help" "List of classes of commands:.*" |
| } |
| |
| with_test_prefix "redirect while already logging" { |
| gdb_test_no_output "set logging redirect off" |
| gdb_test "set logging on" \ |
| "Copying output to /dev/null.*Copying debug output to /dev/null\\." |
| gdb_test "set logging redirect on" \ |
| ".*warning: Currently logging .*Turn the logging off and on to make the new setting effective.*" |
| gdb_test "save breakpoints /dev/null" "Saved to file '/dev/null'\\." |
| gdb_test "set logging off" "Done logging to /dev/null\\." |
| gdb_test "help" "List of classes of commands:.*" |
| gdb_test_no_output "set logging redirect off" |
| } |
| |
| with_test_prefix "debugging" { |
| gdb_test "set debug infrun 1" |
| gdb_test "set logging on" \ |
| "Copying output to /dev/null.*Copying debug output to /dev/null\\." |
| gdb_test "continue" "Continuing.*infrun:.*infrun:.*Breakpoint \[0-9\]+, foo.*" |
| gdb_test "set debug infrun 0" |
| gdb_test "set logging off" "Done logging to /dev/null\\." |
| gdb_test "help" "List of classes of commands:.*" |
| } |
| |
| with_test_prefix "redirect debugging" { |
| gdb_test_no_output "set logging debugredirect on" |
| gdb_test "set debug infrun 1" |
| gdb_test "set logging on" \ |
| "Copying output to /dev/null.*Redirecting debug output to /dev/null\\." |
| gdb_test "continue" "Continuing.*((?!infrun).).*Breakpoint \[0-9\]+, bar.*" |
| gdb_test "set debug infrun 0" |
| gdb_test "set logging off" "Done logging to /dev/null\\." |
| gdb_test "help" "List of classes of commands:.*" |
| } |