8260022: [ppc] os::print_function_and_library_name shall resolve function descriptors transparently
Reviewed-by: mdoerr, lucy
This commit is contained in:
parent
fa40a9661b
commit
3e4194c42e
@ -26,6 +26,7 @@
|
|||||||
#ifndef CPU_PPC_ASSEMBLER_PPC_HPP
|
#ifndef CPU_PPC_ASSEMBLER_PPC_HPP
|
||||||
#define CPU_PPC_ASSEMBLER_PPC_HPP
|
#define CPU_PPC_ASSEMBLER_PPC_HPP
|
||||||
|
|
||||||
|
#include "asm/assembler.hpp"
|
||||||
#include "asm/register.hpp"
|
#include "asm/register.hpp"
|
||||||
|
|
||||||
// Address is an abstraction used to represent a memory location
|
// Address is an abstraction used to represent a memory location
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
// no precompiled headers
|
// no precompiled headers
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
|
#include "assembler_ppc.hpp"
|
||||||
#include "asm/assembler.inline.hpp"
|
#include "asm/assembler.inline.hpp"
|
||||||
#include "classfile/classLoader.hpp"
|
#include "classfile/classLoader.hpp"
|
||||||
#include "classfile/systemDictionary.hpp"
|
#include "classfile/systemDictionary.hpp"
|
||||||
@ -493,3 +494,8 @@ bool os::platform_print_native_stack(outputStream* st, void* context, char *buf,
|
|||||||
AixNativeCallstack::print_callstack_for_context(st, (const ucontext_t*)context, true, buf, (size_t) buf_size);
|
AixNativeCallstack::print_callstack_for_context(st, (const ucontext_t*)context, true, buf, (size_t) buf_size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HAVE_FUNCTION_DESCRIPTORS
|
||||||
|
void* os::resolve_function_descriptor(void* p) {
|
||||||
|
return ((const FunctionDescriptor*)p)->entry();
|
||||||
|
}
|
||||||
|
@ -32,8 +32,11 @@
|
|||||||
// Note: Currently only used in 64 bit Windows implementations
|
// Note: Currently only used in 64 bit Windows implementations
|
||||||
static bool register_code_area(char *low, char *high) { return true; }
|
static bool register_code_area(char *low, char *high) { return true; }
|
||||||
|
|
||||||
#define PLATFORM_PRINT_NATIVE_STACK 1
|
#define PLATFORM_PRINT_NATIVE_STACK 1
|
||||||
static bool platform_print_native_stack(outputStream* st, void* context,
|
static bool platform_print_native_stack(outputStream* st, void* context,
|
||||||
char *buf, int buf_size);
|
char *buf, int buf_size);
|
||||||
|
|
||||||
|
#define HAVE_FUNCTION_DESCRIPTORS 1
|
||||||
|
static void* resolve_function_descriptor(void* p);
|
||||||
|
|
||||||
#endif // OS_CPU_AIX_PPC_OS_AIX_PPC_HPP
|
#endif // OS_CPU_AIX_PPC_OS_AIX_PPC_HPP
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
|
|
||||||
// no precompiled headers
|
// no precompiled headers
|
||||||
#include "jvm.h"
|
#include "jvm.h"
|
||||||
|
#include "assembler_ppc.hpp"
|
||||||
#include "asm/assembler.inline.hpp"
|
#include "asm/assembler.inline.hpp"
|
||||||
#include "classfile/classLoader.hpp"
|
#include "classfile/classLoader.hpp"
|
||||||
#include "classfile/systemDictionary.hpp"
|
#include "classfile/systemDictionary.hpp"
|
||||||
@ -498,3 +499,9 @@ int os::extra_bang_size_in_bytes() {
|
|||||||
// PPC does not require the additional stack bang.
|
// PPC does not require the additional stack bang.
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef HAVE_FUNCTION_DESCRIPTORS
|
||||||
|
void* os::resolve_function_descriptor(void* p) {
|
||||||
|
return ((const FunctionDescriptor*)p)->entry();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
@ -32,4 +32,10 @@
|
|||||||
// Note: Currently only used in 64 bit Windows implementations
|
// Note: Currently only used in 64 bit Windows implementations
|
||||||
static bool register_code_area(char *low, char *high) { return true; }
|
static bool register_code_area(char *low, char *high) { return true; }
|
||||||
|
|
||||||
|
#if !defined(ABI_ELFv2)
|
||||||
|
// ppc (not ppcle) has function descriptors
|
||||||
|
#define HAVE_FUNCTION_DESCRIPTORS 1
|
||||||
|
static void* resolve_function_descriptor(void* p);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // OS_CPU_LINUX_PPC_OS_LINUX_PPC_HPP
|
#endif // OS_CPU_LINUX_PPC_OS_LINUX_PPC_HPP
|
||||||
|
@ -898,8 +898,24 @@ bool os::print_function_and_library_name(outputStream* st,
|
|||||||
buflen = O_BUFLEN;
|
buflen = O_BUFLEN;
|
||||||
}
|
}
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
const bool have_function_name = dll_address_to_function_name(addr, p, buflen,
|
bool have_function_name = dll_address_to_function_name(addr, p, buflen,
|
||||||
&offset, demangle);
|
&offset, demangle);
|
||||||
|
bool is_function_descriptor = false;
|
||||||
|
#ifdef HAVE_FUNCTION_DESCRIPTORS
|
||||||
|
// When we deal with a function descriptor instead of a real code pointer, try to
|
||||||
|
// resolve it. There is a small chance that a random pointer given to this function
|
||||||
|
// may just happen to look like a valid descriptor, but this is rare and worth the
|
||||||
|
// risk to see resolved function names. But we will print a little suffix to mark
|
||||||
|
// this as a function descriptor for the reader (see below).
|
||||||
|
if (!have_function_name && os::is_readable_pointer(addr)) {
|
||||||
|
address addr2 = (address)os::resolve_function_descriptor(addr);
|
||||||
|
if (have_function_name = is_function_descriptor =
|
||||||
|
dll_address_to_function_name(addr2, p, buflen, &offset, demangle)) {
|
||||||
|
addr = addr2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif // HANDLE_FUNCTION_DESCRIPTORS
|
||||||
|
|
||||||
if (have_function_name) {
|
if (have_function_name) {
|
||||||
// Print function name, optionally demangled
|
// Print function name, optionally demangled
|
||||||
if (demangle && strip_arguments) {
|
if (demangle && strip_arguments) {
|
||||||
@ -934,6 +950,12 @@ bool os::print_function_and_library_name(outputStream* st,
|
|||||||
st->print("+%d", offset);
|
st->print("+%d", offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write a trailing marker if this was a function descriptor
|
||||||
|
if (have_function_name && is_function_descriptor) {
|
||||||
|
st->print_raw(" (FD)");
|
||||||
|
}
|
||||||
|
|
||||||
return have_function_name || have_library_name;
|
return have_function_name || have_library_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user