[mlir][acc] Introduce MappableType interface (#122146)
[llvm-project.git] / lldb / test / API / tools / lldb-server / inferior-crash / main.cpp
blobced7f7125088e7e5fe424afe992a8ce7386178d2
1 #include <cstdlib>
2 #include <cstring>
3 #include <iostream>
5 namespace {
6 const char *const SEGFAULT_COMMAND = "segfault";
7 const char *const ABORT_COMMAND = "abort";
10 int main(int argc, char **argv) {
11 if (argc < 2) {
12 std::cout << "expected at least one command provided on the command line"
13 << std::endl;
16 // Process command line args.
17 for (int i = 1; i < argc; ++i) {
18 const char *const command = argv[i];
19 if (std::strstr(command, SEGFAULT_COMMAND)) {
20 // Perform a null pointer access.
21 int *const null_int_ptr = nullptr;
22 *null_int_ptr = 0xDEAD;
23 } else if (std::strstr(command, ABORT_COMMAND)) {
24 std::abort();
25 } else {
26 std::cout << "Unsupported command: " << command << std::endl;
30 return 0;