Automatic Copyright Year update after running gdb/copyright.py
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-auto-load-chaining.exp
1 # Copyright (C) 2021-2022 Free Software Foundation, Inc.
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 that the value of gdb.current_objfile is correct even when one
17 # auto-load script loads a second objfile, which triggers the
18 # execution of another (nested) objfile script.
19
20 load_lib gdb-python.exp
21
22 standard_testfile .c -f1.c -f2.c
23
24 # Two additional object files needed for this test.
25 set f1_o [standard_output_file ${gdb_test_file_name}-f1.o]
26 set f2_o [standard_output_file ${gdb_test_file_name}-f2.o]
27
28 # Now build the object files.
29 if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" ${f1_o} object {}] != ""} {
30 untested "failed to compile object file f1.o"
31 return -1
32 }
33
34 if {[gdb_compile "${srcdir}/${subdir}/${srcfile3}" ${f2_o} object {}] != ""} {
35 untested "failed to compile object file f2.o"
36 return -1
37 }
38
39 # Copy the two Python scripts to where the tests are being run.
40 set remote_python_file [gdb_remote_download host \
41 ${srcdir}/${subdir}/${testfile}-f1.o-gdb.py]
42 set remote_python_file [gdb_remote_download host \
43 ${srcdir}/${subdir}/${testfile}-f2.o-gdb.py]
44
45 # Build the main test executable and start GDB.
46 if {[prepare_for_testing "failed to prepare" ${testfile} ${srcfile}]} {
47 return -1
48 }
49
50 # Skip all tests if Python scripting is not enabled.
51 if { [skip_python_tests] } { continue }
52
53 if ![runto_main] {
54 return -1
55 }
56
57 set safe_path [standard_output_file ""]
58 gdb_test_no_output "set auto-load safe-path ${safe_path}" \
59 "set auto-load safe-path"
60
61 gdb_breakpoint [gdb_get_line_number "Break Here"]
62 gdb_continue_to_breakpoint "run to test breakpoint"
63
64 gdb_test_no_output "set confirm off"
65 gdb_test "add-symbol-file ${f1_o} region_1" \
66 [multi_line \
67 "Entering f1\\.o auto-load script" \
68 "Current objfile is: \[^\r\n\]+/py-auto-load-chaining-f1\\.o" \
69 "Chain loading f2\\.o\\.\\.\\." \
70 "add symbol table from file \"\[^\r\n\]+/py-auto-load-chaining-f2\\.o\" at" \
71 "\\s+\\.text_addr = $hex" \
72 "Entering f2\\.o auto-load script" \
73 "Current objfile is: \[^\r\n\]+/py-auto-load-chaining-f2\\.o" \
74 "Leaving f2\\.o auto-load script" \
75 "After loading f2\\.o\\.\\.\\." \
76 "Current objfile is: \[^\r\n\]+/py-auto-load-chaining-f1\\.o" \
77 "Leaving f1\\.o auto-load script"] \
78 "add-symbol-file f1.o"
This page took 0.031339 seconds and 4 git commands to generate.