/* * Copyright 2001 Sun Microsystems, Inc. ALL RIGHTS RESERVED * Use of this software is authorized pursuant to the * terms of the license found at * http://developers.sun.com/berkeley_license.html */ #include #include #include void handler(sig) { char buffer[64]; sprintf(buffer, "/usr/proc/bin/pstack %d\n", (int)getpid()); system(buffer); exit(1); } static void sub2(int *p) { int i; i = *p; } static void sub(int *p) { sub2(p); } main() { int *p=NULL; sigset(SIGSEGV, handler); sub(p); }