void ThreadInfo::GetThreadStack(const CrashInfo& crashInfo, uint64_t* startAddress, size_t* size) const { *startAddress = m_gpRegisters.rsp & PAGE_MASK; *size = 4 * PAGE_SIZE; for (const MemoryRegion& mapping : crashInfo.OtherMappings()) { if (*startAddress >= mapping.StartAddress() && *startAddress < mapping.EndAddress()) { // Use the mapping found for the size of the thread's stack *size = mapping.EndAddress() - *startAddress; if (g_diagnostics) { TRACE("Thread %04x stack found in other mapping (size %08lx): ", m_tid, *size); mapping.Print(); } break; } } }
void ThreadInfo::GetThreadStack(const CrashInfo& crashInfo, uint64_t* startAddress, size_t* size) const { #if defined(__arm__) *startAddress = m_gpRegisters.ARM_sp & PAGE_MASK; #else *startAddress = m_gpRegisters.rsp & PAGE_MASK; #endif *size = 4 * PAGE_SIZE; const MemoryRegion* region = CrashInfo::SearchMemoryRegions(crashInfo.OtherMappings(), *startAddress); if (region != nullptr) { // Use the mapping found for the size of the thread's stack *size = region->EndAddress() - *startAddress; if (g_diagnostics) { TRACE("Thread %04x stack found in other mapping (size %08zx): ", m_tid, *size); region->Trace(); } } }