Skip to content

Commit

Permalink
devel/dump-offsets: add global_table, print table length
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Aug 10, 2023
1 parent 313523a commit 8e9d040
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion devel/dump-offsets.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ function save_addr(name, addr)
end

local extended = false
local start = data.intptr_t:find_one(search)
local start, start_addr = data.intptr_t:find_one(search)
if start then
extended = true
else
Expand All @@ -215,6 +215,11 @@ if not start then
qerror('Could not find global table header')
end

if extended then
-- structures only has types for an extended global table
save_addr('global_table', start_addr + (#search * data.intptr_t.esize))
end

local index = 1
local entry_size = (extended and 3 or 2)
while true do
Expand All @@ -236,3 +241,5 @@ while true do
end
index = index + 1
end

print('global table length:', index)

0 comments on commit 8e9d040

Please sign in to comment.