aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'bruiser/lua-scripts')
-rw-r--r--bruiser/lua-scripts/asmtest.lua6
-rw-r--r--bruiser/lua-scripts/demo2.lua42
2 files changed, 44 insertions, 4 deletions
diff --git a/bruiser/lua-scripts/asmtest.lua b/bruiser/lua-scripts/asmtest.lua
index 529b7a7..83b523a 100644
--- a/bruiser/lua-scripts/asmtest.lua
+++ b/bruiser/lua-scripts/asmtest.lua
@@ -1,6 +1,10 @@
function test()
print("running asmtest.lua")
- for k,v in pairs(jmp_s_t) do print(k,v) end
+ --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)
end
test()
diff --git a/bruiser/lua-scripts/demo2.lua b/bruiser/lua-scripts/demo2.lua
index 03d6089..fc50cc1 100644
--- a/bruiser/lua-scripts/demo2.lua
+++ b/bruiser/lua-scripts/demo2.lua
@@ -55,13 +55,49 @@ function asm_rewriter()
freejmptable(haed)
end
+setmetatable(jmp_s_t, {__call = function(self, arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)
+ local t = self.new(arg1,arg2,arg3,arg4,arg5,arg6,arg7,arg8,arg9,arg10,arg11,arg12)
+ print("created", t)
+ return t
+ end})
+
+function jmp_s_t:show(msg)
+ print(msg, self, self:custom())
+ return self
+end
+
function jmp_t_test()
- for k,v in pairs(jmp_s_t) do print(k,v) end
- local t = jmp_s_t.new()
+ local t = jmp_s_t.new(1,2,3,nil,nil,nil,7,8,9,0,0,1)
+ t:show("t is")
+ local t_next = jmp_s_t.new()
+ local t_next_y = jmp_s_t.new()
+ local t_next_n = jmp_s_t.new()
+ t:set_next(t_next)
+ t:set_next_y(t_next_y)
+ t:set_next_n(t_next_n)
+ t:show("t is")
+ tt = jmp_s_t()
+ tt:show("tt is")
+ --collectgarbage()
+ --t:show("t is")
+end
+
+function integ_test()
+ local text_section = xobj.getTextSection()
+ local head = jmp_s_t.new()
+ head = getjmptable(#text_section, text_section)
+ head:show("XXXXXhead is")
+ print(head:location())
+ --while head:next() ~= nil do
+ for i=1,11,1 do
+ head = head:next()
+ head:show("next is")
+ end
end
--main()
--pretty_dump()
--test()
--asm_rewriter()
-jmp_t_test()
+--jmp_t_test()
+integ_test()