duke@435: /* duke@435: * Copyright 1999-2007 Sun Microsystems, Inc. All Rights Reserved. duke@435: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. duke@435: * duke@435: * This code is free software; you can redistribute it and/or modify it duke@435: * under the terms of the GNU General Public License version 2 only, as duke@435: * published by the Free Software Foundation. duke@435: * duke@435: * This code is distributed in the hope that it will be useful, but WITHOUT duke@435: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or duke@435: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License duke@435: * version 2 for more details (a copy is included in the LICENSE file that duke@435: * accompanied this code). duke@435: * duke@435: * You should have received a copy of the GNU General Public License version duke@435: * 2 along with this work; if not, write to the Free Software Foundation, duke@435: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. duke@435: * duke@435: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, duke@435: * CA 95054 USA or visit www.sun.com if you need additional information or duke@435: * have any questions. duke@435: * duke@435: */ duke@435: duke@435: #include "incls/_precompiled.incl" duke@435: #include "incls/_debug_sparc.cpp.incl" duke@435: duke@435: #ifndef PRODUCT duke@435: duke@435: extern "C" void findpc(int x); duke@435: duke@435: duke@435: void pd_ps(frame f) { duke@435: intptr_t* sp = f.sp(); duke@435: intptr_t* prev_sp = sp - 1; duke@435: intptr_t *pc = NULL; duke@435: intptr_t *next_pc = NULL; duke@435: int count = 0; duke@435: tty->print("register window backtrace from %#x:\n", sp); duke@435: while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) { duke@435: pc = next_pc; duke@435: next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()]; duke@435: tty->print("[%d] sp=%#x pc=", count, sp); duke@435: findpc((intptr_t)pc); duke@435: if (WizardMode && Verbose) { duke@435: // print register window contents also duke@435: tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}", duke@435: sp[0+0],sp[0+1],sp[0+2],sp[0+3], duke@435: sp[0+4],sp[0+5],sp[0+6],sp[0+7]); duke@435: tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}", duke@435: sp[8+0],sp[8+1],sp[8+2],sp[8+3], duke@435: sp[8+4],sp[8+5],sp[8+6],sp[8+7]); duke@435: // (and print stack frame contents too??) duke@435: duke@435: CodeBlob *b = CodeCache::find_blob((address) pc); duke@435: if (b != NULL) { duke@435: if (b->is_nmethod()) { duke@435: methodOop m = ((nmethod*)b)->method(); duke@435: int nlocals = m->max_locals(); duke@435: int nparams = m->size_of_parameters(); duke@435: tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams); duke@435: } duke@435: } duke@435: } duke@435: prev_sp = sp; duke@435: sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()]; duke@435: sp = (intptr_t *)((intptr_t)sp + STACK_BIAS); duke@435: count += 1; duke@435: } duke@435: if (sp != NULL) duke@435: tty->print("[%d] sp=%#x [bogus sp!]", count, sp); duke@435: } duke@435: duke@435: #endif // PRODUCT