From 72d44ed611459d1716d4e47ed7b881586bec7abc Mon Sep 17 00:00:00 2001 From: bloodstalker Date: Wed, 19 Sep 2018 02:11:57 +0430 Subject: still WIP --- bruiser/autogen/wasm/ft/autowasm.c | 42 +++++++++++++++++--------------------- bruiser/autogen/wasm/ft/makefile | 10 ++++++++- 2 files changed, 28 insertions(+), 24 deletions(-) (limited to 'bruiser/autogen/wasm/ft') diff --git a/bruiser/autogen/wasm/ft/autowasm.c b/bruiser/autogen/wasm/ft/autowasm.c index cbc6e5a..53986c1 100644 --- a/bruiser/autogen/wasm/ft/autowasm.c +++ b/bruiser/autogen/wasm/ft/autowasm.c @@ -3,35 +3,31 @@ #include #include #include -#include #include +#include -#include "./structs.h" -#include "./read.h" #include "./aggregate.h" - +#include "./read.h" +#include "./structs.h" #pragma weak main -int main (int argc, char** argv) { - const rlim_t kStackSize = 160 * 1024 * 1024; // min stack size = 16 MB +int main(int argc, char **argv) { + const rlim_t kStackSize = 160 * 1024 * 1024; // min stack size = 16 MB struct rlimit rl; int result; result = getrlimit(RLIMIT_STACK, &rl); - if (result == 0) - { - if (rl.rlim_cur < kStackSize) - { - rl.rlim_cur = kStackSize; - result = setrlimit(RLIMIT_STACK, &rl); - if (result != 0) - { - fprintf(stderr, "setrlimit returned result = %d\n", result); - } + if (result == 0) { + if (rl.rlim_cur < kStackSize) { + rl.rlim_cur = kStackSize; + result = setrlimit(RLIMIT_STACK, &rl); + if (result != 0) { + fprintf(stderr, "setrlimit returned result = %d\n", result); } + } } int wasm = open("./test.wasm", O_RDONLY); - wasm_lib_ret_t* lib_ret = read_aggr_wasm(wasm); + wasm_lib_ret_t *lib_ret = read_aggr_wasm(wasm); printf("finished reading\n"); #if 0 @@ -165,14 +161,14 @@ int main (int argc, char** argv) { printf("void_train first:0x%x\n", lib_ret->void_train[0]); printf("void_train first:0x%x\n", lib_ret->void_train[1]); printf("void_train self address:0x%x\n", lib_ret->void_train); - //free(lib_ret->void_train[0]); - //release_all(lib_ret->void_train, lib_ret->current_void_count); - //free(lib_ret->void_train[2]); - //free(lib_ret->void_train[1]); - //free(lib_ret->void_train[0]); + // free(lib_ret->void_train[0]); + // release_all(lib_ret->void_train, lib_ret->current_void_count); + // free(lib_ret->void_train[2]); + // free(lib_ret->void_train[1]); + // free(lib_ret->void_train[0]); for (int i = lib_ret->current_void_count - 1; i >= 0; --i) { printf("%d:0x%x ", i, lib_ret->void_train[i]); - //if (i == 1) continue; + // if (i == 1) continue; free(lib_ret->void_train[i]); } free(lib_ret->void_train); diff --git a/bruiser/autogen/wasm/ft/makefile b/bruiser/autogen/wasm/ft/makefile index be67649..d67c45b 100644 --- a/bruiser/autogen/wasm/ft/makefile +++ b/bruiser/autogen/wasm/ft/makefile @@ -101,6 +101,8 @@ ASM:$(ASM_LIST) SO:$(TARGET).so A:$(TARGET).a +ADBG:$(TARGET).adbg +ACOV:$(TARGET).acov TAGS:tags @@ -118,6 +120,12 @@ $(TARGET).so: $(TARGET).o read.o aggregate.o structs.o $(TARGET).a: $(TARGET).o read.o aggregate.o structs.o ar rcs $(TARGET).a $(TARGET).o read.o aggregate.o structs.o +$(TARGET).adbg: $(TARGET).odbg read.odbg aggregate.odbg structs.odbg + ar rcs $(TARGET).adbg $(TARGET).odbg read.odbg aggregate.odbg structs.odbg + +$(TARGET).acov: $(TARGET).ocov read.ocov aggregate.ocov structs.ocov + ar rcs $(TARGET).acov $(TARGET).ocov read.ocov aggregate.ocov structs.ocov + valgrind: $(TARGET) valgrind --leak-check=yes $(TARGET) @@ -125,7 +133,7 @@ test: $(TARGET) $(TARGET) clean: - rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov + rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov $(TARGET).adbg $(TARGET).acov deepclean: rm -f *.o *.dis *.odbg *.ocov *~ $(TARGET) $(TARGET).so tags $(TARGET)-static $(TARGET)-dbg $(TARGET).a $(TARGET)-cov -- cgit v1.2.3