8214120: [REDO] Fix sun.awt.nativedebug on X11 platforms
Reviewed-by: stuefe, ihse
--- a/make/lib/Awt2dLibraries.gmk Wed Nov 21 15:22:57 2018 +0100
+++ b/make/lib/Awt2dLibraries.gmk Wed Nov 21 15:22:28 2018 +0100
@@ -280,7 +280,7 @@
common/font \
#
- LIBAWT_XAWT_EXCLUDES := medialib
+ LIBAWT_XAWT_EXCLUDES := medialib debug
LIBAWT_XAWT_EXTRA_HEADER_DIRS := \
$(LIBAWT_DEFAULT_HEADER_DIRS) \
--- a/src/java.desktop/share/native/common/awt/debug/debug_assert.c Wed Nov 21 15:22:57 2018 +0100
+++ b/src/java.desktop/share/native/common/awt/debug/debug_assert.c Wed Nov 21 15:22:28 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -33,7 +33,9 @@
static DASSERT_CALLBACK PfnAssertCallback = NULL;
-void DAssert_Impl(const char *msg, const char * filename, int linenumber) {
+/* JNIEXPORT because this function is also called from libawt_xawt */
+JNIEXPORT void JNICALL
+DAssert_Impl(const char *msg, const char * filename, int linenumber) {
if (PfnAssertCallback != NULL) {
(*PfnAssertCallback)(msg, filename, linenumber);
} else {
--- a/src/java.desktop/share/native/common/awt/debug/debug_assert.h Wed Nov 21 15:22:57 2018 +0100
+++ b/src/java.desktop/share/native/common/awt/debug/debug_assert.h Wed Nov 21 15:22:28 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -54,7 +54,8 @@
/* prototype for assert function */
typedef void (*DASSERT_CALLBACK)(const char * msg, const char * file, int line);
-extern void DAssert_Impl(const char * msg, const char * file, int line);
+/* JNIEXPORT because this function is also called from libawt_xawt */
+JNIEXPORT void JNICALL DAssert_Impl(const char * msg, const char * file, int line);
extern void DAssert_SetCallback( DASSERT_CALLBACK pfn );
#else /* DEBUG not defined */
--- a/src/java.desktop/share/native/common/awt/debug/debug_trace.c Wed Nov 21 15:22:57 2018 +0100
+++ b/src/java.desktop/share/native/common/awt/debug/debug_trace.c Wed Nov 21 15:22:28 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -237,16 +237,20 @@
/*
* Called via DTRACE_PRINT macro. Outputs printf style formatted text.
+ * JNIEXPORT because these functions are also called from libawt_xawt.
*/
-void DTrace_VPrint( const char * file, int line, int argc, const char * fmt, va_list arglist ) {
+JNIEXPORT void JNICALL
+DTrace_VPrint( const char * file, int line, int argc, const char * fmt, va_list arglist ) {
DASSERT(fmt != NULL);
DTrace_VPrintImpl(fmt, arglist);
}
/*
* Called via DTRACE_PRINTLN macro. Outputs printf style formatted text with an automatic newline.
+ * JNIEXPORT because these functions are also called from libawt_xawt.
*/
-void DTrace_VPrintln( const char * file, int line, int argc, const char * fmt, va_list arglist ) {
+JNIEXPORT void JNICALL
+DTrace_VPrintln( const char * file, int line, int argc, const char * fmt, va_list arglist ) {
DTrace_VPrintImpl(fmt, arglist);
DTrace_PrintImpl("\n");
}
@@ -254,10 +258,12 @@
/*
* Called via DTRACE_ macros. If tracing is enabled at the given location, it enters
* the trace mutex and invokes the callback function to output the trace.
+ * JNIEXPORT because these functions are also called from libawt_xawt.
*/
-void DTrace_PrintFunction( DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pLineTraceId,
- const char * file, int line,
- int argc, const char * fmt, ... ) {
+JNIEXPORT void JNICALL
+DTrace_PrintFunction( DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pLineTraceId,
+ const char * file, int line,
+ int argc, const char * fmt, ... ) {
va_list arglist;
DASSERT(file != NULL);
--- a/src/java.desktop/share/native/common/awt/debug/debug_trace.h Wed Nov 21 15:22:57 2018 +0100
+++ b/src/java.desktop/share/native/common/awt/debug/debug_trace.h Wed Nov 21 15:22:28 2018 +0100
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -59,11 +59,12 @@
void DTrace_DisableMutex();
extern void DTrace_VPrintImpl(const char * fmt, va_list arglist);
extern void DTrace_PrintImpl(const char * fmt, ...);
-extern void DTrace_PrintFunction(DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pTraceId, const char * file, int line, int argc, const char * fmt, ...);
+/* JNIEXPORT because these functions are also called from libawt_xawt */
+JNIEXPORT void JNICALL DTrace_PrintFunction(DTRACE_PRINT_CALLBACK pfn, dtrace_id * pFileTraceId, dtrace_id * pTraceId, const char * file, int line, int argc, const char * fmt, ...);
/* these functions are exported only for use in macros-- do not call them directly!!! */
-extern void DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);
-extern void DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);
+JNIEXPORT void JNICALL DTrace_VPrint(const char * file, int line, int argc, const char * fmt, va_list arglist);
+JNIEXPORT void JNICALL DTrace_VPrintln(const char * file, int line, int argc, const char * fmt, va_list arglist);
/* each file includes this flag indicating module trace status */
static dtrace_id _Dt_FileTraceId = UNDEFINED_TRACE_ID;