70 #define GOLANG_MAX_UVARIANT 10
71 #define GOLANG_MAX_STRING_BUF 0x1000
73 #define GOLANG_MOD_START "\x30\x77\xaf\x0c\x92\x74\x08\x02\x41\xe1\xc1\x07\xe6\xd6\x18\xe6"
83 for (
size_t i = 0;
i <
size; ++
i) {
89 }
else if (
b < 0x80) {
143 ut64 paddr = 0, psize = 0;
175 RZ_LOG_ERROR(
"goinfo: Cannot read build info header at 0x%08" PFMT64x " (phy)\n", bi_paddr);
178 ut32 ptr_size = tmp32[14];
184 RZ_LOG_ERROR(
"goinfo: Cannot read build info header at 0x%08" PFMT64x " (phy)\n", bi_paddr);
191 RZ_LOG_ERROR(
"goinfo: Cannot read build info version\n");
199 bool big_endian = tmp32[15] != 0;
200 ut64 version_offset = 0, setting_offset = 0;
203 setting_offset =
rz_read_ble32(tmp32 + 16 + ptr_size, big_endian);
206 setting_offset =
rz_read_ble64(tmp32 + 16 + ptr_size, big_endian);
229 return !memcmp(magic,
"\xff Go buildinf:", 14);
239 const int build_info_align = 16;
240 if (
len < build_info_align) {
244 for (
ut64 pos = 0;
pos <=
len - build_info_align;
pos += build_info_align) {
275 if (!strcmp(plugname,
"pe") || !strcmp(plugname,
"pe64")) {
277 }
else if (strcmp(plugname,
"elf") && strcmp(plugname,
"elf64") &&
278 strcmp(plugname,
"mach0") && strcmp(plugname,
"mach064")) {
279 RZ_LOG_INFO(
"goinfo: unsupported bin format '%s'\n", plugname);
291 }
else if (!is_pe && (strstr(
section->name,
"go_buildinfo") || strstr(
section->name,
"go.buildinfo"))) {
#define GOLANG_MAX_STRING_BUF
static ut64 go_string(ut8 *buffer, size_t size, char **output)
static ut64 go_uvariant(ut8 *buffer, size_t size, ut32 *read)
static ut64 scan_go_build_info(const ut8 *buf, ut64 len, void *user)
static char * go_string_from_table(RzBinFile *bf, ut32 ptr_size, ut64 offset, bool big_endian, ut32 *str_size)
static bool is_go_build_info(const ut8 *magic)
#define GOLANG_MAX_UVARIANT
struct golang_build_info_t GoBuildInfo
RZ_IPI RZ_OWN char * rz_bin_file_golang_compiler(RZ_NONNULL RzBinFile *bf)
Returns the golang compiler info if buildinfo struct is found.
static st64 io_read_va_at(RzBinFile *bf, ut64 vaddr, ut8 *buffer, ut64 size)
static void find_go_build_info(RzBinFile *bf, GoBuildInfo *go_info, RzBinSection *section)
static void parse_go_build_info(RzBinFile *bf, GoBuildInfo *go_info, ut64 bi_paddr)
RzList * sections(RzBinFile *bf)
RZ_API ut64 rz_bin_object_v2p(RZ_NONNULL RzBinObject *obj, ut64 vaddr)
Convert virtual address to offset in the file according to binary mappings.
RZ_API RZ_OWN RzList * rz_bin_object_get_sections(RZ_NONNULL RzBinObject *obj)
Get list of RzBinSection representing only the sections of the binary object.
RZ_API void Ht_() free(HtName_(Ht) *ht)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * malloc(size_t size)
#define rz_return_val_if_fail(expr, val)
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_fwd_scan(RZ_NONNULL RzBuffer *b, ut64 start, ut64 amount, RZ_NONNULL RzBufferFwdScan fwd_scan, RZ_NULLABLE void *user)
Scans buffer linearly in chunks calling fwd_scan for each chunk.
static ut64 rz_read_ble64(const void *src, bool big_endian)
static ut32 rz_read_ble32(const void *src, bool big_endian)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
XX curplugin == o->plugin.
struct rz_bin_plugin_t * plugin
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
int read(izstream &zs, T *x, Items items)