diff options
author | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-01-16 12:45:07 +0000 |
---|---|---|
committer | Evgeniy Stepanov <eugeni.stepanov@gmail.com> | 2012-01-16 12:45:07 +0000 |
commit | 1b65b17bf51c13e2ee0c461327a94f04390947eb (patch) | |
tree | 5be86d159351ade75e79ee5d526da5573c5cacab | |
parent | 50bf956f290850a4311ca5e0b69d27bcb29b0b93 (diff) | |
download | bcm5719-llvm-1b65b17bf51c13e2ee0c461327a94f04390947eb.tar.gz bcm5719-llvm-1b65b17bf51c13e2ee0c461327a94f04390947eb.zip |
[asan] Implement GetObjectNameAndOffset on ARM.
llvm-svn: 148236
-rw-r--r-- | compiler-rt/lib/asan/asan_linux.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/compiler-rt/lib/asan/asan_linux.cc b/compiler-rt/lib/asan/asan_linux.cc index 8b057230773..67acd524620 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. |