Skip to content
This repository was archived by the owner on Feb 5, 2019. It is now read-only.

Commit 324d96b

Browse files
committed
[asan] better debug diagnostics in asan compiler module
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@166102 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 02bf98a commit 324d96b

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/Transforms/Instrumentation/AddressSanitizer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ void AddressSanitizer::createInitializerPoisonCalls(Module &M,
534534

535535
bool AddressSanitizer::ShouldInstrumentGlobal(GlobalVariable *G) {
536536
Type *Ty = cast<PointerType>(G->getType())->getElementType();
537-
DEBUG(dbgs() << "GLOBAL: " << *G);
537+
DEBUG(dbgs() << "GLOBAL: " << *G << "\n");
538538

539539
if (BL->isIn(*G)) return false;
540540
if (!Ty->isSized()) return false;
@@ -682,7 +682,7 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) {
682682
FirstDynamic = LastDynamic;
683683
}
684684

685-
DEBUG(dbgs() << "NEW GLOBAL:\n" << *NewGlobal);
685+
DEBUG(dbgs() << "NEW GLOBAL: " << *NewGlobal << "\n");
686686
}
687687

688688
ArrayType *ArrayOfGlobalStructTy = ArrayType::get(GlobalStructTy, n);
@@ -851,6 +851,7 @@ bool AddressSanitizer::maybeInsertAsanInitAtFunctionEntry(Function &F) {
851851
bool AddressSanitizer::runOnFunction(Function &F) {
852852
if (BL->isIn(F)) return false;
853853
if (&F == AsanCtorFunction) return false;
854+
DEBUG(dbgs() << "ASAN instrumenting:\n" << F << "\n");
854855

855856
// If needed, insert __asan_init before checking for AddressSafety attr.
856857
maybeInsertAsanInitAtFunctionEntry(F);
@@ -914,8 +915,6 @@ bool AddressSanitizer::runOnFunction(Function &F) {
914915
NumInstrumented++;
915916
}
916917

917-
DEBUG(dbgs() << F);
918-
919918
bool ChangedStack = poisonStackInFunction(F);
920919

921920
// We must unpoison the stack before every NoReturn call (throw, _exit, etc).
@@ -925,6 +924,7 @@ bool AddressSanitizer::runOnFunction(Function &F) {
925924
IRBuilder<> IRB(CI);
926925
IRB.CreateCall(AsanHandleNoReturnFunc);
927926
}
927+
DEBUG(dbgs() << "ASAN done instrumenting:\n" << F << "\n");
928928

929929
return NumInstrumented > 0 || ChangedStack || !NoReturnCalls.empty();
930930
}

0 commit comments

Comments
 (0)