52 entry->type = entry_type;
140 ut64 main_entry_offset;
156 return "CONST_STRING";
161 return "CONST_UNKNOWN";
190 if (
entry->data_len <
sizeof(
double)) {
193 float_value = *(
double *)
entry->data;
194 ret =
rz_str_newf(
"%s_const_%f", proto_name, float_value);
198 if (
entry->data_len <
sizeof(
int)) {
201 integer_value = *(
int *)
entry->data;
202 ret =
rz_str_newf(
"%s_const_%d", proto_name, integer_value);
218 if (debug_name ==
NULL) {
222 return rz_str_newf(
"%s_upvalue_%s", proto_name, debug_name);
246 current_offset = proto->
offset;
247 current_size = proto->
size;
248 section_name =
rz_str_newf(
"%s.header", proto_name);
262 section_name =
rz_str_newf(
"%s.const", proto_name);
269 section_name =
rz_str_newf(
"%s.upvalues", proto_name);
276 section_name =
rz_str_newf(
"%s.protos", proto_name);
283 section_name =
rz_str_newf(
"%s.debug", proto_name);
292 (
char *)local_var_entry->
varname,
298 char **upvalue_names;
299 int real_upvalue_cnt;
302 upvalue_names =
RZ_NEWS0(
char *, real_upvalue_cnt);
303 if (!upvalue_names) {
328 (
char *)const_entry->
data,
RZ_API void rz_bin_symbol_free(RzBinSymbol *sym)
RzBinInfo * info(RzBinFile *bf)
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
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)
static char * simple_build_upvalue_symbol(char *proto_name, LuaUpvalueEntry *entry)
void luac_add_string(RzList *string_list, char *string, ut64 offset, ut64 size)
void _luac_build_info(LuaProto *proto, LuacBinInfo *info)
static void try_free_empty_list(RzList *list)
static void free_rz_section(RzBinSection *section)
static void free_rz_addr(RzBinAddr *addr)
static void free_rz_string(RzBinString *string)
static const char * get_tag_string(ut8 tag)
static char * get_constant_symbol_name(char *proto_name, LuaConstEntry *entry)
void luac_add_section(RzList *section_list, char *name, ut64 offset, ut32 size, bool is_func)
static char * get_upvalue_symbol_name(char *proto_name, LuaUpvalueEntry *entry, char *debug_name)
#define rz_return_val_if_fail(expr, val)
#define RZ_BIN_ENTRY_TYPE_PROGRAM
void(* RzListFree)(void *ptr)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_new(const char *str)
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 local var names and other info.
int varname_len
length of name
ut64 offset
offset of this entry
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
RzList * dbg_upvalue_entries
A list to store upvalue names.
RzList * upvalue_entries
A list to store upvalue entries.
ut64 size
current proto size
ut64 inner_proto_offset
sub proto section offset
ut64 code_skipped
opcode data offset to code_offset.
ut64 const_offset
const section offset
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
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
RzList * entry_list
list of entries
RzList * section_list
list of sections
RzList * symbol_list
list of symbols
RzList * string_list
list of strings
ut64(WINAPI *w32_GetEnabledXStateFeatures)()