src/hotspot/os/windows/decoder_windows.cpp
author jlaskey
Thu, 14 Nov 2019 12:33:47 -0400
branchjlaskey-prng
changeset 59084 b8fb85ee91e9
parent 47666 19219ec3f176
permissions -rw-r--r--
restarting random branch
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     1
/*
47086
2b35673f6297 8186349: [windows] Centralize dbghelp handling code
stuefe
parents: 31352
diff changeset
     2
 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     4
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     7
 * published by the Free Software Foundation.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     8
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    13
 * accompanied this code).
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    14
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    18
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    21
 * questions.
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    22
 *
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    23
 */
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    24
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    25
#include "precompiled.hpp"
47666
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    26
#include "utilities/decoder.hpp"
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    27
#include "symbolengine.hpp"
47086
2b35673f6297 8186349: [windows] Centralize dbghelp handling code
stuefe
parents: 31352
diff changeset
    28
#include "windbghelp.hpp"
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10246
diff changeset
    29
47666
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    30
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const char* modulepath, bool demangle) {
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    31
  return SymbolEngine::decode(addr, buf, buflen, offset, demangle);
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    32
}
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    33
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    34
bool Decoder::decode(address addr, char* buf, int buflen, int* offset, const void* base) {
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    35
  return SymbolEngine::decode(addr, buf, buflen, offset, true);
11483
4d3f4bca0019 7071311: Decoder enhancement
zgu
parents: 10246
diff changeset
    36
}
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    37
47666
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    38
bool Decoder::get_source_info(address pc, char* buf, size_t buflen, int* line) {
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    39
  return SymbolEngine::get_source_info(pc, buf, buflen, line);
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    40
}
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    41
47666
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    42
bool Decoder::demangle(const char* symbol, char* buf, int buflen) {
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    43
  return SymbolEngine::demangle(symbol, buf, buflen);
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    44
}
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    45
47666
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    46
void Decoder::print_state_on(outputStream* st) {
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    47
  WindowsDbgHelp::print_state_on(st);
19219ec3f176 8185712: [windows] Improve native symbol decoder
goetz
parents: 47216
diff changeset
    48
  SymbolEngine::print_state_on(st);
7447
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    49
}
32c42d627f41 7003748: Decode C stack frames when symbols are presented (PhoneHome project)
zgu
parents:
diff changeset
    50