From 7a47d42230d49f052b5599bb0b8f25cf71174436 Mon Sep 17 00:00:00 2001 From: blasty Date: Thu, 23 Jul 2026 01:34:48 +0200 Subject: perf: derive segment map from file_regions, not survey_binary (hex open ~3400x) The slow hex load wasn't the byte reads (read_raw fixed those) -- it was opening the pane at all: hex_model -> image_range -> sections called survey_binary, which computes function counts/strings/stats and takes ~24s on libcrypto, blocking the first hex open (and section_of/segment_bounds/ region_label in the listing). sections/file_regions/image_range now share one cheap _segments source backed by the injected file_regions tool (a plain segment walk, ~7ms), which gains a name field so it fully replaces survey_binary for the segment map. Falls back to survey_binary only if the tool is missing. Measured (libcrypto): segment map 24240ms -> 7.1ms (~3400x); hex open goes from ~24s to ~11ms. Correctness verified (names, section_of/segment_bounds/ file_offset); hex+listing scenarios 24/0, full suite 123/1 flaky. Needs a supervisor restart. --- server/patch_server.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'server/patch_server.py') diff --git a/server/patch_server.py b/server/patch_server.py index 4764367..4b2661f 100644 --- a/server/patch_server.py +++ b/server/patch_server.py @@ -175,7 +175,12 @@ def file_regions() -> dict: fo = -1 if fo < 0 or fo >= (1 << 48): fo = -1 - out.append({"start": hex(seg.start_ea), "end": hex(seg.end_ea), "file_off": fo}) + try: + nm = ida_segment.get_segm_name(seg) or "" + except Exception: + nm = "" + out.append({"start": hex(seg.start_ea), "end": hex(seg.end_ea), + "file_off": fo, "name": nm}) seg = ida_segment.get_next_seg(seg.start_ea) return {"regions": out} -- cgit v1.3.1-sl0p