/* * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * 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. *
*/
bool ElfDecoder::get_source_info(address pc, char* filename, size_t filename_len, int* line, bool is_pc_after_call) { #ifdefined(__clang_major__) && (__clang_major__ < 5)
DWARF_LOG_ERROR("The DWARF parser only supports Clang 5.0+."); returnfalse; #else
assert(filename != nullptr && line != nullptr, "arguments should not be null");
assert(filename_len > 1, "buffer must be able to at least hold 1 character with a null terminator");
filename[0] = '\0';
*line = -1;
char filepath[JVM_MAXPATHLEN];
filepath[JVM_MAXPATHLEN - 1] = '\0'; int offset_in_library = -1; if (!os::dll_address_to_library_name(pc, filepath, sizeof(filepath), &offset_in_library)) { // Method not found. offset_in_library should not overflow.
DWARF_LOG_ERROR("Did not find library for address " PTR_FORMAT, p2i(pc)) returnfalse;
}
if (filepath[JVM_MAXPATHLEN - 1] != '\0') {
DWARF_LOG_ERROR("File path is too large to fit into buffer of size %d", JVM_MAXPATHLEN); returnfalse;
}
ElfFile* file = get_elf_file(filepath); if (file == NULL) { returnfalse;
}
DWARF_LOG_INFO("##### Find filename and line number for offset " INT32_FORMAT_X_0 " in library %s #####",
unsigned_offset_in_library, filepath);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.