Exemplo n.º 1
0
int main (int argc, char *argv[])
{
  jmp_buf env;
  int foo = 5;
  int bar = 42;
  int i, j;

  if (argc == 2 && strcmp (argv[1], "exit") == 0)
    return 0;

  do_nothing ();

  i = 0;
  /* Break at increase.  */
  increase (&i);
  increase (&i);
  increase (&i);

  for (i = 0; i < 10; i++)
    {
      j += 1; /* Condition Break.  */
    }

  if (setjmp (env) == 0) /* longjmp caught */
    {
      call_longjmp (&env);
    }
  else
    j += 1; /* after longjmp.  */

  test_exec_exit (argv[0]);

  return j; /* Break at end.  */
}
Exemplo n.º 2
0
void
hidden_longjmp (void)
{
  if (setjmp (env) == 0)
    {
      call_longjmp (&env);
    }
  else
    resumes++;
}
Exemplo n.º 3
0
void
hidden_longjmp (void)
{
  if (setjmp (env) == 0) /* longjmp caught */
    {
      call_longjmp (&env);
    }
  else
    resumes++;
}
Exemplo n.º 4
0
void * child2(void *arg)
{
        jmp_buf g_sJumpEnv;
         
           pthread_detach( pthread_self() ); 
       
        sleep(1);
        if (setjmp(g_sJumpEnv) == 1)
        {
          printf("jump thread 22222\n");
          return;
        }
        pthread_setspecific(key,(void *)g_sJumpEnv);


        printf("thread2 setjmp\n");
        
        call_longjmp();
}
Exemplo n.º 5
0
int
main ()
{
  volatile int i = 0;

  /* Pattern 1 - simple longjmp.  */
  if (setjmp (env) == 0) /* patt1 */
    {
      longjmps++;
      longjmp (env, 1);
    }
  else
    {
      resumes++;
    }

  i = 1; /* miss_step_1 */


  /* Pattern 2 - longjmp from an inner function.  */
  if (setjmp (env) == 0) /* patt2 */
    {
      call_longjmp (&env);
    }
  else
    {
      resumes++;
    }

  i = 2; /* miss_step_2 */

  /* Pattern 3 - setjmp/longjmp inside stepped-over function.  */
  hidden_longjmp (); /* patt3 */

  i = 77; /* longjmp caught */

  i = 3; /* patt_end3.  */

  return 0;
}