blob: 59789f9b6d4a7165f8a944e26781c6cafd168205 [file] [log] [blame]
# Copyright (C) 2011-2021 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
# 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 <>.
load_lib gdb-python.exp
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(\\(\\))?"