2010-09-16 Phil Muldoon <pmuldoon@redhat.com>
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.mi / dw2-ref-missing-frame.exp
1 # Copyright 2008, 2009, 2010 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 # This test can only be run on targets which support DWARF-2 and use gas.
17 # For now pick a sampling of likely targets.
18 load_lib mi-support.exp
19 set MIFLAGS "-i=mi"
20
21 if {![istarget *-*-linux*]
22 && ![istarget *-*-gnu*]
23 && ![istarget *-*-elf*]
24 && ![istarget *-*-openbsd*]
25 && ![istarget arm-*-eabi*]
26 && ![istarget powerpc-*-eabi*]} {
27 return 0
28 }
29
30 set testfile "dw2-ref-missing-frame"
31 set srcsfile ${testfile}.S
32 set objsfile ${objdir}/${subdir}/${testfile}.o
33 set srcfuncfile ${testfile}-func.c
34 set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
35 set srcmainfile ${testfile}-main.c
36 set objmainfile ${objdir}/${subdir}/${testfile}-main.o
37 set executable ${testfile}
38 set binfile ${objdir}/${subdir}/${executable}
39
40 if { [gdb_compile "${srcdir}/${subdir}/${srcsfile}" $objsfile object {}] != ""
41 || [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" $objfuncfile object {}] != ""
42 || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" $objmainfile object {debug}] != ""
43 || [gdb_compile "$objsfile $objfuncfile $objmainfile" $binfile executable {}] != "" } {
44 return -1
45 }
46
47 if [mi_gdb_start] {
48 continue
49 }
50
51 mi_delete_breakpoints
52 mi_gdb_reinitialize_dir $srcdir/$subdir
53 mi_gdb_load ${binfile}
54
55 if [mi_runto func_nofb_marker] {
56 # First try referencing DW_AT_frame_base which is not defined.
57 mi_gdb_test "300-stack-list-locals --thread 1 --frame 1 --all-values" \
58 "300\\^done,locals=\\\[\{name=\"func_nofb_var\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\},\{name=\"func_nofb_var2\",value=\"\\\<error reading variable: Could not find the frame base for \\\\\"func_nofb\\\\\"\\\.\\\>\"\}\\\].*" \
59 "test func_nofb_marker"
60 }
61
62 # GDB could have crashed.
63 mi_gdb_exit
64 if [mi_gdb_start] {
65 continue
66 }
67 mi_delete_breakpoints
68 mi_gdb_reinitialize_dir $srcdir/$subdir
69 mi_gdb_load ${binfile}
70
71 # And now try referencing DW_AT_frame_base defined using a self-reference
72 # (DW_OP_fbreg).
73 if [mi_runto func_loopfb_marker] {
74 mi_gdb_test "301-stack-list-locals --thread 1 --frame 1 --all-values" \
75 "301\\^done,locals=\\\[\{name=\"func_loopfb_var\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\},\{name=\"func_loopfb_var2\",value=\"\\\<error reading variable: DWARF-2 expression error: Loop detected.*\"\}\\\]" \
76 "test func_loopfb_var"
77 }
This page took 0.032877 seconds and 4 git commands to generate.