AArch64 CRASH post-detach: x0 clobbered, resulting in bad arg for stats in dr_app_stop_and_cleanup_with_stats
If we change the call to dr_app_stop_and_cleanup() to instead call dr_app_stop_and_cleanup_with_stats() in the api.detach test, we hit a crash in stats_get_snapshot().
Looks like x0 is clobbered on detach.
Hmm: ARM has emit_fcache_enter_gonative() but A64 does not! So stolen reg value is not restored. &stats is in x0 as 1st (only) arg to dr_app_stop_and_cleanup_with_stats(). Then fcache_enter uses x0 to store the target PC, clobbering it.
Looks like yet another case of the AArch64 port stopping early and not finishing known pieces, causing problems later and wasted time diagnosing symptoms.