From 012827a7cba40f434b9fc6ce1b46dc725473eae7 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 12 Oct 2015 14:33:15 +0200 Subject: Unified function for adding the atom identifier. Instead of defining two functions for adding the mapping from atom to debug id we use one function which then sets the corresponding values. Bug 17392. --- debug/DebugInit.ml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'debug/DebugInit.ml') diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml index 7ee56ff1..09714628 100644 --- a/debug/DebugInit.ml +++ b/debug/DebugInit.ml @@ -20,8 +20,7 @@ open Debug let init_debug () = implem.init <- DebugInformation.init; - implem.atom_function <- DebugInformation.atom_function; - implem.atom_global_variable <- DebugInformation.atom_global_variable; + implem.atom_global <- DebugInformation.atom_global; implem.set_composite_size <- DebugInformation.set_composite_size; implem.set_member_offset <- DebugInformation.set_member_offset; implem.set_bitfield_offset <- DebugInformation.set_bitfield_offset; @@ -43,7 +42,6 @@ let init_debug () = implem.start_live_range <- DebugInformation.start_live_range; implem.end_live_range <- DebugInformation.end_live_range; implem.stack_variable <- DebugInformation.stack_variable; - implem.function_end <- DebugInformation.function_end; implem.add_label <- DebugInformation.add_label; implem.atom_parameter <- DebugInformation.atom_parameter; implem.add_compilation_section_start <- DebugInformation.add_compilation_section_start; @@ -57,8 +55,7 @@ let init_debug () = let init_none () = implem.init <- (fun _ -> ()); - implem.atom_function <- (fun _ _ -> ()); - implem.atom_global_variable <- (fun _ _ -> ()); + implem.atom_global <- (fun _ _ -> ()); implem.set_composite_size <- (fun _ _ _ -> ()); implem.set_member_offset <- (fun _ _ _ -> ()); implem.set_bitfield_offset <- (fun _ _ _ _ _ -> ()); @@ -76,7 +73,6 @@ let init_none () = implem.start_live_range <- (fun _ _ _ -> ()); implem.end_live_range <- (fun _ _ -> ()); implem.stack_variable <- (fun _ _ -> ()); - implem.function_end <- (fun _ _ -> ()); implem.add_label <- (fun _ _ _ -> ()); implem.atom_parameter <- (fun _ _ _ -> ()); implem.add_compilation_section_start <- (fun _ _ -> ()); -- cgit From 3b0bbd7a60771265ff81cc98310d413130ae4d79 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Mon, 12 Oct 2015 19:09:42 +0200 Subject: Changed definition of implem for debug information. Instead of making each filed mutuable we use a reference to a record of type implem. Now only the default implementation and the default debug information need to be upated to add a new function. Bug 17392. --- debug/DebugInit.ml | 102 +++++++++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 62 deletions(-) (limited to 'debug/DebugInit.ml') diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml index 09714628..209f2024 100644 --- a/debug/DebugInit.ml +++ b/debug/DebugInit.ml @@ -18,71 +18,49 @@ open Dwarfgen open DwarfTypes open Debug +let default_debug = + { + init = DebugInformation.init; + atom_global = DebugInformation.atom_global; + set_composite_size = DebugInformation.set_composite_size; + set_member_offset = DebugInformation.set_member_offset; + set_bitfield_offset = DebugInformation.set_bitfield_offset; + insert_global_declaration = DebugInformation.insert_global_declaration; + add_fun_addr = DebugInformation.add_fun_addr; + generate_debug_info = (fun _ _ -> None); + all_files_iter = (fun f -> DebugInformation.StringSet.iter f !DebugInformation.all_files); + insert_local_declaration = DebugInformation.insert_local_declaration; + atom_local_variable = DebugInformation.atom_local_variable; + enter_scope = DebugInformation.enter_scope; + enter_function_scope = DebugInformation.enter_function_scope; + add_lvar_scope = DebugInformation.add_lvar_scope; + open_scope = DebugInformation.open_scope; + close_scope = DebugInformation.close_scope; + start_live_range = DebugInformation.start_live_range; + end_live_range = DebugInformation.end_live_range; + stack_variable = DebugInformation.stack_variable; + add_label = DebugInformation.add_label; + atom_parameter = DebugInformation.atom_parameter; + add_compilation_section_start = DebugInformation.add_compilation_section_start; + add_compilation_section_end = DebugInformation.add_compilation_section_end; + compute_diab_file_enum = DebugInformation.compute_diab_file_enum; + compute_gnu_file_enum = DebugInformation.compute_gnu_file_enum; + exists_section = DebugInformation.exists_section; + remove_unused = DebugInformation.remove_unused; + variable_printed = DebugInformation.variable_printed; + add_diab_info = DebugInformation.add_diab_info; + } + let init_debug () = - implem.init <- DebugInformation.init; - implem.atom_global <- DebugInformation.atom_global; - implem.set_composite_size <- DebugInformation.set_composite_size; - implem.set_member_offset <- DebugInformation.set_member_offset; - implem.set_bitfield_offset <- DebugInformation.set_bitfield_offset; - implem.insert_global_declaration <- DebugInformation.insert_global_declaration; - implem.add_fun_addr <- DebugInformation.add_fun_addr; - implem.generate_debug_info <- - if Configuration.system = "diab" then - (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) - else - (fun a b -> Some (Dwarfgen.gen_gnu_debug_info a b)); - implem.all_files_iter <- (fun f -> DebugInformation.StringSet.iter f !DebugInformation.all_files); - implem.insert_local_declaration <- DebugInformation.insert_local_declaration; - implem.atom_local_variable <- DebugInformation.atom_local_variable; - implem.enter_scope <- DebugInformation.enter_scope; - implem.enter_function_scope <- DebugInformation.enter_function_scope; - implem.add_lvar_scope <- DebugInformation.add_lvar_scope; - implem.open_scope <- DebugInformation.open_scope; - implem.close_scope <- DebugInformation.close_scope; - implem.start_live_range <- DebugInformation.start_live_range; - implem.end_live_range <- DebugInformation.end_live_range; - implem.stack_variable <- DebugInformation.stack_variable; - implem.add_label <- DebugInformation.add_label; - implem.atom_parameter <- DebugInformation.atom_parameter; - implem.add_compilation_section_start <- DebugInformation.add_compilation_section_start; - implem.add_compilation_section_end <- DebugInformation.add_compilation_section_end; - implem.compute_diab_file_enum <- DebugInformation.compute_diab_file_enum; - implem.compute_gnu_file_enum <- DebugInformation.compute_gnu_file_enum; - implem.exists_section <- DebugInformation.exists_section; - implem.remove_unused <- DebugInformation.remove_unused; - implem.variable_printed <- DebugInformation.variable_printed; - implem.add_diab_info <- DebugInformation.add_diab_info + let gen = + if Configuration.system = "diab" then + (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) + else + (fun a b -> Some (Dwarfgen.gen_gnu_debug_info a b)) in + implem := {default_debug with generate_debug_info = gen;} let init_none () = - implem.init <- (fun _ -> ()); - implem.atom_global <- (fun _ _ -> ()); - implem.set_composite_size <- (fun _ _ _ -> ()); - implem.set_member_offset <- (fun _ _ _ -> ()); - implem.set_bitfield_offset <- (fun _ _ _ _ _ -> ()); - implem.insert_global_declaration <- (fun _ _ -> ()); - implem.add_fun_addr <- (fun _ _ -> ()); - implem.generate_debug_info <- (fun _ _ -> None); - implem.all_files_iter <- (fun _ -> ()); - implem.insert_local_declaration <- (fun _ _ _ _ -> ()); - implem.atom_local_variable <- (fun _ _ -> ()); - implem.enter_scope <- (fun _ _ _ -> ()); - implem.enter_function_scope <- (fun _ _ -> ()); - implem.add_lvar_scope <- (fun _ _ _ -> ()); - implem.open_scope <- (fun _ _ _ -> ()); - implem.close_scope <- (fun _ _ _ -> ()); - implem.start_live_range <- (fun _ _ _ -> ()); - implem.end_live_range <- (fun _ _ -> ()); - implem.stack_variable <- (fun _ _ -> ()); - implem.add_label <- (fun _ _ _ -> ()); - implem.atom_parameter <- (fun _ _ _ -> ()); - implem.add_compilation_section_start <- (fun _ _ -> ()); - implem.add_compilation_section_end <- (fun _ _ -> ()); - implem.compute_diab_file_enum <- (fun _ _ _ -> ()); - implem.compute_gnu_file_enum <- (fun _ -> ()); - implem.exists_section <- (fun _ -> true); - implem.remove_unused <- (fun _ -> ()); - implem.variable_printed <- (fun _ -> ()); - implem.add_diab_info <- (fun _ _ -> ()) + implem := default_implem let init () = if !Clflags.option_g && Configuration.advanced_debug then -- 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/DebugInit.ml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'debug/DebugInit.ml') diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml index 209f2024..b4240af7 100644 --- a/debug/DebugInit.ml +++ b/debug/DebugInit.ml @@ -26,7 +26,7 @@ let default_debug = set_member_offset = DebugInformation.set_member_offset; set_bitfield_offset = DebugInformation.set_bitfield_offset; insert_global_declaration = DebugInformation.insert_global_declaration; - add_fun_addr = DebugInformation.add_fun_addr; + add_fun_addr = (fun _ _ _ -> ()); generate_debug_info = (fun _ _ -> None); all_files_iter = (fun f -> DebugInformation.StringSet.iter f !DebugInformation.all_files); insert_local_declaration = DebugInformation.insert_local_declaration; @@ -41,23 +41,24 @@ let default_debug = stack_variable = DebugInformation.stack_variable; add_label = DebugInformation.add_label; atom_parameter = DebugInformation.atom_parameter; - add_compilation_section_start = DebugInformation.add_compilation_section_start; - add_compilation_section_end = DebugInformation.add_compilation_section_end; compute_diab_file_enum = DebugInformation.compute_diab_file_enum; compute_gnu_file_enum = DebugInformation.compute_gnu_file_enum; exists_section = DebugInformation.exists_section; remove_unused = DebugInformation.remove_unused; variable_printed = DebugInformation.variable_printed; - add_diab_info = DebugInformation.add_diab_info; + add_diab_info = (fun _ _ _ _ -> ()); } let init_debug () = - let gen = + implem := if Configuration.system = "diab" then - (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) + let gen = (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) in + {default_debug with generate_debug_info = gen; + add_diab_info = DebugInformation.add_diab_info; + add_fun_addr = DebugInformation.diab_add_fun_addr;} else - (fun a b -> Some (Dwarfgen.gen_gnu_debug_info a b)) in - implem := {default_debug with generate_debug_info = gen;} + {default_debug with generate_debug_info = (fun a b -> Some (Dwarfgen.gen_gnu_debug_info a b)); + add_fun_addr = DebugInformation.gnu_add_fun_addr} let init_none () = implem := default_implem -- 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/DebugInit.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'debug/DebugInit.ml') diff --git a/debug/DebugInit.ml b/debug/DebugInit.ml index b4240af7..455112ed 100644 --- a/debug/DebugInit.ml +++ b/debug/DebugInit.ml @@ -53,6 +53,7 @@ let init_debug () = implem := if Configuration.system = "diab" then let gen = (fun a b -> Some (Dwarfgen.gen_diab_debug_info a b)) in + Clflags.option_gdwarf := 2; (* Dwarf 2 is the only supported target *) {default_debug with generate_debug_info = gen; add_diab_info = DebugInformation.add_diab_info; add_fun_addr = DebugInformation.diab_add_fun_addr;} -- cgit