9 #include "../i/private.h"
14 #define RZ_UUID_LENGTH 33
52 for (
i = 0;
i < 16;
i++) {
67 if (
n == 0x0100000c) {
71 if (
n == 0x0200000c) {
131 s->size = sect->
size;
135 s->perm = strstr(
s->name,
"TEXT") ? 5 : 4;
136 s->is_segment =
false;
153 s->perm = strstr(
s->name,
"TEXT") ? 5 : 4;
154 s->is_segment =
true;
159 if (!
s->name && !
s->mangled_name) {
164 if (
s->name &&
s->mangled_name) {
167 }
else if (
s->name) {
169 }
else if (
s->mangled_name) {
170 sym->
name =
s->mangled_name;
196 if (available !=
size) {
204 0x00000138 |1a2b b2a1 0300 0000 1a2b b2a1 e055 0000| .+.......+...U..
205 n_segments ----. .--- how many
sections ?
206 0x00000148 |0100 0000 ca55 0000 0400 0000 1800 0000| .....U..........
208 0x00000158 |c700 0000 0000 0000 0000 0000 0104 0000| ................
209 0x00000168 |250
b e803 0000 0100 0000 0000 bd55 0000| %............U..
210 0x00000178 |91bb e903 e35a b42c 93a4 340
a 8746 9489| .....Z.,..4..F..
211 0x00000188 |0cea 4c40 0c00 0000 0900 0000 0000 0000| ..
L@............
212 0x00000198 |0000 0000 0000 0000 0000 0000 0000 0000| ................
213 0x000001a8 |0080 0000 0000 0000 5f5f 5445 5854 0000| ........__TEXT..
214 0x000001b8 |0000 0000 0000 0000 0080 0000 0000 0000| ................
215 0x000001c8 |0040 0000 0000 0000 5f5f 4441 5441 0000| .@......__DATA..
216 0x000001d8 |0000 0000 0000 0000 00
c0 0000 0000 0000| ................
217 0x000001e8 |0000 0100 0000 0000 5f5f 4c4c 564
d 0000| ........__LLVM..
218 0x000001f8 |0000 0000 0000 0000 00
c0 0100 0000 0000| ................
219 0x00000208 |00
c0 0000 0000 0000 5f5f 4c49 4e4b 4544| ........__LINKED
220 0x00000218 |4954 0000 0000 0000 0000 0000 d069 0000| IT...........i..
224 if (
size > 3 && !memcmp(
"\x1a\x2b\xb2\xa1",
b, 4)) {
227 if (
size > 11 && !memcmp(
"\x1a\x2b\xb2\xa1",
b + 8, 4)) {
230 if (magicCombo != 2) {
233 if (available !=
size) {
234 RZ_LOG_WARN(
"bin: symbols: rz_buf_read_at failed\n");
237 if (
size > 3 && !memcmp(
"\x1a\x2b\xb2\xa1",
b, 4)) {
240 RZ_LOG_ERROR(
"bin: symbols: 0x%08x parsing error: invalid magic retry\n",
off);
246 eprintf(
"0x%08x eoss 0x%x\n",
off + 12, e0ss);
259 16 002b0000 01000000 { 0x2b00, 0x0000 }
261 40 2621 d85b 2100 2000 0000 0000 0000 0000
262 56 ffff ffff ffff ff7f 0c00 0000 0900 0000
263 72 0400 0000 6800 0000 2f76 6172 2f66 6f6c .... 4, 104
265 0x000000b8 5f5f 5445 5854 0000 0000 0000 0000 0000 0000 0000 0000 0000 0080 0000 0000 0000 __TEXT..........................
266 0x000000d8 5f5f 4441 5441 0000 0000 0000 0000 0000 0080 0000 0000 0000 0040 0000 0000 0000 __DATA...................@......
267 0x000000f8 5f5f 4c4c 564
d 0000 0000 0000 0000 0000 00
c0 0000 0000 0000 0000 0100 0000 0000 __LLVM..........................
268 0x00000118 5f5f 4c49 4e4b 4544 4954 0000 0000 0000 00
c0 0100 0000 0000 00
c0 0000 0000 0000 __LINKEDIT......................
341 return !memcmp(
buf,
"\x02\xff\x01\xff", 4);
349 HtUU *hash = ht_uu_new0();
363 ht_uu_insert(hash, sym->
paddr, 1);
415 pj_ks(pj,
"uuid", uuidstr);
430 if (!element || !element->
hdr) {
458 .desc =
"Apple Symbols file",
473 #ifndef RZ_PLUGIN_INCORE
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c0
RZ_API void rz_bin_symbol_free(RzBinSymbol *sym)
RZ_API void rz_bin_section_free(RzBinSection *bs)
RZ_API RZ_OWN RzList * rz_bin_maps_of_file_sections(RZ_NONNULL RzBinFile *binfile)
Create a list of RzBinMap from RzBinSections queried from the given file.
RzBinPlugin rz_bin_plugin_symbols
static SymbolsHeader parseHeader(RzBuffer *buf)
static const char * typeString(ut32 n, int *bits)
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb)
static RzList * symbols(RzBinFile *bf)
static ut64 size(RzBinFile *bf)
struct symbols_metadata_t SymbolsMetadata
static void header(RzBinFile *bf)
static RzBinSourceLineInfo * lines(RzBinFile *bf)
struct symbols_header_t SymbolsHeader
static void destroy(RzBinFile *bf)
RZ_API RzLibStruct rizin_plugin
static bool check_buffer(RzBuffer *b)
static RzBinInfo * info(RzBinFile *bf)
static ut64 baddr(RzBinFile *bf)
static RzBinSection * bin_section_from_segment(RzCoreSymCacheElementSegment *seg)
static const char * subtypeString(int n)
static SymbolsMetadata parseMetadata(RzBuffer *buf, int off)
static RzCoreSymCacheElement * parseDragons(RzBinFile *bf, RzBuffer *buf, int off, int bits, RZ_OWN char *file_name)
static RzList * sections(RzBinFile *bf)
static RzBinSymbol * bin_symbol_from_symbol(RzCoreSymCacheElement *element, RzCoreSymCacheElementSymbol *s)
static RzBinSection * bin_section_from_section(RzCoreSymCacheElementSection *sect)
int bits(struct state *s, int need)
RZ_API void rz_coresym_cache_element_free(RzCoreSymCacheElement *element)
RZ_API ut64 rz_coresym_cache_element_pa2va(RzCoreSymCacheElement *element, ut64 pa)
RZ_API RzCoreSymCacheElement * rz_coresym_cache_element_new(RzBinFile *bf, RzBuffer *buf, ut64 off, int bits, RZ_OWN char *file_name)
RZ_API void rz_bin_source_line_info_builder_init(RzBinSourceLineInfoBuilder *builder)
RZ_API RzBinSourceLineInfo * rz_bin_source_line_info_builder_build_and_fini(RzBinSourceLineInfoBuilder *builder)
RZ_API void rz_bin_source_line_info_builder_push_sample(RzBinSourceLineInfoBuilder *builder, ut64 address, ut32 line, ut32 column, const char *file)
Push a new sample into the builder.
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
static const char file_name
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
#define rz_return_if_fail(expr)
#define rz_return_val_if_fail(expr, val)
#define RZ_BIN_TYPE_FUNC_STR
RZ_API st64 rz_buf_read_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL RZ_OUT ut8 *buf, ut64 len)
Read len bytes of the buffer at the specified address.
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
static ut16 rz_read_le16(const void *src)
static ut32 rz_read_le32(const void *src)
RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out)
void(* RzListFree)(void *ptr)
#define RZ_LOG_WARN(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API PJ * pj_end(PJ *j)
RZ_API const char * pj_string(PJ *pj)
RZ_API void pj_free(PJ *j)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
XX curplugin == o->plugin.
RzCoreSymCacheElementSymbol sym
RzCoreSymCacheElementFLC flc
RzCoreSymCacheElementSegment * segments
RzCoreSymCacheElementLineInfo * line_info
RzCoreSymCacheElementSection * sections
RzCoreSymCacheElementHdr * hdr
RzCoreSymCacheElementLinedSymbol * lined_symbols
RzCoreSymCacheElementSymbol * symbols
ut64(WINAPI *w32_GetEnabledXStateFeatures)()