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