title: How to make lldb ignore EXC_BAD_ACCESS exception?
body: <p>I am writing a program on Mac OSX depending on the sigaction/sa_handler mechanism. Run a code snippet from user and get ready to catch signals/exceptions at any time. The program works fine, but the problem is I can't debug it with lldb. lldb seems not being able to ignore any exceptions even I set</p>
  
  <pre><code>proc hand -p true -s false SIGSEGV 
  proc hand -p true -s false SIGBUS
  </code></pre>
  
  <p>The control flow stops at the instruction that triggers the exception and does not jump to the sa_handler I installed earlier even I tried command <code>c</code>. The output was:</p>
  
  <pre><code>Process 764 stopped
  * thread #2: tid = 0xf140, 0x00000001000b8000, stop reason = EXC_BAD_ACCESS (code=2, address=0x1000b8000)
  </code></pre>
  
  <p>How do I make lldb ignore the exception/signal and let the sa_handler of the program do its work?</p>
  
  <p>EDIT: sample code</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include &lt;signal.h&gt;
  #include &lt;pthread.h&gt;
  #include &lt;unistd.h&gt;
  
  static void handler(int signo, siginfo_t *sigaction, void *context)
  {
      printf("in handler.\n");
      signal(signo, SIG_DFL);
  }
  
  static void gen_exception()
  {
      printf("gen_exception in.\n");
      *(int *)0 = 0;
      printf("gen_exception out.\n");
  }
  
  void *gen_exception_thread(void *parg)
  {
      gen_exception();
      return 0;
  }
  
  int main()
  {
      struct sigaction sa;
      sa.sa_sigaction = handler;
      sigemptyset(&amp;sa.sa_mask);
      sa.sa_flags = SA_SIGINFO;
  
      if(sigaction(/*SIGBUS*/SIGSEGV, &amp;sa, NULL) == -1) {
          printf("sigaction fails.\n");
          return 0;
      }
  
      pthread_t id;
      pthread_create(&amp;id, NULL, gen_exception_thread, NULL);
      pthread_join(id, NULL);
  
      return 0;
  }
  </code></pre>