src/cpu/sparc/vm/debug_sparc.cpp

Tue, 23 Nov 2010 13:22:55 -0800

author
stefank
date
Tue, 23 Nov 2010 13:22:55 -0800
changeset 2314
f95d63e2154a
parent 1907
c18cbe5936b8
child 4037
da91efe96a93
permissions
-rw-r--r--

6989984: Use standard include model for Hospot
Summary: Replaced MakeDeps and the includeDB files with more standardized solutions.
Reviewed-by: coleenp, kvn, kamg

duke@435 1 /*
stefank@2314 2 * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
duke@435 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
duke@435 4 *
duke@435 5 * This code is free software; you can redistribute it and/or modify it
duke@435 6 * under the terms of the GNU General Public License version 2 only, as
duke@435 7 * published by the Free Software Foundation.
duke@435 8 *
duke@435 9 * This code is distributed in the hope that it will be useful, but WITHOUT
duke@435 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
duke@435 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
duke@435 12 * version 2 for more details (a copy is included in the LICENSE file that
duke@435 13 * accompanied this code).
duke@435 14 *
duke@435 15 * You should have received a copy of the GNU General Public License version
duke@435 16 * 2 along with this work; if not, write to the Free Software Foundation,
duke@435 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
duke@435 18 *
trims@1907 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
trims@1907 20 * or visit www.oracle.com if you need additional information or have any
trims@1907 21 * questions.
duke@435 22 *
duke@435 23 */
duke@435 24
stefank@2314 25 #include "precompiled.hpp"
stefank@2314 26 #include "code/codeCache.hpp"
stefank@2314 27 #include "code/nmethod.hpp"
stefank@2314 28 #include "runtime/frame.hpp"
stefank@2314 29 #include "runtime/init.hpp"
stefank@2314 30 #include "runtime/os.hpp"
stefank@2314 31 #include "utilities/debug.hpp"
stefank@2314 32 #include "utilities/top.hpp"
duke@435 33
duke@435 34 #ifndef PRODUCT
duke@435 35
duke@435 36 extern "C" void findpc(int x);
duke@435 37
duke@435 38
duke@435 39 void pd_ps(frame f) {
duke@435 40 intptr_t* sp = f.sp();
duke@435 41 intptr_t* prev_sp = sp - 1;
duke@435 42 intptr_t *pc = NULL;
duke@435 43 intptr_t *next_pc = NULL;
duke@435 44 int count = 0;
duke@435 45 tty->print("register window backtrace from %#x:\n", sp);
duke@435 46 while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
duke@435 47 pc = next_pc;
duke@435 48 next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
duke@435 49 tty->print("[%d] sp=%#x pc=", count, sp);
duke@435 50 findpc((intptr_t)pc);
duke@435 51 if (WizardMode && Verbose) {
duke@435 52 // print register window contents also
duke@435 53 tty->print_cr(" L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
duke@435 54 sp[0+0],sp[0+1],sp[0+2],sp[0+3],
duke@435 55 sp[0+4],sp[0+5],sp[0+6],sp[0+7]);
duke@435 56 tty->print_cr(" I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
duke@435 57 sp[8+0],sp[8+1],sp[8+2],sp[8+3],
duke@435 58 sp[8+4],sp[8+5],sp[8+6],sp[8+7]);
duke@435 59 // (and print stack frame contents too??)
duke@435 60
duke@435 61 CodeBlob *b = CodeCache::find_blob((address) pc);
duke@435 62 if (b != NULL) {
duke@435 63 if (b->is_nmethod()) {
duke@435 64 methodOop m = ((nmethod*)b)->method();
duke@435 65 int nlocals = m->max_locals();
duke@435 66 int nparams = m->size_of_parameters();
duke@435 67 tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);
duke@435 68 }
duke@435 69 }
duke@435 70 }
duke@435 71 prev_sp = sp;
duke@435 72 sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];
duke@435 73 sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);
duke@435 74 count += 1;
duke@435 75 }
duke@435 76 if (sp != NULL)
duke@435 77 tty->print("[%d] sp=%#x [bogus sp!]", count, sp);
duke@435 78 }
duke@435 79
duke@435 80 #endif // PRODUCT

mercurial