Chromium Code Reviews| Index: src/IceASanInstrumentation.cpp |
| diff --git a/src/IceASanInstrumentation.cpp b/src/IceASanInstrumentation.cpp |
| index 3978706a1ab5a13c123de5d1677838b09c81aa9b..389760bd5ce162a141305b5aeed5ffe9ad4b95ea 100644 |
| --- a/src/IceASanInstrumentation.cpp |
| +++ b/src/IceASanInstrumentation.cpp |
| @@ -389,6 +389,24 @@ void ASanInstrumentation::instrumentLoad(LoweringContext &Context, |
| void ASanInstrumentation::instrumentStore(LoweringContext &Context, |
| InstStore *Instr) { |
| + Operand *Data = Instr->getData(); |
| + if (auto *Reloc = llvm::dyn_cast<ConstantRelocatable>(Data)) { |
| + std::string DataName = Reloc->getName().toStringOrEmpty(); |
| + assert(!DataName.empty()); |
|
Jim Stichnoth
2016/08/18 13:17:19
I just realized that if you use this pattern:
S
tlively
2016/08/18 15:17:48
Done.
|
| + StringMap::const_iterator DataSub = FuncSubstitutions.find(DataName); |
| + if (DataSub != FuncSubstitutions.end()) { |
| + auto *NewData = ConstantRelocatable::create( |
| + Ctx, Reloc->getType(), |
| + RelocatableTuple(Reloc->getOffset(), RelocOffsetArray(0), |
| + Ctx->getGlobalString(DataSub->second), |
| + Reloc->getEmitString())); |
| + auto *NewStore = InstStore::create(Context.getNode()->getCfg(), NewData, |
| + Instr->getAddr()); |
| + Instr->setDeleted(); |
| + Context.insert(NewStore); |
| + Instr = NewStore; |
| + } |
| + } |
|
Karl
2016/08/18 14:17:01
Minor nit. It appears that instrument load/store l
tlively
2016/08/18 15:17:48
Done.
|
| Constant *Func = |
| Ctx->getConstantExternSym(Ctx->getGlobalString("__asan_check_store")); |
| instrumentAccess(Context, Instr->getAddr(), |