Implement dr_insert_cbr_instrumentation on ARM & AArch64
dr_insert_cbr_instrumentation and dr_insert_cbr_instrumentation_ex are not yet implemented on ARM & AArch64.
xref #1569
Hello @derekbruening @fhahn @egrimley I have a requirement to get api/samples/cbrtrace.c working for AArch64.
My approach to implementing dr_insert_cbr_instrumentation_help() is to figure out the X86 version and port to AArch64. Do you think this is the best way of tackling the issue?
There may (probably will?) be differences in the way the clean call is used by dr_insert_cbr_instrumentation_help() on AArch64 AIUI the layouts differ.
The x86 version is so complex b/c it's trying to take advantage of the clean call state save to avoid spilling anything extra, yet not affect the stored state, while not changing the clean call insertion code and instead examining it afterward: rather messy. One could imagine ways to make it simpler and less fragile, but at a performance cost with extra loads and stores; or even simpler, with a layered callee who computes the branch direction from the dr_mcontex_t, but again at a performance cost.
One thing you won't have to deal with on AArch64 is the flags being clobbered (by POPF on x86 to clear the direction flag for the ABI).
Ah ok! Thanks Derek.
AARCH64 cbr instrumentation done in pr https://github.com/DynamoRIO/dynamorio/pull/7005. Please test and report issues if any. I am re-opening this issue since ARM cbr instrumentation is not implemented yet.