1 |
227 |
jeremybenn |
# Copyright 2007, 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 .
|
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 |
|
|
if {![istarget *-*-linux*]
|
19 |
|
|
&& ![istarget *-*-gnu*]
|
20 |
|
|
&& ![istarget *-*-elf*]
|
21 |
|
|
&& ![istarget *-*-openbsd*]
|
22 |
|
|
&& ![istarget arm-*-eabi*]
|
23 |
|
|
&& ![istarget powerpc-*-eabi*]} {
|
24 |
|
|
return 0
|
25 |
|
|
}
|
26 |
|
|
|
27 |
|
|
if { [prepare_for_testing dw2-noloc.exp "dw2-noloc" {dw2-noloc-main.c dw2-noloc.S} {nodebug}] } {
|
28 |
|
|
return -1
|
29 |
|
|
}
|
30 |
|
|
|
31 |
|
|
# Symbols have the form: {file,main}_loc{addr,empty,no}_{,un}resolvable
|
32 |
|
|
# file: Symbol DIE is placed in DW_TAG_compile_unit.
|
33 |
|
|
# main: Symbol DIE is placed in DW_TAG_subprogram.
|
34 |
|
|
# locaddr: DW_AT_location is using DW_FORM_block DW_OP_addr .
|
35 |
|
|
# locempty: DW_AT_location has zero DW_FORM_block size.
|
36 |
|
|
# locno: DW_AT_location is not present.
|
37 |
|
|
# resolvable: .symtab entry exists for this symbol name.
|
38 |
|
|
# unresolvable: .symtab entry does not exist for this symbol name.
|
39 |
|
|
# DW_AT_declaration is not present in any of these DIEs.
|
40 |
|
|
|
41 |
|
|
proc file_symbols {type} {
|
42 |
|
|
global pf_prefix
|
43 |
|
|
set old_prefix $pf_prefix
|
44 |
|
|
lappend pf_prefix "$type:"
|
45 |
|
|
|
46 |
|
|
global gdb_prompt
|
47 |
|
|
|
48 |
|
|
gdb_test "print file_locaddr_resolvable" "= 1234567890"
|
49 |
|
|
gdb_test "ptype file_locaddr_resolvable" "type = int"
|
50 |
|
|
|
51 |
|
|
gdb_test "print file_locaddr_unresolvable" "= 1234567890"
|
52 |
|
|
gdb_test "ptype file_locaddr_unresolvable" "type = int"
|
53 |
|
|
|
54 |
|
|
gdb_test "print file_locempty_resolvable" "= "
|
55 |
|
|
gdb_test "ptype file_locempty_resolvable" "type = int"
|
56 |
|
|
|
57 |
|
|
gdb_test "print file_locempty_unresolvable" "= "
|
58 |
|
|
gdb_test "ptype file_locempty_unresolvable" "type = int"
|
59 |
|
|
|
60 |
|
|
gdb_test "print file_locno_resolvable" "= "
|
61 |
|
|
gdb_test "ptype file_locno_resolvable" "type = int"
|
62 |
|
|
|
63 |
|
|
gdb_test "print file_locno_unresolvable" "= "
|
64 |
|
|
gdb_test "ptype file_locno_unresolvable" "type = int"
|
65 |
|
|
|
66 |
|
|
gdb_test "print file_extern_locaddr_resolvable" "= 1234567890"
|
67 |
|
|
gdb_test "ptype file_extern_locaddr_resolvable" "type = int"
|
68 |
|
|
|
69 |
|
|
gdb_test "print file_extern_locaddr_unresolvable" "= 1234567890"
|
70 |
|
|
gdb_test "ptype file_extern_locaddr_unresolvable" "type = int"
|
71 |
|
|
|
72 |
|
|
gdb_test "print file_extern_locempty_resolvable" "= "
|
73 |
|
|
gdb_test "ptype file_extern_locempty_resolvable" "type = int"
|
74 |
|
|
|
75 |
|
|
gdb_test "print file_extern_locempty_unresolvable" "= "
|
76 |
|
|
gdb_test "ptype file_extern_locempty_unresolvable" "type = int"
|
77 |
|
|
|
78 |
|
|
gdb_test "print file_extern_locno_resolvable" "= 1234567890"
|
79 |
|
|
gdb_test "ptype file_extern_locno_resolvable" "type = int"
|
80 |
|
|
|
81 |
|
|
# `print file_extern_locno_unresolvable' currently prints
|
82 |
|
|
# Address of symbol "file_extern_locno_unresolvable" is unknown.
|
83 |
|
|
# As DW_AT_declaration is not present in this DIE
|
84 |
|
|
# it should print . As usefulness of such DIE is not
|
85 |
|
|
# clear its resolution is not being tested.
|
86 |
|
|
|
87 |
|
|
set pf_prefix $old_prefix
|
88 |
|
|
}
|
89 |
|
|
|
90 |
|
|
file_symbols no-run
|
91 |
|
|
|
92 |
|
|
if ![runto_main] {
|
93 |
|
|
return -1
|
94 |
|
|
}
|
95 |
|
|
|
96 |
|
|
file_symbols in-main
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
gdb_test "print main_local_locaddr_resolvable" "= 1234567890"
|
100 |
|
|
gdb_test "ptype main_local_locaddr_resolvable" "type = int"
|
101 |
|
|
|
102 |
|
|
gdb_test "print main_local_locaddr_unresolvable" "= 1234567890"
|
103 |
|
|
gdb_test "ptype main_local_locaddr_unresolvable" "type = int"
|
104 |
|
|
|
105 |
|
|
gdb_test "print main_local_locempty_resolvable" "= "
|
106 |
|
|
gdb_test "ptype main_local_locempty_resolvable" "type = int"
|
107 |
|
|
|
108 |
|
|
gdb_test "print main_local_locempty_unresolvable" "= "
|
109 |
|
|
gdb_test "ptype main_local_locempty_unresolvable" "type = int"
|
110 |
|
|
|
111 |
|
|
gdb_test "print main_local_locno_resolvable" "= "
|
112 |
|
|
gdb_test "ptype main_local_locno_resolvable" "type = int"
|
113 |
|
|
|
114 |
|
|
gdb_test "print main_local_locno_unresolvable" "= "
|
115 |
|
|
gdb_test "ptype main_local_locno_unresolvable" "type = int"
|
116 |
|
|
|
117 |
|
|
gdb_test "print main_extern_locaddr_resolvable" "= 1234567890"
|
118 |
|
|
gdb_test "ptype main_extern_locaddr_resolvable" "type = int"
|
119 |
|
|
|
120 |
|
|
gdb_test "print main_extern_locaddr_unresolvable" "= 1234567890"
|
121 |
|
|
gdb_test "ptype main_extern_locaddr_unresolvable" "type = int"
|
122 |
|
|
|
123 |
|
|
gdb_test "print main_extern_locempty_resolvable" "= "
|
124 |
|
|
gdb_test "ptype main_extern_locempty_resolvable" "type = int"
|
125 |
|
|
|
126 |
|
|
gdb_test "print main_extern_locempty_unresolvable" "= "
|
127 |
|
|
gdb_test "ptype main_extern_locempty_unresolvable" "type = int"
|
128 |
|
|
|
129 |
|
|
gdb_test "print main_extern_locno_resolvable" "= 1234567890"
|
130 |
|
|
gdb_test "ptype main_extern_locno_resolvable" "type = int"
|
131 |
|
|
|
132 |
|
|
# For `main_extern_locno_unresolvable' see `file_extern_locno_unresolvable'.
|