aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/debug-frame.exp
blob: f928f19daec39dd0097653810951b36962393d5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Copyright 2024 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/>.

# Test relies on checking gdb debug output. Do not run if gdb debug is
# enabled as any debug will be redirected to the log.
require !gdb_debug_enabled

standard_testfile .c -2.c
set srcfiles [list $srcfile $srcfile2]
if {[prepare_for_testing "failed to prepare" $testfile $srcfiles]} {
    return -1
}

if ![runto_main] {
    return -1
}

# Redirect debug output to file.
set logfile [host_standard_output_file gdb.txt]
gdb_test_no_output "set logging file $logfile" \
    "set logging file [file tail $logfile]"
gdb_test_no_output "set logging debugredirect on"
gdb_test "set logging enabled on"

# Enable debug frame.
gdb_test "set debug frame 1"

# Check that calling info frame doesn't trigger an exception that escapes to
# the CLI.
set re_locals " Locals at \[^\r\n\]*"
set re_regs1 " Saved registers:"
set re_reg "\[^ \]+ at $hex"
set re_regs2 "  $re_reg,( $re_reg,)*"
set re_regs3 "  ${re_reg}(, $re_reg)*"

set re1 $re_locals
set re2 \
    [multi_line \
	 $re_locals\
	 $re_regs1 \
	 ($re_regs2\r\n)*$re_regs3]
gdb_test "info frame" "\r\n($re1|$re2)"

gdb_test_no_output "set debug frame 0"
gdb_test "set logging enabled off"