Commit | Line | Data |
---|---|---|
0b302171 | 1 | # Copyright 2011-2012 Free Software Foundation, Inc. |
9ac7f98e JB |
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 | load_lib "ada.exp" | |
17 | ||
18 | set testdir "task_bp" | |
19 | set testfile "${testdir}/foo" | |
20 | set srcfile ${srcdir}/${subdir}/${testfile}.adb | |
21 | set binfile ${objdir}/${subdir}/${testfile} | |
22 | ||
23 | file mkdir ${objdir}/${subdir}/${testdir} | |
24 | if {[gdb_compile_ada "${srcfile}" "${binfile}" executable [list debug]] != "" } { | |
25 | return -1 | |
26 | } | |
27 | ||
28 | # Insert a breakpoint at LOC, and run the program expecting us to | |
29 | # reach that breakpoint. | |
30 | # | |
31 | # LOC is expected to be a linespec referencing the body of task | |
32 | # Pck.Dummy_Task (the purpose is to test all the variations of | |
33 | # these equivalent linespecs). | |
34 | # | |
35 | # MSG is just a string that's used to qualify the name of the tests | |
36 | # that are executed inside that procedure. The purpose to be able | |
37 | # to call that function multiple times with the same linespec, in | |
38 | # order to test one given linespec under multiple conditions. | |
39 | ||
40 | proc test_bp { loc msg } { | |
41 | gdb_test "break $loc" \ | |
42 | "Breakpoint \[0-9\]+ at 0x\[0-9a-fA-F\]+: file .*pck.adb, line \[0-9\]+\." \ | |
43 | "break $loc - $msg" | |
44 | ||
45 | gdb_run_cmd | |
46 | gdb_test "" \ | |
47 | "Breakpoint \[0-9\]+, pck\\.dummy_task (.*)" \ | |
48 | "run to $loc - $msg" | |
49 | } | |
50 | ||
51 | set all_linespecs { "pck.dummy_task" "dummy_task" | |
52 | "pck.adb:pck.dummy_task" "pck.adb:dummy_task"} | |
53 | ||
54 | # First, test the linespecs when the associated symtab hasn't been | |
55 | # expanded yet. | |
56 | ||
57 | foreach linespec $all_linespecs { | |
58 | clean_restart ${testfile} | |
59 | test_bp $linespec "from psymtab" | |
60 | } | |
61 | ||
62 | # Now, do the same, but with the associated symtab already expanded. | |
63 | ||
64 | foreach linespec $all_linespecs { | |
65 | clean_restart ${testfile} | |
66 | gdb_test "list pck.adb:1" ".*" "expanding symtab for $linespec" | |
67 | test_bp $linespec "from full symtab" | |
68 | } |