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

C++ r_config_get函数代码示例

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

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



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

示例1: config_asmbits_callback

static int config_asmbits_callback(void *user, void *data) {
	const char *asmos, *asmarch;
	RCore *core = (RCore *) user;
	RConfigNode *node = (RConfigNode *) data;
	int ret = r_asm_set_bits (core->assembler, node->i_value);
	if (ret == R_FALSE) {
		RAsmPlugin *h = core->assembler->cur;
		if (h) {
			eprintf ("Cannot set bits %"PFMT64d" to '%s'\n",
				node->i_value, h->name);
		} else {
			eprintf ("e asm.bits: Cannot set value, no plugins defined yet\n");
			ret = R_TRUE;
		}
	}
	if (!r_anal_set_bits (core->anal, node->i_value))
		eprintf ("asm.arch: Cannot setup '%i' bits analysis engine\n", (int)node->i_value);
	if (core->dbg  && core->anal && core->anal->cur)
		r_debug_set_arch (core->dbg, core->anal->cur->arch, node->i_value);

	asmos = r_config_get (core->config, "asm.os");
	asmarch = r_config_get (core->config, "asm.arch");
	if (core && core->anal)
	if (!r_syscall_setup (core->anal->syscall, asmarch,
			asmos, node->i_value)) {
		//eprintf ("asm.arch: Cannot setup syscall '%s/%s' from '%s'\n",
		//	node->value, asmos, R2_LIBDIR"/radare2/"R2_VERSION"/syscall");
	}
	return ret;
}
开发者ID:moon2l,项目名称:radare2,代码行数:30,代码来源:config.c


示例2: r_core_setup_debugger

R_API int r_core_setup_debugger (RCore *r, const char *debugbackend, bool attach) {
	int pid, *p = NULL;
	bool is_gdb = !strcmp (debugbackend, "gdb");
	RIODesc * fd = r->file ? r_io_desc_get (r->io, r->file->fd) : NULL;
	const char *prompt = NULL;

	p = fd ? fd->data : NULL;
	r_config_set_i (r->config, "cfg.debug", 1);
	if (!p) {
		eprintf ("Invalid debug io\n");
		return false;
	}

	r_config_set (r->config, "io.ff", "true");
	r_core_cmdf (r, "dL %s", debugbackend);
	if (!is_gdb) {
		pid = r_io_desc_get_pid (fd);
		r_core_cmdf (r, "dp=%d", pid);
		if (attach) {
			r_core_cmdf (r, "dpa %d", pid);
		}
	}
	//this makes to attach twice showing warnings in the output
	//we get "resource busy" so it seems isn't an issue
	r_core_cmd (r, ".dr*", 0);
	/* honor dbg.bep */
	{
		const char *bep = r_config_get (r->config, "dbg.bep");
		if (bep) {
			if (!strcmp (bep, "loader")) {
				/* do nothing here */
			} else if (!strcmp (bep, "entry")) {
				r_core_cmd (r, "dcu entry0", 0);
			} else {
				r_core_cmdf (r, "dcu %s", bep);
			}
		}
	}
	r_core_cmd (r, "sr PC", 0);

	/* set the prompt if it's not been set already by the callbacks */
	prompt = r_config_get (r->config, "cmd.prompt");
	if (prompt && !strcmp (prompt, "")) {
		if (r_config_get_i (r->config, "dbg.status")) {
			r_config_set (r->config, "cmd.prompt", ".dr*;drd;sr PC;pi 1;s-");
		} else {
			r_config_set (r->config, "cmd.prompt", ".dr*");
		}
	}
	r_config_set (r->config, "cmd.vprompt", ".dr*");
	return true;
}
开发者ID:f0829,项目名称:radare2,代码行数:52,代码来源:cio.c


示例3: textlog_chat

