Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: experimental/visual_studio_plugin/src/dwarf_reader/dwarf_strings.cc

Issue 10928195: First round of dead file removal (Closed) Base URL: https://github.com/samclegg/nativeclient-sdk.git@master
Patch Set: Created 8 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Native Client Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <assert.h>
6
7 #include <map>
8
9 #include "common/dwarf/dwarf2enums.h"
10 #include "common/dwarf/types.h"
11
12 #include "dwarf_reader/dwarf_strings.h"
13
14
15 static int32 s_DwarfStringsInit = 0;
16
17 static std::map<uint32,const char *> s_FormMap;
18 static std::map<uint32,const char *> s_TagMap;
19 static std::map<uint32,const char *> s_AttributeMap;
20
21 #define SET_TAG(x) s_TagMap[DW_TAG_##x] = #x;
22 #define SET_ATTR(x) s_AttributeMap[DW_AT_##x] = #x;
23 #define SET_FORM(x) s_FormMap[DW_FORM_##x] = #x;
24
25
26 using namespace dwarf2reader;
27
28 namespace dwarf_reader {
29
30 static void BuildTagLookup() {
31 SET_TAG(padding)
32 SET_TAG(array_type)
33 SET_TAG(class_type)
34 SET_TAG(entry_point)
35 SET_TAG(enumeration_type)
36 SET_TAG(formal_parameter)
37 SET_TAG(imported_declaration)
38 SET_TAG(label)
39 SET_TAG(lexical_block)
40 SET_TAG(member)
41 SET_TAG(pointer_type)
42 SET_TAG(reference_type)
43 SET_TAG(compile_unit)
44 SET_TAG(string_type)
45 SET_TAG(structure_type)
46 SET_TAG(subroutine_type)
47 SET_TAG(typedef)
48 SET_TAG(union_type)
49 SET_TAG(unspecified_parameters)
50 SET_TAG(variant)
51 SET_TAG(common_block)
52 SET_TAG(common_inclusion)
53 SET_TAG(inheritance)
54 SET_TAG(inlined_subroutine)
55 SET_TAG(module)
56 SET_TAG(ptr_to_member_type)
57 SET_TAG(set_type)
58 SET_TAG(subrange_type)
59 SET_TAG(with_stmt)
60 SET_TAG(access_declaration)
61 SET_TAG(base_type)
62 SET_TAG(catch_block)
63 SET_TAG(const_type)
64 SET_TAG(constant)
65 SET_TAG(enumerator)
66 SET_TAG(file_type)
67 SET_TAG(friend)
68 SET_TAG(namelist)
69 SET_TAG(namelist_item)
70 SET_TAG(packed_type)
71 SET_TAG(subprogram)
72 SET_TAG(template_type_param)
73 SET_TAG(template_value_param)
74 SET_TAG(thrown_type)
75 SET_TAG(try_block)
76 SET_TAG(variant_part)
77 SET_TAG(variable)
78 SET_TAG(volatile_type)
79 // DWARF 3.
80 SET_TAG(dwarf_procedure)
81 SET_TAG(restrict_type)
82 SET_TAG(interface_type)
83 SET_TAG(namespace)
84 SET_TAG(imported_module)
85 SET_TAG(unspecified_type)
86 SET_TAG(partial_unit)
87 SET_TAG(imported_unit)
88 // SGI/MIPS Extensions.
89 SET_TAG(MIPS_loop)
90 // HP extensions. See:
91 // ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz
92 SET_TAG(HP_array_descriptor)
93 // GNU extensions.
94 SET_TAG(format_label)
95 SET_TAG(function_template)
96 SET_TAG(class_template)
97 SET_TAG(GNU_BINCL)
98 SET_TAG(GNU_EINCL)
99 // Extensions for UPC. See: http://upc.gwu.edu/~upc.
100 SET_TAG(upc_shared_type)
101 SET_TAG(upc_strict_type)
102 SET_TAG(upc_relaxed_type)
103 // PGI (STMicroelectronics) extensions. No documentation available.
104 SET_TAG(PGI_kanji_type)
105 SET_TAG(PGI_interface_block)
106 }
107
108 static void BuildAttributeLookup() {
109 SET_ATTR(sibling)
110 SET_ATTR(location)
111 SET_ATTR(name)
112 SET_ATTR(ordering)
113 SET_ATTR(subscr_data)
114 SET_ATTR(byte_size)
115 SET_ATTR(bit_offset)
116 SET_ATTR(bit_size)
117 SET_ATTR(element_list)
118 SET_ATTR(stmt_list)
119 SET_ATTR(low_pc)
120 SET_ATTR(high_pc)
121 SET_ATTR(language)
122 SET_ATTR(member)
123 SET_ATTR(discr)
124 SET_ATTR(discr_value)
125 SET_ATTR(visibility)
126 SET_ATTR(import)
127 SET_ATTR(string_length)
128 SET_ATTR(common_reference)
129 SET_ATTR(comp_dir)
130 SET_ATTR(const_value)
131 SET_ATTR(containing_type)
132 SET_ATTR(default_value)
133 SET_ATTR(inline)
134 SET_ATTR(is_optional)
135 SET_ATTR(lower_bound)
136 SET_ATTR(producer)
137 SET_ATTR(prototyped)
138 SET_ATTR(return_addr)
139 SET_ATTR(start_scope)
140 SET_ATTR(stride_size)
141 SET_ATTR(upper_bound)
142 SET_ATTR(abstract_origin)
143 SET_ATTR(accessibility)
144 SET_ATTR(address_class)
145 SET_ATTR(artificial)
146 SET_ATTR(base_types)
147 SET_ATTR(calling_convention)
148 SET_ATTR(count)
149 SET_ATTR(data_member_location)
150 SET_ATTR(decl_column)
151 SET_ATTR(decl_file)
152 SET_ATTR(decl_line)
153 SET_ATTR(declaration)
154 SET_ATTR(discr_list)
155 SET_ATTR(encoding)
156 SET_ATTR(external)
157 SET_ATTR(frame_base)
158 SET_ATTR(friend)
159 SET_ATTR(identifier_case)
160 SET_ATTR(macro_info)
161 SET_ATTR(namelist_items)
162 SET_ATTR(priority)
163 SET_ATTR(segment)
164 SET_ATTR(specification)
165 SET_ATTR(static_link)
166 SET_ATTR(type)
167 SET_ATTR(use_location)
168 SET_ATTR(variable_parameter)
169 SET_ATTR(virtuality)
170 SET_ATTR(vtable_elem_location)
171 // DWARF 3 values.
172 SET_ATTR(allocated)
173 SET_ATTR(associated)
174 SET_ATTR(data_location)
175 SET_ATTR(stride)
176 SET_ATTR(entry_pc)
177 SET_ATTR(use_UTF8)
178 SET_ATTR(extension)
179 SET_ATTR(ranges)
180 SET_ATTR(trampoline)
181 SET_ATTR(call_column)
182 SET_ATTR(call_file)
183 SET_ATTR(call_line)
184 // SGI/MIPS extensions.
185 SET_ATTR(MIPS_fde)
186 SET_ATTR(MIPS_loop_begin)
187 SET_ATTR(MIPS_tail_loop_begin)
188 SET_ATTR(MIPS_epilog_begin)
189 SET_ATTR(MIPS_loop_unroll_factor)
190 SET_ATTR(MIPS_software_pipeline_depth)
191 SET_ATTR(MIPS_linkage_name)
192 SET_ATTR(MIPS_stride)
193 SET_ATTR(MIPS_abstract_name)
194 SET_ATTR(MIPS_clone_origin)
195 SET_ATTR(MIPS_has_inlines)
196 // HP extensions.
197 SET_ATTR(HP_block_index)
198 SET_ATTR(HP_unmodifiable)
199 SET_ATTR(HP_actuals_stmt_list)
200 SET_ATTR(HP_proc_per_section)
201 SET_ATTR(HP_raw_data_ptr)
202 SET_ATTR(HP_pass_by_reference)
203 SET_ATTR(HP_opt_level)
204 SET_ATTR(HP_prof_version_id)
205 SET_ATTR(HP_opt_flags)
206 SET_ATTR(HP_cold_region_low_pc )
207 SET_ATTR(HP_cold_region_high_pc)
208 SET_ATTR(HP_all_variables_modifiable)
209 SET_ATTR(HP_linkage_name)
210 SET_ATTR(HP_prof_flags)
211 // GNU extensions.
212 SET_ATTR(sf_names)
213 SET_ATTR(src_info)
214 SET_ATTR(mac_info)
215 SET_ATTR(src_coords)
216 SET_ATTR(body_begin)
217 SET_ATTR(body_end)
218 SET_ATTR(GNU_vector)
219 // VMS extensions.
220 SET_ATTR(VMS_rtnbeg_pd_address)
221 // UPC extension.
222 SET_ATTR(upc_threads_scaled)
223 // PGI (STMicroelectronics) extensions.
224 SET_ATTR(PGI_lbase)
225 SET_ATTR(PGI_soffset)
226 SET_ATTR(PGI_lstride)
227 }
228
229 static void BuildFormLookup() {
230 // Form names and codes.
231 SET_FORM(addr)
232 SET_FORM(block2)
233 SET_FORM(block4)
234 SET_FORM(data2)
235 SET_FORM(data4)
236 SET_FORM(data8)
237 SET_FORM(string)
238 SET_FORM(block)
239 SET_FORM(block1)
240 SET_FORM(data1)
241 SET_FORM(flag)
242 SET_FORM(sdata)
243 SET_FORM(strp)
244 SET_FORM(udata)
245 SET_FORM(ref_addr)
246 SET_FORM(ref1)
247 SET_FORM(ref2)
248 SET_FORM(ref4)
249 SET_FORM(ref8)
250 SET_FORM(ref_udata)
251 SET_FORM(indirect)
252 }
253
254
255 static inline void BuildLookups() {
256 if (!s_DwarfStringsInit) {
257 s_DwarfStringsInit = 1;
258 BuildTagLookup();
259 BuildFormLookup();
260 BuildAttributeLookup();
261 }
262 }
263
264
265 const char *DwarfAttributeName(enum DwarfAttribute attr) {
266 const char *out;
267
268 BuildLookups();
269
270 if (attr == DW_AT_data_member_location)
271 out = 0;
272
273 out = s_AttributeMap[attr];
274 assert(NULL != out);
275 return out;
276 }
277
278 const char *DwarfTagName(enum DwarfTag tag) {
279 const char *out;
280
281 BuildLookups();
282
283 out = s_TagMap[tag];
284 assert(NULL != out);
285 return out;
286 }
287
288
289 const char *DwarfFormName(enum DwarfForm form) {
290 const char *out;
291
292 BuildLookups();
293
294 out = s_FormMap[form];
295 assert(NULL != out);
296 return out;
297 }
298
299
300 } // namespace dwarf2reader
301
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698