summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.python/py-frame-inline.exp
blob: 44726cae0c42056384d3dd7a66157aca07a91554 (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
# Copyright (C) 2011-2022 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/>.

load_lib gdb-python.exp

standard_testfile

if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } {
    return -1
}

# Skip all tests if Python scripting is not enabled.
if { [skip_python_tests] } { continue }

if ![runto_main] then {
    return 0
}

gdb_breakpoint [gdb_get_line_number "break-here"]
gdb_continue_to_breakpoint "Block break here."

gdb_test "info frame" "inlined into frame 1\r\n.*"

gdb_test "up" "#1  g .*"

gdb_test "python print (gdb.selected_frame().read_var('l'))" "\r\n42"

# A regression test for having a backtrace limit that forces unwinding
# to stop after an inline frame.  GDB needs to compute the frame_id of
# the inline frame, which requires unwinding past all the inline
# frames to the real stack frame, even if that means bypassing the
# user visible backtrace limit.  See PR backtrace/15558.
#
# Set the limit, and run to an inline function.  It's important that
# the frame cache is flushed somehow after setting the limit, to force
# frame id recomputation.
gdb_test_no_output "set backtrace limit 1"
gdb_continue_to_breakpoint "Block break here again."

gdb_test "python print (gdb.newest_frame())" ".*"

# Regression test to verify that Frame.function works properly for
# inline frames.
gdb_test "python print (gdb.newest_frame().function())" "f(\\(\\))?"