natVMThrowable.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // natVMThrowable.cc - Native part of VMThrowable class.
  2. /* Copyright (C) 2003, 2006 Free Software Foundation
  3. This file is part of libgcj.
  4. This software is copyrighted work licensed under the terms of the
  5. Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
  6. details. */
  7. #include <config.h>
  8. #include <stdlib.h>
  9. #include <gcj/cni.h>
  10. #include <jvm.h>
  11. #include <java-stack.h>
  12. #include <java/lang/Throwable.h>
  13. #include <java/lang/VMThrowable.h>
  14. using namespace gnu::gcj;
  15. java::lang::VMThrowable *
  16. java::lang::VMThrowable::fillInStackTrace (java::lang::Throwable *)
  17. {
  18. using namespace java::lang;
  19. // Don't trace stack during initialization of the runtime.
  20. if (! gcj::runtimeInitialized)
  21. return NULL;
  22. _Jv_StackTrace *trace = _Jv_StackTrace::GetStackTrace ();
  23. VMThrowable *vmthrowable = new VMThrowable ();
  24. vmthrowable->data = (RawDataManaged *) trace;
  25. return vmthrowable;
  26. }
  27. JArray< ::java::lang::StackTraceElement *> *
  28. java::lang::VMThrowable::getStackTrace (java::lang::Throwable *throwable)
  29. {
  30. _Jv_StackTrace *trace = reinterpret_cast <_Jv_StackTrace *> (data);
  31. return _Jv_StackTrace::GetStackTraceElements (trace, throwable);
  32. }