static int textlog_chat(RCore *core) {
	char prompt[64];
	char buf[1024];
	int lastmsg = 0;
	const char *me = r_config_get (core->config, "cfg.user");
	char msg[1024];

	eprintf ("Type '/help' for commands:\n");
	snprintf (prompt, sizeof (prompt) - 1, "[%s]> ", me);
	r_line_set_prompt (prompt);
	for (;;) {
		r_core_log_list (core, lastmsg, 0, 0);
		lastmsg = core->log->last;
		if (r_cons_fgets (buf, sizeof (buf) - 1, 0, NULL) < 0) {
			return 1;
		}
		if (!*buf) {
			continue;
		}
		if (!strcmp (buf, "/help")) {
			eprintf ("/quit           quit the chat (same as ^D)\n");
			eprintf ("/name <nick>    set cfg.user name\n");
			eprintf ("/log            show full log\n");
			eprintf ("/clear          clear text log messages\n");
		} else if (!strncmp (buf, "/name ", 6)) {
			snprintf (msg, sizeof (msg) - 1, "* '%s' is now known as '%s'", me, buf + 6);
			r_core_log_add (core, msg);
			r_config_set (core->config, "cfg.user", buf + 6);
			me = r_config_get (core->config, "cfg.user");
			snprintf (prompt, sizeof (prompt) - 1, "[%s]> ", me);
			r_line_set_prompt (prompt);
			return 0;
		} else if (!strcmp (buf, "/log")) {
			r_core_log_list (core, 0, 0, 0);
			return 0;
		} else if (!strcmp (buf, "/clear")) {
			// r_core_log_del (core, 0);
			r_core_cmd0 (core, "T-");
			return 0;
		} else if (!strcmp (buf, "/quit")) {
			return 0;
		} else if (*buf == '/') {
			eprintf ("Unknown command: %s\n", buf);
		} else {
			snprintf (msg, sizeof (msg) - 1, "[%s] %s", me, buf);
			r_core_log_add (core, msg);
		}
	}
	return 1;
}
开发者ID:XVilka,项目名称:radare2,代码行数:50,代码来源:cmd_log.c


示例4: readline_callback

static int readline_callback(void *_a, const char *str) {
	RCoreVisualAsm *a = _a;
	int xlen;
	r_cons_clear00 ();
	r_cons_printf ("Write your favourite %s-%d opcode...\n\n",
		r_config_get (a->core->config, "asm.arch"),
		r_config_get_i (a->core->config, "asm.bits"));
	if (*str == '?') {
		r_cons_printf ("0> ?\n\n"
			"Visual assembler help:\n\n"
			"  assemble input while typing using asm.arch, asm.bits and cfg.bigendian\n"
			"  press enter to quit (prompt if there are bytes to be written)\n"
			"  this assembler supports various directives like .hex ...\n"
			);
	} else {
		r_asm_code_free (a->acode);
		a->acode = r_asm_massemble (a->core->assembler, str);
		r_cons_printf ("%d> %s\n", a->acode? a->acode->len: 0, str);
		if (a->acode && a->acode->len)
			r_cons_printf ("* %s\n\n", a->acode->buf_hex);
		else r_cons_printf ("\n\n");
		if (a->acode) {
			xlen = strlen (a->acode->buf_hex);
			strcpy (a->codebuf, a->blockbuf);
			memcpy (a->codebuf, a->acode->buf_hex, xlen);
		}
		r_core_cmdf (a->core, "pd [email protected]:%s @0x%"PFMT64x, a->codebuf, a->off);
	}
	r_cons_flush ();
	return 1;
}
开发者ID:BatchDrake,项目名称:radare2,代码行数:31,代码来源:vasm.c


示例5: r_core_project_list

R_API int r_core_project_list(RCore *core, int mode) {
	RListIter *iter;
	RList *list;
	int isfirst = 1;
	char *foo, *path = r_file_abspath (r_config_get (core->config, "dir.projects"));
	if (!path)
		return 0;
	list = r_sys_dir (path);
	switch (mode) {
	case 'j':
		r_cons_printf ("[");
		r_list_foreach (list, iter, foo) {
			// todo. escape string
			if (r_core_is_project (core, foo)) {
				r_cons_printf ("%s\"%s\"",
					isfirst?"":",", foo);
				isfirst = 0;
			}
		}
		r_cons_printf ("]\n");
		break;
	default:
		r_list_foreach (list, iter, foo) {
			if (r_core_is_project (core, foo))
				r_cons_println (foo);
		}
		break;
	}
	r_list_free (list);
	free (path);
	return 0;
}
开发者ID:AmesianX,项目名称:radare2,代码行数:32,代码来源:project.c


示例6: cmd_project

