Index: include/java-interp.h =================================================================== --- include/java-interp.h (revision 121607) +++ include/java-interp.h (working copy) @@ -1,6 +1,6 @@ // java-interp.h - Header file for the bytecode interpreter. -*- c++ -*- -/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation +/* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation This file is part of libgcj. @@ -352,6 +352,16 @@ { thread->frame = (gnu::gcj::RawData *) next; } + + int depth () + { + int depth = 0; + struct _Jv_Frame *f; + for (f = this; f != NULL; f = f->next) + ++depth; + + return depth; + } }; // An interpreted frame in the call stack Index: jvmti.cc =================================================================== --- jvmti.cc (revision 121616) +++ jvmti.cc (working copy) @@ -259,14 +259,7 @@ THREAD_CHECK_IS_ALIVE (thr); _Jv_Frame *frame = reinterpret_cast<_Jv_Frame *> (thr->frame); - (*frame_count) = 0; - - while (frame != NULL) - { - (*frame_count)++; - frame = frame->next; - } - + (*frame_count) = frame->depth (); return JVMTI_ERROR_NONE; }