J
JS
I have this code:
#include <setjmp.h>
#include <stdio.h>
jmp_buf ex;
static int foo (int a, int b)
{
if (!b)
longjmp (ex, 1); /* THROW */
else
return a/b;
}
int main (void)
{
int x = 0, y = 1, z = 0;
if (setjmp (ex) == 0) /* TRY : longjmp branches back to here */
{
x = foo(y, z);
}
else /* CATCH */
{
printf ("Exception: attempt to divide by zero\n");
}
}
It compiles fine and I am also able to run the .exe file. But when I debug
the code it stops when it comes to longjmp. I use eclipse with Cygwin gcc,
gdb, make etc.
Is there something special to do when debugging with longjmp and setjmp?
JS
#include <setjmp.h>
#include <stdio.h>
jmp_buf ex;
static int foo (int a, int b)
{
if (!b)
longjmp (ex, 1); /* THROW */
else
return a/b;
}
int main (void)
{
int x = 0, y = 1, z = 0;
if (setjmp (ex) == 0) /* TRY : longjmp branches back to here */
{
x = foo(y, z);
}
else /* CATCH */
{
printf ("Exception: attempt to divide by zero\n");
}
}
It compiles fine and I am also able to run the .exe file. But when I debug
the code it stops when it comes to longjmp. I use eclipse with Cygwin gcc,
gdb, make etc.
Is there something special to do when debugging with longjmp and setjmp?
JS