aboutsummaryrefslogtreecommitdiffstats
path: root/powerpc/PrintDiab.ml
diff options
context:
space:
mode:
authorBernhard Schommer <bernhardschommer@gmail.com>2014-10-31 16:25:03 +0100
committerBernhard Schommer <bernhardschommer@gmail.com>2014-10-31 16:25:03 +0100
commit513f98b0bf2ee2a9237b54628eb8fcd55e8052d4 (patch)
tree41d69c12d33a9bb7c8023962357d3c36abcd9f84 /powerpc/PrintDiab.ml
parenteeacc882f72d99515f3ec05db3176ea83ade484c (diff)
downloadcompcert-513f98b0bf2ee2a9237b54628eb8fcd55e8052d4.tar.gz
compcert-513f98b0bf2ee2a9237b54628eb8fcd55e8052d4.zip
More functions for printing the abbreviations.
Diffstat (limited to 'powerpc/PrintDiab.ml')
-rw-r--r--powerpc/PrintDiab.ml134
1 files changed, 101 insertions, 33 deletions
diff --git a/powerpc/PrintDiab.ml b/powerpc/PrintDiab.ml
index 6e1f1331..516b0038 100644
--- a/powerpc/PrintDiab.ml
+++ b/powerpc/PrintDiab.ml
@@ -113,49 +113,117 @@ module Diab_System =
in
Buffer.add_string buf s
- let add_abbr_uleb buf v =
+ let add_abbr_uleb v buf =
Buffer.add_string buf " .uleb128 ";
- Buffer.add_string buf v;
+ Buffer.add_string buf (string_of_int v);
Buffer.add_string buf "\n"
-
- let add_sibling buf =
- add_abbr_uleb buf "1";
- add_abbr_uleb buf "19"
-
- let add_decl_file buf =
- add_abbr_uleb buf "58";
- add_abbr_uleb buf "6"
+
+
+ let add_abbr_entry (v1,v2) buf =
+ add_abbr_uleb v1 buf;
+ add_abbr_uleb v2 buf
+
+ let add_sibling = add_abbr_entry (1,19)
+
+ let add_decl_file = add_abbr_entry (58,6)
- let add_decl_line buf =
- add_abbr_uleb buf "59";
- add_abbr_uleb buf "15"
+ let add_decl_line = add_abbr_entry (59,15)
- let add_type buf =
- add_abbr_uleb buf "73";
- add_abbr_uleb buf "16"
+ let add_type = add_abbr_entry (73,16)
- let add_array_type buf a_typ =
- (match a_typ.array_type_file with
- | None -> ()
- | Some _ -> add_decl_file buf);
- (match a_typ.array_type_line with
- | None -> ()
- | Some _ -> add_decl_line buf);
- add_type buf
-
- let add_name buf =
- add_abbr_uleb buf "3";
- add_abbr_uleb buf "8"
+ let add_name = add_abbr_entry (3,8)
+ let add_encoding = add_abbr_entry (62,11)
+
+ let add_byte_size = add_abbr_entry (11,11)
+
+ let add_high_pc = add_abbr_entry (18,1)
+
+ let add_low_pc = add_abbr_entry (17,1)
+
+ let add_stmt_list = add_abbr_entry (16,6)
+
+ let add_declaration = add_abbr_entry (60,12)
+
let abbrv_string_of_entity entity has_sibling =
let buf = Buffer.create 12 in
- let has_child = (match entity.children with [] -> false | _ -> true) in
+ let add_attr_some v f =
+ match v with
+ | None -> ()
+ | Some _ -> f buf in
+ let prologue id =
+ let has_child = match entity.children with
+ | [] -> false
+ | _ -> true in
+ add_abbr_uleb id buf;
+ add_byte buf has_child;
+ if has_sibling then add_sibling buf;
+ in
(match entity.tag with
| DW_TAG_array_type e ->
- (add_abbr_uleb buf "1";
- add_byte buf has_child;
- if has_sibling then add_sibling buf;
- add_array_type buf e)
+ prologue 1;
+ add_attr_some e.array_type_decl_file add_decl_file;
+ add_attr_some e.array_type_decl_line add_decl_line;
+ add_type buf
+ | DW_TAG_base_type _ ->
+ prologue 36;
+ add_encoding buf;
+ add_byte_size buf;
+ add_name buf
+ | DW_TAG_compile_unit e ->
+ prologue 17;
+ add_abbr_entry (27,8) buf;
+ add_high_pc buf;
+ add_low_pc buf;
+ add_abbr_entry (19,15) buf;
+ add_name buf;
+ add_abbr_entry (37,8) buf;
+ add_attr_some e.compile_unit_stmt_list add_stmt_list
+ | DW_TAG_const_type _ ->
+ prologue 40;
+ add_type buf
+ | DW_TAG_enumeration_type e ->
+ prologue 4;
+ add_attr_some e.enumeration_decl_file add_decl_file;
+ add_attr_some e.enumeration_decl_line add_decl_line;
+ add_byte_size buf;
+ add_name buf;
+ add_attr_some e.enumeration_declaration add_declaration
+ | DW_TAG_enumerator e ->
+ prologue 40;
+ add_attr_some e.enumerator_decl_file add_decl_file;
+ add_attr_some e.enumerator_decl_line add_decl_line;
+ add_abbr_entry (28,13) buf;
+ add_name buf
+ | DW_TAG_label _ ->
+ prologue 10;
+ add_low_pc buf;
+ add_name buf;
+ | DW_TAG_lexical_block _ ->
+ prologue 0xb;
+ add_high_pc buf;
+ add_low_pc buf
+ | DW_TAG_member e ->
+ prologue 0xd;
+ add_attr_some e.member_decl_file add_decl_file;
+ add_attr_some e.member_decl_line add_decl_line;
+ add_attr_some e.member_byte_size add_byte_size;
+ add_attr_some e.member_bit_offset (add_abbr_entry (13,11));
+ add_attr_some e.member_bit_size (add_abbr_entry (12,11));
+ add_attr_some e.member_data_member_location (add_abbr_entry (56,9));
+ add_attr_some e.member_declaration add_declaration;
+ add_name buf;
+ add_type buf
+ | DW_TAG_pointer_type _ ->
+ prologue 0xf;
+ add_type buf
+ | DW_TAG_structure_type e ->
+ prologue 0x13;
+ add_attr_some e.structure_decl_file add_decl_file;
+ add_attr_some e.structure_decl_line add_decl_line;
+ add_byte_size buf;
+ add_attr_some e.structure_declaration add_declaration;
+ add_name buf
| _ -> ());
Buffer.contents buf