diff options
author | bloodstalker <thabogre@gmail.com> | 2018-02-01 09:41:13 +0000 |
---|---|---|
committer | bloodstalker <thabogre@gmail.com> | 2018-02-01 09:41:13 +0000 |
commit | bb36d843120d0f30c8930c0cf430e265b0374f25 (patch) | |
tree | 6e8b1e3406472c06c4d10ee9e79502fcb864d3b5 /bruiser | |
parent | fixed string type for xobjs, also xcall can now call functions by name as well (diff) | |
download | mutator-bb36d843120d0f30c8930c0cf430e265b0374f25.tar.gz mutator-bb36d843120d0f30c8930c0cf430e265b0374f25.zip |
update
Diffstat (limited to '')
-rw-r--r-- | bruiser/bruiser-extra.h | 2 | ||||
-rw-r--r-- | bruiser/bruiser.cpp | 12 | ||||
-rw-r--r-- | bruiser/bruiserffi.c | 19 | ||||
-rw-r--r-- | bruiser/compile_commands.json | 175 | ||||
-rw-r--r-- | bruiser/executioner.h | 12 | ||||
-rw-r--r-- | bruiser/lua-scripts/demo1.lua | 15 | ||||
-rw-r--r-- | bruiser/lua-scripts/xobj.lua | 127 |
7 files changed, 171 insertions, 191 deletions
diff --git a/bruiser/bruiser-extra.h b/bruiser/bruiser-extra.h index ac02451..b834345 100644 --- a/bruiser/bruiser-extra.h +++ b/bruiser/bruiser-extra.h @@ -34,6 +34,7 @@ struct SigNames char *SigName; }; +#if 0 std::vector<SigNames> SignalNames = { {SIGHUP, (char*)"SIGHUP"}, @@ -67,6 +68,7 @@ std::vector<SigNames> SignalNames = {SIGWINCH, (char*)"SIGWINCH"}, {SIGIO, (char*)"SIGIO"} }; +#endif std::vector<std::string> BRUISR_COMMANDS = { diff --git a/bruiser/bruiser.cpp b/bruiser/bruiser.cpp index a052b64..e75b173 100644 --- a/bruiser/bruiser.cpp +++ b/bruiser/bruiser.cpp @@ -1066,7 +1066,7 @@ class LiveActionListArrays : public ASTFrontendAction class LuaWrapper { public: - LuaWrapper(ClangTool &__CT, Executioner& __EX) : CT(__CT), executioner(__EX) {} + LuaWrapper(ClangTool &__CT, Executioner& __EX, XGlobals __XG) : CT(__CT), executioner(__EX), xglobals(__XG) {} /*print out the history*/ int BruiserLuaHistory(lua_State* __ls) @@ -1396,12 +1396,15 @@ class LuaWrapper } int BruiserLuaXObjAllocGlobal(lua_State* __ls) { - int nuamrgs = lua_gettop(__ls); + int numargs = lua_gettop(__ls); + if (numargs != 2) {PRINT_WITH_COLOR_LB(RED, "expected exactly two args. did not get that.");} std::string glob_name = lua_tostring(__ls , 1); size_t size = lua_tointeger(__ls, 2); + xglobals.reserve(size); return 0; } - int BruiserLuaXObjAllocAllGlobals(lua_State* __ls) {return 0;} + + int BruiserLuaXObjAllocAllGlobals(lua_State* __ls) {} /*read the m0 report*/ int BruiserLuaM0(lua_State* __ls) @@ -1913,6 +1916,7 @@ class LuaWrapper private: ClangTool CT; Executioner executioner; + XGlobals xglobals; }; /**********************************************************************************************************************/ /**********************************************************************************************************************/ @@ -1958,7 +1962,7 @@ int main(int argc, const char **argv) { } /*initialize the LuaWrapper class so we can register and run them from lua.*/ - LuaWrapper LW(Tool, executioner); + LuaWrapper LW(Tool, executioner, xglobals); /*linenoise init*/ linenoiseSetCompletionCallback(bruiser::ShellCompletion); diff --git a/bruiser/bruiserffi.c b/bruiser/bruiserffi.c index 454e3d7..f43f7ec 100644 --- a/bruiser/bruiserffi.c +++ b/bruiser/bruiserffi.c @@ -26,6 +26,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* #include <stdint.h> #include <stdio.h> #include <string.h> +#include <capstone/capstone.h> #include "bruiserffi.h" /**********************************************************************************************************************/ #define VOIDIFY(X) (void*)X @@ -36,15 +37,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.* X ffi_reinterpret_##X(void* result) {return (X)result;} #define X_LIST_GEN \ - X(uint8_t, "uint8_t")\ - X(uint16_t, "uint8_t")\ - X(uint32_t, "uint8_t")\ - X(uint64_t, "uint8_t")\ - X(int8_t, "uint8_t")\ - X(int16_t, "uint8_t")\ - X(int32_t, "uint8_t")\ - X(int64_t, "uint8_t")\ - X(uintptr_t, "uint8_t")\ + X(uint8_t, "for uint8_t")\ + X(uint16_t, "for uint16_t")\ + X(uint32_t, "for uint32_t")\ + X(uint64_t, "for uint64_t")\ + X(int8_t, "for int8_t")\ + X(int16_t, "for int16_t")\ + X(int32_t, "for int32_t")\ + X(int64_t, "for int64_t")\ + X(uintptr_t, "for pointers")\ #define X(X1,X2) REINTERPRET_GENERATOR(X1) X_LIST_GEN diff --git a/bruiser/compile_commands.json b/bruiser/compile_commands.json index e72faee..48605af 100644 --- a/bruiser/compile_commands.json +++ b/bruiser/compile_commands.json @@ -28,180 +28,5 @@ "command": "cc -c -o bruiserffi.o bruiserffi.c", "directory": "/home/bloodstalker/devi/hell2/bruiser", "file": "/home/bloodstalker/devi/hell2/bruiser/bruiserffi.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lapi.o lapi.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lapi.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lcode.o lcode.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lcode.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lctype.o lctype.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lctype.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ldebug.o ldebug.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ldebug.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ldo.o ldo.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ldo.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ldump.o ldump.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ldump.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lfunc.o lfunc.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lfunc.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lgc.o lgc.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lgc.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o llex.o llex.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/llex.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lmem.o lmem.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lmem.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lobject.o lobject.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lobject.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lopcodes.o lopcodes.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lopcodes.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lparser.o lparser.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lparser.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lstate.o lstate.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lstate.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lstring.o lstring.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lstring.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ltable.o ltable.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ltable.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ltm.o ltm.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ltm.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lundump.o lundump.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lundump.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lvm.o lvm.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lvm.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lzio.o lzio.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lzio.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lauxlib.o lauxlib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lauxlib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lbaselib.o lbaselib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lbaselib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lbitlib.o lbitlib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lbitlib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lcorolib.o lcorolib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lcorolib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ldblib.o ldblib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ldblib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o liolib.o liolib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/liolib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lmathlib.o lmathlib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lmathlib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o loslib.o loslib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/loslib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lstrlib.o lstrlib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lstrlib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o ltablib.o ltablib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/ltablib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lutf8lib.o lutf8lib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lutf8lib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o loadlib.o loadlib.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/loadlib.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o linit.o linit.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/linit.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o lua.o lua.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/lua.c" - }, - { - "command": "cc -c -std=gnu99 -O2 -Wall -Wextra -DLUA_COMPAT_5_2 -DLUA_USE_LINUX -o luac.o luac.c", - "directory": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src", - "file": "/home/bloodstalker/devi/hell2/bruiser/lua-5.3.4/src/luac.c" } ]
\ No newline at end of file diff --git a/bruiser/executioner.h b/bruiser/executioner.h index 4793915..3fe0fac 100644 --- a/bruiser/executioner.h +++ b/bruiser/executioner.h @@ -332,7 +332,17 @@ class Arguary { class XGlobals { public: XGlobals() {} - ~XGlobals() {} + ~XGlobals() { + for (auto &iter : globals) free(iter.first); + } + + void reserve(size_t size) { + globals.push_back(std::make_pair(malloc(size), size)); + } + + void* getAddressByIndex(int index) { + } + private: std::list<std::pair<void*, size_t>> globals; }; diff --git a/bruiser/lua-scripts/demo1.lua b/bruiser/lua-scripts/demo1.lua index 5ef6bd2..2e9cd56 100644 --- a/bruiser/lua-scripts/demo1.lua +++ b/bruiser/lua-scripts/demo1.lua @@ -15,6 +15,16 @@ elf_file = "../bfd/test/test.so" --elf_file = "../bfd/test/test" +function 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") + for i=1,#names,1 do + return_table[names[i]] = sizes[i] + end + return return_table +end + function printObjNames() local c = objload("elf_get_obj_names", elf_file, "symbol_list") for k,v in ipairs(c) do @@ -191,12 +201,13 @@ function main() print("xcall returned:",a) if tostring(a) ~= tostring(666.666) then print("test failed") end + a=xcall(1,{"string"},"string","passthrough", {"i live!"}) + print("xcall returned:",a) + --a=xcall(4,{"sint32", "sint32", "sint32", "sint32"},"sint32",5, {10,20,30,40}) --print("xcall returned:",a) --if a ~= 100 then print("test failed") end - a=xcall(1,{"string"},"string","passthrough", {"i live!"}) - print("xcall returned:",a) end main() diff --git a/bruiser/lua-scripts/xobj.lua b/bruiser/lua-scripts/xobj.lua new file mode 100644 index 0000000..b69f0e5 --- /dev/null +++ b/bruiser/lua-scripts/xobj.lua @@ -0,0 +1,127 @@ +------------------------------------------------Project Mutator----------------------------------------------- +--Copyright (C) 2018 Farzad Sadeghi + +--This program is free software; you can redistribute it and/or +--modify it under the terms of the GNU General Public License +--as published by the Free Software Foundation; either version 2 +--of the License, or (at your option) any later version. + +--This program is distributed in the hope that it will be useful, +--but WITHOUT ANY WARRANTY; without even the implied warranty of +--MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +--GNU General Public License for more details. + +--You should have received a copy of the GNU General Public License +--along with this program; if not, write to the Free Software +--Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.*/ +-------------------------------------------------------------------------------------------------------------- +function getSO(so_path) + elf_file = so_path +end + +function 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") + for i=1,#names,1 do + return_table[names[i]] = sizes[i] + end + return return_table +end + +function printObjNames() + local c = objload("elf_get_obj_names", elf_file, "symbol_list") + for k,v in ipairs(c) do + print(k,v) + end +end + +function printObjSizes() + local c = objload("elf_get_obj_sizes", elf_file, "symbol_list") + for k,v in ipairs(c) do + print(k,v) + end +end + +function printFuncNames() + local c = objload("elf_get_func_names", elf_file, "symbol_list") + for k,v in ipairs(c) do + print(k,v) + end +end + +function printFuncCode() + local c = objload("elf_get_func_code", elf_file, "code_list") + for k,v in ipairs(c) do + print(k,v) + if #v ~= 0 then + for k1,v1 in ipairs(v) do + io.write(string.format('%02x', v1), " ") + end + io.write("\n") + end + end +end + +function findMain() + local c = objload("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") + return k + end + end +end + +function 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") + for i=1,#func_name_table,1 do + return_table[func_name_table[i]] = code_table[i] + end + return return_table +end + +function 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") + for k,v in ipairs(func_name_table) do + if v == name then + for k1, v1 in ipairs(code_table[k]) do + table.insert(return_table, string.format('%02x', v1)) + end + return return_table + end + end + return nil +end + +function 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") + for k,v in ipairs(func_name_table) do + if v == name then + for k1, v1 in ipairs(code_table[k]) do + table.insert(return_table, v1) + end + return return_table + end + end + return nil +end + +function 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 counter = 1 + print("function sizes:") + for k, v in ipairs(code_table) do + print("code size for "..func_name_table[counter].." is".." "..#v) + counter = counter + 1 + end +end +-------------------------------------------------------------------------------------------------------------- + |