Fix IDA 9.0–9.2 build: emulate bookmarks_t::get_by_inode() (#35)#36
Merged
Conversation
bookmarks_t::get_by_inode() was added in IDA 9.3; building the bookmark collectors against the 9.0/9.1/9.2 SDKs failed at both compile (no such member) and link (no exported bookmarks_t_get_by_inode). Route both call sites through a new idasql_bookmarks_get_by_inode() wrapper in ida_compat.hpp, gated by IDASQL_HAS_BOOKMARKS_GET_BY_INODE (IDA_SDK_VERSION >= 930). On 9.3+ it forwards to the real API; on older SDKs it emulates with the stable size()/get() store API. The standard bookmark dirtrees key each leaf inode by the place's primary coordinate (verified on 9.3: idaplace inode == ea, the leaf is even named after the hex ea; tiplace mirrors by ordinal). Both collectors only pass real leaf inodes, so the emulation scans the store and returns the slot whose coordinate matches, leaving out_entry/out_desc filled by get() exactly as get_by_inode would. is_place_class_ea_capable() selects the coordinate without constructing a place (idalib does not export tiplace's constructor). Verified: compiles + links against SDK 9.0/9.1/9.2/9.3; forcing the emulation path on the 9.3 runtime returns byte-for-byte identical bookmarks / local_type_bookmarks rows vs the real get_by_inode.
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.
Fixes #35.
Problem
bookmarks_t::get_by_inode()was introduced in IDA 9.3. The bookmark collectors referenced it directly, so building against the 9.0/9.1/9.2 SDKs failed at both compile (no such member) and link (no exportedbookmarks_t_get_by_inode).Fix
Route both call sites (
symbols_bookmarks.cpp,types_bookmarks.cpp) through a newidasql_bookmarks_get_by_inode()wrapper inida_compat.hpp, gated byIDASQL_HAS_BOOKMARKS_GET_BY_INODE (IDA_SDK_VERSION >= 930):bookmarks_t::get_by_inode()(no behavior change).size()/get()store API.How the emulation works
The standard bookmark dirtrees key each leaf inode by the place's primary coordinate. Verified empirically on 9.3:
inode == ea— the dirtree leaf is even named after the hex EA (e.g./mine/100000558).ordinal(and don't get a leaf frommark()by default, so this path is dormant).Both collectors only ever pass real dirtree-leaf inodes (enumerated via
collect_inode_paths), so the shim scans the store and returns the slot whose coordinate matches the inode, leavingout_entry/out_descpopulated byget()exactly asget_by_inodewould.is_place_class_ea_capable()selects the coordinate without constructing a place (idalib doesn't exporttiplace_t's constructor — we only read members off placesget()fills).Verification
get_by_inode).bookmarksandlocal_type_bookmarksrows (slot / inode / address / description / folder_path / full_path) vs. the realget_by_inode.No CMake changes; header-only addition plus two one-line call-site swaps.