mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 03:58:21 +00:00
8374168: Resolve disabled warnings in JDWP agent
Reviewed-by: cjplummer, sspitsyn, erikj
This commit is contained in:
parent
5fd095fb9b
commit
fa8ea6b32d
@ -54,21 +54,6 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \
|
|||||||
NAME := jdwp, \
|
NAME := jdwp, \
|
||||||
OPTIMIZATION := LOW, \
|
OPTIMIZATION := LOW, \
|
||||||
CFLAGS := -DJDWP_LOGGING $(ICONV_CFLAGS), \
|
CFLAGS := -DJDWP_LOGGING $(ICONV_CFLAGS), \
|
||||||
DISABLED_WARNINGS_gcc_eventFilter.c := unused-variable, \
|
|
||||||
DISABLED_WARNINGS_gcc_SDE.c := unused-function, \
|
|
||||||
DISABLED_WARNINGS_gcc_threadControl.c := unused-but-set-variable \
|
|
||||||
unused-variable, \
|
|
||||||
DISABLED_WARNINGS_gcc_utf_util.c := unused-but-set-variable, \
|
|
||||||
DISABLED_WARNINGS_clang_error_messages.c := format-nonliteral, \
|
|
||||||
DISABLED_WARNINGS_clang_eventFilter.c := unused-variable, \
|
|
||||||
DISABLED_WARNINGS_clang_EventRequestImpl.c := self-assign, \
|
|
||||||
DISABLED_WARNINGS_clang_inStream.c := sometimes-uninitialized, \
|
|
||||||
DISABLED_WARNINGS_clang_log_messages.c := format-nonliteral, \
|
|
||||||
DISABLED_WARNINGS_clang_SDE.c := unused-function, \
|
|
||||||
DISABLED_WARNINGS_clang_threadControl.c := unused-but-set-variable \
|
|
||||||
unused-variable, \
|
|
||||||
DISABLED_WARNINGS_clang_utf_util.c := unused-but-set-variable, \
|
|
||||||
DISABLED_WARNINGS_microsoft_debugInit.c := 5287, \
|
|
||||||
LDFLAGS := $(ICONV_LDFLAGS), \
|
LDFLAGS := $(ICONV_LDFLAGS), \
|
||||||
EXTRA_HEADER_DIRS := \
|
EXTRA_HEADER_DIRS := \
|
||||||
include \
|
include \
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -84,12 +84,10 @@ readAndSetFilters(JNIEnv *env, PacketInputStream *in, HandlerNode *node,
|
|||||||
}
|
}
|
||||||
|
|
||||||
case JDWP_REQUEST_MODIFIER(LocationOnly): {
|
case JDWP_REQUEST_MODIFIER(LocationOnly): {
|
||||||
jbyte tag;
|
|
||||||
jclass clazz;
|
jclass clazz;
|
||||||
jmethodID method;
|
jmethodID method;
|
||||||
jlocation location;
|
jlocation location;
|
||||||
tag = inStream_readByte(in); /* not currently used */
|
(void)inStream_readByte(in); /* not currently used */
|
||||||
tag = tag; /* To shut up lint */
|
|
||||||
if ( (serror = inStream_error(in)) != JDWP_ERROR(NONE) )
|
if ( (serror = inStream_error(in)) != JDWP_ERROR(NONE) )
|
||||||
break;
|
break;
|
||||||
clazz = inStream_readClassRef(env, in);
|
clazz = inStream_readClassRef(env, in);
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -718,19 +718,6 @@ private jboolean isValid(void);
|
|||||||
lineTable[lti].jplsLineInc));
|
lineTable[lti].jplsLineInc));
|
||||||
}
|
}
|
||||||
|
|
||||||
private int fileTableIndex(int sti, int fileId) {
|
|
||||||
int i;
|
|
||||||
int fileIndexStart = stratumTable[sti].fileIndex;
|
|
||||||
/* one past end */
|
|
||||||
int fileIndexEnd = stratumTable[sti+1].fileIndex;
|
|
||||||
for (i = fileIndexStart; i < fileIndexEnd; ++i) {
|
|
||||||
if (fileTable[i].fileId == fileId) {
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
private jboolean isValid(void) {
|
private jboolean isValid(void) {
|
||||||
return sourceMapIsValid;
|
return sourceMapIsValid;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -181,11 +181,11 @@ DEF_Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
|
|||||||
vmInitialized = JNI_FALSE;
|
vmInitialized = JNI_FALSE;
|
||||||
gdata->vmDead = JNI_FALSE;
|
gdata->vmDead = JNI_FALSE;
|
||||||
|
|
||||||
jvmtiCompileTimeMajorVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MAJOR )
|
jvmtiCompileTimeMajorVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MAJOR)
|
||||||
>> JVMTI_VERSION_SHIFT_MAJOR;
|
>> JVMTI_VERSION_SHIFT_MAJOR;
|
||||||
jvmtiCompileTimeMinorVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MINOR )
|
jvmtiCompileTimeMinorVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MINOR)
|
||||||
>> JVMTI_VERSION_SHIFT_MINOR;
|
>> JVMTI_VERSION_SHIFT_MINOR;
|
||||||
jvmtiCompileTimeMicroVersion = ( JVMTI_VERSION & JVMTI_VERSION_MASK_MICRO )
|
jvmtiCompileTimeMicroVersion = ((unsigned)JVMTI_VERSION & JVMTI_VERSION_MASK_MICRO)
|
||||||
>> JVMTI_VERSION_SHIFT_MICRO;
|
>> JVMTI_VERSION_SHIFT_MICRO;
|
||||||
|
|
||||||
/* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */
|
/* Get the JVMTI Env, IMPORTANT: Do this first! For jvmtiAllocate(). */
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -61,6 +61,8 @@
|
|||||||
* NOTE: This function is at the lowest level of the call tree.
|
* NOTE: This function is at the lowest level of the call tree.
|
||||||
* Do not use the ERROR* macros here.
|
* Do not use the ERROR* macros here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
ATTRIBUTE_PRINTF(4, 0)
|
||||||
static void
|
static void
|
||||||
vprint_message(FILE *fp, const char *prefix, const char *suffix,
|
vprint_message(FILE *fp, const char *prefix, const char *suffix,
|
||||||
const char *format, va_list ap)
|
const char *format, va_list ap)
|
||||||
@ -84,6 +86,7 @@ vprint_message(FILE *fp, const char *prefix, const char *suffix,
|
|||||||
* NOTE: This function is at the lowest level of the call tree.
|
* NOTE: This function is at the lowest level of the call tree.
|
||||||
* Do not use the ERROR* macros here.
|
* Do not use the ERROR* macros here.
|
||||||
*/
|
*/
|
||||||
|
ATTRIBUTE_PRINTF(4, 5)
|
||||||
void
|
void
|
||||||
print_message(FILE *fp, const char *prefix, const char *suffix,
|
print_message(FILE *fp, const char *prefix, const char *suffix,
|
||||||
const char *format, ...)
|
const char *format, ...)
|
||||||
@ -96,6 +99,7 @@ print_message(FILE *fp, const char *prefix, const char *suffix,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate error message */
|
/* Generate error message */
|
||||||
|
ATTRIBUTE_PRINTF(1, 2)
|
||||||
void
|
void
|
||||||
error_message(const char *format, ...)
|
error_message(const char *format, ...)
|
||||||
{
|
{
|
||||||
@ -110,6 +114,7 @@ error_message(const char *format, ...)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Print plain message to stdout. */
|
/* Print plain message to stdout. */
|
||||||
|
ATTRIBUTE_PRINTF(1, 2)
|
||||||
void
|
void
|
||||||
tty_message(const char *format, ...)
|
tty_message(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -976,7 +976,6 @@ eventFilter_setSourceNameMatchFilter(HandlerNode *node,
|
|||||||
|
|
||||||
jvmtiError eventFilter_setPlatformThreadsOnlyFilter(HandlerNode *node, jint index)
|
jvmtiError eventFilter_setPlatformThreadsOnlyFilter(HandlerNode *node, jint index)
|
||||||
{
|
{
|
||||||
PlatformThreadsFilter *filter = &FILTER(node, index).u.PlatformThreadsOnly;
|
|
||||||
if (index >= FILTER_COUNT(node)) {
|
if (index >= FILTER_COUNT(node)) {
|
||||||
return AGENT_ERROR_ILLEGAL_ARGUMENT;
|
return AGENT_ERROR_ILLEGAL_ARGUMENT;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -470,6 +470,7 @@ inStream_readValue(PacketInputStream *stream)
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
stream->error = JDWP_ERROR(INVALID_TAG);
|
stream->error = JDWP_ERROR(INVALID_TAG);
|
||||||
|
value.j = 0L; // to make compiler happy
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -155,6 +155,7 @@ standard_logging_format(FILE *fp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* End a log entry */
|
/* End a log entry */
|
||||||
|
ATTRIBUTE_PRINTF(1, 2)
|
||||||
void
|
void
|
||||||
log_message_end(const char *format, ...)
|
log_message_end(const char *format, ...)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2667,12 +2667,16 @@ threadControl_setEventMode(jvmtiEventMode mode, EventIndex ei, jthread thread)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Returns the current thread.
|
* Returns the current thread.
|
||||||
|
* Returns NULL on error (JVMTI_ERROR_WRONG_PHASE, JVMTI_ERROR_UNATTACHED_THREAD).
|
||||||
*/
|
*/
|
||||||
jthread
|
jthread
|
||||||
threadControl_currentThread(void)
|
threadControl_currentThread(void)
|
||||||
{
|
{
|
||||||
jthread thread = NULL;
|
jthread thread = NULL;
|
||||||
jvmtiError error = JVMTI_FUNC_PTR(gdata->jvmti,GetCurrentThread)(gdata->jvmti, &thread);
|
jvmtiError error = JVMTI_FUNC_PTR(gdata->jvmti,GetCurrentThread)(gdata->jvmti, &thread);
|
||||||
|
if (error != JVMTI_ERROR_NONE) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
return thread;
|
return thread;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2700,11 +2704,9 @@ threadControl_getFrameGeneration(jthread thread)
|
|||||||
jthread *
|
jthread *
|
||||||
threadControl_allVThreads(jint *numVThreads)
|
threadControl_allVThreads(jint *numVThreads)
|
||||||
{
|
{
|
||||||
JNIEnv *env;
|
|
||||||
ThreadNode *node;
|
ThreadNode *node;
|
||||||
jthread* vthreads;
|
jthread* vthreads;
|
||||||
|
|
||||||
env = getEnv();
|
|
||||||
debugMonitorEnter(threadLock);
|
debugMonitorEnter(threadLock);
|
||||||
*numVThreads = numRunningVThreads;
|
*numVThreads = numRunningVThreads;
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1998, 2022, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -173,7 +173,7 @@ int JNICALL utf8mToUtf8sLength(jbyte *string, int length) {
|
|||||||
|
|
||||||
newLength = 0;
|
newLength = 0;
|
||||||
for ( i = 0 ; i < length ; i++ ) {
|
for ( i = 0 ; i < length ; i++ ) {
|
||||||
unsigned byte1, byte2, byte3, byte4, byte5, byte6;
|
unsigned byte1, byte2, byte4, byte5, byte6;
|
||||||
|
|
||||||
byte1 = (unsigned char)string[i];
|
byte1 = (unsigned char)string[i];
|
||||||
if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
|
if ( (byte1 & 0x80) == 0 ) { /* 1byte encoding */
|
||||||
@ -196,7 +196,7 @@ int JNICALL utf8mToUtf8sLength(jbyte *string, int length) {
|
|||||||
break; /* Error condition */
|
break; /* Error condition */
|
||||||
}
|
}
|
||||||
byte2 = (unsigned char)string[++i];
|
byte2 = (unsigned char)string[++i];
|
||||||
byte3 = (unsigned char)string[++i];
|
++i; // byte3 is not used
|
||||||
newLength += 3;
|
newLength += 3;
|
||||||
/* Possible process a second 3byte encoding */
|
/* Possible process a second 3byte encoding */
|
||||||
if ( (i+3) < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
|
if ( (i+3) < length && byte1 == 0xED && (byte2 & 0xF0) == 0xA0 ) {
|
||||||
|
|||||||
@ -59,6 +59,14 @@
|
|||||||
#include "error_messages.h"
|
#include "error_messages.h"
|
||||||
#include "debugInit.h"
|
#include "debugInit.h"
|
||||||
|
|
||||||
|
/* To handle "format string is not a string literal" warning. */
|
||||||
|
#if !defined(_MSC_VER)
|
||||||
|
#define ATTRIBUTE_PRINTF(fmt_pos_num, vargs_pos_num) \
|
||||||
|
__attribute__((format(printf, fmt_pos_num, vargs_pos_num)))
|
||||||
|
#else
|
||||||
|
#define ATTRIBUTE_PRINTF(fmt_pos_num, vargs_pos_num)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Definition of a CommonRef tracked by the backend for the frontend */
|
/* Definition of a CommonRef tracked by the backend for the frontend */
|
||||||
typedef struct RefNode {
|
typedef struct RefNode {
|
||||||
jlong seqNum; /* ID of reference, also key for hash table */
|
jlong seqNum; /* ID of reference, also key for hash table */
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user