blind flying adding more debug output cleaning up according to man pages

Original commit message from CVS:
blind flying
adding more debug output
cleaning up according to man pages
This commit is contained in:
Thomas Vander Stichele 2002-06-25 12:08:10 +00:00
parent bcb921d550
commit 1ecc22c610

View file

@ -146,7 +146,8 @@ cothread_state*
cothread_create (cothread_context *ctx)
{
cothread_state *thread;
void *sp, *mmaped = 0;
void *sp;
void *mmaped = 0;
guchar *stack_end;
gint slot = 0;
@ -168,6 +169,8 @@ cothread_create (cothread_context *ctx)
}
}
GST_DEBUG(GST_CAT_COTHREADS, "Found free cothread slot %d\n", slot);
sp = CURRENT_STACK_FRAME;
/* FIXME this may not be 64bit clean
* could use casts to uintptr_t from inttypes.h
@ -176,10 +179,12 @@ cothread_create (cothread_context *ctx)
stack_end = (guchar *) ((gulong) sp & ~(STACK_SIZE - 1));
thread = (cothread_state *) (stack_end + ((slot - 1) * COTHREAD_STACKSIZE));
GST_DEBUG (0, "new stack at %p", thread);
GST_DEBUG (GST_CAT_COTHREAD, "new stack at %p", thread);
GST_DEBUG (GST_CAT_COTHREAD, "going into mmap");
mmaped = mmap ((void *) thread, COTHREAD_STACKSIZE,
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANON, -1, 0);
PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
GST_DEBUG (GST_CAT_COTHREAD, "coming out of mmap");
if (mmaped == MAP_FAILED) {
perror ("mmap'ing cothread stack space");
return NULL;
@ -304,7 +309,7 @@ cothread_stop (cothread_state * thread)
cothread_state *
cothread_main (cothread_context * ctx)
{
GST_DEBUG (0, "returning %p, the 0th cothread", ctx->threads[0]);
GST_DEBUG (GST_CAT_COTHREAD, "returning %p, the 0th cothread", ctx->threads[0]);
return ctx->threads[0];
}
@ -497,11 +502,11 @@ cothread_switch (cothread_state * thread)
#endif
enter = setjmp (current->jmp);
if (enter != 0) {
GST_DEBUG (0, "enter thread #%d %d %p<->%p (%d) %p", current->threadnum, enter,
GST_DEBUG (GST_CAT_COTHREAD, "enter thread #%d %d %p<->%p (%d) %p", current->threadnum, enter,
current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp, current->jmp);
return;
}
GST_DEBUG (0, "exit thread #%d %d %p<->%p (%d) %p", current->threadnum, enter,
GST_DEBUG (GST_CAT_COTHREAD, "exit thread #%d %d %p<->%p (%d) %p", current->threadnum, enter,
current->sp, current->top_sp, (char*)current->top_sp - (char*)current->sp, current->jmp);
enter = 1;
@ -509,10 +514,10 @@ cothread_switch (cothread_state * thread)
cothread_destroy (current);
}
GST_DEBUG (0, "set stack to %p", thread->sp);
GST_DEBUG (GST_CAT_COTHREAD, "set stack to %p", thread->sp);
/* restore stack pointer and other stuff of new cothread */
if (thread->flags & COTHREAD_STARTED) {
GST_DEBUG (0, "in thread %p", thread->jmp);
GST_DEBUG (GST_CAT_COTHREAD, "in thread %p", thread->jmp);
/* switch to it */
longjmp (thread->jmp, 1);
}
@ -521,7 +526,7 @@ cothread_switch (cothread_state * thread)
GST_ARCH_SET_SP (thread->sp);
/* start it */
GST_ARCH_CALL (cothread_stub);
GST_DEBUG (0, "exit thread ");
GST_DEBUG (GST_CAT_COTHREAD, "exit thread ");
ctx->current = 0;
}