]>
Commit | Line | Data |
---|---|---|
4a94e368 | 1 | # Copyright (C) 2021-2022 Free Software Foundation, Inc. |
d52b8007 AB |
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 | # Test gdb.PendingFrame.level method. | |
17 | ||
18 | load_lib gdb-python.exp | |
19 | ||
20 | standard_testfile | |
21 | ||
22 | if { [prepare_for_testing "failed to prepare" ${testfile} ${srcfile}] } { | |
23 | return -1 | |
24 | } | |
25 | ||
26 | # Skip all tests if Python scripting is not enabled. | |
27 | if { [skip_python_tests] } { continue } | |
28 | ||
29 | if ![runto_main] then { | |
d52b8007 AB |
30 | return 0 |
31 | } | |
32 | ||
33 | set pyfile [gdb_remote_download host ${srcdir}/${subdir}/${testfile}.py] | |
34 | ||
35 | gdb_breakpoint [gdb_get_line_number "Break here"] | |
36 | gdb_continue_to_breakpoint "stop at test breakpoint" | |
37 | ||
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 " | |
45 | } | |
46 | ||
47 | # Load the script containing the unwinder. | |
48 | gdb_test_no_output "source ${pyfile}"\ | |
49 | "import python scripts" | |
50 | ||
51 | # Now look at the stack again, we should see output from the Python | |
52 | # unwinder mixed in. | |
53 | gdb_test_sequence "bt" "Backtrace with extra Python output" { | |
54 | "Func f0, Level 0" | |
55 | "Func f1, Level 1" | |
56 | "\\r\\n#0 \[^\r\n\]* f0 \\(\\) at " | |
57 | "\\r\\n#1 \[^\r\n\]* f1 \\(\\) at " | |
58 | "Func f2, Level 2" | |
59 | "\\r\\n#2 \[^\r\n\]* f2 \\(\\) at " | |
60 | "Func f3, Level 3" | |
61 | "\\r\\n#3 \[^\r\n\]* f3 \\(\\) at " | |
62 | "Func main, Level 4" | |
63 | "\\r\\n#4 \[^\r\n\]* main \\(\\) at " | |
64 | } |