Files
clang-p2996/lldb/test/API/macosx/corefile-exception-reason/main.cpp
Vedant Kumar 3b14d80ad4 [MachCore] Report arm64 thread exception state
A MachO userspace corefile may contain LC_THREAD commands which specify
thread exception state.

For arm64* only (for now), report a human-readable version of this state
as the thread stop reason, instead of 'SIGSTOP'.

As a follow-up, similar functionality can be implemented for x86 cores
by translating the trapno/err exception registers.

rdar://82898146

Differential Revision: https://reviews.llvm.org/D109795
2021-09-17 16:45:03 -07:00

25 lines
498 B
C++

#include <stdlib.h>
#include <thread>
#include <unistd.h>
#include <vector>
void *sleep_worker(void *in) {
sleep(30);
sleep(30);
return nullptr;
}
void *crash_worker(void *in) {
sleep(1);
volatile int *p = nullptr; // break here
return (void *)*p;
}
int main() {
std::vector<std::thread> threads;
threads.push_back(std::move(std::thread(crash_worker, nullptr)));
for (int i = 0; i < 15; i++)
threads.push_back(std::move(std::thread(sleep_worker, nullptr)));
sleep(10);
}