| 786 | } |
| 787 | |
| 788 | bool StackTrace::FindSymbol(void* symbol) const { |
| 789 | #if !defined(__UCLIBC__) |
| 790 | for (size_t i = 0; i < count_; ++i) { |
| 791 | uint64_t saddr; |
| 792 | // Subtract by one as return address of function may be in the next |
| 793 | // function when a function is annotated as noreturn. |
| 794 | void* address = static_cast<char*>(trace_[i]) - 1; |
| 795 | if (!google::SymbolizeAddress(address, &saddr)) { |
| 796 | continue; |
| 797 | } |
| 798 | if ((void*)saddr == symbol) { |
| 799 | return true; |
| 800 | } |
| 801 | } |
| 802 | #endif |
| 803 | return false; |
| 804 | } |
| 805 | |
| 806 | void StackTrace::Print() const { |
| 807 | // NOTE: This code MUST be async-signal safe (it's used by in-process |
no outgoing calls