[WIP] Enable search during debugging via backend memory map#1120
Draft
xusheng6 wants to merge 1 commit into
Draft
[WIP] Enable search during debugging via backend memory map#1120xusheng6 wants to merge 1 commit into
xusheng6 wants to merge 1 commit into
Conversation
…while debugging When a debug adapter reports a memory map (DebugAdapter::GetMemoryMap), mirror it into the debugger BinaryView as one bounded remote memory region per entry instead of the single blanket overlay that spans the whole address space. This makes GetBackedAddressRanges() / GetNextBackedAddress() (which drive Find) cover only mapped memory, so search works during a debug session and skips unmapped gaps. - SyncMemoryRegions() runs on every stop but no-ops when the map is unchanged, so single-stepping stays cheap. - Adapters that report no map fall back to the blanket "debugger" region (search stays disabled gracefully instead of hanging on a 2^64 scan). - Per-region accessors are retired (not freed) on change and drained at teardown to avoid use-after-free from in-flight reads. Prototype; not ready for review. Known follow-ups: accessor-backed AddRemoteMemoryRegion is O(N^2), and the fallback should likely move into the adapter (base default returns a full range + an "exact" bit). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prototype for #668. Makes Find work during a debug session by mirroring the backend's memory map into the debugger BinaryView as bounded regions, instead of the single blanket overlay
[0, UINT64_MAX)that made search either hang or be hard-disabled.DebugAdapter::GetMemoryMap), register one bounded remote region per entry (debugger:N, with R/W/X flags).GetBackedAddressRanges()/GetNextBackedAddress()— which drive Find — then cover only mapped memory.SyncMemoryRegions()runs on every stop but no-ops when the map is unchanged, so single-stepping stays cheap."debugger"region, which keeps search disabled gracefully (no 2^64 scan / hang).Status
Not ready for review. Compiles clean (debugger core + parent core/UI) but not yet run against a live session.
Companion parent-repo change (search-gate warning messages): Vector35/binaryninja
test_debugger_memory_map.Known follow-ups
AddRemoteMemoryRegionis O(N²) per rebuild (rare, since diffed).🤖 Generated with Claude Code