diff options
Diffstat (limited to 'src/debug/createdump/crashinfo.cpp')
-rw-r--r-- | src/debug/createdump/crashinfo.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/debug/createdump/crashinfo.cpp b/src/debug/createdump/crashinfo.cpp index 4db2b00eeb..a720e5ca36 100644 --- a/src/debug/createdump/crashinfo.cpp +++ b/src/debug/createdump/crashinfo.cpp @@ -98,7 +98,7 @@ CrashInfo::EnumMemoryRegion( // gather any info about the process. // bool -CrashInfo::EnumerateAndSuspendThreads() +CrashInfo::EnumerateAndSuspendThreads(bool suspend) { char taskPath[128]; snprintf(taskPath, sizeof(taskPath), "/proc/%d/task", m_pid); @@ -117,7 +117,7 @@ CrashInfo::EnumerateAndSuspendThreads() if (tid != 0) { // Don't suspend the threads if running under sos - if (!m_sos) + if (!m_sos && suspend) { // Reference: http://stackoverflow.com/questions/18577956/how-to-use-ptrace-to-get-a-consistent-view-of-multiple-threads if (ptrace(PTRACE_ATTACH, tid, nullptr, nullptr) != -1) @@ -143,22 +143,42 @@ CrashInfo::EnumerateAndSuspendThreads() } // +// Set registers for all threads +// +bool +CrashInfo::SetThreadsRegisters(const std::vector<elf_prstatus*> &statuses) +{ + for (ThreadInfo* thread : m_threads) { + for (elf_prstatus* status : statuses) { + if (thread->Tid() == status->pr_pid) { + thread->SetRegisters(status); + break; + } + } + } + + return true; +} + +// // Gather all the necessary crash dump info. // bool -CrashInfo::GatherCrashInfo(MINIDUMP_TYPE minidumpType) +CrashInfo::GatherCrashInfo(MINIDUMP_TYPE minidumpType, bool initialize_threads) { // Get the process info if (!GetStatus(m_pid, &m_ppid, &m_tgid, &m_name)) { return false; } - // Get the info about the threads (registers, etc.) - for (ThreadInfo* thread : m_threads) - { - if (!thread->Initialize(m_sos ? m_dataTarget : nullptr)) + if (initialize_threads) { + // Get the info about the threads (registers, etc.) + for (ThreadInfo* thread : m_threads) { - return false; + if (!thread->Initialize(m_sos ? m_dataTarget : nullptr)) + { + return false; + } } } // Get the auxv data |