hotspot/src/cpu/sparc/vm/debug_sparc.cpp
author mikael
Tue, 29 Apr 2014 22:05:10 -0700
changeset 24327 d8d91481f76e
parent 13728 882756847a04
child 24932 374cc5d929fb
permissions -rw-r--r--
8042059: Various fixes to linux/sparc Reviewed-by: twisti, kvn
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     1
/*
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
     2
 * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     4
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
489c9b5090e2 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
489c9b5090e2 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.
489c9b5090e2 Initial load
duke
parents:
diff changeset
     8
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
489c9b5090e2 Initial load
duke
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
489c9b5090e2 Initial load
duke
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
489c9b5090e2 Initial load
duke
parents:
diff changeset
    13
 * accompanied this code).
489c9b5090e2 Initial load
duke
parents:
diff changeset
    14
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
489c9b5090e2 Initial load
duke
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
489c9b5090e2 Initial load
duke
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
489c9b5090e2 Initial load
duke
parents:
diff changeset
    18
 *
5547
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
f4b087cbb361 6941466: Oracle rebranding changes for Hotspot repositories
trims
parents: 1
diff changeset
    21
 * questions.
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    22
 *
489c9b5090e2 Initial load
duke
parents:
diff changeset
    23
 */
489c9b5090e2 Initial load
duke
parents:
diff changeset
    24
7397
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    25
#include "precompiled.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    26
#include "code/codeCache.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    27
#include "code/nmethod.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    28
#include "runtime/frame.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    29
#include "runtime/init.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    30
#include "runtime/os.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    31
#include "utilities/debug.hpp"
5b173b4ca846 6989984: Use standard include model for Hospot
stefank
parents: 5547
diff changeset
    32
#include "utilities/top.hpp"
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    33
489c9b5090e2 Initial load
duke
parents:
diff changeset
    34
#ifndef PRODUCT
489c9b5090e2 Initial load
duke
parents:
diff changeset
    35
489c9b5090e2 Initial load
duke
parents:
diff changeset
    36
extern "C" void findpc(int x);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    37
489c9b5090e2 Initial load
duke
parents:
diff changeset
    38
489c9b5090e2 Initial load
duke
parents:
diff changeset
    39
void pd_ps(frame f) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    40
  intptr_t* sp = f.sp();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    41
  intptr_t* prev_sp = sp - 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    42
  intptr_t *pc = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    43
  intptr_t *next_pc = NULL;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    44
  int count = 0;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    45
  tty->print("register window backtrace from %#x:\n", sp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    46
  while (sp != NULL && ((intptr_t)sp & 7) == 0 && sp > prev_sp && sp < prev_sp+1000) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    47
    pc      = next_pc;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    48
    next_pc = (intptr_t*) sp[I7->sp_offset_in_saved_window()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    49
    tty->print("[%d] sp=%#x pc=", count, sp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    50
    findpc((intptr_t)pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    51
    if (WizardMode && Verbose) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    52
      // print register window contents also
489c9b5090e2 Initial load
duke
parents:
diff changeset
    53
      tty->print_cr("    L0..L7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    54
                    sp[0+0],sp[0+1],sp[0+2],sp[0+3],
489c9b5090e2 Initial load
duke
parents:
diff changeset
    55
                    sp[0+4],sp[0+5],sp[0+6],sp[0+7]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    56
      tty->print_cr("    I0..I7: {%#x %#x %#x %#x %#x %#x %#x %#x}",
489c9b5090e2 Initial load
duke
parents:
diff changeset
    57
                    sp[8+0],sp[8+1],sp[8+2],sp[8+3],
489c9b5090e2 Initial load
duke
parents:
diff changeset
    58
                    sp[8+4],sp[8+5],sp[8+6],sp[8+7]);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    59
      // (and print stack frame contents too??)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    60
489c9b5090e2 Initial load
duke
parents:
diff changeset
    61
      CodeBlob *b = CodeCache::find_blob((address) pc);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    62
      if (b != NULL) {
489c9b5090e2 Initial load
duke
parents:
diff changeset
    63
        if (b->is_nmethod()) {
13728
882756847a04 6964458: Reimplement class meta-data storage to use native memory
coleenp
parents: 7397
diff changeset
    64
          Method* m = ((nmethod*)b)->method();
1
489c9b5090e2 Initial load
duke
parents:
diff changeset
    65
          int nlocals = m->max_locals();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    66
          int nparams  = m->size_of_parameters();
489c9b5090e2 Initial load
duke
parents:
diff changeset
    67
          tty->print_cr("compiled java method (locals = %d, params = %d)", nlocals, nparams);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    68
        }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    69
      }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    70
    }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    71
    prev_sp = sp;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    72
    sp = (intptr_t *)sp[FP->sp_offset_in_saved_window()];
489c9b5090e2 Initial load
duke
parents:
diff changeset
    73
    sp = (intptr_t *)((intptr_t)sp + STACK_BIAS);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    74
    count += 1;
489c9b5090e2 Initial load
duke
parents:
diff changeset
    75
  }
489c9b5090e2 Initial load
duke
parents:
diff changeset
    76
  if (sp != NULL)
489c9b5090e2 Initial load
duke
parents:
diff changeset
    77
    tty->print("[%d] sp=%#x [bogus sp!]", count, sp);
489c9b5090e2 Initial load
duke
parents:
diff changeset
    78
}
489c9b5090e2 Initial load
duke
parents:
diff changeset
    79
489c9b5090e2 Initial load
duke
parents:
diff changeset
    80
#endif // PRODUCT