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