From 55eb2d92376f592258855cfa5c0cfbbf39e8e833 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 6 Oct 2015 11:08:58 +0200 Subject: Fast fix for functions in different sections in one compilation unit for gcc. --- debug/DwarfTypes.mli | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index ed75b3d7..8f03eb8d 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -247,7 +247,7 @@ type location_entry = loc: (int * int * location_value) list; loc_id: reference; } -type dw_locations = int * location_entry list +type dw_locations = int option * location_entry list type diab_entries = (string * int * int * dw_entry * dw_locations) list -- cgit From 9873f9ee01c6ccca88fd461d318e107ff303fe88 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 12 Oct 2015 18:39:31 +0200 Subject: Use a more descriptive type for diab debug entries. Instead of using a tuple we now use a record with descriptive names for the different entries. Bug 17392 --- debug/DwarfTypes.mli | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 8f03eb8d..233ada2e 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -249,7 +249,16 @@ type location_entry = } type dw_locations = int option * location_entry list -type diab_entries = (string * int * int * dw_entry * dw_locations) list +type diab_entry = + { + section_name: string; + start_label: int; + line_label: int; + entry: dw_entry; + locs: dw_locations; + } + +type diab_entries = diab_entry list type gnu_entries = dw_entry * dw_locations -- cgit From daed22eb5afdc86267c8f90b55008267c9383fca Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 13 Oct 2015 10:49:36 +0200 Subject: Remove unused members from debug types. The dwarf 2 standard allows more attributes for certain debuggint entries than used by gcc or diab data. Since they are also not set by compcert they can be removed. Bug 17392. --- debug/DwarfTypes.mli | 5 ----- 1 file changed, 5 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 233ada2e..669ceabc 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -66,7 +66,6 @@ type file_loc = type dw_tag_array_type = { - array_type_file_loc: file_loc option; array_type: reference; } @@ -99,14 +98,12 @@ type dw_tag_enumeration_type = type dw_tag_enumerator = { - enumerator_file_loc: file_loc option; enumerator_value: constant; enumerator_name: string; } type dw_tag_formal_parameter = { - formal_parameter_file_loc: file_loc option; formal_parameter_artificial: flag option; formal_parameter_name: string option; formal_parameter_type: reference; @@ -128,7 +125,6 @@ type dw_tag_lexical_block = type dw_tag_member = { - member_file_loc: file_loc option; member_byte_size: constant option; member_bit_offset: constant option; member_bit_size: constant option; @@ -191,7 +187,6 @@ type dw_tag_union_type = type dw_tag_unspecified_parameter = { - unspecified_parameter_file_loc: file_loc option; unspecified_parameter_artificial: flag option; } -- cgit From 16315711d815580afa77f93424cc49c7362ab5b8 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Tue, 13 Oct 2015 14:57:31 +0200 Subject: Implement the usage of the debug_str section for the gcc backend. GCC prints all string larger than 3 characters in the debug_str section which reduces the size of the debug information since entries containing the same string now map to the same string in the debug_str sections. Bug 17392. --- debug/DwarfTypes.mli | 82 ++++++++++++++++++++++++++++------------------------ 1 file changed, 44 insertions(+), 38 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 669ceabc..c7e5dce1 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -36,13 +36,11 @@ type encoding = type address = int -type block = string - type location_expression = | DW_OP_plus_uconst of constant - | DW_OP_bregx of int * int32 - | DW_OP_piece of int - | DW_OP_reg of int + | DW_OP_bregx of constant * int32 + | DW_OP_piece of constant + | DW_OP_reg of constant type location_value = | LocSymbol of atom @@ -58,11 +56,15 @@ type bound_value = | BoundConst of constant | BoundRef of reference +type string_const = + | Simple_string of string + | Offset_string of reference + (* Types representing the attribute information per tag value *) type file_loc = - | Diab_file_loc of int * constant - | Gnu_file_loc of int * constant + | Diab_file_loc of constant * constant + | Gnu_file_loc of constant * constant type dw_tag_array_type = { @@ -72,15 +74,17 @@ type dw_tag_array_type = type dw_tag_base_type = { base_type_byte_size: constant; - base_type_encoding: encoding option; - base_type_name: string; + base_type_encoding: encoding option; + base_type_name: string_const; } type dw_tag_compile_unit = { - compile_unit_name: string; - compile_unit_low_pc: int; - compile_unit_high_pc: int; + compile_unit_name: string_const; + compile_unit_low_pc: constant; + compile_unit_high_pc: constant; + compile_unit_dir: string_const; + compile_unit_prod_name: string_const; } type dw_tag_const_type = @@ -90,22 +94,22 @@ type dw_tag_const_type = type dw_tag_enumeration_type = { - enumeration_file_loc: file_loc option; + enumeration_file_loc: file_loc option; enumeration_byte_size: constant; - enumeration_declaration: flag option; - enumeration_name: string option; + enumeration_declaration: flag option; + enumeration_name: string_const; } type dw_tag_enumerator = { enumerator_value: constant; - enumerator_name: string; + enumerator_name: string_const; } type dw_tag_formal_parameter = { formal_parameter_artificial: flag option; - formal_parameter_name: string option; + formal_parameter_name: string_const option; formal_parameter_type: reference; formal_parameter_variable_parameter: flag option; formal_parameter_location: location_value option; @@ -114,7 +118,7 @@ type dw_tag_formal_parameter = type dw_tag_label = { label_low_pc: address; - label_name: string; + label_name: string_const; } type dw_tag_lexical_block = @@ -130,7 +134,7 @@ type dw_tag_member = member_bit_size: constant option; member_data_member_location: data_location_value option; member_declaration: flag option; - member_name: string option; + member_name: string_const; member_type: reference; } @@ -141,21 +145,21 @@ type dw_tag_pointer_type = type dw_tag_structure_type = { - structure_file_loc: file_loc option; - structure_byte_size: constant option; - structure_declaration: flag option; - structure_name: string option; + structure_file_loc: file_loc option; + structure_byte_size: constant option; + structure_declaration: flag option; + structure_name: string_const option; } type dw_tag_subprogram = { subprogram_file_loc: file_loc; - subprogram_external: flag option; - subprogram_name: string; + subprogram_external: flag option; + subprogram_name: string_const; subprogram_prototyped: flag; - subprogram_type: reference option; - subprogram_high_pc: reference option; - subprogram_low_pc: reference option; + subprogram_type: reference option; + subprogram_high_pc: reference option; + subprogram_low_pc: reference option; } type dw_tag_subrange_type = @@ -173,21 +177,21 @@ type dw_tag_subroutine_type = type dw_tag_typedef = { typedef_file_loc: file_loc option; - typedef_name: string; + typedef_name: string_const; typedef_type: reference; } type dw_tag_union_type = { - union_file_loc: file_loc option; - union_byte_size: constant option; - union_declaration: flag option; - union_name: string option; + union_file_loc: file_loc option; + union_byte_size: constant option; + union_declaration: flag option; + union_name: string_const option; } type dw_tag_unspecified_parameter = { - unspecified_parameter_artificial: flag option; + unspecified_parameter_artificial: flag option; } type dw_tag_variable = @@ -195,7 +199,7 @@ type dw_tag_variable = variable_file_loc: file_loc; variable_declaration: flag option; variable_external: flag option; - variable_name: string; + variable_name: string_const; variable_type: reference; variable_location: location_value option; } @@ -239,10 +243,10 @@ type dw_entry = (* The type for the location list. *) type location_entry = { - loc: (int * int * location_value) list; + loc: (address * address * location_value) list; loc_id: reference; } -type dw_locations = int option * location_entry list +type dw_locations = constant option * location_entry list type diab_entry = { @@ -255,7 +259,9 @@ type diab_entry = type diab_entries = diab_entry list -type gnu_entries = dw_entry * dw_locations +type dw_string = (int * string) list + +type gnu_entries = dw_entry * dw_locations * dw_string type debug_entries = | Diab of diab_entries -- cgit From 60ab550a952c3d9719b2a91ec90c9b58769f6717 Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Wed, 14 Oct 2015 15:07:48 +0200 Subject: bug 17392: remove trailing whitespace in source files --- debug/DwarfTypes.mli | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index c7e5dce1..7048d8d3 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -47,7 +47,7 @@ type location_value = | LocRef of address | LocSimple of location_expression | LocList of location_expression list - + type data_location_value = | DataLocBlock of location_expression | DataLocRef of reference @@ -62,10 +62,10 @@ type string_const = (* Types representing the attribute information per tag value *) -type file_loc = +type file_loc = | Diab_file_loc of constant * constant | Gnu_file_loc of constant * constant - + type dw_tag_array_type = { array_type: reference; -- cgit From df78560fdf859644274dbdabccdd1fdb9e75634e Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Wed, 14 Oct 2015 18:06:04 +0200 Subject: More verbose debug printer. Like, for example the clang, CompCert now prints a more detailed descriptions of the debug information in the assembler file. For each abbreviation and debug entry the dwarf attributes and their encodings are added. Bug 17392. --- debug/DwarfTypes.mli | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index 7048d8d3..fb1725d9 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -60,12 +60,35 @@ type string_const = | Simple_string of string | Offset_string of reference -(* Types representing the attribute information per tag value *) - type file_loc = | Diab_file_loc of constant * constant | Gnu_file_loc of constant * constant +type dw_form = + | DW_FORM_addr + | DW_FORM_block2 + | DW_FORM_block4 + | DW_FORM_data2 + | DW_FORM_data4 + | DW_FORM_data8 + | DW_FORM_string + | DW_FORM_block + | DW_FORM_block1 + | DW_FORM_data1 + | DW_FORM_flag + | DW_FORM_sdata + | DW_FORM_strp + | DW_FORM_udata + | DW_FORM_ref_addr + | DW_FORM_ref1 + | DW_FORM_ref2 + | DW_FORM_ref4 + | DW_FORM_ref8 + | DW_FORM_ref_udata + | DW_FORM_ref_indirect + +(* Types representing the attribute information per tag value *) + type dw_tag_array_type = { array_type: reference; @@ -273,4 +296,5 @@ module type DWARF_TARGET= val label: out_channel -> int -> unit val section: out_channel -> section_name -> unit val symbol: out_channel -> atom -> unit + val comment: string end -- cgit From 1e52bb2001964d87086cea00d0cb779e270b99ce Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Thu, 15 Oct 2015 13:15:28 +0200 Subject: First step to implemente address ranges for the gnu backend. In contrast to the dcc, the gcc uses address ranges to express non-contiguous range of addresses. As a first step we set the start and end addresses for the different address ranges for the compilation unit by using the start and end addresses of functions. Bug 17392. --- debug/DwarfTypes.mli | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index fb1725d9..ff895623 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -87,6 +87,11 @@ type dw_form = | DW_FORM_ref_udata | DW_FORM_ref_indirect +type dw_range = + | Pc_pair of reference * reference (* Simple low,high pc *) + | Offset of reference * constant (* DWARF 3 version for different range *) + | Empty (* Needed for compilation units only containing variables *) + (* Types representing the attribute information per tag value *) type dw_tag_array_type = @@ -104,8 +109,7 @@ type dw_tag_base_type = type dw_tag_compile_unit = { compile_unit_name: string_const; - compile_unit_low_pc: constant; - compile_unit_high_pc: constant; + compile_unit_range: dw_range; compile_unit_dir: string_const; compile_unit_prod_name: string_const; } @@ -146,8 +150,7 @@ type dw_tag_label = type dw_tag_lexical_block = { - lexical_block_high_pc: address option; - lexical_block_low_pc: address option; + lexical_block_range: dw_range; } type dw_tag_member = @@ -181,8 +184,7 @@ type dw_tag_subprogram = subprogram_name: string_const; subprogram_prototyped: flag; subprogram_type: reference option; - subprogram_high_pc: reference option; - subprogram_low_pc: reference option; + subprogram_range: dw_range; } type dw_tag_subrange_type = -- cgit From 24b4159b6a29328c529e0e59405e03ea192aa99e Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 16 Oct 2015 13:06:09 +0200 Subject: Implemented the usage of DW_AT_ranges for non-contiguous address ranges. The gcc produces DW_AT_ranges for non-contiguous address ranges, like compilation units containing functions which are placed in different ELF-sections or lexical scopes that are split up. With this commit CompCert also uses this DWARF v3 feature for gnu backend based targets. In order to ensure backward compability a flag is added which avoids this and produces debug info in DWARF v2 format. Bug 17392. --- debug/DwarfTypes.mli | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'debug/DwarfTypes.mli') diff --git a/debug/DwarfTypes.mli b/debug/DwarfTypes.mli index ff895623..a4c75201 100644 --- a/debug/DwarfTypes.mli +++ b/debug/DwarfTypes.mli @@ -89,7 +89,7 @@ type dw_form = type dw_range = | Pc_pair of reference * reference (* Simple low,high pc *) - | Offset of reference * constant (* DWARF 3 version for different range *) + | Offset of constant (* DWARF 3 version for different range *) | Empty (* Needed for compilation units only containing variables *) (* Types representing the attribute information per tag value *) @@ -273,6 +273,12 @@ type location_entry = } type dw_locations = constant option * location_entry list +type range_entry = (address * address) list + +type dw_ranges = range_entry list + +type dw_string = (int * string) list + type diab_entry = { section_name: string; @@ -284,9 +290,7 @@ type diab_entry = type diab_entries = diab_entry list -type dw_string = (int * string) list - -type gnu_entries = dw_entry * dw_locations * dw_string +type gnu_entries = dw_entry * dw_locations * dw_string * dw_ranges type debug_entries = | Diab of diab_entries -- cgit