< prev index next >

test/hotspot/jtreg/testlibrary/jvmti/libSimpleClassFileLoadHook.c

Print this page


  87         while (d < end) {
  88           *d++ = *s++;
  89         }
  90 
  91         *new_class_data_len = class_data_len;
  92         *new_class_data = new_data;
  93 
  94         fprintf(stderr, "Rewriting done. Replaced %d occurrence(s) of \"%s\" to \"%s\"\n", count, FROM, TO);
  95       }
  96     }
  97 }
  98 
  99 static int early = 0;
 100 
 101 static jint init_options(char *options) {
 102   char* class_name;
 103   char* from;
 104   char* to;
 105 
 106   fprintf(stderr, "Agent library loaded with options = %s\n", options);
 107   if (options != NULL && strncmp(options, "+early,", 7) == 0) {
 108     early = 1;
 109     options += 7;
 110   }
 111   if ((class_name = options) != NULL &&
 112       (from = strchr(class_name, ',')) != NULL && (from[1] != 0)) {
 113     *from = 0;
 114     from++;
 115     if ((to = strchr(from, ',')) != NULL && (to[1] != 0)) {
 116       *to = 0;
 117       to++;
 118       if (strchr(to, ',') == NULL &&
 119           strlen(to) == strlen(from) &&
 120           strlen(class_name) > 0 &&
 121           strlen(to) > 0) {
 122         CLASS_NAME = strdup(class_name);
 123         FROM = strdup(from);
 124         TO = strdup(to);
 125         fprintf(stderr, "CLASS_NAME = %s, FROM = %s, TO = %s\n",
 126                 CLASS_NAME, FROM, TO);
 127         return JNI_OK;




  87         while (d < end) {
  88           *d++ = *s++;
  89         }
  90 
  91         *new_class_data_len = class_data_len;
  92         *new_class_data = new_data;
  93 
  94         fprintf(stderr, "Rewriting done. Replaced %d occurrence(s) of \"%s\" to \"%s\"\n", count, FROM, TO);
  95       }
  96     }
  97 }
  98 
  99 static int early = 0;
 100 
 101 static jint init_options(char *options) {
 102   char* class_name;
 103   char* from;
 104   char* to;
 105 
 106   fprintf(stderr, "Agent library loaded with options = %s\n", options);
 107   if (options != NULL && strncmp(options, "-early,", 7) == 0) {
 108     early = 1;
 109     options += 7;
 110   }
 111   if ((class_name = options) != NULL &&
 112       (from = strchr(class_name, ',')) != NULL && (from[1] != 0)) {
 113     *from = 0;
 114     from++;
 115     if ((to = strchr(from, ',')) != NULL && (to[1] != 0)) {
 116       *to = 0;
 117       to++;
 118       if (strchr(to, ',') == NULL &&
 119           strlen(to) == strlen(from) &&
 120           strlen(class_name) > 0 &&
 121           strlen(to) > 0) {
 122         CLASS_NAME = strdup(class_name);
 123         FROM = strdup(from);
 124         TO = strdup(to);
 125         fprintf(stderr, "CLASS_NAME = %s, FROM = %s, TO = %s\n",
 126                 CLASS_NAME, FROM, TO);
 127         return JNI_OK;


< prev index next >