1 // natLogger.cc - Native part of Logger class. 2 3 /* Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation 4 5 This Logger is part of libgcj. 6 7 This software is copyrighted work licensed under the terms of the 8 Libgcj License. Please consult the Logger "LIBGCJ_LICENSE" for 9 details. */ 10 11 #include <config.h> 12 #include <platform.h> 13 14 #include <string.h> 15 16 #pragma implementation "Logger.h" 17 18 #include <gcj/cni.h> 19 #include <jvm.h> 20 #include <java-stack.h> 21 22 #include <java/lang/Object.h> 23 #include <java/lang/Class.h> 24 #include <java/util/logging/Logger.h> 25 #include <java/lang/StackTraceElement.h> 26 #include <java/lang/ArrayIndexOutOfBoundsException.h> 27 28 using namespace java::util::logging; 29 30 java::lang::StackTraceElement* getCallerStackFrame()31java::util::logging::Logger::getCallerStackFrame () 32 { 33 jclass klass = NULL; 34 _Jv_Method *meth = NULL; 35 _Jv_StackTrace::GetCallerInfo (&Logger::class$, &klass, &meth); 36 37 jstring meth_name = NULL; 38 jstring klass_name = NULL; 39 if (klass != NULL) 40 klass_name = klass->getName(); 41 if (meth != NULL) 42 meth_name = _Jv_NewStringUtf8Const (meth->name); 43 44 java::lang::StackTraceElement *e 45 = new java::lang::StackTraceElement 46 (JvNewStringUTF (""), 0, klass_name, meth_name, false); 47 48 return e; 49 } 50