mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2025-04-05 21:32:17 +02:00
Include <unistd.h>.
(sighandler): Correct return type to "void". Delete unused variables buffer[] and n. (main): Cast sighandler to (sighandler_t). (Logical change 1.19)
This commit is contained in:
parent
21647f4830
commit
7e8c5066e8
1 changed files with 3 additions and 5 deletions
|
@ -18,6 +18,7 @@ GNU General Public License for more details. */
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
|
|
||||||
#define panic(args...) \
|
#define panic(args...) \
|
||||||
|
@ -67,12 +68,9 @@ foo (void)
|
||||||
printf ("[%d] ip=%p\n", i, buffer[i]);
|
printf ("[%d] ip=%p\n", i, buffer[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
void
|
||||||
sighandler (int signal, void *siginfo, struct sigcontext *sc)
|
sighandler (int signal, void *siginfo, struct sigcontext *sc)
|
||||||
{
|
{
|
||||||
void *buffer[20];
|
|
||||||
int n;
|
|
||||||
|
|
||||||
printf ("sighandler: got signal %d @ %lx\n", signal, sc->sc_ip);
|
printf ("sighandler: got signal %d @ %lx\n", signal, sc->sc_ip);
|
||||||
|
|
||||||
do_backtrace();
|
do_backtrace();
|
||||||
|
@ -83,7 +81,7 @@ main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
foo ();
|
foo ();
|
||||||
|
|
||||||
signal (SIGTERM, sighandler);
|
signal (SIGTERM, (sighandler_t) sighandler);
|
||||||
kill (getpid (), SIGTERM);
|
kill (getpid (), SIGTERM);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue