]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blob - gdb/testsuite/gdb.dwarf2/dw2-ref-missing-frame.exp
2011-01-19 Yao Qi <yao@codesourcery.com>
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dw2-ref-missing-frame.exp
1 # Copyright 2008, 2009, 2010, 2011 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 load_lib dwarf.exp
16
17 # This test can only be run on targets which support DWARF-2 and use gas.
18 if {![dwarf2_support]} {
19 return 0
20 }
21
22 set testfile "dw2-ref-missing-frame"
23 set srcsfile ${testfile}.S
24 set objsfile ${objdir}/${subdir}/${testfile}.o
25 set srcfuncfile ${testfile}-func.c
26 set objfuncfile ${objdir}/${subdir}/${testfile}-func.o
27 set srcmainfile ${testfile}-main.c
28 set objmainfile ${objdir}/${subdir}/${testfile}-main.o
29 set executable ${testfile}
30 set binfile ${objdir}/${subdir}/${executable}
31
32 if { [gdb_compile "${srcdir}/${subdir}/${srcsfile}" $objsfile object {}] != ""
33 || [gdb_compile "${srcdir}/${subdir}/${srcfuncfile}" $objfuncfile object {}] != ""
34 || [gdb_compile "${srcdir}/${subdir}/${srcmainfile}" $objmainfile object {debug}] != ""
35 || [gdb_compile "$objsfile $objfuncfile $objmainfile" $binfile executable {}] != "" } {
36 return -1
37 }
38
39 clean_restart $executable
40
41 # First try referencing DW_AT_frame_base which is not defined.
42 if [runto func_nofb] {
43 gdb_test "p func_nofb_var" {Could not find the frame base for "func_nofb".} "func_nofb print"
44 gdb_test "bt full" " in main .* main_var = 1" "func_nofb backtrace"
45 }
46
47 # GDB could have crashed.
48 clean_restart $executable
49
50 # And now try referencing DW_AT_frame_base defined using a self-reference
51 # (DW_OP_fbreg).
52 if [runto func_loopfb] {
53 gdb_test "p func_loopfb_var" "DWARF-2 expression error: Loop detected .*" "func_loopfb print"
54 gdb_test "bt full" " in main .* main_var = 1" "func_loopfb backtrace"
55 }