This is an archive of the discontinued LLVM Phabricator instance.

[TSAN] Fix test java_race_pc for MIPS
ClosedPublic

Authored by slthakur on Mar 2 2016, 3:45 AM.

Details

Reviewers
dvyukov
samsonov
Summary

For mips we reduce pc by 8 in function StackTrace::GetPreviousInstructionPc. Therefore we need to increase pc by 8 here to get the correct address in the stacktrace.

Diff Detail

Repository
rL LLVM

Event Timeline

slthakur updated this revision to Diff 49599.Mar 2 2016, 3:45 AM
slthakur retitled this revision from to [TSAN] Fix test java_race_pc for MIPS.
slthakur updated this object.
slthakur added reviewers: samsonov, dvyukov.
slthakur set the repository for this revision to rL LLVM.
dvyukov edited edge metadata.Mar 2 2016, 4:23 AM

This is not specific to this particular test. Please add kPCInc constant to test.h file and use the const here.

slthakur updated this revision to Diff 49606.Mar 2 2016, 4:45 AM
slthakur edited edge metadata.

Addressed review comment.

I see that StackTrace::GetPreviousInstructionPc special cases not just mips. Please duplicate what StackTrace::GetPreviousInstructionPc does, and comment that it must be in sync with StackTrace::GetPreviousInstructionPc. Also we never increase indentation level after #if (at least not in this file), so start "const int kPCInc" from the first column.

Here is what StackTrace::GetPreviousInstructionPc does:

#if defined(powerpc) || defined(powerpc64)

// PCs are always 4 byte aligned.
return pc - 4;

#elif defined(sparc) || defined(mips)

return pc - 8;

#else

return pc - 1;

#endif

slthakur updated this revision to Diff 49607.Mar 2 2016, 5:33 AM

Fixed indentation and duplicated code of StackTrace::GetPreviousInstructionPc in test.h

dvyukov accepted this revision.Mar 2 2016, 5:44 AM
dvyukov edited edge metadata.

LGTM
Thanks!

This revision is now accepted and ready to land.Mar 2 2016, 5:44 AM
slthakur closed this revision.Mar 2 2016, 5:58 AM

Committed in revision 262483.