static int cmd_project(void *data, const char *input) {
	RCore *core = (RCore *)data;
	const char *file, *arg = input+1;
	char *str = strdup (r_config_get (core->config, "file.project"));
	if (*arg==' ') arg++;
	file = input[1]?arg:str;
	switch (input[0]) {
	case 'o':
	//	if (r_file_is_regular (file))
		r_core_project_open (core, file);
		break;
	case 's':
		r_core_project_save (core, file);
		r_config_set (core->config, "file.project", file);
		break;
	case 'i':
//		if (r_file_is_regular (file))
		free (r_core_project_info (core, file));
		break;
	default:
		r_cons_printf (
		"|Usage: P[?osi] [file]\n"
		"| Po [file]  open project\n"
		"| Ps [file]  save project\n"
		"| Pi [file]  show project information\n"
		"|NOTE: See 'e file.project'\n"
		"|NOTE: project files are stored in ~/.config/radare2/rdb\n");
		break;
	}
	free (str);
	return R_TRUE;
}
开发者ID:Jo-Con-El,项目名称:radare2,代码行数:32,代码来源:cmd_project.c


示例7: r_core_hack

R_API int r_core_hack(RCore *core, const char *op) {
	bool (*hack)(RCore *core, const char *op, const RAnalOp *analop) = NULL;
	const char *asmarch = r_config_get (core->config, "asm.arch");
	const int asmbits = core->assembler->bits;

	if (!asmarch) {
		return false;
	}
	if (strstr (asmarch, "x86")) {
		hack = r_core_hack_x86;
	} else if (strstr (asmarch, "arm")) {
		if (asmbits == 64) {
			hack = r_core_hack_arm64;
		} else {
			hack = r_core_hack_arm;
		}
	} else {
		eprintf ("TODO: write hacks are only for x86\n");
	}
	if (hack) {
		RAnalOp analop;
		if (!r_anal_op (core->anal, &analop, core->offset, core->block, core->blocksize, R_ANAL_OP_MASK_ALL)) {
			eprintf ("anal op fail\n");
			return false;
		}
		return hack (core, op, &analop);
	}
	return false;
}
开发者ID:megabug,项目名称:radare2,代码行数:29,代码来源:hack.c


示例8: r_anal_hint_free

R_API RAnalHint *r_core_hint_begin (RCore *core, RAnalHint* hint, ut64 at) {
// XXX not here
	static char *hint_arch = NULL;
	static int hint_bits = 0;
	if (hint) {
		r_anal_hint_free (hint);
		hint = NULL;
	}
	hint = r_anal_hint_get (core->anal, at);
	if (hint_arch) {
		r_config_set (core->config, "asm.arch", hint_arch);
		hint_arch = NULL;
	}
	if (hint_bits) {
		r_config_set_i (core->config, "asm.bits", hint_bits);
		hint_bits = 0;
	}
	if (hint) {
		/* arch */
		if (hint->arch) {
			if (!hint_arch) hint_arch = strdup (
				r_config_get (core->config, "asm.arch"));
			r_config_set (core->config, "asm.arch", hint->arch);
		}
		/* bits */
		if (hint->bits) {
			if (!hint_bits) hint_bits =
				r_config_get_i (core->config, "asm.bits");
			r_config_set_i (core->config, "asm.bits", hint->bits);
		}
	}
	return hint;
}
开发者ID:0xroot,项目名称:radare2,代码行数:33,代码来源:disasm.c


示例9: strdup

static char *projectScriptPath(RCore *core, const char *file) {
	const char *magic = "# r2 rdb project file";
	char *data, *prjfile;
	if (r_file_is_abspath (file)) {
		prjfile = strdup (file);
	} else {
		if (!is_valid_project_name (file)) {
			return NULL;
		}
		prjfile = r_file_abspath (r_config_get (core->config, "dir.projects"));
		prjfile = r_str_append (prjfile, R_SYS_DIR);
		prjfile = r_str_append (prjfile, file);
		if (!r_file_exists (prjfile) || r_file_is_directory (prjfile)) {
			prjfile = r_str_append (prjfile, R_SYS_DIR "rc");
		}
	}
	data = r_file_slurp (prjfile, NULL);
	if (data) {
		if (strncmp (data, magic, strlen (magic))) {
			R_FREE (prjfile);
		}
	}
	free (data);
	return prjfile;
}
开发者ID:csarn,项目名称:radare2,代码行数:25,代码来源:project.c


