add_box_excl: use greater address below bound
It is possible, eg. for the end-of-data debug_line tag, that the address does not correspond to an instruction address but eg. the last address of .text. To avoid an error here, we use as a bound address the greater known address below the given bound instead.
This commit is contained in:
parent
d738314490
commit
89ac1b8368
1 changed files with 8 additions and 5 deletions
|
@ -97,11 +97,14 @@ let add_box render_data range opt_data : render_data_t * int =
|
|||
|
||||
(** Same as [add_box], with an included start, excluded end for range. *)
|
||||
let add_box_excl render_data (addr_beg, addr_end) opt_data =
|
||||
(match RawAsm.AddrMap.find_opt addr_end render_data.render_prev_address with
|
||||
| None -> Format.eprintf "Box end address %x not found, ignoring box."
|
||||
addr_end ;
|
||||
raise Not_found
|
||||
| Some end_bound -> add_box render_data (addr_beg, end_bound) opt_data
|
||||
let lower_than_end addr = addr <= addr_end in
|
||||
(match RawAsm.AddrMap.find_last_opt
|
||||
lower_than_end render_data.render_prev_address with
|
||||
| None ->
|
||||
Format.eprintf "Box end address %x not found, ignoring box.@."
|
||||
addr_end ;
|
||||
raise Not_found
|
||||
| Some (_, end_bound) -> add_box render_data (addr_beg, end_bound) opt_data
|
||||
)
|
||||
|
||||
(** [to_file renderer render_data path] renders the given [render_data] to a
|
||||
|
|
Loading…
Reference in a new issue