diff options
author | Bernhard Schommer <bernhardschommer@gmail.com> | 2020-02-06 14:55:34 +0100 |
---|---|---|
committer | Bernhard Schommer <bschommer@users.noreply.github.com> | 2020-02-06 17:28:39 +0100 |
commit | 6ca9f9bfc7119f1ca4f48de3b5a37cbaee07e4fd (patch) | |
tree | 10d82488c0f84f927888deaa5de76e30535e2f53 /debug/Dwarfgen.ml | |
parent | d5435a34169d92a96f1436128f3e90df7f4f9e9a (diff) | |
download | compcert-6ca9f9bfc7119f1ca4f48de3b5a37cbaee07e4fd.tar.gz compcert-6ca9f9bfc7119f1ca4f48de3b5a37cbaee07e4fd.zip |
Added base address if needed.
Ranges of locations are relative to some base address. Most times
this is just the same as the compilation unit. However if the
compilation unit contains functions in multiple sections we need
to add a base address of the section that the locations are
contained.
Diffstat (limited to 'debug/Dwarfgen.ml')
-rw-r--r-- | debug/Dwarfgen.ml | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/debug/Dwarfgen.ml b/debug/Dwarfgen.ml index e1b71f13..6c1d0846 100644 --- a/debug/Dwarfgen.ml +++ b/debug/Dwarfgen.ml @@ -408,7 +408,7 @@ module Dwarfgenaux (Target: TARGET) = and lo = translate_label f_id lo in hi,lo,range_entry_loc i.var_loc) l in let id = next_id () in - Some (LocRef id),[{loc = l;loc_id = id;}] + Some (LocRef id),[{loc_sec_begin = !current_section_start; loc = l;loc_id = id;}] end with Not_found -> None,[] else @@ -574,8 +574,8 @@ let diab_gen_compilation_section sec_name s defs acc = section_name = s; start_label = debug_start; line_label = line_start; - entry = cp; - dlocs = Some low_pc,accu.locs; + diab_entry = cp; + diab_locs = accu.locs; }::acc let gen_diab_debug_info sec_name var_section : debug_entries = @@ -643,6 +643,12 @@ let gen_gnu_debug_info sec_name var_section : debug_entries = } in let cp = new_entry (next_id ()) (DW_TAG_compile_unit cp) in let cp = add_children cp (types@defs) in - let loc_pc = if StringSet.cardinal sec > 1 then None else low_pc in let string_table = Hashtbl.fold (fun s i acc -> (i,s)::acc) string_table [] in - Gnu (cp,(loc_pc,accu.locs),string_table,snd accu.ranges) + let cp = { + string_table = string_table; + range_table = snd accu.ranges; + gnu_locs = accu.locs; + gnu_entry = cp; + several_secs = StringSet.cardinal sec > 1} + in + Gnu cp |