[gdb/testsuite] Factor out lib/valgrind.exp
[external/binutils.git] / gdb / testsuite / gdb.base / wrong_frame_bt_full.exp
1 # Copyright (C) 2015-2018 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 # Build wrong_frame_bt_full-main using two C files:
17 #   - wrong_frame_bt_full-opaque.c, which needs to be built without
18 #     debugging info;
19 #   - wrong_frame_bt_full-main.c, which needs to be built with
20 #     debugging info.
21 # This is why we use gdb_compile instead of relying on he usual call
22 # to prepare_for_testing.
23
24 set main_testfile wrong_frame_bt_full-main
25 set opaque_testfile wrong_frame_bt_full-opaque
26 set opaque_objfile [standard_output_file "$opaque_testfile.o"]
27
28 if {[gdb_compile "${srcdir}/${subdir}/$opaque_testfile.c" \
29                  $opaque_objfile \
30                  object {}] != ""} {
31   untested "failed to compile"
32   return -1
33 }
34
35 if {[gdb_compile \
36       [list ${srcdir}/${subdir}/$main_testfile.c $opaque_objfile] \
37       [standard_output_file ${main_testfile}] \
38       executable {debug}] != ""} {
39     untested "failed to build $main_testfile"
40     return -1
41 }
42
43 clean_restart ${main_testfile}
44
45 if ![runto opaque_routine] {
46     untested "could not run to opaque_routine"
47     return -1
48 }
49
50 # Make sure that "bt full" command is capable of displaying MY_TABLE
51 # correctly when frame #0 (the frame which does not have any debugging
52 # info) is the selected frame.
53
54 gdb_test "bt full" \
55          ".*\[\r\n\]+ *my_table = \\{0, 1, 2\\}\[\r\n\]+.*"
56