/*
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* - Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* - Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* - Neither the name of Oracle nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
* THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*
* This source code is provided to illustrate the usage of a given feature
* or technique and has been deliberately simplified. Additional steps
* required for a production-quality application, such as security checks,
* input validation and proper error handling, might not be present in
* this sample code.
*/
#include <agent_util.h>
/* ------------------------------------------------------------------- */
/* Generic C utility functions */
/* Send message to stdout or whatever the data output location is */
void
{
}
/* Send message to stderr or whatever the error output location is and exit */
void
{
exit(3);
}
/* Get a token from a string (strtok is not MT-safe)
* str String to scan
* seps Separation characters
* buf Place to put results
* max Size of buf
* Returns NULL if no token available or can't do the scan.
*/
char *
{
int len;
buf[0] = 0;
return NULL;
}
if ( str[0]==0 ) {
return NULL;
}
return NULL;
}
}
* item String that represents a pattern to match
* If it starts with a '*', then any class is allowed
* If it ends with a '*', then any method is allowed
* cname Class name, e.g. "java.lang.Object"
* mname Method name, e.g. "<init>"
* Returns 1(true) or 0(false).
*/
static int
{
int len;
if ( item[0]=='*' ) {
return 1;
}
return 1;
}
} else {
int cname_len;
/* No method name supplied in item, we must have matched */
return 1;
} else {
int mname_len;
return 1;
}
}
}
}
return 0;
}
* list String of comma separated pattern items
* cname Class name, e.g. "java.lang.Object"
* mname Method name, e.g. "<init>"
* Returns 1(true) or 0(false).
*/
static int
{
char *next;
if ( list[0] == 0 ) {
return 0;
}
return 1;
}
}
return 0;
}
/* Determines which class and methods we are interested in
* cname Class name, e.g. "java.lang.Object"
* mname Method name, e.g. "<init>"
* include_list Empty or an explicit list for inclusion
* exclude_list Empty or an explicit list for exclusion
* Returns 1(true) or 0(false).
*/
int
{
return 0;
}
return 0;
}
return 1;
}
/* ------------------------------------------------------------------- */
/* Generic JVMTI utility functions */
/* Every JVMTI interface returns an error code, which should be checked
* to avoid any cascading errors down the line.
* The interface GetErrorName() returns the actual enumeration constant
* name, making the error messages much easier to understand.
*/
void
{
if ( errnum != JVMTI_ERROR_NONE ) {
char *errnum_str;
errnum_str = NULL;
}
}
/* All memory allocated by JVMTI must be freed by the JVMTI Deallocate
* interface.
*/
void
{
}
/* Allocation of JVMTI managed memory */
void *
{
void *ptr;
return ptr;
}
/* Add demo jar file to boot class path (the BCI Tracker class must be
* in the boot classpath)
*
* WARNING: This code assumes that the jar file can be found at one of:
* where JAVA_HOME may refer to the jre directory.
* Both these values are added to the boot classpath.
* These locations are only true for these demos, installed
* in the JDK area. Platform specific code could be used to
* find the location of the DLL or .so library, and construct a
* path name to the jar file, relative to the library location.
*/
void
{
char *file_sep;
int max_len;
char *java_home;
fatal_error("ERROR: Java home not found\n");
}
#ifdef WIN32
file_sep = "\\";
#else
file_sep = "/";
#endif
16 /* ".." "demo" "jvmti" ".jar" NULL */ );
fatal_error("ERROR: Path to jar file too long\n");
}
}
/* ------------------------------------------------------------------- */