/* if possible, print the method name from the symbol table, 
   otherwise use the StackTrace entry to print the address */ 
static void printItem(JNIEnv *env, jobject sobj,
		      symtab_entry *item, StackTrace backup) {
#ifdef FULL_STACK_TRACE
  if (item != NULL)
#else
  if (item != NULL && 
      item->value >= (symvalue)(&code_start) && 
      item->value < (symvalue)(&code_end))
#endif
    /* make sure we only print methods not in the runtime */
    {
#ifndef FULL_STACK_TRACE
      int i = 0;
      /* filter out methods that should be "invisible" */
      for( ; i < (sizeof(strtab)/sizeof(char *)); i++)
	if (strcmp(item->name, strtab[i]) == 0) return;
      if (strstr(item->name, "__0003cinit_0003e__")) return;
#endif
      jprintln(env, sobj, "        at %s", item->name);
    }
  else
    /* if for some reason we cannot find the symbol, print the address */
    jprintln(env, sobj, "        at %p", backup->retaddr);

}
/* prints out return addresses */
static void printNumericStackTrace(JNIEnv *env, jobject sobj, StackTrace tr) {
  StackTrace curr = tr;
  while(curr != NULL) {
    jprintln(env, sobj, "        at %p", curr->retaddr);
    curr = curr->next;
  }
}
Beispiel #3
0
void NPrintError( JNIEnv *env, STATUS err ) {
    if( err!=NOERROR ) {
        // Get the notes error msg
        char buffer[512];
        OSLoadString( NULLHANDLE, (STATUS)err, buffer, WORD(sizeof(buffer))-1 );

		jint errorCode = (jint)err;

		jprintln(buffer);
     }
}
Beispiel #4
0
bool NCheck( JNIEnv *env, STATUS err ) {
    if( err!=NOERROR ) {
        // Get the notes error msg
        char buffer[512];
        OSLoadString( NULLHANDLE, (STATUS)err, buffer, WORD(sizeof(buffer))-1 );

		jint errorCode = (jint)err;
		ThrowErrorRelease(env,buffer,err);

		jprintln(buffer);
		return false;
     }

     return true;
}
/* The given object 'sobj' must have a void println(char[]) method */
JNIEXPORT void JNICALL Java_java_lang_Throwable_printStackTrace0
  (JNIEnv *env, jobject thisobj, jobject sobj) {
    jprintln(env, sobj, "printStackTrace() unimplemented.");
}