Skip to content

Count a dirty epoch on functions and on the type database ##analysis - #26706

Open
0verflowme wants to merge 1 commit into
radareorg:masterfrom
0verflowme:pr/anal-dirty-epochs
Open

Count a dirty epoch on functions and on the type database ##analysis#26706
0verflowme wants to merge 1 commit into
radareorg:masterfrom
0verflowme:pr/anal-dirty-epochs

Conversation

@0verflowme

Copy link
Copy Markdown
Member

Anything that caches work derived from a function's typed metadata, or from the type database, needs to know when that input changed. has_changed is a flag that one consumer clears, so a second consumer never sees the change. An epoch is a counter that only moves forward, and every consumer keeps the value it last saw.

  • RAnalFunction.dirty_epoch, bumped by r_anal_function_bump_dirty_epoch, on: relocate, rename, variable set/rename/retype, signature set, calling convention change, afB, afS, and when r_anal_function_cc resolves a lazy dyncc marker. Zero is never a valid value, so a consumer that starts from zero always sees the first change.
  • RAnal.type_dirty_epoch, bumped by r_anal_types_bump_dirty_epoch, on: type database loads and reloads, parsed type save and remove, base type save, signature delete, and type links. The link writers (r_type_set_link, r_type_link_offset, r_type_unlink) do not see RAnal, so r_anal_types_set_link, r_anal_types_set_link_offset and r_anal_types_unlink wrap them and the three core callers go through the wrappers.
  • r_anal_function_set_callconv validates the convention and bumps; afc uses it instead of writing fcn->callconv directly.

The function bump also sets has_changed, so existing readers of that flag keep working. test_anal_function checks that relocate and rename move the epoch.

Split out of #26701.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant