aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-06-24 06:16:22 +0000
committerbloodstalker <thabogre@gmail.com>2018-06-24 06:16:22 +0000
commit045e4e775c5d0ee2e7fd489cc3c236861fa5f004 (patch)
tree17a24b4f1d29e48f7c5b6db28927700d4e3bf186 /bruiser
parentfixes #43. the auto-gen source files by luatablegen dont look like source fil... (diff)
downloadmutator-045e4e775c5d0ee2e7fd489cc3c236861fa5f004.tar.gz
mutator-045e4e775c5d0ee2e7fd489cc3c236861fa5f004.zip
fixes 42, fixes 44
Diffstat (limited to 'bruiser')
-rw-r--r--bruiser/bruiser.cpp22
-rw-r--r--bruiser/lua-scripts/demo1.lua30
-rw-r--r--bruiser/lua-scripts/demo3.lua13
-rw-r--r--bruiser/lua-scripts/regtest.lua12
-rw-r--r--bruiser/lua-scripts/wasm.lua1
-rw-r--r--bruiser/lua-scripts/xobj.lua34
-rw-r--r--bruiser/luatablegen/W_Code_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Data_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Data_Segment_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Elem_Segment_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Element_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Export_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Function_Body_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Function_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Global_Entry_tablegen.c4
-rw-r--r--bruiser/luatablegen/W_Global_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Import_Section_Entry_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Import_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Memory_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Table_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/W_Type_Section_Entry_tablegen.c4
-rw-r--r--bruiser/luatablegen/W_Type_Section_tablegen.c2
-rw-r--r--bruiser/luatablegen/Wasm_Module_tablegen.c24
-rw-r--r--bruiser/luatablegen/memory_type_t_tablegen.c2
-rw-r--r--bruiser/luatablegen/table_type_t_tablegen.c2
-rw-r--r--bruiser/makefile4
-rwxr-xr-xbruiser/tablegen.sh2
-rw-r--r--bruiser/wasm/execute.py2
-rw-r--r--bruiser/wasm/init.py (renamed from bruiser/wasm/TBInit.py)2
-rw-r--r--bruiser/wasm/opcodes.py (renamed from bruiser/wasm/OpCodes.py)0
-rwxr-xr-xbruiser/wasm/parse.py4
-rw-r--r--bruiser/wasm/utils.py2
32 files changed, 109 insertions, 83 deletions
diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp
index 7e6a22e..99f7731 100644
--- a/bruiser/bruiser.cpp
+++ b/bruiser/bruiser.cpp
@@ -1375,22 +1375,24 @@ class LuaWrapper
int BruiserPyLoader(lua_State* __ls ) {
int numargs = lua_gettop(__ls);
//std::string filename = "../bfd/load.py";
- std::string filename = "load";
+ //std::string filename = "load";
+ std::string filename;
std::string funcname;
std::string objjpath;
std::string action;
- if (numargs == 3) {
+ if (numargs == 4) {
if (Verbose) std::cout << CYAN << "got args." << NORMAL << "\n";
- funcname = lua_tostring(__ls, 1);
- if (funcname == "") PRINT_WITH_COLOR_LB(RED, "first argument is nil");
- objjpath = lua_tostring(__ls, 2);
- if (objjpath == "") PRINT_WITH_COLOR_LB(RED, "second argument is nil");
- action = lua_tostring(__ls, 3);
- if (action == "") PRINT_WITH_COLOR_LB(RED, "third argument is nil");
+ filename = lua_tostring(__ls, 1);
+ if (filename == "") PRINT_WITH_COLOR_LB(RED, "first argument is nil");
+ funcname = lua_tostring(__ls, 2);
+ if (funcname == "") PRINT_WITH_COLOR_LB(RED, "second argument is nil");
+ objjpath = lua_tostring(__ls, 3);
+ if (objjpath == "") PRINT_WITH_COLOR_LB(RED, "third argument is nil");
+ action = lua_tostring(__ls, 4);
+ if (action == "") PRINT_WITH_COLOR_LB(RED, "fourth argument is nil");
std::cout << NORMAL;
- }
- else {
+ } else {
std::cout << RED << "wrong number of arguments provided. should give the python script name, python func name and the return type.\n" << NORMAL;
return EXIT_FAILURE;
}
diff --git a/bruiser/lua-scripts/demo1.lua b/bruiser/lua-scripts/demo1.lua
index c0ee9fd..c349c36 100644
--- a/bruiser/lua-scripts/demo1.lua
+++ b/bruiser/lua-scripts/demo1.lua
@@ -20,8 +20,8 @@ elf_file = "/home/bloodstalker/devi/hell2/bfd/test/test.so"
function Demo1.getGlobalTable()
local return_table = {}
- local names = objload("elf_get_obj_names", elf_file, "symbol_list")
- local sizes = objload("elf_get_obj_sizes", elf_file, "bytes")
+ local names = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
+ local sizes = objload("load", "elf_get_obj_sizes", elf_file, "bytes")
for i=1,#names,1 do
return_table[names[i]] = sizes[i]
end
@@ -29,28 +29,28 @@ function Demo1.getGlobalTable()
end
function Demo1.printObjNames()
- local c = objload("elf_get_obj_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printObjSizes()
- local c = objload("elf_get_obj_sizes", elf_file, "bytes")
+ local c = objload("load", "elf_get_obj_sizes", elf_file, "bytes")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printFuncNames()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function Demo1.printFuncCode()
- local c = objload("elf_get_func_code", elf_file, "code_list")
+ local c = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(c) do
print(k,v)
if #v ~= 0 then
@@ -63,7 +63,7 @@ function Demo1.printFuncCode()
end
function Demo1.findMain()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
if v == "main" then
io.write("main index is".." "..k.."\n")
@@ -74,8 +74,8 @@ end
function Demo1.codeTables()
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for i=1,#func_name_table,1 do
return_table[func_name_table[i]] = code_table[i]
end
@@ -84,8 +84,8 @@ end
function Demo1.codeTableByName(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -99,8 +99,8 @@ end
function Demo1.codeTableByName_number(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -113,8 +113,8 @@ function Demo1.codeTableByName_number(name)
end
function Demo1.printFuncSizes()
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
local counter = 1
print("function sizes:")
for k, v in ipairs(code_table) do
diff --git a/bruiser/lua-scripts/demo3.lua b/bruiser/lua-scripts/demo3.lua
new file mode 100644
index 0000000..89dde81
--- /dev/null
+++ b/bruiser/lua-scripts/demo3.lua
@@ -0,0 +1,13 @@
+
+local demo3 = {}
+
+function demo3.init()
+ local wasm = require("wasm")
+ local wasm_file = "../wasm/test/injected.wasm"
+ local wasm_module = Wasm_Module()
+ local table_type = table_type_t()
+ local resizable_limit = resizable_limit_t()
+ table_type:set_resizable_limit(resizable_limit)
+end
+
+return demo3
diff --git a/bruiser/lua-scripts/regtest.lua b/bruiser/lua-scripts/regtest.lua
new file mode 100644
index 0000000..f7ec461
--- /dev/null
+++ b/bruiser/lua-scripts/regtest.lua
@@ -0,0 +1,12 @@
+
+-- luarocks install luaposix
+--local posix = require("posix")
+
+function reg_test()
+ local demo1 = require("demo1")
+ local demo2 = require("demo2")
+ local demo3 = require("asmtest")
+ print("yo")
+end
+
+reg_test()
diff --git a/bruiser/lua-scripts/wasm.lua b/bruiser/lua-scripts/wasm.lua
index 3c94960..88588a6 100644
--- a/bruiser/lua-scripts/wasm.lua
+++ b/bruiser/lua-scripts/wasm.lua
@@ -20,7 +20,6 @@ setmetatable(resizable_limit_t, {__call =
setmetatable(global_type_t, {__call =
function(self, arg0, arg1)
local t = self.new(arg0, arg1)
- print("created",t)
return t
end
}
diff --git a/bruiser/lua-scripts/xobj.lua b/bruiser/lua-scripts/xobj.lua
index 08a2945..a4f7a8d 100644
--- a/bruiser/lua-scripts/xobj.lua
+++ b/bruiser/lua-scripts/xobj.lua
@@ -26,8 +26,8 @@ end
function xobj.getGlobalTable()
local return_table = {}
- local names = objload("elf_get_obj_names", elf_file, "symbol_list")
- local sizes = objload("elf_get_obj_sizes", elf_file, "symbol_list")
+ local names = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
+ local sizes = objload("load", "elf_get_obj_sizes", elf_file, "symbol_list")
for i=1,#names,1 do
return_table[names[i]] = sizes[i]
end
@@ -35,28 +35,28 @@ function xobj.getGlobalTable()
end
function xobj.printObjNames()
- local c = objload("elf_get_obj_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printObjSizes()
- local c = objload("elf_get_obj_sizes", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_obj_sizes", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printFuncNames()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
print(k,v)
end
end
function xobj.printFuncCode()
- local c = objload("elf_get_func_code", elf_file, "code_list")
+ local c = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(c) do
print(k,v)
if #v ~= 0 then
@@ -69,7 +69,7 @@ function xobj.printFuncCode()
end
function xobj.findMain()
- local c = objload("elf_get_func_names", elf_file, "symbol_list")
+ local c = objload("load", "elf_get_func_names", elf_file, "symbol_list")
for k,v in ipairs(c) do
if v == "'main'" then
io.write("main index is".." "..k.."\n")
@@ -80,8 +80,8 @@ end
function xobj.codeTables()
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for i=1,#func_name_table,1 do
return_table[func_name_table[i]] = code_table[i]
end
@@ -90,8 +90,8 @@ end
function xobj.codeTableByName(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -105,8 +105,8 @@ end
function xobj.codeTableByName_number(name)
local return_table = {}
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
for k,v in ipairs(func_name_table) do
if v == name then
for k1, v1 in ipairs(code_table[k]) do
@@ -119,8 +119,8 @@ function xobj.codeTableByName_number(name)
end
function xobj.printFuncSizes()
- local func_name_table = objload("elf_get_func_names", elf_file, "symbol_list")
- local code_table = objload("elf_get_func_code", elf_file, "code_list")
+ local func_name_table = objload("load", "elf_get_func_names", elf_file, "symbol_list")
+ local code_table = objload("load", "elf_get_func_code", elf_file, "code_list")
local counter = 1
print("function sizes:")
for k, v in ipairs(code_table) do
@@ -130,11 +130,11 @@ function xobj.printFuncSizes()
end
function xobj.getTextSection(elf_exe)
- return objload("elf_get_text_section", elf_exe, "bytes")
+ return objload("load", "elf_get_text_section", elf_exe, "bytes")
end
function xobj.getRODataSection(elf_exe)
- return objload("elf_get_rodata_section", elf_exe, "bytes")
+ return objload("load", "elf_get_rodata_section", elf_exe, "bytes")
end
function xobj.CSDump(code)
diff --git a/bruiser/luatablegen/W_Code_Section_tablegen.c b/bruiser/luatablegen/W_Code_Section_tablegen.c
index 1c516ce..b4bd190 100644
--- a/bruiser/luatablegen/W_Code_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Code_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Code_Section_count(lua_State* __ls) {
}
static int setter_W_Code_Section_bodies(lua_State* __ls) {
W_Code_Section* dummy = check_W_Code_Section(__ls, 1);
- dummy->bodies = luaL_checkudata(__ls, 2, "W_Code_Section");
+ dummy->bodies = luaL_checkudata(__ls, 2, "bodies_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Data_Section_tablegen.c b/bruiser/luatablegen/W_Data_Section_tablegen.c
index 3dbc98b..9426e71 100644
--- a/bruiser/luatablegen/W_Data_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Data_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Data_Section_count(lua_State* __ls) {
}
static int setter_W_Data_Section_entries(lua_State* __ls) {
W_Data_Section* dummy = check_W_Data_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Data_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Data_Segment_tablegen.c b/bruiser/luatablegen/W_Data_Segment_tablegen.c
index 20b2762..1fbac4d 100644
--- a/bruiser/luatablegen/W_Data_Segment_tablegen.c
+++ b/bruiser/luatablegen/W_Data_Segment_tablegen.c
@@ -87,7 +87,7 @@ static int setter_W_Data_Segment_index(lua_State* __ls) {
}
static int setter_W_Data_Segment_offset(lua_State* __ls) {
W_Data_Segment* dummy = check_W_Data_Segment(__ls, 1);
- dummy->offset = luaL_checkudata(__ls, 2, "W_Data_Segment");
+ dummy->offset = luaL_checkudata(__ls, 2, "offset_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Elem_Segment_tablegen.c b/bruiser/luatablegen/W_Elem_Segment_tablegen.c
index 82f8a30..a9ae97d 100644
--- a/bruiser/luatablegen/W_Elem_Segment_tablegen.c
+++ b/bruiser/luatablegen/W_Elem_Segment_tablegen.c
@@ -87,7 +87,7 @@ static int setter_W_Elem_Segment_index(lua_State* __ls) {
}
static int setter_W_Elem_Segment_offset(lua_State* __ls) {
W_Elem_Segment* dummy = check_W_Elem_Segment(__ls, 1);
- dummy->offset = luaL_checkudata(__ls, 2, "W_Elem_Segment");
+ dummy->offset = luaL_checkudata(__ls, 2, "offset_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Element_Section_tablegen.c b/bruiser/luatablegen/W_Element_Section_tablegen.c
index 93e545b..b00b7fc 100644
--- a/bruiser/luatablegen/W_Element_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Element_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Element_Section_count(lua_State* __ls) {
}
static int setter_W_Element_Section_entries(lua_State* __ls) {
W_Element_Section* dummy = check_W_Element_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Element_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Export_Section_tablegen.c b/bruiser/luatablegen/W_Export_Section_tablegen.c
index fbd2538..3ec02c8 100644
--- a/bruiser/luatablegen/W_Export_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Export_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Export_Section_count(lua_State* __ls) {
}
static int setter_W_Export_Section_entries(lua_State* __ls) {
W_Export_Section* dummy = check_W_Export_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Export_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Function_Body_tablegen.c b/bruiser/luatablegen/W_Function_Body_tablegen.c
index 173c381..59a6a10 100644
--- a/bruiser/luatablegen/W_Function_Body_tablegen.c
+++ b/bruiser/luatablegen/W_Function_Body_tablegen.c
@@ -93,7 +93,7 @@ static int setter_W_Function_Body_local_count(lua_State* __ls) {
}
static int setter_W_Function_Body_locals(lua_State* __ls) {
W_Function_Body* dummy = check_W_Function_Body(__ls, 1);
- dummy->locals = luaL_checkudata(__ls, 2, "W_Function_Body");
+ dummy->locals = luaL_checkudata(__ls, 2, "locals_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Function_Section_tablegen.c b/bruiser/luatablegen/W_Function_Section_tablegen.c
index ebc249d..a2de6b6 100644
--- a/bruiser/luatablegen/W_Function_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Function_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Function_Section_count(lua_State* __ls) {
}
static int setter_W_Function_Section_types(lua_State* __ls) {
W_Function_Section* dummy = check_W_Function_Section(__ls, 1);
- dummy->types = luaL_checkudata(__ls, 2, "W_Function_Section");
+ dummy->types = luaL_checkudata(__ls, 2, "types_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Global_Entry_tablegen.c b/bruiser/luatablegen/W_Global_Entry_tablegen.c
index 9b87c0f..0259cd6 100644
--- a/bruiser/luatablegen/W_Global_Entry_tablegen.c
+++ b/bruiser/luatablegen/W_Global_Entry_tablegen.c
@@ -63,13 +63,13 @@ static int getter_W_Global_Entry_init(lua_State* __ls) {
static int setter_W_Global_Entry_type(lua_State* __ls) {
W_Global_Entry* dummy = check_W_Global_Entry(__ls, 1);
- dummy->type = luaL_checkudata(__ls, 2, "W_Global_Entry");
+ dummy->type = luaL_checkudata(__ls, 2, "type_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_W_Global_Entry_init(lua_State* __ls) {
W_Global_Entry* dummy = check_W_Global_Entry(__ls, 1);
- dummy->init = luaL_checkudata(__ls, 2, "W_Global_Entry");
+ dummy->init = luaL_checkudata(__ls, 2, "init_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Global_Section_tablegen.c b/bruiser/luatablegen/W_Global_Section_tablegen.c
index 1254816..0bb2056 100644
--- a/bruiser/luatablegen/W_Global_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Global_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Global_Section_count(lua_State* __ls) {
}
static int setter_W_Global_Section_globals(lua_State* __ls) {
W_Global_Section* dummy = check_W_Global_Section(__ls, 1);
- dummy->globals = luaL_checkudata(__ls, 2, "W_Global_Section");
+ dummy->globals = luaL_checkudata(__ls, 2, "globals_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c
index 0a568e8..97ee26b 100644
--- a/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c
+++ b/bruiser/luatablegen/W_Import_Section_Entry_tablegen.c
@@ -129,7 +129,7 @@ static int setter_W_Import_Section_Entry_kind(lua_State* __ls) {
}
static int setter_W_Import_Section_Entry_type(lua_State* __ls) {
W_Import_Section_Entry* dummy = check_W_Import_Section_Entry(__ls, 1);
- dummy->type = luaL_checkudata(__ls, 2, "W_Import_Section_Entry");
+ dummy->type = luaL_checkudata(__ls, 2, "type_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Import_Section_tablegen.c b/bruiser/luatablegen/W_Import_Section_tablegen.c
index de966f9..5286c75 100644
--- a/bruiser/luatablegen/W_Import_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Import_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Import_Section_count(lua_State* __ls) {
}
static int setter_W_Import_Section_entries(lua_State* __ls) {
W_Import_Section* dummy = check_W_Import_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Import_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Memory_Section_tablegen.c b/bruiser/luatablegen/W_Memory_Section_tablegen.c
index 8972528..78cd664 100644
--- a/bruiser/luatablegen/W_Memory_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Memory_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Memory_Section_count(lua_State* __ls) {
}
static int setter_W_Memory_Section_entries(lua_State* __ls) {
W_Memory_Section* dummy = check_W_Memory_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Memory_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Table_Section_tablegen.c b/bruiser/luatablegen/W_Table_Section_tablegen.c
index 43bcdf0..c536fd3 100644
--- a/bruiser/luatablegen/W_Table_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Table_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Table_Section_count(lua_State* __ls) {
}
static int setter_W_Table_Section_entries(lua_State* __ls) {
W_Table_Section* dummy = check_W_Table_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Table_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c
index c6a38ea..5462a41 100644
--- a/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c
+++ b/bruiser/luatablegen/W_Type_Section_Entry_tablegen.c
@@ -102,7 +102,7 @@ static int setter_W_Type_Section_Entry_param_count(lua_State* __ls) {
}
static int setter_W_Type_Section_Entry_param_types(lua_State* __ls) {
W_Type_Section_Entry* dummy = check_W_Type_Section_Entry(__ls, 1);
- dummy->param_types = luaL_checkudata(__ls, 2, "W_Type_Section_Entry");
+ dummy->param_types = luaL_checkudata(__ls, 2, "param_types_t");
lua_settop(__ls, 1);
return 1;
}
@@ -114,7 +114,7 @@ static int setter_W_Type_Section_Entry_return_count(lua_State* __ls) {
}
static int setter_W_Type_Section_Entry_return_types(lua_State* __ls) {
W_Type_Section_Entry* dummy = check_W_Type_Section_Entry(__ls, 1);
- dummy->return_types = luaL_checkudata(__ls, 2, "W_Type_Section_Entry");
+ dummy->return_types = luaL_checkudata(__ls, 2, "return_types_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/W_Type_Section_tablegen.c b/bruiser/luatablegen/W_Type_Section_tablegen.c
index 237c87b..d7e9f7e 100644
--- a/bruiser/luatablegen/W_Type_Section_tablegen.c
+++ b/bruiser/luatablegen/W_Type_Section_tablegen.c
@@ -69,7 +69,7 @@ static int setter_W_Type_Section_count(lua_State* __ls) {
}
static int setter_W_Type_Section_entries(lua_State* __ls) {
W_Type_Section* dummy = check_W_Type_Section(__ls, 1);
- dummy->entries = luaL_checkudata(__ls, 2, "W_Type_Section");
+ dummy->entries = luaL_checkudata(__ls, 2, "entries_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/Wasm_Module_tablegen.c b/bruiser/luatablegen/Wasm_Module_tablegen.c
index 318309e..99b603c 100644
--- a/bruiser/luatablegen/Wasm_Module_tablegen.c
+++ b/bruiser/luatablegen/Wasm_Module_tablegen.c
@@ -162,73 +162,73 @@ static int getter_Wasm_Module_name(lua_State* __ls) {
static int setter_Wasm_Module_type_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->type_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->type_section = luaL_checkudata(__ls, 2, "type_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_import_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->import_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->import_section = luaL_checkudata(__ls, 2, "import_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_function_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->function_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->function_section = luaL_checkudata(__ls, 2, "function_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_table_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->table_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->table_section = luaL_checkudata(__ls, 2, "table_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_memory_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->memory_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->memory_section = luaL_checkudata(__ls, 2, "memory_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_global_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->global_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->global_section = luaL_checkudata(__ls, 2, "global_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_export_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->export_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->export_section = luaL_checkudata(__ls, 2, "export_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_start_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->start_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->start_section = luaL_checkudata(__ls, 2, "start_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_element_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->element_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->element_section = luaL_checkudata(__ls, 2, "element_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_code_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->code_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->code_section = luaL_checkudata(__ls, 2, "code_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_data_section(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->data_section = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->data_section = luaL_checkudata(__ls, 2, "data_section_t");
lua_settop(__ls, 1);
return 1;
}
static int setter_Wasm_Module_W_Custom_Sections(lua_State* __ls) {
Wasm_Module* dummy = check_Wasm_Module(__ls, 1);
- dummy->W_Custom_Sections = luaL_checkudata(__ls, 2, "Wasm_Module");
+ dummy->W_Custom_Sections = luaL_checkudata(__ls, 2, "W_Custom_Sections_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/memory_type_t_tablegen.c b/bruiser/luatablegen/memory_type_t_tablegen.c
index 5f75d51..3914732 100644
--- a/bruiser/luatablegen/memory_type_t_tablegen.c
+++ b/bruiser/luatablegen/memory_type_t_tablegen.c
@@ -54,7 +54,7 @@ static int getter_memory_type_t_resizable_limit(lua_State* __ls) {
static int setter_memory_type_t_resizable_limit(lua_State* __ls) {
memory_type_t* dummy = check_memory_type_t(__ls, 1);
- dummy->resizable_limit = luaL_checkudata(__ls, 2, "memory_type_t");
+ dummy->resizable_limit = luaL_checkudata(__ls, 2, "resizable_limit_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/luatablegen/table_type_t_tablegen.c b/bruiser/luatablegen/table_type_t_tablegen.c
index a8e5af0..c37af75 100644
--- a/bruiser/luatablegen/table_type_t_tablegen.c
+++ b/bruiser/luatablegen/table_type_t_tablegen.c
@@ -69,7 +69,7 @@ static int setter_table_type_t_element_type(lua_State* __ls) {
}
static int setter_table_type_t_resizable_limit(lua_State* __ls) {
table_type_t* dummy = check_table_type_t(__ls, 1);
- dummy->resizable_limit = luaL_checkudata(__ls, 2, "table_type_t");
+ dummy->resizable_limit = luaL_checkudata(__ls, 2, "resizable_limit_t");
lua_settop(__ls, 1);
return 1;
}
diff --git a/bruiser/makefile b/bruiser/makefile
index ed592d8..31dff92 100644
--- a/bruiser/makefile
+++ b/bruiser/makefile
@@ -17,14 +17,14 @@ C_SRCS=$(wildcard *.c)
#for some reason without ld the build fails on ubuntu trusty on travis
#EXTRA_LD_FLAGS+=-lpthread -ldl -lutil -lm -Xlinker -lpython3
EXTRA_LD_FLAGS+=$(shell $(PY_CONF) --ldflags) -lffi -lcapstone -lkeystone -L./lua-5.3.4/src -llua
-TBG_OBJLIST_INC:=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c))
+TBG_OBJLIST_INC=$(patsubst ./luatablegen/%.c, ./luatablegen/%.o, $(wildcard ./luatablegen/*.c))
SAN?=
######################################RULES####################################
.DEFAULT: all
.PHONY: all clean help
-all: $(BRUISER)
+all: $(BRUISER) ./wasmtablegen.json
depend:.depend
dependc:.dependc
diff --git a/bruiser/tablegen.sh b/bruiser/tablegen.sh
index 03a660c..3279e22 100755
--- a/bruiser/tablegen.sh
+++ b/bruiser/tablegen.sh
@@ -1,6 +1,6 @@
#!/usr/bin/bash
cd $(dirname $0)
-../extra-tools/luatablegen.py --tbg ./wasmtablegen.json --out ./luatablegen --luaheader ../lua-5.3.4/src --pre ./luatablegen/wasmheader.txt --headeraggr ./luatablegen/wasm_tables.h --lualibpath ./lua-scripts/wasm.lua
+../extra-tools/luatablegen.py --tbg ./wasmtablegen.json --out ./luatablegen --luaheader ../lua-5.3.4/src --pre ./luatablegen/wasmheader.txt --headeraggr ./luatablegen/wasm_tables.h --lualibpath ./lua-scripts/wasm.lua --docpath /home/bloodstalker/extra/mutator.wiki/wasm.md
if [[ $1 == test ]]; then
make -C ./luatablegen
make clean
diff --git a/bruiser/wasm/execute.py b/bruiser/wasm/execute.py
index af8455f..40b9042 100644
--- a/bruiser/wasm/execute.py
+++ b/bruiser/wasm/execute.py
@@ -1,4 +1,4 @@
-from OpCodes import *
+from opcodes import *
from utils import Colors, ror, rol
import numpy as np
import math
diff --git a/bruiser/wasm/TBInit.py b/bruiser/wasm/init.py
index f14dfd1..f3ac986 100644
--- a/bruiser/wasm/TBInit.py
+++ b/bruiser/wasm/init.py
@@ -1,5 +1,5 @@
from utils import Colors, init_interpret, ParseFlags
-from OpCodes import WASM_OP_Code
+from opcodes import WASM_OP_Code
from section_structs import Code_Section, Func_Body, WASM_Ins, Resizable_Limits, Memory_Section
from execute import *
import datetime as dti
diff --git a/bruiser/wasm/OpCodes.py b/bruiser/wasm/opcodes.py
index f7c9a1b..f7c9a1b 100644
--- a/bruiser/wasm/OpCodes.py
+++ b/bruiser/wasm/opcodes.py
diff --git a/bruiser/wasm/parse.py b/bruiser/wasm/parse.py
index 05c6465..424a2b6 100755
--- a/bruiser/wasm/parse.py
+++ b/bruiser/wasm/parse.py
@@ -6,9 +6,9 @@ import sys
import re
from section_structs import *
from utils import *
-from OpCodes import *
+from opcodes import *
from copy import deepcopy
-from TBInit import *
+from init import *
import readline
import code
import signal
diff --git a/bruiser/wasm/utils.py b/bruiser/wasm/utils.py
index 6f93a94..69393b4 100644
--- a/bruiser/wasm/utils.py
+++ b/bruiser/wasm/utils.py
@@ -1,4 +1,4 @@
-from OpCodes import *
+from opcodes import *
import numpy as np
import struct as stc