• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ r_list_newf函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中r_list_newf函数的典型用法代码示例。如果您正苦于以下问题:C++ r_list_newf函数的具体用法?C++ r_list_newf怎么用?C++ r_list_newf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了r_list_newf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: R_NEW0

static void *load_bytes(RBinFile *bf, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb) {
	RBinNROObj *bin = R_NEW0 (RBinNROObj);
	if (!bin) {
		return NULL;
	}
	ut64 ba = baddr (bf);
	bin->methods_list = r_list_newf ((RListFree)free);
	bin->imports_list = r_list_newf ((RListFree)free);
	bin->classes_list = r_list_newf ((RListFree)free);
	ut32 mod0 = readLE32 (bf->buf, NRO_OFFSET_MODMEMOFF);
	parseMod (bf, bin, mod0, ba);
	return (void *) bin;//(size_t) check_bytes (buf, sz);
}
开发者ID:PankajKataria,项目名称:radare2,代码行数:13,代码来源:bin_nro.c


示例2: load_bytes

static bool load_bytes(RBinFile *bf, void **bin_obj, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb) {
	RBinNXOObj *bin = R_NEW0 (RBinNXOObj);
	if (!bin) {
		return false;
	}
	ut64 ba = baddr (bf);
	bin->methods_list = r_list_newf ((RListFree)free);
	bin->imports_list = r_list_newf ((RListFree)free);
	bin->classes_list = r_list_newf ((RListFree)free);
	ut32 mod0 = readLE32 (bf->buf, NRO_OFFSET_MODMEMOFF);
	parseMod (bf->buf, bin, mod0, ba);
	*bin_obj = bin;
	return true;
}
开发者ID:radare,项目名称:radare2,代码行数:14,代码来源:bin_nro.c


示例3: r_list_newf

