util.h revision 2362
/*
* 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. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* 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.
*/
#ifndef JDWP_UTIL_H
#define JDWP_UTIL_H
#include <stddef.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#ifdef DEBUG
/* Just to make sure these interfaces are not used here. */
#endif
#include "log_messages.h"
#include "vm_interface.h"
#include "JDWP.h"
#include "util_md.h"
#include "error_messages.h"
#include "debugInit.h"
/* Get access to Native Platform Toolkit functions */
#include "npt.h"
/* Definition of a CommonRef tracked by the backend for the frontend */
typedef struct RefNode {
} RefNode;
/* Value of a NULL ID */
#define NULL_OBJECT_ID ((jlong)0)
/*
* Globals used throughout the back end
*/
typedef jint FrameNumber;
typedef struct {
/* Debug flags (bit mask) */
int debugflags;
/* Possible debug flags */
#define USE_ITERATE_THROUGH_HEAP 0X001
char * options;
/* Various property values we should grab on initialization */
char* property_java_version; /* UTF8 java.version */
char* property_java_vm_name; /* UTF8 java.vm.name */
char* property_java_vm_info; /* UTF8 java.vm.info */
char* property_java_class_path; /* UTF8 java.class.path */
char* property_sun_boot_class_path; /* UTF8 sun.boot.class.path */
char* property_sun_boot_library_path; /* UTF8 sun.boot.library.path */
char* property_path_separator; /* UTF8 path.separator */
char* property_user_dir; /* UTF8 user.dir */
unsigned log_flags;
/* The Native Platform Toolkit access */
/* Common References static data */
int objectsByIDsize;
int objectsByIDcount;
/* Indication that the agent has been loaded */
extern BackendGlobalData * gdata;
/*
* Event Index for handlers
*/
typedef enum {
EI_min = 1,
EI_SINGLE_STEP = 1,
EI_BREAKPOINT = 2,
EI_FRAME_POP = 3,
EI_EXCEPTION = 4,
EI_THREAD_START = 5,
EI_THREAD_END = 6,
EI_CLASS_PREPARE = 7,
EI_GC_FINISH = 8,
EI_CLASS_LOAD = 9,
EI_FIELD_ACCESS = 10,
EI_FIELD_MODIFICATION = 11,
EI_EXCEPTION_CATCH = 12,
EI_METHOD_ENTRY = 13,
EI_METHOD_EXIT = 14,
EI_MONITOR_WAIT = 17,
EI_MONITOR_WAITED = 18,
EI_VM_INIT = 19,
EI_VM_DEATH = 20,
EI_max = 20
} EventIndex;
/* Agent errors that might be in a jvmtiError for JDWP or internal.
* (Done this way so that compiler allows it's use as a jvmtiError)
*/
/* Combined event information */
typedef struct {
union {
/* ei = EI_FIELD_ACCESS */
struct {
} field_access;
/* ei = EI_FIELD_MODIFICATION */
struct {
char signature_type;
/* ei = EI_EXCEPTION */
struct {
} exception;
/* ei = EI_METHOD_EXIT */
struct {
} method_exit;
/* For monitor wait events */
union {
/* ei = EI_MONITOR_WAIT */
/* ei = EI_MONITOR_WAITED */
} monitor;
} u;
} EventInfo;
/* Structure to hold dynamic array of objects */
typedef struct ObjectBatch {
} ObjectBatch;
/*
* JNI signature constants, beyond those defined in JDWP_TAG(*)
*/
#define SIGNATURE_BEGIN_ARGS '('
#define SIGNATURE_END_ARGS ')'
#define SIGNATURE_END_CLASS ';'
/*
* Modifier flags for classes, fields, methods
*/
/*
* Additional modifiers not defined as such in the JVM spec
*/
/*
* jlong conversion macros
*/
#define jlong_zero ((jlong) 0)
#define jlong_to_ptr(a) ((void*)(intptr_t)(a))
#define jint_to_jlong(a) ((jlong)(a))
#define jlong_to_jint(a) ((jint)(a))
/*
* util funcs
*/
void util_reset(void);
struct PacketInputStream;
struct PacketOutputStream;
void convertSignatureToClassname(char *convert);
/*
* Command handling helpers shared among multiple command sets
*/
struct PacketOutputStream *out,
struct PacketOutputStream *out);
/*
* Thin wrappers on top of JNI
*/
/*
* Thin wrappers on top of JVMTI
*/
jint jvmtiMajorVersion(void);
jint jvmtiMinorVersion(void);
jint jvmtiMicroVersion(void);
char *getClassname(jclass);
void writeGenericSignature(struct PacketOutputStream *, char *);
void jvmtiDeallocate(void *buffer);
void eventIndexInit(void);
void log_debugee_location(const char *func,
/*
* Local Reference management. The two macros below are used
* throughout the back end whenever space for JNI local references
* is needed in the current frame.
*/
{ /* BEGINNING OF WITH SCOPE */
#define END_WITH_LOCAL_REFS(env) \
} /* END OF WITH SCOPE */
#endif