From 31407492664c2135adbd8c9f82b971c9e20e497b Mon Sep 17 00:00:00 2001 From: pancake Date: Tue, 16 Feb 2016 02:58:29 +0100 Subject: [PATCH] Fix #4095 - Export RBinSection info for mach0.la_symbol_ptr --- libr/bin/p/bin_mach0.c | 11 ++++++++++- libr/core/bin.c | 3 +++ libr/include/r_bin.h | 1 + 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/libr/bin/p/bin_mach0.c b/libr/bin/p/bin_mach0.c index 1d397e99a1..11d19d6c58 100644 --- a/libr/bin/p/bin_mach0.c +++ b/libr/bin/p/bin_mach0.c @@ -1,4 +1,4 @@ -/* radare - LGPL - Copyright 2009-2015 - pancake */ +/* radare - LGPL - Copyright 2009-2016 - pancake */ #include #include @@ -101,6 +101,15 @@ static RList* sections(RBinFile *arch) { if (!(ptr = R_NEW0 (RBinSection))) break; strncpy (ptr->name, (char*)sections[i].name, R_BIN_SIZEOF_STRINGS); + if (strstr (ptr->name, "la_symbol_ptr")) { +#ifndef R_BIN_MACH064 + const int sz = 4; +#else + const int sz = 8; +#endif + int len = sections[i].size / sz; + ptr->format = r_str_newf ("Cd %d[%d]", sz, len); + } ptr->name[R_BIN_SIZEOF_STRINGS] = 0; ptr->size = sections[i].size; ptr->vsize = sections[i].size; diff --git a/libr/core/bin.c b/libr/core/bin.c index ffd8507b79..baecabe750 100644 --- a/libr/core/bin.c +++ b/libr/core/bin.c @@ -1446,6 +1446,9 @@ static int bin_sections(RCore *r, int mode, ut64 laddr, int va, ut64 at, const c } #endif r_name_filter (section->name, 128); + if (section->format) { + r_core_cmdf (r, "%s @ 0x%"PFMT64x, section->format, section->vaddr); + } if (r->bin->prefix) { snprintf (str, sizeof(str)-1, "%s.section.%s", r->bin->prefix, section->name); diff --git a/libr/include/r_bin.h b/libr/include/r_bin.h index 10d3b03cbb..741e44ad0e 100644 --- a/libr/include/r_bin.h +++ b/libr/include/r_bin.h @@ -280,6 +280,7 @@ typedef struct r_bin_section_t { ut32 srwx; // per section platform info const char *arch; + char *format; int bits; bool has_strings; bool add; // indicates when you want to add the section to io `S` command