URL
https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 24 |
Rev 157 |
#include <signal.h>
|
#include <signal.h>
|
#include <unistd.h>
|
#include <unistd.h>
|
#include <stdlib.h>
|
#include <stdlib.h>
|
|
|
void foo (void);
|
void foo (void);
|
void bar (void);
|
void bar (void);
|
|
|
void subroutine (int);
|
void subroutine (int);
|
void handler (int);
|
void handler (int);
|
void have_a_very_merry_interrupt (void);
|
void have_a_very_merry_interrupt (void);
|
|
|
main ()
|
main ()
|
{
|
{
|
foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
|
foo (); /* Put a breakpoint on foo() and call it to see a dummy frame */
|
|
|
|
|
have_a_very_merry_interrupt ();
|
have_a_very_merry_interrupt ();
|
}
|
}
|
|
|
void
|
void
|
foo (void)
|
foo (void)
|
{
|
{
|
}
|
}
|
|
|
void
|
void
|
bar (void)
|
bar (void)
|
{
|
{
|
char *nuller = 0;
|
char *nuller = 0;
|
|
|
*nuller = 'a'; /* try to cause a segfault */
|
*nuller = 'a'; /* try to cause a segfault */
|
}
|
}
|
|
|
void
|
void
|
handler (int sig)
|
handler (int sig)
|
{
|
{
|
subroutine (sig);
|
subroutine (sig);
|
}
|
}
|
|
|
/* The first statement in subroutine () is a place for a breakpoint.
|
/* The first statement in subroutine () is a place for a breakpoint.
|
Without it, the breakpoint is put on the while comparison and will
|
Without it, the breakpoint is put on the while comparison and will
|
be hit at each iteration. */
|
be hit at each iteration. */
|
|
|
void
|
void
|
subroutine (int in)
|
subroutine (int in)
|
{
|
{
|
int count = in;
|
int count = in;
|
while (count < 100)
|
while (count < 100)
|
count++;
|
count++;
|
}
|
}
|
|
|
void
|
void
|
have_a_very_merry_interrupt (void)
|
have_a_very_merry_interrupt (void)
|
{
|
{
|
signal (SIGALRM, handler);
|
signal (SIGALRM, handler);
|
alarm (1);
|
alarm (1);
|
sleep (2); /* We'll receive that signal while sleeping */
|
sleep (2); /* We'll receive that signal while sleeping */
|
}
|
}
|
|
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.