authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-08-23 07:10:09-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2016-08-29 22:13:59-07:00
log6149f7318986214a34b09347f28ba48b2a614fef
tree8b98adae2cf59dbf807c95d7a91102310a416ddf
parented50bd1b655ff028bdd650edecdcdd6675f1dee0

std: more progress toward stack printing


2 files changed, 644 insertions(+), 4 deletions(-)

std/debug.zig+23-4
......@@ -2,6 +2,7 @@ const Allocator = @import("mem.zig").Allocator;
22const io = @import("io.zig");
33const os = @import("os.zig");
44const elf = @import("elf.zig");
5const DW = @import("dwarf.zig");
56
67pub error MissingDebugInfo;
78pub error InvalidDebugInfo;
......@@ -27,6 +28,7 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void {
2728 defer %return st.elf.close();
2829
2930 st.aranges = %return st.elf.findSection(".debug_aranges");
31 st.debug_info = (%return st.elf.findSection(".debug_info")) ?? return error.MissingDebugInfo;
3032
3133 var maybe_fp: ?&const u8 = @frameAddress();
3234 while (true) {
......@@ -34,7 +36,7 @@ pub fn writeStackTrace(out_stream: &io.OutStream) -> %void {
3436 const return_address = *(&const usize)(usize(fp) + @sizeOf(usize));
3537
3638 // read .debug_aranges to find out which compile unit the address is in
37 const debug_info_offset = %return debugInfoOffset(&st, return_address);
39 const compile_unit_offset = %return findCompileUnitOffset(&st, return_address);
3840
3941 %return out_stream.printInt(usize, return_address);
4042 %return out_stream.printf(" -> ");
......@@ -59,11 +61,28 @@ struct ElfStackTrace {
5961 self_exe_stream: io.InStream,
6062 elf: elf.Elf,
6163 aranges: ?&elf.SectionHeader,
64 debug_info: &elf.SectionHeader,
6265}
6366
64fn debugInfoOffset(st: &ElfStackTrace, target_address: usize) -> %u64 {
65 // when there is no .debug_aranges section, offset into debug info is 0x0
66 const aranges = st.aranges ?? return 0;
67fn findCompileUnitOffset(st: &ElfStackTrace, target_address: usize) -> %u64 {
68 if (const result ?= %return arangesOffset(st, target_address))
69 return result;
70
71 // iterate over compile units looking for a match with the low pc and high pc
72 %return st.elf.seekToSection(st.debug_info);
73
74 while (true) {
75 const tag_id = %return st.self_exe_stream.readByte();
76 if (tag_id == DW.TAG_compile_unit) {
77
78 } else {
79
80 }
81 }
82}
83
84fn arangesOffset(st: &ElfStackTrace, target_address: usize) -> %?u64 {
85 const aranges = ?return st.aranges;
6786
6887 %return st.elf.seekToSection(aranges);
6988
std/dwarf.zig created+621
......@@ -0,0 +1,621 @@
1pub const TAG_padding = 0x00;
2pub const TAG_array_type = 0x01;
3pub const TAG_class_type = 0x02;
4pub const TAG_entry_point = 0x03;
5pub const TAG_enumeration_type = 0x04;
6pub const TAG_formal_parameter = 0x05;
7pub const TAG_imported_declaration = 0x08;
8pub const TAG_label = 0x0a;
9pub const TAG_lexical_block = 0x0b;
10pub const TAG_member = 0x0d;
11pub const TAG_pointer_type = 0x0f;
12pub const TAG_reference_type = 0x10;
13pub const TAG_compile_unit = 0x11;
14pub const TAG_string_type = 0x12;
15pub const TAG_structure_type = 0x13;
16pub const TAG_subroutine_type = 0x15;
17pub const TAG_typedef = 0x16;
18pub const TAG_union_type = 0x17;
19pub const TAG_unspecified_parameters = 0x18;
20pub const TAG_variant = 0x19;
21pub const TAG_common_block = 0x1a;
22pub const TAG_common_inclusion = 0x1b;
23pub const TAG_inheritance = 0x1c;
24pub const TAG_inlined_subroutine = 0x1d;
25pub const TAG_module = 0x1e;
26pub const TAG_ptr_to_member_type = 0x1f;
27pub const TAG_set_type = 0x20;
28pub const TAG_subrange_type = 0x21;
29pub const TAG_with_stmt = 0x22;
30pub const TAG_access_declaration = 0x23;
31pub const TAG_base_type = 0x24;
32pub const TAG_catch_block = 0x25;
33pub const TAG_const_type = 0x26;
34pub const TAG_constant = 0x27;
35pub const TAG_enumerator = 0x28;
36pub const TAG_file_type = 0x29;
37pub const TAG_friend = 0x2a;
38pub const TAG_namelist = 0x2b;
39pub const TAG_namelist_item = 0x2c;
40pub const TAG_packed_type = 0x2d;
41pub const TAG_subprogram = 0x2e;
42pub const TAG_template_type_param = 0x2f;
43pub const TAG_template_value_param = 0x30;
44pub const TAG_thrown_type = 0x31;
45pub const TAG_try_block = 0x32;
46pub const TAG_variant_part = 0x33;
47pub const TAG_variable = 0x34;
48pub const TAG_volatile_type = 0x35;
49
50// DWARF 3
51pub const TAG_dwarf_procedure = 0x36;
52pub const TAG_restrict_type = 0x37;
53pub const TAG_interface_type = 0x38;
54pub const TAG_namespace = 0x39;
55pub const TAG_imported_module = 0x3a;
56pub const TAG_unspecified_type = 0x3b;
57pub const TAG_partial_unit = 0x3c;
58pub const TAG_imported_unit = 0x3d;
59pub const TAG_condition = 0x3f;
60pub const TAG_shared_type = 0x40;
61
62// DWARF 4
63pub const TAG_type_unit = 0x41;
64pub const TAG_rvalue_reference_type = 0x42;
65pub const TAG_template_alias = 0x43;
66
67pub const TAG_lo_user = 0x4080;
68pub const TAG_hi_user = 0xffff;
69
70// SGI/MIPS Extensions.
71pub const DW_TAG_MIPS_loop = 0x4081;
72
73// HP extensions. See: ftp://ftp.hp.com/pub/lang/tools/WDB/wdb-4.0.tar.gz .
74pub const TAG_HP_array_descriptor = 0x4090;
75pub const TAG_HP_Bliss_field = 0x4091;
76pub const TAG_HP_Bliss_field_set = 0x4092;
77
78// GNU extensions.
79pub const TAG_format_label = 0x4101; // For FORTRAN 77 and Fortran 90.
80pub const TAG_function_template = 0x4102; // For C++.
81pub const TAG_class_template = 0x4103; //For C++.
82pub const TAG_GNU_BINCL = 0x4104;
83pub const TAG_GNU_EINCL = 0x4105;
84
85// Template template parameter.
86// See http://gcc.gnu.org/wiki/TemplateParmsDwarf .
87pub const TAG_GNU_template_template_param = 0x4106;
88
89// Template parameter pack extension = specified at
90// http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Variadic_templates
91// The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
92// are properly part of DWARF 5.
93pub const TAG_GNU_template_parameter_pack = 0x4107;
94pub const TAG_GNU_formal_parameter_pack = 0x4108;
95// The GNU call site extension = specified at
96// http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open .
97// The values of these two TAGS are in the DW_TAG_GNU_* space until the tags
98// are properly part of DWARF 5.
99pub const TAG_GNU_call_site = 0x4109;
100pub const TAG_GNU_call_site_parameter = 0x410a;
101// Extensions for UPC. See: http://dwarfstd.org/doc/DWARF4.pdf.
102pub const TAG_upc_shared_type = 0x8765;
103pub const TAG_upc_strict_type = 0x8766;
104pub const TAG_upc_relaxed_type = 0x8767;
105// PGI (STMicroelectronics; extensions. No documentation available.
106pub const TAG_PGI_kanji_type = 0xA000;
107pub const TAG_PGI_interface_block = 0xA020;
108
109pub const FORM_addr = 0x01;
110pub const FORM_block2 = 0x03;
111pub const FORM_block4 = 0x04;
112pub const FORM_data2 = 0x05;
113pub const FORM_data4 = 0x06;
114pub const FORM_data8 = 0x07;
115pub const FORM_string = 0x08;
116pub const FORM_block = 0x09;
117pub const FORM_block1 = 0x0a;
118pub const FORM_data1 = 0x0b;
119pub const FORM_flag = 0x0c;
120pub const FORM_sdata = 0x0d;
121pub const FORM_strp = 0x0e;
122pub const FORM_udata = 0x0f;
123pub const FORM_ref_addr = 0x10;
124pub const FORM_ref1 = 0x11;
125pub const FORM_ref2 = 0x12;
126pub const FORM_ref4 = 0x13;
127pub const FORM_ref8 = 0x14;
128pub const FORM_ref_udata = 0x15;
129pub const FORM_indirect = 0x16;
130
131// DWARF 4.
132pub const FORM_sec_offset = 0x17;
133pub const FORM_exprloc = 0x18;
134pub const FORM_flag_present = 0x19;
135pub const FORM_ref_sig8 = 0x20;
136
137// Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission.
138pub const FORM_GNU_addr_index = 0x1f01;
139pub const FORM_GNU_str_index = 0x1f02;
140
141// Extensions for DWZ multifile.
142// See http://www.dwarfstd.org/ShowIssue.php?issue=120604.1&type=open .
143pub const FORM_GNU_ref_alt = 0x1f20;
144pub const FORM_GNU_strp_alt = 0x1f21;
145
146pub const AT_sibling = 0x01;
147pub const AT_location = 0x02;
148pub const AT_name = 0x03;
149pub const AT_ordering = 0x09;
150pub const AT_subscr_data = 0x0a;
151pub const AT_byte_size = 0x0b;
152pub const AT_bit_offset = 0x0c;
153pub const AT_bit_size = 0x0d;
154pub const AT_element_list = 0x0f;
155pub const AT_stmt_list = 0x10;
156pub const AT_low_pc = 0x11;
157pub const AT_high_pc = 0x12;
158pub const AT_language = 0x13;
159pub const AT_member = 0x14;
160pub const AT_discr = 0x15;
161pub const AT_discr_value = 0x16;
162pub const AT_visibility = 0x17;
163pub const AT_import = 0x18;
164pub const AT_string_length = 0x19;
165pub const AT_common_reference = 0x1a;
166pub const AT_comp_dir = 0x1b;
167pub const AT_const_value = 0x1c;
168pub const AT_containing_type = 0x1d;
169pub const AT_default_value = 0x1e;
170pub const AT_inline = 0x20;
171pub const AT_is_optional = 0x21;
172pub const AT_lower_bound = 0x22;
173pub const AT_producer = 0x25;
174pub const AT_prototyped = 0x27;
175pub const AT_return_addr = 0x2a;
176pub const AT_start_scope = 0x2c;
177pub const AT_bit_stride = 0x2e;
178pub const AT_upper_bound = 0x2f;
179pub const AT_abstract_origin = 0x31;
180pub const AT_accessibility = 0x32;
181pub const AT_address_class = 0x33;
182pub const AT_artificial = 0x34;
183pub const AT_base_types = 0x35;
184pub const AT_calling_convention = 0x36;
185pub const AT_count = 0x37;
186pub const AT_data_member_location = 0x38;
187pub const AT_decl_column = 0x39;
188pub const AT_decl_file = 0x3a;
189pub const AT_decl_line = 0x3b;
190pub const AT_declaration = 0x3c;
191pub const AT_discr_list = 0x3d;
192pub const AT_encoding = 0x3e;
193pub const AT_external = 0x3f;
194pub const AT_frame_base = 0x40;
195pub const AT_friend = 0x41;
196pub const AT_identifier_case = 0x42;
197pub const AT_macro_info = 0x43;
198pub const AT_namelist_items = 0x44;
199pub const AT_priority = 0x45;
200pub const AT_segment = 0x46;
201pub const AT_specification = 0x47;
202pub const AT_static_link = 0x48;
203pub const AT_type = 0x49;
204pub const AT_use_location = 0x4a;
205pub const AT_variable_parameter = 0x4b;
206pub const AT_virtuality = 0x4c;
207pub const AT_vtable_elem_location = 0x4d;
208
209// DWARF 3 values.
210pub const AT_allocated = 0x4e;
211pub const AT_associated = 0x4f;
212pub const AT_data_location = 0x50;
213pub const AT_byte_stride = 0x51;
214pub const AT_entry_pc = 0x52;
215pub const AT_use_UTF8 = 0x53;
216pub const AT_extension = 0x54;
217pub const AT_ranges = 0x55;
218pub const AT_trampoline = 0x56;
219pub const AT_call_column = 0x57;
220pub const AT_call_file = 0x58;
221pub const AT_call_line = 0x59;
222pub const AT_description = 0x5a;
223pub const AT_binary_scale = 0x5b;
224pub const AT_decimal_scale = 0x5c;
225pub const AT_small = 0x5d;
226pub const AT_decimal_sign = 0x5e;
227pub const AT_digit_count = 0x5f;
228pub const AT_picture_string = 0x60;
229pub const AT_mutable = 0x61;
230pub const AT_threads_scaled = 0x62;
231pub const AT_explicit = 0x63;
232pub const AT_object_pointer = 0x64;
233pub const AT_endianity = 0x65;
234pub const AT_elemental = 0x66;
235pub const AT_pure = 0x67;
236pub const AT_recursive = 0x68;
237
238// DWARF 4.
239pub const AT_signature = 0x69;
240pub const AT_main_subprogram = 0x6a;
241pub const AT_data_bit_offset = 0x6b;
242pub const AT_const_expr = 0x6c;
243pub const AT_enum_class = 0x6d;
244pub const AT_linkage_name = 0x6e;
245
246pub const AT_lo_user = 0x2000; // Implementation-defined range start.
247pub const AT_hi_user = 0x3fff; // Implementation-defined range end.
248
249// SGI/MIPS extensions.
250pub const AT_MIPS_fde = 0x2001;
251pub const AT_MIPS_loop_begin = 0x2002;
252pub const AT_MIPS_tail_loop_begin = 0x2003;
253pub const AT_MIPS_epilog_begin = 0x2004;
254pub const AT_MIPS_loop_unroll_factor = 0x2005;
255pub const AT_MIPS_software_pipeline_depth = 0x2006;
256pub const AT_MIPS_linkage_name = 0x2007;
257pub const AT_MIPS_stride = 0x2008;
258pub const AT_MIPS_abstract_name = 0x2009;
259pub const AT_MIPS_clone_origin = 0x200a;
260pub const AT_MIPS_has_inlines = 0x200b;
261
262// HP extensions.
263pub const AT_HP_block_index = 0x2000;
264pub const AT_HP_unmodifiable = 0x2001; // Same as DW_AT_MIPS_fde.
265pub const AT_HP_prologue = 0x2005; // Same as DW_AT_MIPS_loop_unroll.
266pub const AT_HP_epilogue = 0x2008; // Same as DW_AT_MIPS_stride.
267pub const AT_HP_actuals_stmt_list = 0x2010;
268pub const AT_HP_proc_per_section = 0x2011;
269pub const AT_HP_raw_data_ptr = 0x2012;
270pub const AT_HP_pass_by_reference = 0x2013;
271pub const AT_HP_opt_level = 0x2014;
272pub const AT_HP_prof_version_id = 0x2015;
273pub const AT_HP_opt_flags = 0x2016;
274pub const AT_HP_cold_region_low_pc = 0x2017;
275pub const AT_HP_cold_region_high_pc = 0x2018;
276pub const AT_HP_all_variables_modifiable = 0x2019;
277pub const AT_HP_linkage_name = 0x201a;
278pub const AT_HP_prof_flags = 0x201b; // In comp unit of procs_info for -g.
279pub const AT_HP_unit_name = 0x201f;
280pub const AT_HP_unit_size = 0x2020;
281pub const AT_HP_widened_byte_size = 0x2021;
282pub const AT_HP_definition_points = 0x2022;
283pub const AT_HP_default_location = 0x2023;
284pub const AT_HP_is_result_param = 0x2029;
285
286// GNU extensions.
287pub const AT_sf_names = 0x2101;
288pub const AT_src_info = 0x2102;
289pub const AT_mac_info = 0x2103;
290pub const AT_src_coords = 0x2104;
291pub const AT_body_begin = 0x2105;
292pub const AT_body_end = 0x2106;
293pub const AT_GNU_vector = 0x2107;
294// Thread-safety annotations.
295// See http://gcc.gnu.org/wiki/ThreadSafetyAnnotation .
296pub const AT_GNU_guarded_by = 0x2108;
297pub const AT_GNU_pt_guarded_by = 0x2109;
298pub const AT_GNU_guarded = 0x210a;
299pub const AT_GNU_pt_guarded = 0x210b;
300pub const AT_GNU_locks_excluded = 0x210c;
301pub const AT_GNU_exclusive_locks_required = 0x210d;
302pub const AT_GNU_shared_locks_required = 0x210e;
303// One-definition rule violation detection.
304// See http://gcc.gnu.org/wiki/DwarfSeparateTypeInfo .
305pub const AT_GNU_odr_signature = 0x210f;
306// Template template argument name.
307// See http://gcc.gnu.org/wiki/TemplateParmsDwarf .
308pub const AT_GNU_template_name = 0x2110;
309// The GNU call site extension.
310// See http://www.dwarfstd.org/ShowIssue.php?issue=100909.2&type=open .
311pub const AT_GNU_call_site_value = 0x2111;
312pub const AT_GNU_call_site_data_value = 0x2112;
313pub const AT_GNU_call_site_target = 0x2113;
314pub const AT_GNU_call_site_target_clobbered = 0x2114;
315pub const AT_GNU_tail_call = 0x2115;
316pub const AT_GNU_all_tail_call_sites = 0x2116;
317pub const AT_GNU_all_call_sites = 0x2117;
318pub const AT_GNU_all_source_call_sites = 0x2118;
319// Section offset into .debug_macro section.
320pub const AT_GNU_macros = 0x2119;
321// Extensions for Fission. See http://gcc.gnu.org/wiki/DebugFission.
322pub const AT_GNU_dwo_name = 0x2130;
323pub const AT_GNU_dwo_id = 0x2131;
324pub const AT_GNU_ranges_base = 0x2132;
325pub const AT_GNU_addr_base = 0x2133;
326pub const AT_GNU_pubnames = 0x2134;
327pub const AT_GNU_pubtypes = 0x2135;
328// VMS extensions.
329pub const AT_VMS_rtnbeg_pd_address = 0x2201;
330// GNAT extensions.
331// GNAT descriptive type.
332// See http://gcc.gnu.org/wiki/DW_AT_GNAT_descriptive_type .
333pub const AT_use_GNAT_descriptive_type = 0x2301;
334pub const AT_GNAT_descriptive_type = 0x2302;
335// UPC extension.
336pub const AT_upc_threads_scaled = 0x3210;
337// PGI (STMicroelectronics) extensions.
338pub const AT_PGI_lbase = 0x3a00;
339pub const AT_PGI_soffset = 0x3a01;
340pub const AT_PGI_lstride = 0x3a02;
341
342
343pub const OP_addr = 0x03;
344pub const OP_deref = 0x06;
345pub const OP_const1u = 0x08;
346pub const OP_const1s = 0x09;
347pub const OP_const2u = 0x0a;
348pub const OP_const2s = 0x0b;
349pub const OP_const4u = 0x0c;
350pub const OP_const4s = 0x0d;
351pub const OP_const8u = 0x0e;
352pub const OP_const8s = 0x0f;
353pub const OP_constu = 0x10;
354pub const OP_consts = 0x11;
355pub const OP_dup = 0x12;
356pub const OP_drop = 0x13;
357pub const OP_over = 0x14;
358pub const OP_pick = 0x15;
359pub const OP_swap = 0x16;
360pub const OP_rot = 0x17;
361pub const OP_xderef = 0x18;
362pub const OP_abs = 0x19;
363pub const OP_and = 0x1a;
364pub const OP_div = 0x1b;
365pub const OP_minus = 0x1c;
366pub const OP_mod = 0x1d;
367pub const OP_mul = 0x1e;
368pub const OP_neg = 0x1f;
369pub const OP_not = 0x20;
370pub const OP_or = 0x21;
371pub const OP_plus = 0x22;
372pub const OP_plus_uconst = 0x23;
373pub const OP_shl = 0x24;
374pub const OP_shr = 0x25;
375pub const OP_shra = 0x26;
376pub const OP_xor = 0x27;
377pub const OP_bra = 0x28;
378pub const OP_eq = 0x29;
379pub const OP_ge = 0x2a;
380pub const OP_gt = 0x2b;
381pub const OP_le = 0x2c;
382pub const OP_lt = 0x2d;
383pub const OP_ne = 0x2e;
384pub const OP_skip = 0x2f;
385pub const OP_lit0 = 0x30;
386pub const OP_lit1 = 0x31;
387pub const OP_lit2 = 0x32;
388pub const OP_lit3 = 0x33;
389pub const OP_lit4 = 0x34;
390pub const OP_lit5 = 0x35;
391pub const OP_lit6 = 0x36;
392pub const OP_lit7 = 0x37;
393pub const OP_lit8 = 0x38;
394pub const OP_lit9 = 0x39;
395pub const OP_lit10 = 0x3a;
396pub const OP_lit11 = 0x3b;
397pub const OP_lit12 = 0x3c;
398pub const OP_lit13 = 0x3d;
399pub const OP_lit14 = 0x3e;
400pub const OP_lit15 = 0x3f;
401pub const OP_lit16 = 0x40;
402pub const OP_lit17 = 0x41;
403pub const OP_lit18 = 0x42;
404pub const OP_lit19 = 0x43;
405pub const OP_lit20 = 0x44;
406pub const OP_lit21 = 0x45;
407pub const OP_lit22 = 0x46;
408pub const OP_lit23 = 0x47;
409pub const OP_lit24 = 0x48;
410pub const OP_lit25 = 0x49;
411pub const OP_lit26 = 0x4a;
412pub const OP_lit27 = 0x4b;
413pub const OP_lit28 = 0x4c;
414pub const OP_lit29 = 0x4d;
415pub const OP_lit30 = 0x4e;
416pub const OP_lit31 = 0x4f;
417pub const OP_reg0 = 0x50;
418pub const OP_reg1 = 0x51;
419pub const OP_reg2 = 0x52;
420pub const OP_reg3 = 0x53;
421pub const OP_reg4 = 0x54;
422pub const OP_reg5 = 0x55;
423pub const OP_reg6 = 0x56;
424pub const OP_reg7 = 0x57;
425pub const OP_reg8 = 0x58;
426pub const OP_reg9 = 0x59;
427pub const OP_reg10 = 0x5a;
428pub const OP_reg11 = 0x5b;
429pub const OP_reg12 = 0x5c;
430pub const OP_reg13 = 0x5d;
431pub const OP_reg14 = 0x5e;
432pub const OP_reg15 = 0x5f;
433pub const OP_reg16 = 0x60;
434pub const OP_reg17 = 0x61;
435pub const OP_reg18 = 0x62;
436pub const OP_reg19 = 0x63;
437pub const OP_reg20 = 0x64;
438pub const OP_reg21 = 0x65;
439pub const OP_reg22 = 0x66;
440pub const OP_reg23 = 0x67;
441pub const OP_reg24 = 0x68;
442pub const OP_reg25 = 0x69;
443pub const OP_reg26 = 0x6a;
444pub const OP_reg27 = 0x6b;
445pub const OP_reg28 = 0x6c;
446pub const OP_reg29 = 0x6d;
447pub const OP_reg30 = 0x6e;
448pub const OP_reg31 = 0x6f;
449pub const OP_breg0 = 0x70;
450pub const OP_breg1 = 0x71;
451pub const OP_breg2 = 0x72;
452pub const OP_breg3 = 0x73;
453pub const OP_breg4 = 0x74;
454pub const OP_breg5 = 0x75;
455pub const OP_breg6 = 0x76;
456pub const OP_breg7 = 0x77;
457pub const OP_breg8 = 0x78;
458pub const OP_breg9 = 0x79;
459pub const OP_breg10 = 0x7a;
460pub const OP_breg11 = 0x7b;
461pub const OP_breg12 = 0x7c;
462pub const OP_breg13 = 0x7d;
463pub const OP_breg14 = 0x7e;
464pub const OP_breg15 = 0x7f;
465pub const OP_breg16 = 0x80;
466pub const OP_breg17 = 0x81;
467pub const OP_breg18 = 0x82;
468pub const OP_breg19 = 0x83;
469pub const OP_breg20 = 0x84;
470pub const OP_breg21 = 0x85;
471pub const OP_breg22 = 0x86;
472pub const OP_breg23 = 0x87;
473pub const OP_breg24 = 0x88;
474pub const OP_breg25 = 0x89;
475pub const OP_breg26 = 0x8a;
476pub const OP_breg27 = 0x8b;
477pub const OP_breg28 = 0x8c;
478pub const OP_breg29 = 0x8d;
479pub const OP_breg30 = 0x8e;
480pub const OP_breg31 = 0x8f;
481pub const OP_regx = 0x90;
482pub const OP_fbreg = 0x91;
483pub const OP_bregx = 0x92;
484pub const OP_piece = 0x93;
485pub const OP_deref_size = 0x94;
486pub const OP_xderef_size = 0x95;
487pub const OP_nop = 0x96;
488
489// DWARF 3 extensions.
490pub const OP_push_object_address = 0x97;
491pub const OP_call2 = 0x98;
492pub const OP_call4 = 0x99;
493pub const OP_call_ref = 0x9a;
494pub const OP_form_tls_address = 0x9b;
495pub const OP_call_frame_cfa = 0x9c;
496pub const OP_bit_piece = 0x9d;
497
498// DWARF 4 extensions.
499pub const OP_implicit_value = 0x9e;
500pub const OP_stack_value = 0x9f;
501
502pub const OP_lo_user = 0xe0; // Implementation-defined range start.
503pub const OP_hi_user = 0xff; // Implementation-defined range end.
504
505// GNU extensions.
506pub const OP_GNU_push_tls_address = 0xe0;
507// The following is for marking variables that are uninitialized.
508pub const OP_GNU_uninit = 0xf0;
509pub const OP_GNU_encoded_addr = 0xf1;
510// The GNU implicit pointer extension.
511// See http://www.dwarfstd.org/ShowIssue.php?issue=100831.1&type=open .
512pub const OP_GNU_implicit_pointer = 0xf2;
513// The GNU entry value extension.
514// See http://www.dwarfstd.org/ShowIssue.php?issue=100909.1&type=open .
515pub const OP_GNU_entry_value = 0xf3;
516// The GNU typed stack extension.
517// See http://www.dwarfstd.org/doc/040408.1.html .
518pub const OP_GNU_const_type = 0xf4;
519pub const OP_GNU_regval_type = 0xf5;
520pub const OP_GNU_deref_type = 0xf6;
521pub const OP_GNU_convert = 0xf7;
522pub const OP_GNU_reinterpret = 0xf9;
523// The GNU parameter ref extension.
524pub const OP_GNU_parameter_ref = 0xfa;
525// Extension for Fission. See http://gcc.gnu.org/wiki/DebugFission.
526pub const OP_GNU_addr_index = 0xfb;
527pub const OP_GNU_const_index = 0xfc;
528// HP extensions.
529pub const OP_HP_unknown = 0xe0; // Ouch, the same as GNU_push_tls_address.
530pub const OP_HP_is_value = 0xe1;
531pub const OP_HP_fltconst4 = 0xe2;
532pub const OP_HP_fltconst8 = 0xe3;
533pub const OP_HP_mod_range = 0xe4;
534pub const OP_HP_unmod_range = 0xe5;
535pub const OP_HP_tls = 0xe6;
536// PGI (STMicroelectronics) extensions.
537pub const OP_PGI_omp_thread_num = 0xf8;
538
539pub const ATE_void = 0x0;
540pub const ATE_address = 0x1;
541pub const ATE_boolean = 0x2;
542pub const ATE_complex_float = 0x3;
543pub const ATE_float = 0x4;
544pub const ATE_signed = 0x5;
545pub const ATE_signed_char = 0x6;
546pub const ATE_unsigned = 0x7;
547pub const ATE_unsigned_char = 0x8;
548
549// DWARF 3.
550pub const ATE_imaginary_float = 0x9;
551pub const ATE_packed_decimal = 0xa;
552pub const ATE_numeric_string = 0xb;
553pub const ATE_edited = 0xc;
554pub const ATE_signed_fixed = 0xd;
555pub const ATE_unsigned_fixed = 0xe;
556pub const ATE_decimal_float = 0xf;
557
558// DWARF 4.
559pub const ATE_UTF = 0x10;
560
561pub const ATE_lo_user = 0x80;
562pub const ATE_hi_user = 0xff;
563
564// HP extensions.
565pub const ATE_HP_float80 = 0x80; // Floating-point (80 bit).
566pub const ATE_HP_complex_float80 = 0x81; // Complex floating-point (80 bit).
567pub const ATE_HP_float128 = 0x82; // Floating-point (128 bit).
568pub const ATE_HP_complex_float128 = 0x83; // Complex fp (128 bit).
569pub const ATE_HP_floathpintel = 0x84; // Floating-point (82 bit IA64).
570pub const ATE_HP_imaginary_float80 = 0x85;
571pub const ATE_HP_imaginary_float128 = 0x86;
572pub const ATE_HP_VAX_float = 0x88; // F or G floating.
573pub const ATE_HP_VAX_float_d = 0x89; // D floating.
574pub const ATE_HP_packed_decimal = 0x8a; // Cobol.
575pub const ATE_HP_zoned_decimal = 0x8b; // Cobol.
576pub const ATE_HP_edited = 0x8c; // Cobol.
577pub const ATE_HP_signed_fixed = 0x8d; // Cobol.
578pub const ATE_HP_unsigned_fixed = 0x8e; // Cobol.
579pub const ATE_HP_VAX_complex_float = 0x8f; // F or G floating complex.
580pub const ATE_HP_VAX_complex_float_d = 0x90; // D floating complex.
581
582
583pub const CFA_advance_loc = 0x40;
584pub const CFA_offset = 0x80;
585pub const CFA_restore = 0xc0;
586pub const CFA_nop = 0x00;
587pub const CFA_set_loc = 0x01;
588pub const CFA_advance_loc1 = 0x02;
589pub const CFA_advance_loc2 = 0x03;
590pub const CFA_advance_loc4 = 0x04;
591pub const CFA_offset_extended = 0x05;
592pub const CFA_restore_extended = 0x06;
593pub const CFA_undefined = 0x07;
594pub const CFA_same_value = 0x08;
595pub const CFA_register = 0x09;
596pub const CFA_remember_state = 0x0a;
597pub const CFA_restore_state = 0x0b;
598pub const CFA_def_cfa = 0x0c;
599pub const CFA_def_cfa_register = 0x0d;
600pub const CFA_def_cfa_offset = 0x0e;
601
602// DWARF 3.
603pub const CFA_def_cfa_expression = 0x0f;
604pub const CFA_expression = 0x10;
605pub const CFA_offset_extended_sf = 0x11;
606pub const CFA_def_cfa_sf = 0x12;
607pub const CFA_def_cfa_offset_sf = 0x13;
608pub const CFA_val_offset = 0x14;
609pub const CFA_val_offset_sf = 0x15;
610pub const CFA_val_expression = 0x16;
611
612pub const CFA_lo_user = 0x1c;
613pub const CFA_hi_user = 0x3f;
614
615// SGI/MIPS specific.
616pub const CFA_MIPS_advance_loc8 = 0x1d;
617
618// GNU extensions.
619pub const CFA_GNU_window_save = 0x2d;
620pub const CFA_GNU_args_size = 0x2e;
621pub const CFA_GNU_negative_offset_extended = 0x2f;