static RList *r_debug_windbg_pids(RDebug *dbg, int pid) {
	RListIter *it;
	WindProc *p;

	RList *ret = r_list_newf (free);
	if (!ret) {
		return NULL;
	}

	RList *pids = windbg_list_process(wctx);
	if (!pids) {
		return ret;
	}
	r_list_foreach (pids, it, p) {
		RDebugPid *newpid = R_NEW0 (RDebugPid);
		if (!newpid) {
			r_list_free (ret);
			return NULL;
		}
		newpid->path = strdup (p->name);
		newpid->pid = p->uniqueid;
		newpid->status = 's';
		newpid->runnable = true;
		r_list_append (ret, newpid);
	}
开发者ID:aronsky,项目名称:radare2,代码行数:25,代码来源:debug_windbg.c


示例4: relocs

static RList * relocs(RBinFile *bf) {
	RList *ret = NULL;
	RBinReloc *rel = NULL;
	const struct r_bin_mz_reloc_t *relocs = NULL;
	int i;

	if (!bf || !bf->o || !bf->o->bin_obj) {
		return NULL;
	}
	if (!(ret = r_list_newf (free))) {
		return NULL;
	}
	if (!(relocs = r_bin_mz_get_relocs (bf->o->bin_obj))) {
		return ret;
	}
	for (i = 0; !relocs[i].last; i++) {
		if (!(rel = R_NEW0 (RBinReloc))) {
			free ((void *)relocs);
			r_list_free (ret);
			return NULL;
		}
		rel->type = R_BIN_RELOC_16;
		rel->vaddr = relocs[i].paddr;
		rel->paddr = relocs[i].paddr;
		r_list_append (ret, rel);
	}
	free ((void *)relocs);
	return ret;
}
开发者ID:ampotos,项目名称:radare2,代码行数:29,代码来源:bin_mz.c


示例5:

static RList *sections(RBinFile *arch) {
	RBinWasmObj *bin = arch && arch->o ? arch->o->bin_obj : NULL;
	RList *ret = NULL;
	RList *secs = NULL;
	RBinSection *ptr = NULL;
	RBinWasmSection *sec;

	if (!(ret = r_list_newf ((RListFree)free))) {
		return NULL;
	}
	if (!(secs = r_bin_wasm_get_sections (bin))) {
		r_list_free (ret);
		return NULL;
	}
	RListIter *iter;
	r_list_foreach (secs, iter, sec) {
		if (!(ptr = R_NEW0 (RBinSection))) {
			break;
		}
		strncpy (ptr->name, (char*)sec->name, R_BIN_SIZEOF_STRINGS);
		if (sec->id == R_BIN_WASM_SECTION_DATA || sec->id == R_BIN_WASM_SECTION_MEMORY) {
			ptr->is_data = true;
		}
		ptr->size = sec->payload_len;
		ptr->vsize = sec->payload_len;
		ptr->vaddr = sec->offset;
		ptr->paddr = sec->offset;
		ptr->add = true;
		// TODO permissions
		ptr->srwx = 0;
		r_list_append (ret, ptr);
	}
	return ret;
}
开发者ID:P4N74,项目名称:radare2,代码行数:34,代码来源:bin_wasm.c


示例6: calloc

static RList *parseSegments(RBuffer *buf, int off, int count) {
	ut8 *b = calloc (count, 32);
	(void)r_buf_read_at (buf, off, b, count * 32);
	int x = off;
	int X = 0;
	int i;
	RList *segments = r_list_newf ((RListFree)r_bin_section_free);
	if (!segments) {
		return NULL;
	}
	// eprintf ("Segments: %d\n", count);
	for (i = 0; i < count; i++) {
		int A = r_read_le32 (b + X + 16);
		int B = r_read_le32 (b + X + 16 + 8);
		//	eprintf ("0x%08x  segment  0x%08x 0x%08x  %s\n",
		//		x, A, A + B, b + X);
		const char *cname = (const char *)(b + X);
		char *name = r_str_ndup (cname, r_str_nlen (cname, 16));
		RBinSection *section = newSection (name, A, A + B, true);
		free (name);
		r_list_append (segments, section);
		x += 32;
		X += 32;
	}
	return segments;
}
开发者ID:aronsky,项目名称:radare2,代码行数:26,代码来源:bin_symbols.c


示例7: spaces_unset_single

static bool spaces_unset_single(RSpaces *sp, const char *name) {
	RSpace *space = r_spaces_get (sp, name);
	if (!space) {
		return false;
	}

	RSpaceEvent ev = { .data.unset.space = space };
	r_event_send (sp->event, R_SPACE_EVENT_UNSET, &ev);
	return r_rbtree_delete (&sp->spaces, (void *)name, name_space_cmp, space_node_free);
}

R_API bool r_spaces_unset(RSpaces *sp, const char *name) {
	if (name) {
		return spaces_unset_single (sp, name);
	}

	RList *names = r_list_newf ((RListFree)free);
	if (!names) {
		return false;
	}

	RBIter it;
	RSpace *s;
	r_spaces_foreach (sp, it, s) {
		r_list_append (names, strdup (s->name));
	}

	RListIter *lit;
	const char *n;
	bool res = false;
	r_list_foreach (names, lit, n) {
		res |= spaces_unset_single (sp, n);
	}
开发者ID:nmatt0,项目名称:radare2,代码行数:33,代码来源:spaces.c


示例8: build_str_list_from_iterable

static RList * build_str_list_from_iterable (RList *the_list) {
	RList * res = r_list_newf (free);
	DsoJsonObj *json_obj;
	RListIter *iter;
	r_list_foreach (the_list, iter, json_obj) {
		char *str = dso_json_obj_to_str (json_obj);
		r_list_append (res, str);
	}
开发者ID:dequis,项目名称:radare2,代码行数:8,代码来源:dsojson.c


示例9: r_buf_new

R_API RBuffer *r_buf_new_sparse() {
	RBuffer *b = r_buf_new ();
	if (!b) {
		return NULL;
	}
	b->sparse = r_list_newf ((RListFree)free);
	return b;
}
开发者ID:P4N74,项目名称:radare2,代码行数:8,代码来源:buf.c


示例10: xnu_dbg_maps

static RList *r_debug_native_modules_get (RDebug *dbg) {
	char *lastname = NULL;
	RDebugMap *map;
	RListIter *iter, *iter2;
	RList *list, *last;
	int must_delete;
#if __APPLE__
	list = xnu_dbg_maps (dbg, 1);
	if (list && !r_list_empty (list)) {
		return list;
	}
#endif
#if __WINDOWS__
	list = w32_dbg_modules (dbg);
	if (list && !r_list_empty (list)) {
		return list;
	}
#endif
	list = r_debug_native_map_get (dbg);
	if (!list) {
		return NULL;
	}
	last = r_list_newf ((RListFree)r_debug_map_free);
	if (!last) {
		r_list_free (list);
		return NULL;
	}
	r_list_foreach_safe (list, iter, iter2, map) {
		const char *file = map->file;
		if (!map->file) {
			file = map->file = strdup (map->name);
		}
		must_delete = 1;
		if (file && *file) {
			if (file[0] == '/') {
				if (lastname) {
					if (strcmp (lastname, file)) {
						must_delete = 0;
					}
				} else {
					must_delete = 0;
				}
			}
		}
		if (must_delete) {
			r_list_delete (list, iter);
		} else {
			r_list_append (last, map);
			free (lastname);
			lastname = strdup (file);
		}
	}
	list->free = NULL;
	free (lastname);
	r_list_free (list);
	return last;
}
开发者ID:Lukas-Dresel,项目名称:radare2,代码行数:57,代码来源:debug_native.c


示例11: entries

static RList* entries(RBinFile *arch) {
	RBinAddr *ptr = NULL;
	RList* ret = r_list_newf (free);
	if (!ret) return NULL;
	if ((ptr = R_NEW0 (RBinAddr))) {
		r_list_append (ret, ptr);
	}
	return ret;
}
开发者ID:Hyask,项目名称:radare2,代码行数:9,代码来源:bin_dyldcache.c


示例12: r_list_newf

R_API RList *r_syscall_list(RSyscall *s) {
	RList *list;
	if (!s || !s->db) {
		return NULL;
	}
	// show list of syscalls to stdout
	list = r_list_newf ((RListFree)r_syscall_item_free);
	sdb_foreach (s->db, callback_list, list);
	return list;
}
开发者ID:PankajKataria,项目名称:radare2,代码行数:10,代码来源:syscall.c


示例13: sections

static RList* sections(RBinFile *arch) {
	RList *ret = NULL;
	RBinSection *ptr = NULL;
	ut64 textsize, datasize, symssize, spszsize, pcszsize;
	ut64 entry0 = findEntry (arch->buf, 0);
	ut64 entry1 = findEntry (arch->buf, 1);
	ut64 entry2 = findEntry (arch->buf, 2);

	if (!(ret = r_list_newf (free))) {
		return NULL;
	}
	// add text segment
	textsize = r_mem_get_num (arch->buf->buf + 4, 4);
	if (!(ptr = R_NEW0 (RBinSection))) {
		return ret;
	}
	if (!entry1) {
		entry1 = arch->buf->length;
	}
	strncpy (ptr->name, "init", R_BIN_SIZEOF_STRINGS);
	ptr->size = entry1-entry0;
	ptr->vsize = entry1-entry0;
	ptr->paddr = entry0 + 4;
	ptr->vaddr = entry0;
	ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_EXECUTABLE | R_BIN_SCN_MAP; // r-x
	r_list_append (ret, ptr);

	if (entry1) {
		if (entry2) {
			if (!(ptr = R_NEW0 (RBinSection)))
				return ret;
			strncpy (ptr->name, "fini", R_BIN_SIZEOF_STRINGS);
			ptr->size = entry2-entry1;
			ptr->vsize = entry2-entry1;
			ptr->paddr = entry1 + 4;
			ptr->vaddr = entry1;
			ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_EXECUTABLE | R_BIN_SCN_MAP; // r-x
			r_list_append (ret, ptr);
		} else {
			entry2 = entry1;
		}
	}
	if (entry2) {
		if (!(ptr = R_NEW0 (RBinSection)))
			return ret;
		strncpy (ptr->name, "text", R_BIN_SIZEOF_STRINGS);
		ptr->size = arch->buf->length - entry2;
		ptr->vsize = arch->buf->length - entry2;
		ptr->paddr = entry2 + 4;
		ptr->vaddr = entry2;
		ptr->srwx = R_BIN_SCN_READABLE | R_BIN_SCN_EXECUTABLE | R_BIN_SCN_MAP; // r-x
		r_list_append (ret, ptr);
	}
	return ret;
}
开发者ID:P4N74,项目名称:radare2-extras,代码行数:55,代码来源:bin_bcl.c


示例14:

static RList *entries(RBinFile *arch) {
	struct r_bin_coff_obj *obj = (struct r_bin_coff_obj*)arch->o->bin_obj;
	RList *ret;
	RBinAddr *ptr = NULL;
	if (!(ret = r_list_newf (free))) {
		return NULL;
	}
	ptr = r_coff_get_entry(obj);
	r_list_append(ret, ptr);
	return ret;
}
开发者ID:lionaneesh,项目名称:radare2,代码行数:11,代码来源:bin_coff.c


示例15: r_list_newf

static RList *sections(RBinFile *arch) {
	char *tmp, *coffname = NULL;
	size_t i;
	RList *ret = NULL;
	RBinSection *ptr = NULL;
	struct r_bin_coff_obj *obj = (struct r_bin_coff_obj*)arch->o->bin_obj;

	ret = r_list_newf (free);
	if (!ret) {
		return NULL;
	}
	if (obj && obj->scn_hdrs) {
		for (i = 0; i < obj->hdr.f_nscns; i++) {
			free (coffname);
			tmp = r_coff_symbol_name (obj, &obj->scn_hdrs[i]);
			if (!tmp) {
				r_list_free (ret);
				return NULL;
			}
			//IO does not like sections with the same name append idx
			//since it will update it
			coffname = r_str_newf ("%s-%d", tmp, i);
			free (tmp); 
			ptr = R_NEW0 (RBinSection);
			if (!ptr) {
				free (coffname);
				return ret;
			}
			strncpy (ptr->name, coffname, R_BIN_SIZEOF_STRINGS);
			if (strstr (ptr->name, "data")) {
				ptr->is_data = true;
			}
			ptr->size = obj->scn_hdrs[i].s_size;
			ptr->vsize = obj->scn_hdrs[i].s_size;
			ptr->paddr = obj->scn_hdrs[i].s_scnptr;
			ptr->add = true;
			ptr->srwx = R_BIN_SCN_MAP;
			if (obj->scn_hdrs[i].s_flags & COFF_SCN_MEM_READ) {
				ptr->srwx |= R_BIN_SCN_READABLE;
			}
			if (obj->scn_hdrs[i].s_flags & COFF_SCN_MEM_WRITE) {
				ptr->srwx |= R_BIN_SCN_WRITABLE;
			}
			if (obj->scn_hdrs[i].s_flags & COFF_SCN_MEM_EXECUTE) {
				ptr->srwx |= R_BIN_SCN_EXECUTABLE;
			}
			r_list_append (ret, ptr);
		}
	}
	free (coffname);
	return ret;
}
开发者ID:lionaneesh,项目名称:radare2,代码行数:52,代码来源:bin_coff.c


示例16: r_list_newf

static RList *entries(RBinFile *bf) {
	RList /*<RBinAddr>*/ *ret = r_list_newf (free);
	if (!ret) {
		return NULL;
	}
	RBinAddr *ptr = R_NEW0 (RBinAddr);
	if (ptr) {
		ptr->paddr = N64_ROM_START;
		ptr->vaddr = baddr (bf);
		r_list_append (ret, ptr);
	}
	return ret;
}
开发者ID:radare,项目名称:radare2,代码行数:13,代码来源:bin_z64.c


示例17:

static RList *entries(RBinFile *bf) {
	RList *ret;
	RBinAddr *ptr = NULL;

	if (!(ret = r_list_newf (free))) {
		return NULL;
	}
	if (!(ptr = R_NEW0 (RBinAddr))) {
		return ret;
	}
	ptr->paddr = ptr->vaddr = 0;
	r_list_append (ret, ptr);
	return ret;
}
开发者ID:brainstorm,项目名称:radare2,代码行数:14,代码来源:bin_bf.c


示例18: strdup

static RList *imports(RBinFile *bf) {
	RBinWasmObj *bin = NULL;
	RList *imports = NULL;
	RBinImport *ptr = NULL;
	RList *ret = NULL;

	if (!bf || !bf->o || !bf->o->bin_obj) {
		return NULL;
	}
	bin = bf->o->bin_obj;
	if (!(ret = r_list_newf (r_bin_import_free))) {
		return NULL;
	}
	if (!(imports = r_bin_wasm_get_imports (bin))) {
		goto bad_alloc;
	}

	RBinWasmImportEntry *import = NULL;
	ut32 i = 0;
	RListIter *iter;
	r_list_foreach (imports, iter, import) {
		if (!(ptr = R_NEW0 (RBinImport))) {
			goto bad_alloc;
		}
		ptr->name = strdup (import->field_str);
		ptr->classname = strdup (import->module_str);
		ptr->ordinal = i;
		ptr->bind = r_str_const ("NONE");
		switch(import->kind) {
		case R_BIN_WASM_EXTERNALKIND_Function:
			ptr->type = r_str_const ("FUNC");
			break;
		case R_BIN_WASM_EXTERNALKIND_Table:
			ptr->type = r_str_const ("TABLE");
			break;
		case R_BIN_WASM_EXTERNALKIND_Memory:
			ptr->type = r_str_const ("MEM");
			break;
		case R_BIN_WASM_EXTERNALKIND_Global:
			ptr->type = r_str_const ("GLOBAL");
			break;
		}
		r_list_append (ret, ptr);
	}
	return ret;
bad_alloc:
	r_list_free (imports);
	r_list_free (ret);
	return NULL;
}
开发者ID:ampotos,项目名称:radare2,代码行数:50,代码来源:bin_wasm.c


示例19: r_list_newf

static RList *r_debug_native_map_get(RDebug *dbg) {
	RIOBdescbg *o = dbg->iob.io->desc->data;
	BfvmCPU *c = o->bfvm;
	RList *list = r_list_newf ((RListFree)r_debug_map_free);
	if (!list) return NULL;
	r_list_append (list, r_debug_map_new (
		"code", 0, 4096, 6, 0));
	r_list_append (list, r_debug_map_new (
		"memory", c->base, c->base+c->size, 6, 0));
	r_list_append (list, r_debug_map_new (
		"screen", c->screen, c->screen+c->screen_size, 6, 0));
	r_list_append (list, r_debug_map_new (
		"input", c->input, c->input+c->input_size, 6, 0));
	return list;
}
开发者ID:AmesianX,项目名称:radare2,代码行数:15,代码来源:debug_bf.c


示例20: entries

static RList * entries(RBinFile *bf) {
	RBinAddr *ptr = NULL;
	RList *res = NULL;
	if (!(res = r_list_newf (free))) {
		return NULL;
	}
	int entry = r_bin_mz_get_entrypoint (bf->o->bin_obj);
	if (entry >= 0) {
		if ((ptr = R_NEW0 (RBinAddr))) {
			ptr->paddr = (ut64) entry;
			ptr->vaddr = (ut64) entry;
			r_list_append (res, ptr);
		}
	}
	return res;
}
开发者ID:ampotos,项目名称:radare2,代码行数:16,代码来源:bin_mz.c



注:本文中的r_list_newf函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ r_log函数代码示例发布时间:2022-05-30
下一篇:
C++ r_list_new函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap