Commit | Line | Data |
---|---|---|
4c38e0a4 | 1 | # Copyright 2009, 2010 Free Software Foundation, Inc. |
b321dd90 PA |
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 multi-exec / multi-process features that work for all configurations, | |
17 | # even ones that cannot run multiple processes simultaneously. | |
18 | ||
19 | set testfile "base" | |
20 | ||
21 | set exec1 "hello" | |
22 | set srcfile1 ${exec1}.c | |
23 | set binfile1 ${objdir}/${subdir}/${exec1} | |
24 | ||
25 | set exec2 "hangout" | |
26 | set srcfile2 ${exec2}.c | |
27 | set binfile2 ${objdir}/${subdir}/${exec2} | |
28 | ||
29 | set exec3 "goodbye" | |
30 | set srcfile3 ${exec3}.c | |
31 | set binfile3 ${objdir}/${subdir}/${exec3} | |
32 | ||
33 | if { [prepare_for_testing ${testfile}.exp ${exec1} "${srcfile1}" {debug nowarnings}] } { | |
34 | return -1 | |
35 | } | |
36 | ||
37 | if { [prepare_for_testing ${testfile}.exp ${exec2} "${srcfile2}" {debug nowarnings}] } { | |
38 | return -1 | |
39 | } | |
40 | ||
41 | if { [prepare_for_testing ${testfile}.exp ${exec3} "${srcfile3}" {debug nowarnings}] } { | |
42 | return -1 | |
43 | } | |
44 | ||
45 | gdb_exit | |
46 | gdb_start | |
47 | gdb_reinitialize_dir $srcdir/$subdir | |
48 | gdb_load ${binfile1} | |
49 | ||
50 | # Add an empty inferior space, switch to it, and load a main | |
51 | # executable into it. | |
52 | gdb_test "add-inferior" "Added inferior 2.*" | |
53 | gdb_test "inferior 2" "Switching to inferior 2.*" | |
54 | gdb_test "file ${binfile2}" "" | |
55 | ||
56 | # Add a new inferior space and load a main executable into it in one | |
57 | # command. | |
58 | gdb_test "add-inferior -exec ${binfile3}" | |
59 | ||
60 | # Check that we have multiple spaces. | |
61 | ||
62 | gdb_test "info inferiors" \ | |
63 | "Executable.*${exec3}.*${exec2}.*${exec1}.*" | |
64 | ||
65 | # Test that we have multiple symbol tables. | |
66 | ||
67 | gdb_test "inferior 1" | |
68 | gdb_test "info functions commonfun" "${srcfile1}.*" | |
69 | ||
70 | gdb_test "inferior 3" | |
71 | gdb_test "info functions commonfun" "${srcfile3}.*" | |
72 | ||
73 | ||
74 | gdb_test "inferior 1" | |
75 | ||
76 | gdb_test "set listsize 1" "" | |
77 | ||
78 | gdb_test "list commonfun" "from hello.*" | |
79 | ||
80 | gdb_test "print hglob" "1" | |
81 | ||
82 | gdb_test "print glob" "92" "print glob (${exec1})" | |
83 | ||
84 | ||
85 | gdb_test "inferior 3" | |
86 | ||
87 | gdb_test "print gglob" "2" | |
88 | ||
89 | gdb_test "print glob" "45" "print glob (${exec3})" | |
90 | ||
91 | gdb_test "list commonfun" "from goodbye.*" | |
92 | ||
93 | ||
94 | # Let's run the hello program. | |
95 | gdb_test "inferior 1" | |
96 | ||
97 | if { ![runto_main] } then { | |
98 | return -1 | |
99 | } | |
100 | ||
101 | gdb_test "break hello" "" | |
102 | gdb_test "continue" "Breakpoint \[0-9\].*, hello.*" |