Path: blob/aarch64-shenandoah-jdk8u272-b10/hotspot/src/cpu/sparc/vm/debug_sparc.cpp
32285 views
/*1* Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*22*/2324#include "precompiled.hpp"25#include "code/codeCache.hpp"26#include "code/nmethod.hpp"27#include "runtime/frame.hpp"28#include "runtime/init.hpp"29#include "runtime/os.hpp"30#include "utilities/debug.hpp"31#include "utilities/top.hpp"3233#ifndef PRODUCT3435extern "C" void findpc(int x);363738void pd_ps(frame f) {39intptr_t* sp = f.sp();40intptr_t* prev_sp = sp - 1;41intptr_t *pc = NULL;42intptr_t *next_pc = NULL;43int count = 0;44tty->print("register window backtrace from %#x:\n", sp);45while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {46pc = next_pc;47next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];48tty->print("[%d] sp=%#x pc=", count, sp);49findpc((intptr_t)pc);50if (WizardMode && Verbose) {51// print register window contents also52tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}",53sp[0+0],sp[0+1],sp[0+2],sp[0+3],54sp[0+4],sp[0+5],sp[0+6],sp[0+7]);55tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}",56sp[8+0],sp[8+1],sp[8+2],sp[8+3],57sp[8+4],sp[8+5],sp[8+6],sp[8+7]);58// (and print stack frame contents too??)5960CodeBlob *b = CodeCache::find_blob((address) pc);61if (b != NULL) {62if (b->is_nmethod()) {63Method* m = ((nmethod*)b)->method();64int nlocals = m->max_locals();65int nparams = m->size_of_parameters();66tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);67}68}69}70prev_sp = sp;71sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];72sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);73count += 1;74}75if (sp != NULL)76tty->print("[%d] sp=%#x [bogus sp!]", count, sp);77}7879#endif // PRODUCT808182