6 #ifndef BUILD_LUAC_COMMON_H
7 #define BUILD_LUAC_COMMON_H
16 #define LUAC_MAGIC_OFFSET 0x00
17 #define LUAC_MAGIC_SIZE 4
18 #define LUAC_VERSION_OFFSET 0x04
19 #define LUAC_VERSION_SIZE 1
21 #define LUAC_MAGIC "\x1b\x4c\x75\x61"
24 #define makevariant(t, v) ((t) | ((v) << 4))
27 #define LUA_TBOOLEAN 1
31 #define LUA_VNIL makevariant(LUA_TNIL, 0)
32 #define LUA_VFALSE makevariant(LUA_TBOOLEAN, 0)
33 #define LUA_VTRUE makevariant(LUA_TBOOLEAN, 1)
34 #define LUA_VNUMINT makevariant(LUA_TNUMBER, 0)
35 #define LUA_VNUMFLT makevariant(LUA_TNUMBER, 1)
36 #define LUA_VSHRSTR makevariant(LUA_TSTRING, 0)
37 #define LUA_VLNGSTR makevariant(LUA_TSTRING, 1)
208 #define lua_check_error_offset(offset) \
209 if ((offset) == 0) { \
212 #define lua_check_error_offset_proto(offset, proto) \
213 if ((offset) == 0) { \
214 lua_free_proto_entry((proto)); \
217 #define lua_return_if_null(proto) \
218 if ((proto) == NULL) { \
RzBinInfo * info(RzBinFile *bf)
struct lua_proto_ex LuaProtoHeavy
void lua_free_local_var_entry(LuaLocalVarEntry *)
LuaLineinfoEntry * lua_new_lineinfo_entry()
LuacBinInfo * luac_build_info(LuaProto *proto)
void luac_add_entry(RzList *entry_list, ut64 offset, int entry_type)
void luac_add_symbol(RzList *symbol_list, char *name, ut64 offset, ut64 size, const char *type)
struct lua_abs_lineinfo_entry LuaAbsLineinfoEntry
struct lua_local_var_entry LuaLocalVarEntry
LuaConstEntry * lua_new_const_entry()
RzBinInfo * lua_parse_header_54(RzBinFile *bf, st32 major, st32 minor)
void luac_add_string(RzList *string_list, char *string, ut64 offset, ut64 size)
void _luac_build_info(LuaProto *proto, LuacBinInfo *info)
RzBinInfo * lua_parse_header_53(RzBinFile *bf, st32 major, st32 minor)
void lua_free_const_entry(LuaConstEntry *)
LuaProto * lua_parse_body_54(RzBuffer *buffer, ut64 offset, ut64 data_size)
LuaProto * lua_new_proto_entry()
struct lua_upvalue_entry LuaUpvalueEntry
struct lua_lineinfo_entry LuaLineinfoEntry
LuaDbgUpvalueEntry * lua_new_dbg_upvalue_entry()
LuaLocalVarEntry * lua_new_local_var_entry()
LuaUpvalueEntry * lua_new_upvalue_entry()
void lua_free_proto_entry(LuaProto *)
struct lua_constant_entry LuaConstEntry
struct luac_bin_info LuacBinInfo
LuaAbsLineinfoEntry * lua_new_abs_lineinfo_entry()
void lua_free_dbg_upvalue_entry(LuaDbgUpvalueEntry *)
void luac_add_section(RzList *section_list, char *name, ut64 offset, ut32 size, bool is_func)
LuaProto * lua_parse_body_53(RzBuffer *buffer, ut64 offset, ut64 data_size)
struct lua_dbg_upvalue_entry LuaDbgUpvalueEntry
Store line info attributes.
int line
line number in source file
Store constant type, data, and offset of this constant in luac file.
ut64 offset
addr of this constant
void * data
can be Number/Integer/String
ut8 tag
type of this constant, see LUA_V* macros in luac_common.h
Store upvalue's debug info.
int name_len
length of name
ut8 * upvalue_name
upvalue name
Store line info attributes.
Store local var names and other info.
int varname_len
length of name
int end_pc
first deactive position
ut64 offset
offset of this entry
int start_pc
first active position
ut8 * varname
name of this variable
Store valuable info when parsing. Treat luac file body as a main function.
int name_size
size of proto name
ut64 lastline_defined
line number of function end
RzList * dbg_upvalue_entries
A list to store upvalue names.
ut64 line_defined
line number of function start
RzList * upvalue_entries
A list to store upvalue entries.
ut64 size
current proto size
ut8 is_vararg
is variable arg?
ut64 inner_proto_offset
sub proto section offset
RzList * abs_line_info_entries
A list to store absolutely line info entries.
ut64 code_skipped
opcode data offset to code_offset.
ut64 const_offset
const section offset
ut8 num_params
number of parameters of this proto
ut64 upvalue_size
upvalue section size
RzList * local_var_info_entries
A list to store local var entries.
RzList * const_entries
A list to store constant entries.
ut8 * proto_name
current proto name
ut64 code_offset
code section offset
RzList * proto_entries
A list to store sub proto entries.
ut64 upvalue_offset
upvalue section offset
ut64 offset
proto offset in bytes
ut64 debug_size
debug section size
ut64 debug_offset
debug section offset
RzList * line_info_entries
A list to store line info entries.
ut8 max_stack_size
max stack size
ut64 const_size
const section size
ut64 inner_proto_size
sub proto section size
ut64 code_size
code section size
Store upvalue attributes.
ut64 offset
offset of this upvalue
RzBinInfo * general_info
general binary info from luac header
RzList * entry_list
list of entries
RzList * section_list
list of sections
RzList * symbol_list
list of symbols
RzList * string_list
list of strings
XX curplugin == o->plugin.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()