Rizin
unix-like reverse engineering framework and cli tools
bin_symbols.c
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: 2018 pancake <pancake@nopcode.org>
2 // SPDX-License-Identifier: LGPL-3.0-only
3 
4 #include <rz_types.h>
5 #include <rz_util.h>
6 #include <rz_lib.h>
7 #include <rz_bin.h>
8 #include <ht_uu.h>
9 #include "../i/private.h"
11 
12 // enable debugging messages
13 #define D if (0)
14 #define RZ_UUID_LENGTH 33
15 
16 typedef struct symbols_header_t {
19  ut8 uuid[16];
24  bool valid;
25  int size;
27 
28 typedef struct symbols_metadata_t { // 0x40
34  bool valid;
36  // RzList *segments;
38  int bits;
39  const char *arch;
40  const char *cpu;
42 
43 // header starts at offset 0 and ends at offset 0x40
45  ut8 b[64];
46  SymbolsHeader sh = { 0 };
47  (void)rz_buf_read_at(buf, 0, b, sizeof(b));
48  sh.magic = rz_read_le32(b);
49  sh.version = rz_read_le32(b + 4);
50  sh.valid = sh.magic == 0xff01ff02;
51  int i;
52  for (i = 0; i < 16; i++) {
53  sh.uuid[i] = b[24 + i];
54  }
55  sh.unk0 = rz_read_le16(b + 0x28);
56  sh.unk1 = rz_read_le16(b + 0x2c); // is slotsize + 1 :?
57  sh.slotsize = rz_read_le16(b + 0x2e);
58  sh.size = 0x40;
59  return sh;
60 }
61 
62 static const char *typeString(ut32 n, int *bits) {
63  *bits = 32;
64  if (n == 12) { // CPU_SUBTYPE_ARM_V7) {
65  return "arm";
66  }
67  if (n == 0x0100000c) { // arm64
68  *bits = 64;
69  return "arm";
70  }
71  if (n == 0x0200000c) { // arm64-32
72  // TODO: must change bits
73  *bits = 64;
74  return "arm";
75  }
76  return "x86";
77 }
78 
79 static const char *subtypeString(int n) {
80  if (n == 9) { // CPU_SUBTYPE_ARM_V7) {
81  return "armv7";
82  }
83  return "?";
84 }
85 
86 // metadata section starts at offset 0x40 and ends around 0xb0 depending on filenamelength
88  SymbolsMetadata sm = { 0 };
89  ut8 b[0x100] = { 0 };
90  (void)rz_buf_read_at(buf, off, b, sizeof(b));
91  sm.addr = off;
92  sm.cputype = rz_read_le32(b);
93  sm.arch = typeString(sm.cputype, &sm.bits);
94  // eprintf ("0x%08x cputype 0x%x -> %s\n", 0x40, sm.cputype, typeString (sm.cputype));
95  // bits = (strstr (typeString (sm.cputype, &sm.bits), "64"))? 64: 32;
96  sm.subtype = rz_read_le32(b + 4);
97  sm.cpu = subtypeString(sm.subtype);
98  // eprintf ("0x%08x subtype 0x%x -> %s\n", 0x44, sm.subtype, subtypeString (sm.subtype));
99  sm.n_segments = rz_read_le32(b + 8);
100  // int count = rz_read_le32 (b + 0x48);
101  sm.namelen = rz_read_le32(b + 0xc);
102  // eprintf ("0x%08x count %d\n", 0x48, count);
103  // eprintf ("0x%08x strlen %d\n", 0x4c, sm.namelen);
104  // eprintf ("0x%08x filename %s\n", 0x50, b + 16);
105  int delta = 16;
106  // sm.segments = parseSegments (buf, off + sm.namelen + delta, sm.n_segments);
107  sm.size = (sm.n_segments * 32) + sm.namelen + delta;
108 
109  // hack to detect format
110  ut32 nm, nm2, nm3;
111  rz_buf_read_at(buf, off + sm.size, (ut8 *)&nm, sizeof(nm));
112  rz_buf_read_at(buf, off + sm.size + 4, (ut8 *)&nm2, sizeof(nm2));
113  rz_buf_read_at(buf, off + sm.size + 8, (ut8 *)&nm3, sizeof(nm3));
114  // eprintf ("0x%x next %x %x %x\n", off + sm.size, nm, nm2, nm3);
115  if (rz_read_le32(&nm3) != 0xa1b22b1a) {
116  sm.size -= 8;
117  // is64 = true;
118  }
119  return sm;
120 }
121 
123  if (!sect->name) {
124  return NULL;
125  }
127  if (!s) {
128  return NULL;
129  }
130  s->name = rz_str_ndup(sect->name, 256);
131  s->size = sect->size;
132  s->vsize = s->size;
133  s->paddr = sect->paddr;
134  s->vaddr = sect->vaddr;
135  s->perm = strstr(s->name, "TEXT") ? 5 : 4;
136  s->is_segment = false;
137  return s;
138 }
139 
141  if (!seg->name) {
142  return NULL;
143  }
145  if (!s) {
146  return NULL;
147  }
148  s->name = rz_str_ndup(seg->name, 16);
149  s->size = seg->size;
150  s->vsize = seg->vsize;
151  s->paddr = seg->paddr;
152  s->vaddr = seg->vaddr;
153  s->perm = strstr(s->name, "TEXT") ? 5 : 4;
154  s->is_segment = true;
155  return s;
156 }
157 
159  if (!s->name && !s->mangled_name) {
160  return NULL;
161  }
163  if (sym) {
164  if (s->name && s->mangled_name) {
165  sym->dname = strdup(s->name);
166  sym->name = strdup(s->mangled_name);
167  } else if (s->name) {
168  sym->name = strdup(s->name);
169  } else if (s->mangled_name) {
170  sym->name = s->mangled_name;
171  }
172  sym->paddr = s->paddr;
173  sym->vaddr = rz_coresym_cache_element_pa2va(element, s->paddr);
174  sym->size = s->size;
175  sym->type = RZ_BIN_TYPE_FUNC_STR;
176  sym->bind = "NONE";
177  }
178  return sym;
179 }
180 
182  D eprintf("Dragons at 0x%x\n", off);
184  if (off >= size) {
185  return NULL;
186  }
187  size -= off;
188  if (!size) {
189  return NULL;
190  }
191  ut8 *b = malloc(size);
192  if (!b) {
193  return NULL;
194  }
195  int available = rz_buf_read_at(buf, off, b, size);
196  if (available != size) {
197  RZ_LOG_ERROR("bin: symbols: cannot read at 0x%08x\n", off);
198  return NULL;
199  }
200 #if 0
201  // after the list of sections, there's a bunch of unknown
202  // data, brobably dwords, and then the same section list again
203  // this function aims to parse it.
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..........
207  .---- how many symbols? 0xc7
208  0x00000158 |c700 0000 0000 0000 0000 0000 0104 0000| ................
209  0x00000168 |250b e803 0000 0100 0000 0000 bd55 0000| %............U..
210  0x00000178 |91bb e903 e35a b42c 93a4 340a 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 00c0 0000 0000 0000| ................
217  0x000001e8 |0000 0100 0000 0000 5f5f 4c4c 564d 0000| ........__LLVM..
218  0x000001f8 |0000 0000 0000 0000 00c0 0100 0000 0000| ................
219  0x00000208 |00c0 0000 0000 0000 5f5f 4c49 4e4b 4544| ........__LINKED
220  0x00000218 |4954 0000 0000 0000 0000 0000 d069 0000| IT...........i..
221 #endif
222  // eprintf ("Dragon's magic:\n");
223  int magicCombo = 0;
224  if (size > 3 && !memcmp("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ?
225  magicCombo++;
226  }
227  if (size > 11 && !memcmp("\x1a\x2b\xb2\xa1", b + 8, 4)) {
228  magicCombo++;
229  }
230  if (magicCombo != 2) {
231  // hack for C22F7494
232  available = rz_buf_read_at(buf, off - 8, b, size);
233  if (available != size) {
234  RZ_LOG_WARN("bin: symbols: rz_buf_read_at failed\n");
235  return NULL;
236  }
237  if (size > 3 && !memcmp("\x1a\x2b\xb2\xa1", b, 4)) { // 0x130 ?
238  off -= 8;
239  } else {
240  RZ_LOG_ERROR("bin: symbols: 0x%08x parsing error: invalid magic retry\n", off);
241  }
242  }
243  D eprintf("0x%08x magic OK\n", off);
244  D {
245  const int e0ss = rz_read_le32(b + 12);
246  eprintf("0x%08x eoss 0x%x\n", off + 12, e0ss);
247  }
248  free(b);
249  return rz_coresym_cache_element_new(bf, buf, off + 16, bits, file_name);
250 }
251 
252 static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb) {
253 #if 0
254  SYMBOLS HEADER
255 
256  0 MAGIC 02ff01ff
257  4 VERSION 1 (little endian)
258  8 ffffffff
259 16 002b0000 01000000 { 0x2b00, 0x0000 }
260 24 UUID 16 bytes
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
264 184
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 564d 0000 0000 0000 0000 0000 00c0 0000 0000 0000 0000 0100 0000 0000 __LLVM..........................
268 0x00000118 5f5f 4c49 4e4b 4544 4954 0000 0000 0000 00c0 0100 0000 0000 00c0 0000 0000 0000 __LINKEDIT......................
269 
270 #endif
271  // 0 - magic check, version ...
273  if (!sh.valid) {
274  eprintf("Invalid headers\n");
275  return false;
276  }
277  SymbolsMetadata sm = parseMetadata(buf, 0x40);
278  char *file_name = NULL;
279  if (sm.namelen) {
280  file_name = calloc(sm.namelen + 1, 1);
281  if (!file_name) {
282  return false;
283  }
284  if (rz_buf_read_at(buf, 0x50, (ut8 *)file_name, sm.namelen) != sm.namelen) {
285  return false;
286  }
287  }
288  RzCoreSymCacheElement *element = parseDragons(bf, buf, sm.addr + sm.size, sm.bits, file_name);
289  obj->bin_obj = element;
290  free(file_name);
291  return obj->bin_obj != NULL;
292 }
293 
294 static RzList *sections(RzBinFile *bf) {
296  rz_return_val_if_fail(res && bf->o && bf->o->bin_obj, res);
297  RzCoreSymCacheElement *element = bf->o->bin_obj;
298  size_t i;
299  for (i = 0; i < element->hdr->n_segments; i++) {
300  RzCoreSymCacheElementSegment *seg = &element->segments[i];
302  if (s) {
303  rz_list_append(res, s);
304  }
305  }
306  for (i = 0; i < element->hdr->n_sections; i++) {
307  RzCoreSymCacheElementSection *sect = &element->sections[i];
309  if (s) {
310  rz_list_append(res, s);
311  }
312  }
313  return res;
314 }
315 
316 static ut64 baddr(RzBinFile *bf) {
317  return 0LL;
318 }
319 
320 static RzBinInfo *info(RzBinFile *bf) {
321  SymbolsMetadata sm = parseMetadata(bf->buf, 0x40);
322  RzBinInfo *ret = RZ_NEW0(RzBinInfo);
323  if (!ret) {
324  return NULL;
325  }
326  ret->file = strdup(bf->file);
327  ret->bclass = strdup("symbols");
328  ret->os = strdup("unknown");
329  ret->arch = sm.arch ? strdup(sm.arch) : NULL;
330  ret->bits = sm.bits;
331  ret->type = strdup("Symbols file");
332  ret->subsystem = strdup("llvm");
333  ret->has_va = true;
334 
335  return ret;
336 }
337 
338 static bool check_buffer(RzBuffer *b) {
339  ut8 buf[4];
340  rz_buf_read_at(b, 0, buf, sizeof(buf));
341  return !memcmp(buf, "\x02\xff\x01\xff", 4);
342 }
343 
344 static RzList *symbols(RzBinFile *bf) {
346  rz_return_val_if_fail(res && bf->o && bf->o->bin_obj, res);
347  RzCoreSymCacheElement *element = bf->o->bin_obj;
348  size_t i;
349  HtUU *hash = ht_uu_new0();
350  if (!hash) {
351  return res;
352  }
353  bool found = false;
354  for (i = 0; i < element->hdr->n_lined_symbols; i++) {
356  ht_uu_find(hash, sym->paddr, &found);
357  if (found) {
358  continue;
359  }
360  RzBinSymbol *s = bin_symbol_from_symbol(element, sym);
361  if (s) {
362  rz_list_append(res, s);
363  ht_uu_insert(hash, sym->paddr, 1);
364  }
365  }
366  for (i = 0; i < element->hdr->n_symbols; i++) {
367  RzCoreSymCacheElementSymbol *sym = &element->symbols[i];
368  ht_uu_find(hash, sym->paddr, &found);
369  if (found) {
370  continue;
371  }
372  RzBinSymbol *s = bin_symbol_from_symbol(element, sym);
373  if (s) {
374  rz_list_append(res, s);
375  }
376  }
377  ht_uu_free(hash);
378  return res;
379 }
380 
381 static ut64 size(RzBinFile *bf) {
382  return UT64_MAX;
383 }
384 
385 static void destroy(RzBinFile *bf) {
387 }
388 
389 static void header(RzBinFile *bf) {
390  rz_return_if_fail(bf && bf->o);
391 
392  RzCoreSymCacheElement *element = bf->o->bin_obj;
393  if (!element) {
394  return;
395  }
396 
397  RzBin *bin = bf->rbin;
398  PrintfCallback p = bin->cb_printf;
399  PJ *pj = pj_new();
400  if (!pj) {
401  return;
402  }
403 
404  pj_o(pj);
405  pj_kn(pj, "cs_version", element->hdr->version);
406  pj_kn(pj, "size", element->hdr->size);
407  if (element->file_name) {
408  pj_ks(pj, "name", element->file_name);
409  }
410  if (element->binary_version) {
411  pj_ks(pj, "version", element->binary_version);
412  }
413  char uuidstr[RZ_UUID_LENGTH];
414  rz_hex_bin2str(element->hdr->uuid, 16, uuidstr);
415  pj_ks(pj, "uuid", uuidstr);
416  pj_kn(pj, "segments", element->hdr->n_segments);
417  pj_kn(pj, "sections", element->hdr->n_sections);
418  pj_kn(pj, "symbols", element->hdr->n_symbols);
419  pj_kn(pj, "lined_symbols", element->hdr->n_lined_symbols);
420  pj_kn(pj, "line_info", element->hdr->n_line_info);
421  pj_end(pj);
422 
423  p("%s\n", pj_string(pj));
424  pj_free(pj);
425 }
426 
428  rz_return_val_if_fail(bf && bf->o, NULL);
429  RzCoreSymCacheElement *element = bf->o->bin_obj;
430  if (!element || !element->hdr) {
431  return NULL;
432  }
435  if (element->lined_symbols) {
436  for (size_t i = 0; i < element->hdr->n_lined_symbols; i++) {
439  ut32 sz = lsym->sym.size;
440  rz_bin_source_line_info_builder_push_sample(&alice, addr, lsym->flc.line, lsym->flc.col, lsym->flc.file);
441  rz_bin_source_line_info_builder_push_sample(&alice, addr + (sz ? sz : 1), 0, 0, NULL);
442  }
443  }
444  if (element->line_info) {
445  for (size_t i = 0; i < element->hdr->n_line_info; i++) {
447  ut64 addr = rz_coresym_cache_element_pa2va(element, info->paddr);
448  ut32 sz = info->size;
449  rz_bin_source_line_info_builder_push_sample(&alice, addr, info->flc.line, info->flc.col, info->flc.file);
450  rz_bin_source_line_info_builder_push_sample(&alice, addr + (sz ? sz : 1), 0, 0, NULL);
451  }
452  }
454 }
455 
457  .name = "symbols",
458  .desc = "Apple Symbols file",
459  .license = "MIT",
460  .load_buffer = &load_buffer,
461  .check_buffer = &check_buffer,
462  .symbols = &symbols,
464  .sections = &sections,
465  .size = &size,
466  .baddr = &baddr,
467  .info = &info,
468  .header = &header,
469  .destroy = &destroy,
470  .lines = lines
471 };
472 
473 #ifndef RZ_PLUGIN_INCORE
476  .data = &rz_bin_plugin_symbols,
478 };
479 #endif
lzma_index ** i
Definition: index.h:629
static ut8 bytes[32]
Definition: asm_arc.c:23
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)
Definition: bin.c:175
RZ_API void rz_bin_section_free(RzBinSection *bs)
Definition: bin.c:1116
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.
Definition: bin.c:1040
RzBinPlugin rz_bin_plugin_symbols
Definition: bin_symbols.c:456
static SymbolsHeader parseHeader(RzBuffer *buf)
Definition: bin_symbols.c:44
static const char * typeString(ut32 n, int *bits)
Definition: bin_symbols.c:62
static bool load_buffer(RzBinFile *bf, RzBinObject *obj, RzBuffer *buf, Sdb *sdb)
Definition: bin_symbols.c:252
static RzList * symbols(RzBinFile *bf)
Definition: bin_symbols.c:344
static ut64 size(RzBinFile *bf)
Definition: bin_symbols.c:381
struct symbols_metadata_t SymbolsMetadata
static void header(RzBinFile *bf)
Definition: bin_symbols.c:389
static RzBinSourceLineInfo * lines(RzBinFile *bf)
Definition: bin_symbols.c:427
#define RZ_UUID_LENGTH
Definition: bin_symbols.c:14
struct symbols_header_t SymbolsHeader
static void destroy(RzBinFile *bf)
Definition: bin_symbols.c:385
RZ_API RzLibStruct rizin_plugin
Definition: bin_symbols.c:474
static bool check_buffer(RzBuffer *b)
Definition: bin_symbols.c:338
static RzBinInfo * info(RzBinFile *bf)
Definition: bin_symbols.c:320
static ut64 baddr(RzBinFile *bf)
Definition: bin_symbols.c:316
static RzBinSection * bin_section_from_segment(RzCoreSymCacheElementSegment *seg)
Definition: bin_symbols.c:140
static const char * subtypeString(int n)
Definition: bin_symbols.c:79
static SymbolsMetadata parseMetadata(RzBuffer *buf, int off)
Definition: bin_symbols.c:87
static RzCoreSymCacheElement * parseDragons(RzBinFile *bf, RzBuffer *buf, int off, int bits, RZ_OWN char *file_name)
Definition: bin_symbols.c:181
static RzList * sections(RzBinFile *bf)
Definition: bin_symbols.c:294
static RzBinSymbol * bin_symbol_from_symbol(RzCoreSymCacheElement *element, RzCoreSymCacheElementSymbol *s)
Definition: bin_symbols.c:158
#define D
Definition: bin_symbols.c:13
static RzBinSection * bin_section_from_section(RzCoreSymCacheElementSection *sect)
Definition: bin_symbols.c:122
int bits(struct state *s, int need)
Definition: blast.c:72
#define VERSION
Definition: config.h:54
#define RZ_API
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)
#define NULL
Definition: cris-opc.c:27
RZ_API void rz_bin_source_line_info_builder_init(RzBinSourceLineInfoBuilder *builder)
Definition: dbginfo.c:9
RZ_API RzBinSourceLineInfo * rz_bin_source_line_info_builder_build_and_fini(RzBinSourceLineInfoBuilder *builder)
Definition: dbginfo.c:87
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.
Definition: dbginfo.c:28
uint32_t ut32
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API const KEY_TYPE bool * found
Definition: ht_inc.h:130
voidpf void uLong size
Definition: ioapi.h:138
voidpf void * buf
Definition: ioapi.h:138
uint8_t ut8
Definition: lh5801.h:11
void * p
Definition: libc.cpp:67
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
void * malloc(size_t size)
Definition: malloc.c:123
void * calloc(size_t number, size_t size)
Definition: malloc.c:102
static const char file_name
Definition: sflib.h:131
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")
int n
Definition: mipsasm.c:19
int off
Definition: pal.c:13
#define eprintf(x, y...)
Definition: rlcc.c:7
static RzSocket * s
Definition: rtr.c:28
#define rz_return_if_fail(expr)
Definition: rz_assert.h:100
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
#define RZ_BIN_TYPE_FUNC_STR
Definition: rz_bin.h:119
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.
Definition: buf.c:1136
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
Definition: buf.c:1225
static ut16 rz_read_le16(const void *src)
Definition: rz_endian.h:206
static ut32 rz_read_le32(const void *src)
Definition: rz_endian.h:239
RZ_API int rz_hex_bin2str(const ut8 *in, int len, char *out)
Definition: hex.c:382
@ RZ_LIB_TYPE_BIN
Definition: rz_lib.h:75
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
#define RZ_LOG_WARN(fmtstr,...)
Definition: rz_log.h:56
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
RZ_API PJ * pj_new(void)
Definition: pj.c:25
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API const char * pj_string(PJ *pj)
Definition: pj.c:57
RZ_API void pj_free(PJ *j)
Definition: pj.c:34
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
Definition: pj.c:121
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
Definition: str.c:1006
#define RZ_OWN
Definition: rz_types.h:62
#define RZ_NEW0(x)
Definition: rz_types.h:284
int(* PrintfCallback)(const char *str,...) RZ_PRINTF_CHECK(1
Definition: rz_types.h:233
#define UT64_MAX
Definition: rz_types_base.h:86
#define RZ_VERSION
Definition: rz_version.h:8
@ HEADER
Definition: packet.c:10
#define d(i)
Definition: sha256.c:44
#define b(i)
Definition: sha256.c:42
#define a(i)
Definition: sha256.c:41
Definition: malloc.c:26
Definition: rz_pj.h:12
XX curplugin == o->plugin.
Definition: rz_bin.h:298
RzBinObject * o
Definition: rz_bin.h:305
struct rz_bin_t * rbin
Definition: rz_bin.h:316
char * file
Definition: rz_bin.h:299
RzBuffer * buf
Definition: rz_bin.h:303
int has_va
Definition: rz_bin.h:228
char * type
Definition: rz_bin.h:211
char * os
Definition: rz_bin.h:219
char * subsystem
Definition: rz_bin.h:220
char * bclass
Definition: rz_bin.h:212
char * file
Definition: rz_bin.h:210
char * arch
Definition: rz_bin.h:214
void * bin_obj
Definition: rz_bin.h:293
char * name
Definition: rz_bin.h:509
char * version
Definition: rz_bin.h:512
const char * bind
Definition: rz_bin.h:681
const char * type
Definition: rz_bin.h:682
char * name
Definition: rz_bin.h:675
char * dname
Definition: rz_bin.h:676
RzCoreSymCacheElementSegment * segments
RzCoreSymCacheElementLineInfo * line_info
RzCoreSymCacheElementSection * sections
RzCoreSymCacheElementHdr * hdr
RzCoreSymCacheElementLinedSymbol * lined_symbols
RzCoreSymCacheElementSymbol * symbols
Definition: sdb.h:63
const char * cpu
Definition: bin_symbols.c:40
const char * arch
Definition: bin_symbols.c:39
static st64 delta
Definition: vmenus.c:2425
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58
#define L
Definition: zip_err_str.c:7