To protect your data, the CISO officer has suggested users to enable GitLab 2FA as soon as possible.

Commit 978e993e authored by john's avatar john
Browse files

refactored java instrumentation code

parent 0c6390a0
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -301,7 +301,6 @@ Agent_OnLoad(JavaVM *vm, char *options, void *reserved)
expensive.
*/
makeOptionListFromFile(options);
// makeOptionList(options);
/* Create a raw monitor in the agent for critical sections. */
if (!dacapo_log_init()) {
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
......@@ -176,6 +176,29 @@ void append(char** buf, int* length, int* maxLength, char c)
(*buf)[*length] = c;
*length = *length + 1;
}
static void addOption(char* key, int keyLength, char* value, int valueLength) {
struct option_s* opt = (struct option_s*)malloc(sizeof(struct option_s));
opt->next = NULL;
opt->option = (char*)malloc(sizeof(char)*(keyLength+1));
opt->length = keyLength;
strncpy(opt->option,key,sizeof(char)*keyLength);
opt->option[keyLength] = '\0';
opt->argument = (char*)malloc(sizeof(char)*(valueLength+1));
opt->argLength = valueLength;
strncpy(opt->argument,value,sizeof(char)*valueLength);
opt->argument[valueLength] = '\0';
if (optionList == NULL)
optionList = optionTail = opt;
else {
optionTail->next = opt;
optionTail = opt;
}
}
void makeOptionListFromFile(char* agentDir)
{
......@@ -240,6 +263,14 @@ void makeOptionListFromFile(char* agentDir)
case '=':
state = VALUE;
break;
case '\r': case '\n':
state = UNKNOWN;
addOption(key,keyLength,value,valueLength);
keyLength = 0;
valueLength = 0;
break;
default:
append(&key, &keyLength, &keyMaxLength, c);
break;
......@@ -268,26 +299,7 @@ void makeOptionListFromFile(char* agentDir)
case '\r': case '\n':
state = UNKNOWN;
struct option_s* opt = (struct option_s*)malloc(sizeof(struct option_s));
opt->next = NULL;
opt->option = (char*)malloc(sizeof(char)*(keyLength+1));
opt->length = keyLength;
strncpy(opt->option,key,sizeof(char)*keyLength);
opt->option[keyLength] = '\0';
opt->argument = (char*)malloc(sizeof(char)*(valueLength+1));
opt->argLength = valueLength;
strncpy(opt->argument,value,sizeof(char)*valueLength);
opt->argument[valueLength] = '\0';
if (optionList == NULL)
optionList = optionTail = opt;
else {
optionTail->next = opt;
optionTail = opt;
}
addOption(key,keyLength,value,valueLength);
keyLength = 0;
valueLength = 0;
......
File mode changed from 100644 to 100755
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment