8 #define RZ_CS_EL_OFF_SEGS 0x58
9 #define RZ_CS_EL_SIZE_SEG 0x20
10 #define RZ_CS_EL_SIZE_SECT_64 0x18
11 #define RZ_CS_EL_SIZE_SECT_32 0x10
12 #define RZ_CS_EL_SIZE_SYM 0x18
13 #define RZ_CS_EL_SIZE_LSYM 0x24
14 #define RZ_CS_EL_SIZE_LINFO 0x14
108 if (seg->
size == 0) {
111 if (seg->
paddr < pa && pa < seg->paddr + seg->
size) {
151 RZ_LOG_ERROR(
"Corrupted CoreSymbolication header: size out of bounds (0x%x)\n", hdr->
size);
175 const size_t word_size =
bits / 8;
184 ut64 page_zero_size = 0;
185 size_t page_zero_idx = 0;
223 if (!strcmp(seg->
name,
"__PAGEZERO")) {
224 page_zero_size = seg->
size;
230 for (
i = 0;
i < hdr->
n_segments && page_zero_size > 0;
i++) {
231 if (
i == page_zero_idx) {
235 if (seg->
vaddr < page_zero_size) {
236 seg->
vaddr += page_zero_size;
240 bool relative_to_strings =
false;
248 ut8 *cursor =
b + start_of_sections;
249 ut8 *upper_boundary =
end - word_size;
250 for (
i = 0;
i < hdr->
n_sections && cursor < upper_boundary;
i++) {
251 ut8 *sect_start = cursor;
254 if (sect->
vaddr < page_zero_size) {
255 sect->
vaddr += page_zero_size;
258 if (cursor >= upper_boundary) {
263 if (cursor >= upper_boundary) {
267 if (!
i && !sect_name_off) {
268 relative_to_strings =
true;
274 string_origin = relative_to_strings ?
b + start_of_strings : sect_start;
284 ut8 *cursor =
b + start_of_symbols;
293 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
299 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
307 if (i < hdr->n_symbols) {
317 ut8 *cursor =
b + start_of_lined_symbols;
329 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
334 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
339 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
346 if (i < hdr->n_lined_symbols) {
356 ut8 *cursor =
b + start_of_line_info;
364 string_origin = relative_to_strings ?
b + start_of_strings : cursor;
371 if (i < hdr->n_line_info) {
RzBinInfo * info(RzBinFile *bf)
int bits(struct state *s, int need)
#define RZ_CS_EL_SIZE_SYM
static void rz_coresym_cache_element_lined_symbol_fini(RzCoreSymCacheElementLinedSymbol *sym)
#define RZ_CS_EL_SIZE_SECT_64
#define RZ_CS_EL_SIZE_SEG
static void rz_coresym_cache_element_line_info_fini(RzCoreSymCacheElementLineInfo *line)
#define RZ_CS_EL_SIZE_LSYM
RZ_API void rz_coresym_cache_element_free(RzCoreSymCacheElement *element)
#define RZ_CS_EL_SIZE_SECT_32
RZ_API ut64 rz_coresym_cache_element_pa2va(RzCoreSymCacheElement *element, ut64 pa)
static char * str_dup_safe_fixed(const ut8 *b, const ut8 *str, ut64 len, const ut8 *end)
static void rz_coresym_cache_element_symbol_fini(RzCoreSymCacheElementSymbol *sym)
static RzCoreSymCacheElementHdr * rz_coresym_cache_element_header_new(RzBuffer *buf, size_t off, int bits)
static void rz_coresym_cache_element_segment_fini(RzCoreSymCacheElementSegment *seg)
#define RZ_CS_EL_SIZE_LINFO
static char * str_dup_safe(const ut8 *b, const ut8 *str, const ut8 *end)
#define RZ_CS_EL_OFF_SEGS
static void rz_coresym_cache_element_section_fini(RzCoreSymCacheElementSection *sec)
static void rz_coresym_cache_element_flc_fini(RzCoreSymCacheElementFLC *flc)
RZ_API RzCoreSymCacheElement * rz_coresym_cache_element_new(RzBinFile *bf, RzBuffer *buf, ut64 off, int bits, RZ_OWN char *file_name)
RZ_API void Ht_() free(HtName_(Ht) *ht)
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")
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 st64 rz_buf_fread_at(RZ_NONNULL RzBuffer *b, ut64 addr, RZ_NONNULL ut8 *buf, RZ_NONNULL const char *fmt, int n)
...
RZ_API ut64 rz_buf_size(RZ_NONNULL RzBuffer *b)
Return the size of the buffer.
static ut32 rz_read_le32(const void *src)
static ut64 rz_read_le64(const void *src)
static ut64 rz_read_ble(const void *src, bool big_endian, int size)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.
RZ_API size_t rz_str_nlen(const char *s, size_t n)
XX curplugin == o->plugin.
RzCoreSymCacheElementSymbol sym
RzCoreSymCacheElementFLC flc
RzCoreSymCacheElementSegment * segments
RzCoreSymCacheElementLineInfo * line_info
RzCoreSymCacheElementSection * sections
RzCoreSymCacheElementHdr * hdr
RzCoreSymCacheElementLinedSymbol * lined_symbols
RzCoreSymCacheElementSymbol * symbols
if(dbg->bits==RZ_SYS_BITS_64)
ut64(WINAPI *w32_GetEnabledXStateFeatures)()