[llvm-commits] [compiler-rt] r148236 - /compiler-rt/trunk/lib/asan/asan_linux.cc

Evgeniy Stepanov eugeni.stepanov at gmail.com
Mon Jan 16 04:45:08 PST 2012


Author: eugenis
Date: Mon Jan 16 06:45:07 2012
New Revision: 148236

URL: http://llvm.org/viewvc/llvm-project?rev=148236&view=rev
Log:
[asan] Implement GetObjectNameAndOffset on ARM.

Modified:
    compiler-rt/trunk/lib/asan/asan_linux.cc

Modified: compiler-rt/trunk/lib/asan/asan_linux.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/asan/asan_linux.cc?rev=148236&r1=148235&r2=148236&view=diff
==============================================================================
--- compiler-rt/trunk/lib/asan/asan_linux.cc (original)
+++ compiler-rt/trunk/lib/asan/asan_linux.cc Mon Jan 16 06:45:07 2012
@@ -214,6 +214,27 @@
   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 @@
   return false;
 }
 
+#endif // __arm__
+
 void AsanThread::SetThreadStackTopAndBottom() {
   if (tid() == 0) {
     // This is the main thread. Libpthread may not be initialized yet.





More information about the llvm-commits mailing list