From 24d27098b85efc6cc69f5dc6492ec6675cabfcec Mon Sep 17 00:00:00 2001 From: Tudor Brindus Date: Tue, 9 Jan 2024 18:17:05 -0500 Subject: [PATCH] Fix `-trigger addr:...` selections The hex string parsing was reversed. Signed-off-by: Tudor Brindus --- core/elf.ml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/elf.ml b/core/elf.ml index 0de0a27e3..fe02cf273 100644 --- a/core/elf.ml +++ b/core/elf.ml @@ -216,13 +216,13 @@ let find_selection t name : Selection.t option = | None -> None | Some address -> Some (Selection.Address { address; name }))) in - let find_addr_selection name = + let find_addr_selection addr = Option.bind (Option.try_with (fun () -> - let name = - if String.is_prefix ~prefix:"0x" name then String.drop_prefix name 2 else name + let addr = + if not (String.is_prefix ~prefix:"0x" addr) then "0x" ^ addr else addr in - Int.Hex.of_string name)) + Int.Hex.of_string addr)) ~f:(fun address -> Some (Selection.Address { address; name })) in let find_symbol_selection name =