Skip to content

Commit

Permalink
i#4461: Skip stolen register on drcachesim filter barriers
Browse files Browse the repository at this point in the history
Do not try to get the application value of the stolen register on the
jump barrier used for drreg parity in filtered drcachesim
instrumentation.

Enable thread filtering on non-x86: there is no missing support there.

Tested by locally enabling the tool.drcacheoff.burst_threadfilter test
(it is disabled for AArch64 because of the #2007 link failure in some
toolchains), working around #4468 with "-steal_register 25", and
confirming that the drreg failure disappears with the fix here.

This is needed for the forthcoming new global filter for drcachesim
(#4462), in addition to the thread filter feature.  An
enabled-on-AArch64 test should be added as part of that feature to
serve as a regression test here, if #2007 has not been resolved by
then to enable the thread filter test.

Issue: #4461, #4462
Fixes #4461
  • Loading branch information
derekbruening committed Oct 2, 2020
1 parent 32236dc commit 5ca06cd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions clients/drcachesim/tracer/tracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,10 +298,6 @@ drmemtrace_status_t
drmemtrace_filter_threads(bool (*should_trace_thread)(thread_id_t tid, void *user_data),
void *user_value)
{
#ifndef X86
/* XXX i#2820: only x86 supports thread filtering for now. */
return DRMEMTRACE_ERROR_NOT_IMPLEMENTED;
#endif
if (should_trace_thread == NULL)
return DRMEMTRACE_ERROR_INVALID_PARAMETER;
/* We document that this should be called once at init time: i.e., we do not
Expand Down Expand Up @@ -700,7 +696,11 @@ insert_conditional_skip_target(void *drcontext, instrlist_t *ilist, instr_t *whe
{
if (reg_barrier != DR_REG_NULL) {
for (reg_id_t reg = DR_REG_START_GPR; reg <= DR_REG_STOP_GPR; ++reg) {
if (reg != reg_barrier) {
/* We're not allowed to restore the stolen register this way, but drreg
* won't hand it out as a scratch register in any case, so we don't need
* a barrier for it.
*/
if (reg != reg_barrier && reg != dr_get_stolen_reg()) {
drreg_status_t res =
drreg_get_app_value(drcontext, ilist, where, reg, reg);
if (res != DRREG_ERROR_NO_APP_VALUE && res != DRREG_SUCCESS)
Expand Down

0 comments on commit 5ca06cd

Please sign in to comment.