示例10: visual_repeat

static void visual_repeat(RCore *core) {
	int atport = r_config_get_i (core->config, "scr.atport");
	if (atport) {
#if __UNIX__ && !__APPLE__
		int port = r_config_get_i (core->config, "http.port");
		if (!r_core_rtr_http (core, '&', NULL)) {
			const char *xterm = r_config_get (core->config, "cmd.xterm");
			// TODO: this must be configurable
			r_sys_cmdf ("%s 'r2 -C http://localhost:%d/cmd/V;sleep 1' &", xterm, port);
			//xterm -bg black -fg gray -e 'r2 -C http://localhost:%d/cmd/;sleep 1' &", port);
		} else {
			r_cons_any_key (NULL);
		}
#else
		eprintf ("Unsupported on this platform\n");
		r_cons_any_key (NULL);
#endif
	} else {
		RThread *th = r_th_new (visual_repeat_thread, core, 0);
		r_th_start (th, 1);
		r_cons_break (NULL, NULL);
		r_cons_any_key (NULL);
		eprintf ("^C  \n");
		core->cons->breaked = true;
		r_th_wait (th);
		r_cons_break_end ();
	}
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:28,代码来源:visual.c


示例11: r_core_visual_hud

R_API int r_core_visual_hud(RCore *core) {
	const char *c = r_config_get (core->config, "hud.path");
	const char *f = R2_LIBDIR"/radare2/"R2_VERSION"/hud/main";
	char *homehud = r_str_home (R2_HOMEDIR"/hud");
	char *res = NULL;
	char *p = 0;

	showcursor (core, true);
	if (c && *c && r_file_exists (c))
		res = r_cons_hud_file (c);
	if (!res && homehud)
		res = r_cons_hud_file (homehud);
	if (!res && r_file_exists (f))
		res = r_cons_hud_file (f);
	if (!res)
		r_cons_message ("Cannot find hud file");

	r_cons_clear ();
	if (res) {
		p = strchr (res, '\t');
		r_cons_printf ("%s\n", res);
		r_cons_flush ();
		if (p) r_core_cmd0 (core, p+1);
		free (res);
	}
	showcursor (core, false);
	r_cons_flush ();
	free (homehud);
	return (int)(size_t)p;
}
开发者ID:xuwenbo,项目名称:radare2,代码行数:30,代码来源:visual.c


示例12: cmd_project

/* radare - LGPL - Copyright 2009-2012 // pancake<nopcode.org> */
static int cmd_project(void *data, const char *input) {
    RCore *core = (RCore *)data;
    const char *arg = input+1;
    char *str = strdup (r_config_get (core->config, "file.project"));
    if (*arg==' ') arg++;
    switch (input[0]) {
    case 'o':
        r_core_project_open (core, input[1]?arg:str);
        break;
    case 's':
        r_core_project_save (core, input[1]?arg:str);
        break;
    case 'i':
        free (r_core_project_info (core, input[1]?arg:str));
        break;
    default:
        r_cons_printf (
            "Usage: P[?osi] [file]\n"
            " Po [file]  open project\n"
            " Ps [file]  save project\n"
            " Pi [file]  info\n"
            "NOTE: project files are stored in ~/.radare2/rdb\n");
        break;
    }
    free (str);
    return R_TRUE;
}
开发者ID:Rogunix,项目名称:radare2,代码行数:28,代码来源:cmd_project.c


示例13: r_core_project_init

static int r_core_project_init(RCore *core) {
	char *prjdir = r_file_abspath (r_config_get (
		core->config, "dir.projects"));
	int ret = r_sys_rmkdir (prjdir);
	if (!ret) eprintf ("Cannot mkdir dir.projects\n");
	free (prjdir);
	return ret;
}
开发者ID:CodingFree,项目名称:radare2,代码行数:8,代码来源:project.c


示例14: config_asmos_callback

static int config_asmos_callback(void *user, void *data) {
	RCore *core = (RCore*) user;
	RConfigNode *node = (RConfigNode*) data;
	r_syscall_setup (core->anal->syscall, 
			r_config_get (core->config, "asm.arch"),
			node->value, core->anal->bits);
	//if (!ret) eprintf ("asm.os: Cannot setup syscall os/arch for '%s'\n", node->value);
	return R_TRUE;
}
开发者ID:moon2l,项目名称:radare2,代码行数:9,代码来源:config.c


示例15: objc_analyze

static void objc_analyze(RCore *core) {
	eprintf ("[+] Analyzing searching references to selref\n");
	r_core_cmd0 (core, "aar");
	if (!strcmp ("arm", r_config_get (core->config, "asm.arch"))) {
		bool emu_lazy = r_config_get_i (core->config, "emu.lazy");
		r_config_set_i (core->config, "emu.lazy", true);
		r_core_cmd0 (core, "aae");
		r_config_set_i (core->config, "emu.lazy", emu_lazy);
	}
}
开发者ID:aronsky,项目名称:radare2,代码行数:10,代码来源:anal_objc.c


示例16: r_core_debug_breakpoint_hit

static void r_core_debug_breakpoint_hit(RCore *core, RBreakpointItem *bpi) {
	const char *cmdbp;
	int oecho = core->cons->echo; // should be configurable by user?
	core->cons->echo = 1; // should be configurable by user?
	cmdbp = r_config_get (core->config, "cmd.bp");
	if (cmdbp && *cmdbp)
		r_core_cmd0 (core, cmdbp);
	r_core_cmd0 (core, bpi->data);
	core->cons->echo = oecho;
}
开发者ID:0x2F,项目名称:radare2,代码行数:10,代码来源:core.c


示例17: objc_analyze

static void objc_analyze(RCore *core) {
	static const char *oldstr = NULL;
	oldstr = r_print_rowlog (core->print, "Analyzing searching references to selref");
	r_core_cmd0 (core, "aar");
	if (!strcmp ("arm", r_config_get (core->config, "asm.arch"))) {
		bool emu_lazy = r_config_get_i (core->config, "emu.lazy");
		r_config_set_i (core->config, "emu.lazy", true);
		r_core_cmd0 (core, "aae");
		r_config_set_i (core->config, "emu.lazy", emu_lazy);
	}
	r_print_rowlog_done (core->print, oldstr);
}
开发者ID:l4l,项目名称:radare2,代码行数:12,代码来源:anal_objc.c


示例18: on_fcn_delete

static int on_fcn_delete (void *_anal, void* _user, RAnalFunction *fcn) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.delete");
	if (cmd && *cmd) {
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:12,代码来源:core.c


示例19: on_fcn_rename

static int on_fcn_rename(void *_anal, void* _user, RAnalFunction *fcn, const char *oname) {
	RCore *core = (RCore*)_user;
	const char *cmd = r_config_get (core->config, "cmd.fcn.rename");
	if (cmd && *cmd) {
// XXX: wat do with old name here?
		ut64 oaddr = core->offset;
		ut64 addr = fcn->addr;
		r_core_seek (core, addr, 1);
		r_core_cmd0 (core, cmd);
		r_core_seek (core, oaddr, 1);
	}
	return 0;
}
开发者ID:0x2F,项目名称:radare2,代码行数:13,代码来源:core.c


示例20: r_core_loadlibs

R_API int r_core_loadlibs(struct r_core_t *core) {
	/* TODO: all those default plugin paths should be defined in r_lib */
	char *homeplugindir = r_str_home (R2_HOMEDIR"/plugins");
	core->lib = r_lib_new ("radare_plugin");
	r_core_loadlibs_init (core);
	r_lib_opendir (core->lib, r_config_get (core->config, "dir.plugins"));
	r_lib_opendir (core->lib, getenv (R_LIB_ENV));
	// !!!! // r_lib_opendir (core->lib, ".");
	r_lib_opendir (core->lib, homeplugindir);
	r_lib_opendir (core->lib, R2_LIBDIR"/radare2/");
	free (homeplugindir);
	return R_TRUE;
}
开发者ID:BatchDrake,项目名称:radare2,代码行数:13,代码来源:libs.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ r_config_get_i函数代码示例发布时间:2022-05-30
下一篇:
C++ r_cnjg函数代码示例发布时间: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