print PTR.all where PTR is an Ada thin pointer
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.dwarf2 / dwz.exp
CommitLineData
ecd75fc8 1# Copyright 2013-2014 Free Software Foundation, Inc.
f9125b6c
TT
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
16load_lib dwarf.exp
17
18# This test can only be run on targets which support DWARF-2 and use gas.
19if {![dwarf2_support]} {
20 return 0
21}
22
23standard_testfile main.c dwz.S
24
9730e6cc
YQ
25if {[gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile}1.o \
26 object {nodebug}] != ""} {
27 return -1
28}
29
30# Start GDB and load object file, compute the function length which is
31# needed in the Dwarf Assembler below.
32clean_restart ${testfile}1.o
33
34set main_length ""
35set test "disassemble main"
36gdb_test_multiple $test $test {
37 -re ".*$hex <\\+($decimal)>:\[^\r\n\]+\r\nEnd of assembler dump\.\r\n$gdb_prompt $" {
38 set main_length $expect_out(1,string)
39 pass $test
40 }
41}
42
43if { $main_length == "" } {
44 # Bail out here, because we can't do the following tests if
45 # $main_length is unknown.
46 return -1
47}
48
49# Compute the size of the last instruction.
50
51set test "x/2i main+$main_length"
52gdb_test_multiple $test $test {
53 -re ".*($hex) <main\\+$main_length>:\[^\r\n\]+\r\n\[ \]+($hex).*\.\r\n$gdb_prompt $" {
54 set start $expect_out(1,string)
55 set end $expect_out(2,string)
56
57 set main_length [expr $main_length + $end - $start]
58 pass $test
59 }
60}
61
62if { $main_length == "" } {
63 # Bail out here, because we can't do the following tests if
64 # $main_length is unknown.
65 return -1
66}
67
68gdb_exit
69
f9125b6c
TT
70# Create the DWARF.
71set asm_file [standard_output_file $srcfile2]
72Dwarf::assemble $asm_file {
4c2d33e7 73 declare_labels partial_label int_label int_label2
9730e6cc 74 global main_length
f9125b6c
TT
75
76 extern main
77
78 cu {} {
79 partial_label: partial_unit {} {
80 subprogram {
81 {name main}
82 {low_pc main addr}
9730e6cc 83 {high_pc "main + $main_length" addr}
f9125b6c
TT
84 }
85 }
86 }
87
88 cu {} {
89 compile_unit {{language @DW_LANG_C}} {
90 int_label2: base_type {
91 {name int}
92 {byte_size 4 sdata}
93 {encoding @DW_ATE_signed}
94 }
95
96 constant {
97 {name the_int}
98 {type :$int_label2}
99 {const_value 99 data1}
100 }
101
102 constant {
103 {name other_int}
104 {type :$int_label2}
105 {const_value 99 data1}
106 }
107 }
108 }
109
110 cu {} {
111 compile_unit {{language @DW_LANG_C}} {
112 imported_unit {
113 {import $partial_label ref_addr}
114 }
115
116 int_label: base_type {
117 {name int}
118 {byte_size 4 sdata}
119 {encoding @DW_ATE_signed}
120 }
121
122 constant {
123 {name the_int}
124 {type :$int_label}
125 {const_value 23 data1}
126 }
127 }
128 }
129}
130
9730e6cc 131if {[gdb_compile $asm_file ${binfile}2.o object {nodebug}] != ""} {
f9125b6c
TT
132 return -1
133}
134
9730e6cc
YQ
135if {[gdb_compile [list ${binfile}1.o ${binfile}2.o] \
136 "${binfile}" executable {}] != ""} {
137 return -1
138}
139
140clean_restart ${testfile}
141
f9125b6c
TT
142if ![runto_main] {
143 return -1
144}
145
146gdb_test "p other_int" " = 99"
147gdb_test "p the_int" " = 23"
This page took 0.147866 seconds and 4 git commands to generate.