Re: assertion failure with pthreads

Christian Groessler <[email protected]>
Newsgroups gmane.os.netbsd.ports.sh3
Message-ID <[email protected]>
Hi,

> > ftp.groessler.org/pub/chris/dreamcast/netbsd/tmp/pthread-sh3.tgz .

> Hi, I unpacked this archive to /usr/src/lib and tried to cross compile 
> everything using build.sh. The result was undefined references to 
> debout, dumpregs, and pthread__switch_return_point. Is there a simple 
> way to make this compile? Vesa

Sorry, I forgot to include some things for compilation with DEBUG
defined.

Add the following to lib/libpthread/pthread_alarms.c:

-------------------------------
#ifdef __sh__
#include <stdio.h>
void dumpiter(void)
{
	struct pt_alarm_t *iterator;
        for ((iterator) = ((&pthread_alarmqueue)->ptqh_first);
	     (iterator);
	     (iterator) = ((iterator)->pta_next.ptqe_next)) {

		printf("dumpiter: (iterator = %p, iterator->pta_time = %p\n\tnext = %p)\n",
		       iterator, iterator ? iterator->pta_time: NULL,
		       iterator->pta_next.ptqe_next
		       ); fflush(stdout);
        }
}


void dumpregs(const ucontext_t *ctx);
void dumpregs(const ucontext_t *ctx)
{
	printf("dumpregs %p\n", ctx);
	printf("\tr0\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R0]);
	printf("\tr1\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R1]);
	printf("\tr2\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R2]);
	printf("\tr3\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R3]);
	printf("\tr4\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R4]);
	printf("\tr5\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R5]);
	printf("\tr6\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R6]);
	printf("\tr7\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R7]);
	printf("\tr8\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R8]);
	printf("\tr9\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R9]);
	printf("\tr10\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R10]);
	printf("\tr11\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R11]);
	printf("\tr12\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R12]);
	printf("\tr13\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R13]);
	printf("\tr14\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R14]);
	printf("\tr15\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_R15]);
	printf("\tpr\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_PR]);
	printf("\tsr\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_SR]);
	printf("\tpc\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_PC]);
	printf("\tmach\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_MACH]);
	printf("\tmacl\t= %8x\n", ctx->uc_mcontext.__gregs[_REG_MACL]);
	fflush(stdout);
	/*asm(".word 0xfffd");*/
}
#endif
-------------------------------


debout is provided in the following file:



pthread__switch_return_point comes from a recent change in
pthread_sa.c, which isn't integrated into the sh3 files yet.

regards,
chris
debout.s (application/octet-stream, 1.3 KB) - not displayed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.