22 lines · cpp
1#include "attach.h"2#include <chrono>3#include <cstdio>4#include <thread>5 6volatile int g_val = 12345;7 8int main(int argc, char const *argv[]) {9 int temp;10 lldb_enable_attach();11 12 // Waiting to be attached by the debugger.13 temp = 0;14 15 while (temp < 30) {16 std::this_thread::sleep_for(std::chrono::seconds(2)); // Waiting to be attached...17 temp++;18 }19 20 printf("Exiting now\n");21}22