]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.base/page-logging.exp
ec54ba12c65375644feffd40a5db56fba0babe43
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.base / page-logging.exp
1 # Copyright (C) 2021-2023 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 # Do not run if gdb debug is enabled as it will interfere with log redirect.
17 require !gdb_debug_enabled
18
19 gdb_start
20
21 gdb_test_no_output "set height 5"
22 gdb_test_no_output "set pagination on"
23
24 # Test that logging redirect disables the pager.
25 set log_name [standard_output_file log.txt]
26 gdb_test_no_output "set logging file $log_name" \
27 "set logging filename"
28 gdb_test_no_output "set logging redirect on"
29 gdb_test "set logging enabled on" "Copying debug output to .*"
30 set ok 1
31 set str "1\\n2\\n3\\n4\\n5\\n"
32 gdb_test_multiple "printf \"$str\"" "printf without paging" {
33 -re "$pagination_prompt" {
34 set ok 0
35 send_gdb "c\n"
36 exp_continue
37 }
38 -re "\r\n$gdb_prompt $" {
39 # Ok.
40 }
41 }
42 if {$ok} {
43 pass "printf without paging"
44 } else {
45 fail "printf without paging"
46 }
47 gdb_test "set logging enabled off" "Done logging to .*"
48
49 set cmd "interpreter-exec mi2 \"-data-evaluate-expression 23\""
50 gdb_test_multiple $cmd $cmd {
51 -re ".done.value=.23\[^\n\]+\r\n$gdb_prompt " {
52 pass "$cmd"
53 gdb_expect 1 {
54 -re "\r\n$gdb_prompt $" { }
55 }
56 }
57 }