Subject: Why no backtrace from some cores on PPC?
To: 'port-macppc@netbsd.org' <port-macppc@netbsd.org>
From: Duncan Missimer <dmissimer@rhapsodynetworks.com>
List: port-macppc
Date: 07/08/2002 18:02:07
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C226E4.3F5354E0
Content-Type: text/plain;
	charset="iso-8859-1"

 <<sigsegv.c>>  

------_=_NextPart_000_01C226E4.3F5354E0
Content-Type: application/octet-stream;
	name="sigsegv.c"
Content-Disposition: attachment;
	filename="sigsegv.c"

//	
//	When the following program is compiled on i386, all
//	three methods of triggering a core dump produce a
//	core file from which gdb can print a stack trace.
//	On PPC, only the third method (assignment via a bad
//	pointer) does so. Anybody know why?
//


#include <unistd.h>
#include <signal.h>

void b(void)				// force core dump
{
	// kill (getpid(), SIGSEGV);	// PPC gdb bt command shows nothing
	// kill (getpid(), SIGABRT);  // PPC gdb bt command shows nothing
	* (int *) -1 = 3;			// PPC gdb bt command shows main -> a -> b
}

void a(void)
{
	b();
}

main()
{
	a();
}


------_=_NextPart_000_01C226E4.3F5354E0--