From 1b65b17bf51c13e2ee0c461327a94f04390947eb Mon Sep 17 00:00:00 2001 From: Evgeniy Stepanov Date: Mon, 16 Jan 2012 12:45:07 +0000 Subject: [PATCH] [asan] Implement GetObjectNameAndOffset on ARM. llvm-svn: 148236 --- compiler-rt/lib/asan/asan_linux.cc | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/compiler-rt/lib/asan/asan_linux.cc b/compiler-rt/lib/asan/asan_linux.cc index 8b0572307735..67acd5246206 100644 --- a/compiler-rt/lib/asan/asan_linux.cc +++ b/compiler-rt/lib/asan/asan_linux.cc @@ -214,6 +214,27 @@ bool AsanProcMaps::Next(uintptr_t *start, uintptr_t *end, return true; } +#ifdef __arm__ + +// Gets the object name and the offset by walking AsanProcMaps. +bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset, + char filename[], + size_t filename_size) { + AsanProcMaps proc_maps; + uintptr_t start, end, file_offset; + while (proc_maps.Next(&start, &end, &file_offset, filename, filename_size)) { + if (addr >= start && addr < end) { + *offset = (addr - start) + file_offset; + return true; + } + } + if (filename_size) + filename[0] = '\0'; + return false; +} + +#else // __arm__ + struct DlIterateData { int count; uintptr_t addr; @@ -258,6 +279,8 @@ bool AsanProcMaps::GetObjectNameAndOffset(uintptr_t addr, uintptr_t *offset, return false; } +#endif // __arm__ + void AsanThread::SetThreadStackTopAndBottom() { if (tid() == 0) { // This is the main thread. Libpthread may not be initialized yet.