11bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen//===-- main.cpp ------------------------------------------------*- C++ -*-===// 21bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// 31bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// The LLVM Compiler Infrastructure 41bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// 51bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// This file is distributed under the University of Illinois Open Source 61bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// License. See LICENSE.TXT for details. 71bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen// 81bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen//===----------------------------------------------------------------------===// 91bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen#include <stdio.h> 10cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor#include <unistd.h> 111bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen 121bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chenint main (int argc, char const *argv[]) 131bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen{ 141bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen char my_string[] = {'a', 'b', 'c', 'd', 'e', 'f', 'g', 0}; 151bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen double my_double = 1234.5678; 16cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor 17cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor // For simplicity assume that any cmdline argument means wait for attach. 18cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor if (argc > 1) 19cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor { 20cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor volatile int wait_for_attach=1; 21cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor while (wait_for_attach) 22cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor usleep(1); 23cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor } 24cd2b54b6d78fec6c5b68f8565150b5a6d3aaf7caAndrew Kaylor 251bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen printf("my_string=%s\n", my_string); 261bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen printf("my_double=%g\n", my_double); 271bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen return 0; 281bc1caddf53e812ba87411f76fc15b7971930c22Johnny Chen} 29