1 # Copyright
(C
) 2021-2022 Free Software Foundation
, Inc.
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.
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.
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
/>.
16 # Test gdb.PendingFrame.level method.
18 load_lib gdb
-python.exp
22 if { [prepare_for_testing
"failed to prepare" ${testfile} ${srcfile}] } {
26 # Skip all tests
if Python scripting is not enabled.
27 if { [skip_python_tests
] } { continue }
29 if ![runto_main
] then {
33 set pyfile
[gdb_remote_download host $
{srcdir
}/$
{subdir
}/$
{testfile
}.py
]
35 gdb_breakpoint
[gdb_get_line_number
"Break here"]
36 gdb_continue_to_breakpoint
"stop at test breakpoint"
38 # An initial look at the stack to ensure it is correct.
39 gdb_test_sequence
"bt" "Initial backtrace" {
40 "\\r\\n#0 \[^\r\n\]* f0 \\(\\) at "
41 "\\r\\n#1 \[^\r\n\]* f1 \\(\\) at "
42 "\\r\\n#2 \[^\r\n\]* f2 \\(\\) at "
43 "\\r\\n#3 \[^\r\n\]* f3 \\(\\) at "
44 "\\r\\n#4 \[^\r\n\]* main \\(\\) at "
47 #
Load the script containing the unwinder.
48 gdb_test_no_output
"source ${pyfile}"\
49 "import python scripts"
51 # Now look at the stack again
, we should see output from the Python
53 gdb_test_sequence
"bt" "Backtrace with extra Python output" {
56 "\\r\\n#0 \[^\r\n\]* f0 \\(\\) at "
57 "\\r\\n#1 \[^\r\n\]* f1 \\(\\) at "
59 "\\r\\n#2 \[^\r\n\]* f2 \\(\\) at "
61 "\\r\\n#3 \[^\r\n\]* f3 \\(\\) at "
63 "\\r\\n#4 \[^\r\n\]* main \\(\\) at "