/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
#include "precompiled.hpp"
#include "classfile/javaClasses.hpp"
#include "code/codeCache.hpp"
#include "compiler/disassembler.hpp"
#include "gc_interface/collectedHeap.hpp"
#include "memory/cardTableModRefBS.hpp"
#include "runtime/fprofiler.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "runtime/stubRoutines.hpp"
#ifdef TARGET_ARCH_x86
# include "depChecker_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "depChecker_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "depChecker_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "depChecker_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "depChecker_ppc.hpp"
#endif
#ifdef SHARK
#include "shark/sharkEntry.hpp"
#endif
// This routine is in the shared library:
if (_decode_instructions != NULL) {
// Already succeeded.
return true;
}
if (_tried_to_load_library) {
// Do not try twice.
// To force retry in debugger: assign _tried_to_load_library=0
return false;
}
// Try to load it.
{
// Match "jvm[^/]*" in jvm_path.
}
// Find the disassembler shared library.
// Search for several paths derived from libjvm, in this order:
// 4. hsdis-<arch>.so (using LD_LIBRARY_PATH)
if (jvm_offset >= 0) {
}
if (p != NULL) {
}
}
}
// 4. hsdis-<arch>.so (using LD_LIBRARY_PATH)
}
}
_tried_to_load_library = true;
if (_decode_instructions == NULL) {
? "entry point is missing"
: (WizardMode || PrintMiscellaneous)
? (const char*)ebuf
: "library not loadable"),
"PrintAssembly is disabled");
return false;
}
// Success.
return true;
}
class decode_env {
private:
char _print_raw;
bool _print_pc;
bool _print_bytes;
int _total_ticks;
return false;
}
void collect_options(const char* p) {
if (p == NULL || p[0] == '\0') return;
// replace white space by commas:
char* q = fillp;
*q++ = ',';
// Note that multiple PrintAssemblyOptions flags accumulate with \n,
// which we want to be changed to a comma...
}
void print_insn_labels();
public:
}
// this calls reloc_string_for which calls oop::print_value_on
}
// Output pc bucket ticks if we have any
if (total_ticks() != 0) {
if (bucket_count != 0) {
}
}
}
}
};
memset(this, 0, sizeof(*this));
// by default, output pc but not bytes:
_print_pc = true;
_print_bytes = false;
// parse the global option string:
}
}
}
return arg;
}
// Only print this when the mach changes
}
} else {
// ignore unrecognized markup
}
return NULL;
}
// called by the disassembler to print out jump targets and data addresses
return;
}
return;
}
if (Universe::is_fully_initialized()) {
return;
}
return;
}
return;
}
// No output. (Can happen in product builds.)
}
return;
}
}
// Fall through to a simple (hexadecimal) numeral.
}
}
if (_print_pc) {
}
}
incr = sizeof(int);
}
// tab to the desired column:
if (incr == sizeof(int))
}
}
}
}
if (flen == 0) return 0;
if (flen < 2 ||
// happens a lot on machines with names like %foo
flen--;
}
return (int) flen;
}
}
assert(((((intptr_t)start | (intptr_t)end) % Disassembler::pd_instruction_alignment()) == 0), "misaligned insn addr");
//_version = Disassembler::pd_cpu_version();
if (!Disassembler::can_decode()) {
return NULL;
}
// decode a series of instructions and return the end of the last instruction
if (_print_raw) {
// Print whatever the library wants to print, w/o fancy callbacks.
// This is mainly for debugging the library itself.
return (address)
options());
}
return (address)
&event_to_env, (void*) this,
&printf_to_env, (void*) this,
options());
}
if (!load_library()) return;
}
if (!load_library()) return;
}
if (!load_library()) return;
#ifdef SHARK
unsigned char* p = entry->code_start();
#else
unsigned char* p = nm->code_begin();
#endif // SHARK
// If there has been profiling, print the buckets.
unsigned char* p1 = p;
int total_bucket_count = 0;
p1 += pd_instruction_alignment();
}
}
// Print constant table.
if (nm->consts_size() > 0) {
int offset = 0;
if ((offset % 8) == 0) {
env.output()->print_cr(" " PTR_FORMAT " (offset: %4d): " PTR32_FORMAT " " PTR64_FORMAT, p, offset, *((int32_t*) p), *((int64_t*) p));
} else {
}
}
}
}