From 7a9eb49a47058fddaaf1576bc8547696221d9230 Mon Sep 17 00:00:00 2001 From: Kostya Serebryany Date: Thu, 15 Dec 2011 22:55:55 +0000 Subject: [PATCH] [asan] add the name of the module to the description of a global variable. This improves the readability of global-buffer-overflow reports. llvm-svn: 146698 --- llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp index e4f197853eff..4cc57276e6f1 100644 --- a/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp +++ b/llvm/lib/Transforms/Instrumentation/AddressSanitizer.cpp @@ -521,7 +521,11 @@ bool AddressSanitizer::insertGlobalRedzones(Module &M) { NewTy, G->getInitializer(), Constant::getNullValue(RightRedZoneTy), NULL); - GlobalVariable *Name = createPrivateGlobalForString(M, G->getName()); + SmallString<2048> DescriptionOfGlobal = G->getName(); + DescriptionOfGlobal += " ("; + DescriptionOfGlobal += M.getModuleIdentifier(); + DescriptionOfGlobal += ")"; + GlobalVariable *Name = createPrivateGlobalForString(M, DescriptionOfGlobal); // Create a new global variable with enough space for a redzone. GlobalVariable *NewGlobal = new GlobalVariable(