aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts/asmtest.lua
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-03-12 13:00:46 +0000
committerbloodstalker <thabogre@gmail.com>2018-03-12 13:00:46 +0000
commitab8c8bf7f6d5fec080cfae5155ae891af214674f (patch)
tree97c01489d3b17cf7e6ed5e6913ef5594c849a88a /bruiser/lua-scripts/asmtest.lua
parentthe jmp table is working now. you get member set and get methods, and an iter... (diff)
downloadmutator-ab8c8bf7f6d5fec080cfae5155ae891af214674f.tar.gz
mutator-ab8c8bf7f6d5fec080cfae5155ae891af214674f.zip
added a lua module for asmrewriter, will soon add docs. you can try the new module by running asmtest.lua or demo2.lua did some cosmetic fixes to load bfd so it doesnt suck as hard when you get dumps
Diffstat (limited to 'bruiser/lua-scripts/asmtest.lua')
-rw-r--r--bruiser/lua-scripts/asmtest.lua23
1 files changed, 17 insertions, 6 deletions
diff --git a/bruiser/lua-scripts/asmtest.lua b/bruiser/lua-scripts/asmtest.lua
index 83b523a..ac5730e 100644
--- a/bruiser/lua-scripts/asmtest.lua
+++ b/bruiser/lua-scripts/asmtest.lua
@@ -1,10 +1,21 @@
+
+xobj = require("lua-scripts.xobj")
+asmrw = require("lua-scripts.asmrw")
+
function test()
- print("running asmtest.lua")
- --for k,v in pairs(jmp_s_t) do print(k,v) end
- local t = jmp_s_t.new()
- print(t)
- t:set_type(3)
- print(t.type)
+ local elf_exe = "../bfd/test/test"
+ local text_section = xobj.getTextSection(elf_exe)
+ local head = jmp_s_t()
+ -- messes up the stack. I could fix it but not sure why i would want to keep this in
+ --local head2 = jmp_s_t:new()
+ head = getjmptable(#text_section, text_section)
+
+ while head:inext() ~= nil do
+ head:dump("entry")
+ io.write("type:", head:type(), "\tlocation:", "0x"..string.format("%x", head:location()))
+ print()
+ head = head:inext()
+ end
end
test()