[asan] minor fix in the asan memory profile
authorKostya Serebryany <kcc@google.com>
Tue, 23 Aug 2016 18:13:51 +0000 (18:13 +0000)
committerKostya Serebryany <kcc@google.com>
Tue, 23 Aug 2016 18:13:51 +0000 (18:13 +0000)
llvm-svn: 279547

compiler-rt/lib/asan/asan_allocator.cc
compiler-rt/lib/asan/asan_allocator.h
compiler-rt/lib/asan/asan_memory_profile.cc

index c1a9765..b45c23a 100644 (file)
@@ -710,6 +710,9 @@ void GetAllocatorOptions(AllocatorOptions *options) {
 AsanChunkView FindHeapChunkByAddress(uptr addr) {
   return instance.FindHeapChunkByAddress(addr);
 }
+AsanChunkView FindHeapChunkByAllocBeg(uptr addr) {
+  return AsanChunkView(instance.GetAsanChunk(reinterpret_cast<void*>(addr)));
+}
 
 void AsanThreadLocalMallocStorage::CommitBack() {
   instance.CommitBack(this);
index 19142fb..c179b86 100644 (file)
@@ -91,6 +91,7 @@ class AsanChunkView {
 };
 
 AsanChunkView FindHeapChunkByAddress(uptr address);
+AsanChunkView FindHeapChunkByAllocBeg(uptr address);
 
 // List of AsanChunks with total size.
 class AsanChunkFifoList: public IntrusiveList<AsanChunk> {
index ba00516..c55264e 100644 (file)
@@ -74,7 +74,7 @@ class HeapProfile {
 
 static void ChunkCallback(uptr chunk, void *arg) {
   HeapProfile *hp = reinterpret_cast<HeapProfile*>(arg);
-  AsanChunkView cv = FindHeapChunkByAddress(chunk);
+  AsanChunkView cv = FindHeapChunkByAllocBeg(chunk);
   if (!cv.IsAllocated()) return;
   u32 id = cv.GetAllocStackId();
   if (!id) return;