diff options
author | Alexander Potapenko <glider@google.com> | 2012-01-18 11:42:30 +0000 |
---|---|---|
committer | Alexander Potapenko <glider@google.com> | 2012-01-18 11:42:30 +0000 |
commit | 1d483d4e933705971ff6285522fb5aecfb8a2e20 (patch) | |
tree | 7eae07b2a81f694b98929091eabca4876ba5fd6f /lib/asan/asan_stack.cc | |
parent | 8a34d384255f9bf4c2a9b03a4df81b9af57124d8 (diff) |
Delete sysinfo/* and all references to it.
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@148386 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/asan/asan_stack.cc')
-rw-r--r-- | lib/asan/asan_stack.cc | 98 |
1 files changed, 4 insertions, 94 deletions
diff --git a/lib/asan/asan_stack.cc b/lib/asan/asan_stack.cc index c332db050..60e4f9228 100644 --- a/lib/asan/asan_stack.cc +++ b/lib/asan/asan_stack.cc @@ -18,10 +18,6 @@ #include "asan_thread.h" #include "asan_thread_registry.h" -#if ASAN_USE_SYSINFO == 1 -#include "sysinfo/sysinfo.h" -#endif - #ifdef ASAN_USE_EXTERNAL_SYMBOLIZER extern bool ASAN_USE_EXTERNAL_SYMBOLIZER(const void *pc, char *out, int out_size); @@ -29,93 +25,8 @@ ASAN_USE_EXTERNAL_SYMBOLIZER(const void *pc, char *out, int out_size); namespace __asan { -// ----------------------- ProcSelfMaps ----------------------------- {{{1 -#if ASAN_USE_SYSINFO == 1 -class ProcSelfMaps { - public: - void Init() { - ScopedLock lock(&mu_); - if (map_size_ != 0) return; // already inited - if (FLAG_v >= 2) { - Printf("ProcSelfMaps::Init()\n"); - } - ProcMapsIterator it(0, &proc_self_maps_); // 0 means "current pid" - - uint64 start, end, offset; - int64 inode; - char *flags, *filename; - CHECK(map_size_ == 0); - while (it.Next(&start, &end, &flags, &offset, &inode, &filename)) { - CHECK(map_size_ < kMaxProcSelfMapsSize); - Mapping &mapping = memory_map[map_size_]; - mapping.beg = start; - mapping.end = end; - mapping.offset = offset; - real_strncpy(mapping.name, - filename, ASAN_ARRAY_SIZE(mapping.name)); - mapping.name[ASAN_ARRAY_SIZE(mapping.name) - 1] = 0; - if (FLAG_v >= 2) { - Printf("[%ld] [%p,%p] off %p %s\n", map_size_, - mapping.beg, mapping.end, mapping.offset, mapping.name); - } - map_size_++; - } - } - - void Print() { - Printf("%s\n", proc_self_maps_); - } - - void PrintPc(uintptr_t pc, int idx) { - for (size_t i = 0; i < map_size_; i++) { - Mapping &m = memory_map[i]; - if (pc >= m.beg && pc < m.end) { - uintptr_t offset = pc - m.beg; - if (i == 0) offset = pc; - Printf(" #%d 0x%lx (%s+0x%lx)\n", idx, pc, m.name, offset); - return; - } - } - Printf(" #%d 0x%lx\n", idx, pc); - } - - private: - void copy_until_new_line(const char *str, char *dest, size_t max_size) { - size_t i = 0; - for (; str[i] && str[i] != '\n' && i < max_size - 1; i++) { - dest[i] = str[i]; - } - dest[i] = 0; - } - - - struct Mapping { - uintptr_t beg, end, offset; - char name[1000]; - }; - static const size_t kMaxNumMapEntries = 4096; - static const size_t kMaxProcSelfMapsSize = 1 << 20; - ProcMapsIterator::Buffer proc_self_maps_; - size_t map_size_; - Mapping memory_map[kMaxNumMapEntries]; - - static AsanLock mu_; -}; - -static ProcSelfMaps proc_self_maps; -AsanLock ProcSelfMaps::mu_(LINKER_INITIALIZED); - - -void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { - proc_self_maps.Init(); - for (size_t i = 0; i < size && addr[i]; i++) { - uintptr_t pc = addr[i]; - // int line; - proc_self_maps.PrintPc(pc, i); - // Printf(" #%ld 0x%lx %s\n", i, pc, rtn.c_str()); - } -} -#elif defined(ASAN_USE_EXTERNAL_SYMBOLIZER) +// ----------------------- AsanStackTrace ----------------------------- {{{1 +#if defined(ASAN_USE_EXTERNAL_SYMBOLIZER) void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { for (size_t i = 0; i < size && addr[i]; i++) { uintptr_t pc = addr[i]; @@ -125,7 +36,7 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { } } -#else // ASAN_USE_SYSINFO +#else // ASAN_USE_EXTERNAL_SYMBOLIZER void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { AsanProcMaps proc_maps; for (size_t i = 0; i < size && addr[i]; i++) { @@ -141,7 +52,7 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { } } } -#endif // ASAN_USE_SYSINFO +#endif // ASAN_USE_EXTERNAL_SYMBOLIZER #ifdef __arm__ #define UNWIND_STOP _URC_END_OF_STACK @@ -151,7 +62,6 @@ void AsanStackTrace::PrintStack(uintptr_t *addr, size_t size) { #define UNWIND_CONTINUE _URC_NO_REASON #endif -// ----------------------- AsanStackTrace ----------------------------- {{{1 uintptr_t AsanStackTrace::GetCurrentPc() { return GET_CALLER_PC(); } |