1 /* radare - LGPL - Copyright 2009-2021 - pancake */ 2 3 #ifndef R2_CORE_H 4 #define R2_CORE_H 5 6 #include <r_main.h> 7 #include "r_socket.h" 8 #include "r_types.h" 9 #include "r_magic.h" 10 #include "r_agraph.h" 11 #include "r_io.h" 12 #include "r_fs.h" 13 #include "r_lib.h" 14 #include "r_diff.h" 15 #include "r_egg.h" 16 #include "r_lang.h" 17 #include "r_asm.h" 18 #include "r_parse.h" 19 #include "r_anal.h" 20 #include "r_cmd.h" 21 #include "r_cons.h" 22 #include "r_search.h" 23 #include "r_sign.h" 24 #include "r_debug.h" 25 #include "r_flag.h" 26 #include "r_config.h" 27 #include "r_bin.h" 28 #include "r_hash.h" 29 #include "r_util.h" 30 #include "r_util/r_print.h" 31 #include "r_crypto.h" 32 #include "r_bind.h" 33 #include "r_util/r_annotated_code.h" 34 35 #ifdef __cplusplus 36 extern "C" { 37 #endif 38 R_LIB_VERSION_HEADER(r_core); 39 40 #define R_CORE_CMD_OK 0 41 #define R_CORE_CMD_INVALID -1 42 #define R_CORE_CMD_EXIT -2 43 44 #define R_CORE_BLOCKSIZE 0x100 45 #define R_CORE_BLOCKSIZE_MAX 0x3200000 /* 32MB */ 46 47 #define R_CORE_ANAL_GRAPHLINES 1 48 #define R_CORE_ANAL_GRAPHBODY 2 49 #define R_CORE_ANAL_GRAPHDIFF 4 50 #define R_CORE_ANAL_JSON 8 51 #define R_CORE_ANAL_KEYVALUE 16 52 #define R_CORE_ANAL_JSON_FORMAT_DISASM 32 53 #define R_CORE_ANAL_STAR 64 54 55 #define R_FLAGS_FS_CLASSES "classes" 56 #define R_FLAGS_FS_FUNCTIONS "functions" 57 #define R_FLAGS_FS_IMPORTS "imports" 58 #define R_FLAGS_FS_RELOCS "relocs" 59 #define R_FLAGS_FS_REGISTERS "registers" 60 #define R_FLAGS_FS_RESOURCES "resources" 61 #define R_FLAGS_FS_SECTIONS "sections" 62 #define R_FLAGS_FS_SEGMENTS "segments" 63 #define R_FLAGS_FS_SIGNS "sign" 64 #define R_FLAGS_FS_STRINGS "strings" 65 #define R_FLAGS_FS_SYMBOLS "symbols" 66 #define R_FLAGS_FS_SYMBOLS_SECTIONS "symbols.sections" 67 #define R_FLAGS_FS_SYSCALLS "syscalls" 68 69 #define R_GRAPH_FORMAT_NO 0 70 #define R_GRAPH_FORMAT_GMLFCN 1 71 #define R_GRAPH_FORMAT_JSON 2 72 #define R_GRAPH_FORMAT_GML 3 73 #define R_GRAPH_FORMAT_DOT 4 74 #define R_GRAPH_FORMAT_CMD 5 75 76 /// 77 #define R_CONS_COLOR_DEF(x, def) ((core->cons && core->cons->context->pal.x)? core->cons->context->pal.x: def) 78 #define R_CONS_COLOR(x) R_CONS_COLOR_DEF (x, "") 79 80 /* rtr */ 81 #define RTR_PROTOCOL_RAP 0 82 #define RTR_PROTOCOL_TCP 1 83 #define RTR_PROTOCOL_UDP 2 84 #define RTR_PROTOCOL_HTTP 3 85 #define RTR_PROTOCOL_UNIX 4 86 87 #define RTR_MAX_HOSTS 255 88 89 /* visual mode */ 90 typedef enum { 91 R_CORE_VISUAL_MODE_PX = 0, 92 R_CORE_VISUAL_MODE_PD = 1, 93 R_CORE_VISUAL_MODE_DB = 2, 94 R_CORE_VISUAL_MODE_OV = 3, 95 R_CORE_VISUAL_MODE_CD = 4 96 } RCoreVisualMode; 97 98 /* 99 #define R_CORE_VISUAL_MODE_PC 4 100 #define R_CORE_VISUAL_MODE_PXA 5 101 #define R_CORE_VISUAL_MODE_PSS 6 102 #define R_CORE_VISUAL_MODE_PRC 7 103 #define R_CORE_VISUAL_MODE_PXa 8 104 #define R_CORE_VISUAL_MODE_PXR 9 105 */ 106 107 typedef struct r_core_rtr_host_t { 108 int proto; 109 char host[512]; 110 int port; 111 char file[1024]; 112 RSocket *fd; 113 } RCoreRtrHost; 114 115 typedef struct r_core_undo_t { 116 char *action; 117 char *revert; 118 ut64 tstamp; 119 ut64 offset; 120 } RCoreUndo; 121 122 typedef enum { 123 AUTOCOMPLETE_DEFAULT, 124 AUTOCOMPLETE_MS 125 } RAutocompleteType; 126 127 typedef struct { 128 ut64 addr; 129 const char *glob; 130 ut64 minstamp; 131 } RCoreUndoCondition; 132 133 typedef struct r_core_log_t { 134 int first; 135 int last; 136 RStrpool *sp; 137 } RCoreLog; 138 139 typedef struct r_core_times_t { 140 ut64 loadlibs_init_time; 141 ut64 loadlibs_time; 142 ut64 file_open_time; 143 } RCoreTimes; 144 145 #define R_CORE_ASMQJMPS_NUM 10 146 #define R_CORE_ASMQJMPS_LETTERS 26 147 #define R_CORE_ASMQJMPS_MAX_LETTERS (26 * 26 * 26 * 26 * 26) 148 #define R_CORE_ASMQJMPS_LEN_LETTERS 5 149 150 typedef enum r_core_autocomplete_types_t { 151 R_CORE_AUTOCMPLT_DFLT = 0, 152 R_CORE_AUTOCMPLT_FLAG, 153 R_CORE_AUTOCMPLT_FLSP, 154 R_CORE_AUTOCMPLT_SEEK, 155 R_CORE_AUTOCMPLT_FCN, 156 R_CORE_AUTOCMPLT_ZIGN, 157 R_CORE_AUTOCMPLT_EVAL, 158 R_CORE_AUTOCMPLT_PRJT, 159 R_CORE_AUTOCMPLT_MINS, 160 R_CORE_AUTOCMPLT_BRKP, 161 R_CORE_AUTOCMPLT_MACR, 162 R_CORE_AUTOCMPLT_FILE, 163 R_CORE_AUTOCMPLT_THME, 164 R_CORE_AUTOCMPLT_OPTN, 165 R_CORE_AUTOCMPLT_MS, 166 R_CORE_AUTOCMPLT_SDB, 167 // --- left as last always 168 R_CORE_AUTOCMPLT_END, 169 } RCoreAutocompleteType; 170 171 typedef struct r_core_autocomplete_t { 172 const char* cmd; 173 int length; 174 int n_subcmds; 175 bool locked; 176 int type; 177 struct r_core_autocomplete_t** subcmds; 178 } RCoreAutocomplete; 179 180 typedef struct r_core_visual_tab_t { 181 int printidx; 182 ut64 offset; 183 bool cur_enabled; 184 int cur; 185 int ocur; 186 int cols; 187 int disMode; 188 int hexMode; 189 int asm_offset; 190 int asm_instr; 191 int asm_indent; 192 int asm_bytes; 193 int asm_cmt_col; 194 int printMode; 195 int current3format; 196 int current4format; 197 int current5format; 198 int dumpCols; 199 char name[32]; // XXX leak because no r_core_visual_tab_free 200 // TODO: cursor and such 201 } RCoreVisualTab; 202 // #define RCoreVisualTab Tab 203 204 typedef struct r_core_visual_t { 205 RList *tabs; 206 int tab; 207 } RCoreVisual; 208 // #define RCoreVisual Visual 209 210 typedef struct { 211 int x; 212 int y; 213 int w; 214 int h; 215 char *cmd; 216 } RCoreGadget; 217 218 R_API void r_core_gadget_free (RCoreGadget *g); 219 220 typedef struct r_core_tasks_t { 221 int task_id_next; 222 RList *tasks; 223 RList *tasks_queue; 224 RList *oneshot_queue; 225 int oneshots_enqueued; 226 struct r_core_task_t *current_task; 227 struct r_core_task_t *main_task; 228 RThreadLock *lock; 229 int tasks_running; 230 bool oneshot_running; 231 } RCoreTaskScheduler; 232 233 typedef struct r_core_project_t { 234 char *name; 235 char *path; 236 } RProject; 237 238 R_API RProject *r_project_new(void); 239 R_API bool r_project_rename(RProject *p, const char *newname); 240 R_API bool r_project_is_git(RProject *p); 241 R_API void r_project_close(RProject *p); 242 R_API bool r_project_open(RProject *p, const char *prjname, const char *path); 243 R_API void r_project_save(RProject *p); 244 R_API void r_project_free(RProject *p); 245 R_API bool r_project_is_loaded(RProject *p); 246 247 struct r_core_t { 248 RBin *bin; 249 RConfig *config; 250 RProject *prj; 251 ut64 offset; // current seek 252 ut64 prompt_offset; // temporarily set to offset to have $$ in expressions always stay the same during temp seeks 253 ut32 blocksize; 254 ut32 blocksize_max; 255 ut8 *block; 256 RBuffer *yank_buf; 257 ut64 yank_addr; 258 bool tmpseek; 259 bool vmode; 260 int interrupted; // XXX IS THIS DUPPED SOMEWHERE? 261 /* files */ 262 RCons *cons; 263 RIO *io; 264 RNum *num; 265 ut64 rc; // command's return code .. related to num->value; 266 RLib *lib; 267 RCmd *rcmd; 268 RCmdDescriptor root_cmd_descriptor; 269 RList/*<RCmdDescriptor>*/ *cmd_descriptors; 270 RAnal *anal; 271 RAsm *rasm; 272 /* ^^ */ 273 RCoreTimes *times; 274 RParse *parser; 275 RPrint *print; 276 RLang *lang; 277 RDebug *dbg; 278 RFlag *flags; 279 RSearch *search; 280 RFS *fs; 281 RFSShell *rfs; 282 REgg *egg; 283 RCoreLog *log; 284 RAGraph *graph; 285 RPanelsRoot *panels_root; 286 RPanels* panels; 287 char *cmdqueue; 288 char *lastcmd; 289 char *cmdlog; 290 bool cfglog; // cfg.corelog 291 int cmdrepeat; // cmd.repeat 292 const char *cmdtimes; // cmd.times 293 R_DEPRECATE bool cmd_in_backticks; // whether currently executing a cmd out of backticks 294 int rtr_n; 295 RCoreRtrHost rtr_host[RTR_MAX_HOSTS]; 296 ut64 *asmqjmps; 297 int asmqjmps_count; 298 int asmqjmps_size; 299 bool is_asmqjmps_letter; 300 bool keep_asmqjmps; 301 RCoreVisual visual; 302 // visual // TODO: move them into RCoreVisual 303 int http_up; 304 int gdbserver_up; 305 RCoreVisualMode printidx; 306 char *stkcmd; 307 bool in_search; 308 RList *watchers; 309 RList *scriptstack; 310 RCoreTaskScheduler tasks; 311 int max_cmd_depth; 312 ut8 switch_file_view; 313 Sdb *sdb; 314 int incomment; 315 int curtab; // current tab 316 int seltab; // selected tab 317 char *cmdremote; 318 char *lastsearch; 319 char *cmdfilter; 320 bool break_loop; 321 RList *undos; 322 bool binat; 323 bool fixedbits; // will be true when using @b: 324 bool fixedarch; // will be true when using @a: 325 bool fixedblock; 326 char *table_query; 327 int sync_index; // used for http.sync and T= 328 struct r_core_t *c2; 329 RTable *table; 330 RCoreAutocomplete *autocomplete; 331 int autocomplete_type; 332 int maxtab; 333 REvent *ev; 334 RList *gadgets; 335 bool scr_gadgets; 336 bool log_events; // core.c:cb_event_handler : log actions from events if cfg.log.events is set 337 RList *ropchain; 338 bool use_tree_sitter_r2cmd; 339 char *theme; 340 bool marks_init; 341 ut64 marks[UT8_MAX + 1]; 342 343 RMainCallback r_main_radare2; 344 // int (*r_main_radare2)(int argc, char **argv); 345 int (*r_main_rafind2)(int argc, const char **argv); 346 int (*r_main_radiff2)(int argc, const char **argv); 347 int (*r_main_rabin2)(int argc, const char **argv); 348 int (*r_main_rarun2)(int argc, const char **argv); 349 int (*r_main_ragg2)(int argc, const char **argv); 350 int (*r_main_rasm2)(int argc, const char **argv); 351 int (*r_main_rax2)(int argc, const char **argv); 352 }; 353 354 // maybe move into RAnal 355 typedef struct r_core_item_t { 356 const char *type; 357 ut64 addr; 358 ut64 next; 359 ut64 prev; 360 int size; 361 int perm; 362 char *data; 363 char *comment; 364 char *sectname; 365 char *fcnname; 366 } RCoreItem; 367 368 R_API RCoreItem *r_core_item_at(RCore *core, ut64 addr); 369 R_API void r_core_item_free(RCoreItem *ci); 370 371 R_API int r_core_bind(RCore *core, RCoreBind *bnd); 372 373 typedef struct r_core_cmpwatch_t { 374 ut64 addr; 375 int size; 376 char cmd[32]; 377 ut8 *odata; 378 ut8 *ndata; 379 } RCoreCmpWatcher; 380 381 typedef int (*RCoreSearchCallback)(RCore *core, ut64 from, ut8 *buf, int len); 382 383 #ifdef R_API 384 //#define r_core_ncast(x) (RCore*)(size_t)(x) 385 R_API RList *r_core_list_themes(RCore *core); 386 R_API char *r_core_get_theme(RCore *core); 387 R_API const char *r_core_get_section_name(RCore *core, ut64 addr); 388 R_API RCons *r_core_get_cons(RCore *core); 389 R_API RBin *r_core_get_bin(RCore *core); 390 R_API RConfig *r_core_get_config (RCore *core); 391 R_API bool r_core_init(RCore *core); 392 R_API void r_core_bind_cons(RCore *core); // to restore pointers in cons 393 R_API RCore *r_core_new(void); 394 R_API void r_core_free(RCore *core); 395 R_API void r_core_fini(RCore *c); 396 R_API void r_core_wait(RCore *core); 397 R_API RCore *r_core_ncast(ut64 p); 398 R_API RCore *r_core_cast(void *p); 399 R_API bool r_core_bin_load_structs(RCore *core, const char *file); 400 R_API int r_core_config_init(RCore *core); 401 R_API void r_core_config_update(RCore *core); 402 R_API void r_core_parse_radare2rc(RCore *r); 403 R_API int r_core_prompt(RCore *core, int sync); 404 R_API int r_core_prompt_exec(RCore *core); 405 R_API int r_core_lines_initcache (RCore *core, ut64 start_addr, ut64 end_addr); 406 R_API int r_core_lines_currline (RCore *core); 407 R_API void r_core_prompt_loop(RCore *core); 408 R_API ut64 r_core_pava(RCore *core, ut64 addr); 409 R_API int r_core_cmd(RCore *core, const char *cmd, bool log); 410 R_API int r_core_cmd_task_sync(RCore *core, const char *cmd, bool log); 411 R_API char *r_core_editor(const RCore *core, const char *file, const char *str); 412 R_API int r_core_fgets(char *buf, int len); 413 R_API RFlagItem *r_core_flag_get_by_spaces(RFlag *f, ut64 off); 414 R_API int r_core_cmdf(RCore *core, const char *fmt, ...) R_PRINTF_CHECK(2, 3); 415 R_API int r_core_flush(RCore *core, const char *cmd); 416 R_API int r_core_cmd0(RCore *core, const char *cmd); 417 R_API void r_core_cmd_init(RCore *core); 418 R_API int r_core_cmd_pipe(RCore *core, char *radare_cmd, char *shell_cmd); 419 R_API char *r_core_cmd_str(RCore *core, const char *cmd); 420 R_API char *r_core_cmd_strf(RCore *core, const char *fmt, ...) R_PRINTF_CHECK(2, 3); 421 R_API char *r_core_cmd_str_pipe(RCore *core, const char *cmd); 422 R_API int r_core_cmd_file(RCore *core, const char *file); 423 R_API int r_core_cmd_lines(RCore *core, const char *lines); 424 R_API int r_core_cmd_command(RCore *core, const char *command); 425 R_API bool r_core_run_script (RCore *core, const char *file); 426 R_API bool r_core_seek(RCore *core, ut64 addr, bool rb); 427 R_API bool r_core_visual_bit_editor(RCore *core); 428 R_API int r_core_seek_base (RCore *core, const char *hex); 429 R_API void r_core_seek_previous (RCore *core, const char *type); 430 R_API void r_core_seek_next (RCore *core, const char *type); 431 R_API int r_core_seek_align(RCore *core, ut64 align, int count); 432 R_API void r_core_arch_bits_at(RCore *core, ut64 addr, R_OUT R_NULLABLE int *bits, R_OUT R_BORROW R_NULLABLE const char **arch); 433 R_API void r_core_seek_arch_bits(RCore *core, ut64 addr); 434 R_API int r_core_block_read(RCore *core); 435 R_API int r_core_block_size(RCore *core, int bsize); 436 R_API int r_core_seek_size(RCore *core, ut64 addr, int bsize); 437 R_API int r_core_is_valid_offset (RCore *core, ut64 offset); 438 R_API int r_core_shift_block(RCore *core, ut64 addr, ut64 b_size, st64 dist); 439 R_API void r_core_autocomplete(R_NULLABLE RCore *core, RLineCompletion *completion, RLineBuffer *buf, RLinePromptType prompt_type); 440 R_API void r_core_print_scrollbar(RCore *core); 441 R_API void r_core_print_scrollbar_bottom(RCore *core); 442 R_API void r_core_visual_prompt_input (RCore *core); 443 R_API void r_core_visual_toggle_decompiler_disasm(RCore *core, bool for_graph, bool reset); 444 R_API void r_core_visual_applyDisMode(RCore *core, int disMode); 445 R_API void r_core_visual_applyHexMode(RCore *core, int hexMode); 446 R_API int r_core_visual_refs(RCore *core, bool xref, bool fcnInsteadOfAddr); 447 R_API void r_core_visual_append_help(RStrBuf *p, const char *title, const char **help); 448 R_API bool r_core_prevop_addr(RCore* core, ut64 start_addr, int numinstrs, ut64* prev_addr); 449 R_API ut64 r_core_prevop_addr_force(RCore *core, ut64 start_addr, int numinstrs); 450 R_API bool r_core_visual_hudstuff(RCore *core); 451 R_API int r_core_visual_classes(RCore *core); 452 R_API int r_core_visual_anal_classes(RCore *core); 453 R_API int r_core_visual_types(RCore *core); 454 R_API int r_core_visual(RCore *core, const char *input); 455 R_API int r_core_visual_graph(RCore *core, RAGraph *g, RAnalFunction *_fcn, int is_interactive); 456 R_API void r_core_visual_browse(RCore *core, const char *arg); 457 R_API int r_core_visual_cmd(RCore *core, const char *arg); 458 R_API void r_core_visual_seek_animation (RCore *core, ut64 addr); 459 R_API void r_core_visual_asm(RCore *core, ut64 addr); 460 R_API void r_core_visual_colors(RCore *core); 461 R_API int r_core_visual_xrefs_x(RCore *core); 462 R_API int r_core_visual_xrefs_X(RCore *core); 463 R_API void r_core_visual_showcursor(RCore *core, int x); 464 R_API void r_core_visual_offset(RCore *core); 465 R_API int r_core_visual_hud(RCore *core); 466 R_API void r_core_visual_jump(RCore *core, ut8 ch); 467 R_API void r_core_visual_disasm_up(RCore *core, int *cols); 468 R_API void r_core_visual_disasm_down(RCore *core, RAsmOp *op, int *cols); 469 R_API RBinReloc *r_core_getreloc(RCore *core, ut64 addr, int size); 470 R_API ut64 r_core_get_asmqjmps(RCore *core, const char *str); 471 R_API void r_core_set_asmqjmps(RCore *core, char *str, size_t len, int i); 472 R_API char* r_core_add_asmqjmp(RCore *core, ut64 addr); 473 474 // core/panels.c 475 R_API bool r_core_panels_root(RCore *core, RPanelsRoot *panels_root); 476 R_API void r_core_panels_save(RCore *core, const char *_name); 477 R_API bool r_core_panels_load(RCore *core, const char *_name); 478 479 R_API void r_core_anal_type_init(RCore *core); 480 R_API char *r_core_anal_hasrefs_to_depth(RCore *core, ut64 value, PJ *pj, int depth); 481 R_API void r_core_link_stroff(RCore *core, RAnalFunction *fcn); 482 R_API void r_core_anal_inflags (RCore *core, const char *glob); 483 R_API bool cmd_anal_objc (RCore *core, const char *input, bool auto_anal); 484 R_API void r_core_anal_cc_init(RCore *core); 485 R_API void r_core_anal_paths(RCore *core, ut64 from, ut64 to, bool followCalls, int followDepth, bool is_json); 486 487 R_API void r_core_list_io(RCore *core); 488 R_API RListInfo *r_listinfo_new (const char *name, RInterval pitv, RInterval vitv, int perm, const char *extra); 489 R_API void r_listinfo_free (RListInfo *info); 490 /* visual marks */ 491 R_API void r_core_visual_mark_seek(RCore *core, ut8 ch); 492 R_API void r_core_visual_mark(RCore *core, ut8 ch); 493 R_API void r_core_visual_mark_set(RCore *core, ut8 ch, ut64 addr); 494 R_API void r_core_visual_mark_del(RCore *core, ut8 ch); 495 R_API bool r_core_visual_mark_dump(RCore *core); 496 R_API void r_core_visual_mark_reset(RCore *core); 497 498 R_API int r_core_search_cb(RCore *core, ut64 from, ut64 to, RCoreSearchCallback cb); 499 R_API bool r_core_serve(RCore *core, RIODesc *fd); 500 501 // RCoreFile APIs (bind, riodesc + rbinfile) 502 R_API bool r_core_file_reopen(RCore *core, const char *args, int perm, int binload); 503 R_API void r_core_file_reopen_debug(RCore *core, const char *args); 504 R_API void r_core_file_reopen_remote_debug(RCore *core, char *uri, ut64 addr); 505 R_API RIODesc *r_core_file_open(RCore *core, const char *file, int flags, ut64 loadaddr); 506 R_API RIODesc *r_core_file_open_many(RCore *r, const char *file, int flags, ut64 loadaddr); 507 R_API bool r_core_file_close_all_but(RCore *core); 508 509 510 R_API int r_core_setup_debugger (RCore *r, const char *debugbackend, bool attach); 511 R_API int r_core_seek_delta(RCore *core, st64 addr); 512 R_API bool r_core_extend_at(RCore *core, ut64 addr, int size); 513 R_API bool r_core_write_at(RCore *core, ut64 addr, const ut8 *buf, int size); 514 R_API int r_core_write_op(RCore *core, const char *arg, char op); 515 R_API ut8* r_core_transform_op(RCore *core, const char *arg, char op); 516 R_API int r_core_set_file_by_fd (RCore * core, ut64 bin_fd); 517 R_API int r_core_set_file_by_name (RBin * bin, const char * name); 518 519 R_API void r_core_debug_rr (RCore *core, RReg *reg, int mode); 520 521 /* fortune */ 522 R_API void r_core_fortune_list_types(void); 523 R_API void r_core_fortune_list(RCore *core); 524 R_API void r_core_fortune_print_random(RCore *core); 525 526 /* project */ 527 #if 0 528 R_API bool r_core_project_load(RCore *core, const char *prjfile, const char *rcfile); 529 R_API RThread *r_core_project_load_bg(RCore *core, const char *prjfile, const char *rcfile); 530 #endif 531 R_API void r_core_project_execute_cmds(RCore *core, const char *prjfile); 532 533 #define R_CORE_FOREIGN_ADDR -1 534 R_API int r_core_yank(RCore *core, ut64 addr, int len); 535 R_API int r_core_yank_string(RCore *core, ut64 addr, int maxlen); 536 R_API bool r_core_yank_hexpair(RCore *core, const char *input); 537 R_API int r_core_yank_paste(RCore *core, ut64 addr, int len); 538 R_API int r_core_yank_set (RCore *core, ut64 addr, const ut8 *buf, ut32 len); // set yank buffer bytes 539 R_API int r_core_yank_set_str (RCore *core, ut64 addr, const char *buf, ut32 len); // Null terminate the bytes 540 R_API int r_core_yank_to(RCore *core, const char *arg); 541 R_API bool r_core_yank_dump (RCore *core, ut64 pos, int format); 542 R_API int r_core_yank_hexdump (RCore *core, ut64 pos); 543 R_API int r_core_yank_cat (RCore *core, ut64 pos); 544 R_API int r_core_yank_cat_string (RCore *core, ut64 pos); 545 R_API int r_core_yank_hud_file (RCore *core, const char *input); 546 R_API int r_core_yank_hud_path (RCore *core, const char *input, int dir); 547 R_API bool r_core_yank_file_ex (RCore *core, const char *input); 548 R_API int r_core_yank_file_all (RCore *core, const char *input); 549 550 #define R_CORE_LOADLIBS_ENV 1 551 #define R_CORE_LOADLIBS_HOME 2 552 #define R_CORE_LOADLIBS_SYSTEM 4 553 #define R_CORE_LOADLIBS_CONFIG 8 554 #define R_CORE_LOADLIBS_ALL UT32_MAX 555 556 R_API void r_core_loadlibs_init(RCore *core); 557 R_API bool r_core_loadlibs(RCore *core, int where, const char *path); 558 R_API int r_core_cmd_buffer(RCore *core, const char *buf); 559 R_API int r_core_cmdf(RCore *core, const char *fmt, ...) R_PRINTF_CHECK(2, 3); 560 R_API int r_core_cmd0(RCore *core, const char *cmd); 561 R_API char *r_core_cmd_str(RCore *core, const char *cmd); 562 R_API int r_core_cmd_foreach(RCore *core, const char *cmd, char *each); 563 R_API int r_core_cmd_foreach3(RCore *core, const char *cmd, char *each); 564 R_API char *r_core_op_str(RCore *core, ut64 addr); 565 R_API RAnalOp *r_core_op_anal(RCore *core, ut64 addr, RAnalOpMask mask); 566 R_API char *r_core_disassemble_instr(RCore *core, ut64 addr, int l); 567 R_API char *r_core_disassemble_bytes(RCore *core, ut64 addr, int b); 568 569 /* carg.c */ 570 R_API RList *r_core_get_func_args(RCore *core, const char *func_name); 571 R_API void r_core_print_func_args(RCore *core); 572 R_API char *resolve_fcn_name(RAnal *anal, const char * func_name); 573 R_API int r_core_get_stacksz(RCore *core, ut64 from, ut64 to); 574 575 /* anal.c */ 576 R_API RAnalOp* r_core_anal_op(RCore *core, ut64 addr, int mask); 577 R_API void r_core_anal_esil(RCore *core, const char *str, const char *addr); 578 R_API void r_core_anal_fcn_merge (RCore *core, ut64 addr, ut64 addr2); 579 R_API const char *r_core_anal_optype_colorfor(RCore *core, ut64 addr, bool verbose); 580 R_API ut64 r_core_anal_address (RCore *core, ut64 addr); 581 R_API void r_core_anal_undefine(RCore *core, ut64 off); 582 R_API void r_core_anal_hint_print(RAnal* a, ut64 addr, int mode); 583 R_API void r_core_anal_hint_list(RAnal *a, int mode); 584 R_API int r_core_anal_search(RCore *core, ut64 from, ut64 to, ut64 ref, int mode); 585 R_API int r_core_anal_search_xrefs(RCore *core, ut64 from, ut64 to, PJ *pj, int rad); 586 R_API int r_core_anal_data(RCore *core, ut64 addr, int count, int depth, int wordsize); 587 R_API void r_core_anal_datarefs(RCore *core, ut64 addr); 588 R_API void r_core_anal_coderefs(RCore *core, ut64 addr); 589 R_API RGraph/*<RGraphNodeInfo>*/ *r_core_anal_codexrefs(RCore *core, ut64 addr); 590 R_API RGraph/*<RGraphNodeInfo>*/ *r_core_anal_importxrefs(RCore *core); 591 R_API void r_core_anal_callgraph(RCore *core, ut64 addr, int fmt); 592 R_API int r_core_anal_refs(RCore *core, const char *input); 593 R_API void r_core_agraph_print(RCore *core, int use_utf, const char *input); 594 R_API bool r_core_esil_cmd(RAnalEsil *esil, const char *cmd, ut64 a1, ut64 a2); 595 R_API int r_core_esil_step(RCore *core, ut64 until_addr, const char *until_expr, ut64 *prev_addr, bool stepOver); 596 R_API int r_core_esil_step_back(RCore *core); 597 R_API ut64 r_core_anal_get_bbaddr(RCore *core, ut64 addr); 598 R_API bool r_core_anal_bb_seek(RCore *core, ut64 addr); 599 R_API int r_core_anal_fcn(RCore *core, ut64 at, ut64 from, int reftype, int depth); 600 R_API char *r_core_anal_fcn_autoname(RCore *core, ut64 addr, int dump, int mode); 601 R_API void r_core_anal_autoname_all_fcns(RCore *core); 602 R_API void r_core_anal_autoname_all_golang_fcns(RCore *core); 603 R_API int r_core_anal_fcn_list(RCore *core, const char *input, const char *rad); 604 R_API char *r_core_anal_fcn_name(RCore *core, RAnalFunction *fcn); 605 R_API ut64 r_core_anal_fcn_list_size(RCore *core); 606 R_API void r_core_anal_fcn_labels(RCore *core, RAnalFunction *fcn, int rad); 607 R_API int r_core_anal_fcn_clean(RCore *core, ut64 addr); 608 R_API int r_core_print_bb_custom(RCore *core, RAnalFunction *fcn); 609 R_API int r_core_print_bb_gml(RCore *core, RAnalFunction *fcn); 610 R_API int r_core_anal_graph(RCore *core, ut64 addr, int opts); 611 R_API int r_core_anal_graph_fcn(RCore *core, char *input, int opts); 612 R_API RList* r_core_anal_graph_to(RCore *core, ut64 addr, int n); 613 R_API int r_core_anal_ref_list(RCore *core, int rad); 614 R_API int r_core_anal_all(RCore *core); 615 R_API RList* r_core_anal_cycles (RCore *core, int ccl); 616 R_API RList *r_core_anal_fcn_get_calls (RCore *core, RAnalFunction *fcn); // get all calls from a function 617 618 /*tp.c*/ 619 R_API void r_core_anal_type_match(RCore *core, RAnalFunction *fcn); 620 621 /* asm.c */ 622 #define R_MIDFLAGS_SHOW 1 623 #define R_MIDFLAGS_REALIGN 2 624 #define R_MIDFLAGS_SYMALIGN 3 625 626 typedef struct r_core_asm_hit { 627 char *code; 628 int len; 629 ut64 addr; 630 ut8 valid; 631 } RCoreAsmHit; 632 633 R_API RBuffer *r_core_syscall (RCore *core, const char *name, const char *args); 634 R_API RBuffer *r_core_syscallf (RCore *core, const char *name, const char *fmt, ...) R_PRINTF_CHECK(3, 4); 635 R_API RCoreAsmHit *r_core_asm_hit_new(void); 636 R_API RList *r_core_asm_hit_list_new(void); 637 R_API void r_core_asm_hit_free(void *_hit); 638 R_API void r_core_set_asm_configs(RCore *core, char *arch, ut32 bits, int segoff); 639 R_API char* r_core_asm_search(RCore *core, const char *input); 640 R_API RList *r_core_asm_strsearch(RCore *core, const char *input, ut64 from, ut64 to, int maxhits, int regexp, int everyByte, int mode); 641 R_API RList *r_core_asm_bwdisassemble (RCore *core, ut64 addr, int n, int len); 642 R_API RList *r_core_asm_back_disassemble_instr (RCore *core, ut64 addr, int len, ut32 hit_count, ut32 extra_padding); 643 R_API RList *r_core_asm_back_disassemble_byte (RCore *core, ut64 addr, int len, ut32 hit_count, ut32 extra_padding); 644 R_API ut32 r_core_asm_bwdis_len (RCore* core, int* len, ut64* start_addr, ut32 l); 645 R_API int r_core_print_disasm(RPrint *p, RCore *core, ut64 addr, ut8 *buf, int len, int lines, int invbreak, int nbytes, bool json, PJ *pj, RAnalFunction *pdf); 646 R_API int r_core_print_disasm_json(RCore *core, ut64 addr, ut8 *buf, int len, int lines, PJ *pj); 647 R_API int r_core_print_disasm_instructions_with_buf(RCore *core, ut64 address, ut8 *buf, int nb_bytes, int nb_opcodes); 648 R_API int r_core_print_disasm_instructions(RCore *core, int nb_bytes, int nb_opcodes); 649 R_API int r_core_print_disasm_all(RCore *core, ut64 addr, int l, int len, int mode); 650 R_API int r_core_disasm_pdi_with_buf(RCore *core, ut64 address, ut8 *buf, ut32 nb_opcodes, ut32 nb_bytes, int fmt); 651 R_API int r_core_disasm_pdi(RCore *core, int nb_opcodes, int nb_bytes, int fmt); 652 R_API int r_core_disasm_pde(RCore *core, int nb_opcodes, int mode); 653 R_API int r_core_print_fcn_disasm(RPrint *p, RCore *core, ut64 addr, int l, int invbreak, int cbytes); 654 R_API int r_core_get_prc_cols(RCore *core); 655 R_API int r_core_flag_in_middle(RCore *core, ut64 at, int oplen, int *midflags); 656 R_API int r_core_bb_starts_in_middle(RCore *core, ut64 at, int oplen); 657 658 // both do the same, we should get rid of one of them 659 R_API bool r_core_bin_raise (RCore *core, ut32 bfid); 660 R_API bool r_core_bin_set_cur(RCore *core, RBinFile *binfile); 661 662 R_API int r_core_bin_set_env (RCore *r, RBinFile *binfile); 663 R_API int r_core_bin_set_by_fd (RCore *core, ut64 bin_fd); 664 R_API int r_core_bin_set_by_name (RCore *core, const char *name); 665 R_API int r_core_bin_reload(RCore *core, const char *file, ut64 baseaddr); 666 R_API bool r_core_bin_load(RCore *core, const char *file, ut64 baseaddr); 667 R_API int r_core_bin_rebase(RCore *core, ut64 baddr); 668 R_API void r_core_bin_export_info(RCore *core, int mode); 669 R_API int r_core_bin_list(RCore *core, int mode); 670 R_API bool r_core_bin_delete (RCore *core, ut32 binfile_idx); 671 R_API ut64 r_core_bin_impaddr(RBin *bin, int va, const char *name); 672 673 // XXX - this is kinda hacky, maybe there should be a way to 674 // refresh the bin environment without specific calls? 675 R_API int r_core_pseudo_code (RCore *core, const char *input); 676 677 /* gdiff.c */ 678 R_API int r_core_zdiff(RCore *c, RCore *c2); 679 R_API int r_core_gdiff(RCore *core1, RCore *core2); 680 R_API int r_core_gdiff_fcn(RCore *c, ut64 addr, ut64 addr2); 681 682 R_API bool r_core_project_open(RCore *core, const char *file); 683 R_API int r_core_project_cat(RCore *core, const char *name); 684 R_API int r_core_project_delete(RCore *core, const char *prjfile); 685 R_API int r_core_project_list(RCore *core, int mode); 686 R_API bool r_core_project_save_script(RCore *core, const char *file, int opts); 687 R_API bool r_core_project_save(RCore *core, const char *file); 688 R_API char *r_core_project_name(RCore *core, const char *file); 689 R_API char *r_core_project_notes_file (RCore *core, const char *file); 690 691 R_API char *r_core_sysenv_begin(RCore *core, const char *cmd); 692 R_API void r_core_sysenv_end(RCore *core, const char *cmd); 693 694 R_API void r_core_recover_vars(RCore *core, RAnalFunction *fcn, bool argonly); 695 // XXX dupe from r_bin.h 696 /* bin.c */ 697 #define R_CORE_BIN_ACC_STRINGS 0x001 698 #define R_CORE_BIN_ACC_INFO 0x002 699 #define R_CORE_BIN_ACC_MAIN 0x004 700 #define R_CORE_BIN_ACC_ENTRIES 0x008 701 #define R_CORE_BIN_ACC_RELOCS 0x010 702 #define R_CORE_BIN_ACC_IMPORTS 0x020 703 #define R_CORE_BIN_ACC_SYMBOLS 0x040 704 #define R_CORE_BIN_ACC_SECTIONS 0x080 705 #define R_CORE_BIN_ACC_FIELDS 0x100 706 #define R_CORE_BIN_ACC_LIBS 0x200 707 #define R_CORE_BIN_ACC_CLASSES 0x400 708 #define R_CORE_BIN_ACC_DWARF 0x800 709 #define R_CORE_BIN_ACC_SIZE 0x1000 710 #define R_CORE_BIN_ACC_PDB 0x2000 711 #define R_CORE_BIN_ACC_MEM 0x4000 712 #define R_CORE_BIN_ACC_EXPORTS 0x8000 713 #define R_CORE_BIN_ACC_VERSIONINFO 0x10000 714 #define R_CORE_BIN_ACC_SIGNATURE 0x20000 715 #define R_CORE_BIN_ACC_RAW_STRINGS 0x40000 716 #define R_CORE_BIN_ACC_HEADER 0x80000 717 #define R_CORE_BIN_ACC_RESOURCES 0x100000 718 #define R_CORE_BIN_ACC_INITFINI 0x200000 719 #define R_CORE_BIN_ACC_SEGMENTS 0x400000 720 #define R_CORE_BIN_ACC_SOURCE 0x800000 721 #define R_CORE_BIN_ACC_HASHES 0x10000000 722 #define R_CORE_BIN_ACC_TRYCATCH 0x20000000 723 #define R_CORE_BIN_ACC_SECTIONS_MAPPING 0x40000000 724 #define R_CORE_BIN_ACC_ALL 0x504FFF 725 726 #define R_CORE_PRJ_FLAGS 0x0001 727 #define R_CORE_PRJ_EVAL 0x0002 728 #define R_CORE_PRJ_IO_MAPS 0x0004 729 #define R_CORE_PRJ_SECTIONS 0x0008 730 #define R_CORE_PRJ_META 0x0010 731 #define R_CORE_PRJ_XREFS 0x0020 732 #define R_CORE_PRJ_FCNS 0x0040 733 #define R_CORE_PRJ_ANAL_HINTS 0x0080 734 #define R_CORE_PRJ_ANAL_TYPES 0x0100 735 #define R_CORE_PRJ_ANAL_MACROS 0x0200 736 #define R_CORE_PRJ_ANAL_SEEK 0x0400 737 #define R_CORE_PRJ_DBG_BREAK 0x0800 738 #define R_CORE_PRJ_ALL 0xFFFF 739 740 typedef struct r_core_bin_filter_t { 741 ut64 offset; 742 const char *name; 743 } RCoreBinFilter; 744 745 R_API int r_core_bin_info (RCore *core, int action, PJ *pj, int mode, int va, RCoreBinFilter *filter, const char *chksum); 746 R_API int r_core_bin_set_arch_bits (RCore *r, const char *name, const char * arch, ut16 bits); 747 R_API int r_core_bin_update_arch_bits (RCore *r); 748 R_API char *r_core_bin_method_flags_str(ut64 flags, int mode); 749 R_API bool r_core_pdb_info(RCore *core, const char *file, PJ *pj, int mode); 750 751 /* rtr */ 752 R_API int r_core_rtr_cmds (RCore *core, const char *port); 753 R_API char *r_core_rtr_cmds_query (RCore *core, const char *host, const char *port, const char *cmd); 754 R_API void r_core_rtr_help(RCore *core); 755 R_API void r_core_rtr_pushout(RCore *core, const char *input); 756 R_API void r_core_rtr_list(RCore *core); 757 R_API void r_core_rtr_add(RCore *core, const char *input); 758 R_API void r_core_rtr_remove(RCore *core, const char *input); 759 R_API void r_core_rtr_session(RCore *core, const char *input); 760 R_API void r_core_rtr_cmd(RCore *core, const char *input); 761 R_API int r_core_rtr_http(RCore *core, int launch, int browse, const char *path); 762 R_API int r_core_rtr_http_stop(RCore *u); 763 R_API int r_core_rtr_gdb(RCore *core, int launch, const char *path); 764 765 R_API int r_core_visual_prevopsz(RCore *core, ut64 addr); 766 R_API void r_core_visual_config(RCore *core); 767 R_API void r_core_visual_mounts(RCore *core); 768 R_API void r_core_visual_anal(RCore *core, const char *input); 769 R_API void r_core_visual_debugtraces(RCore *core, const char *input); 770 R_API void r_core_seek_next(RCore *core, const char *type); 771 R_API void r_core_seek_previous(RCore *core, const char *type); 772 R_API void r_core_visual_define(RCore *core, const char *arg, int distance); 773 R_API int r_core_visual_trackflags(RCore *core); 774 R_API int r_core_visual_view_graph(RCore *core); 775 R_API int r_core_visual_view_zigns(RCore *core); 776 R_API int r_core_visual_view_rop(RCore *core); 777 R_API int r_core_visual_comments(RCore *core); 778 R_API int r_core_visual_prompt(RCore *core); 779 R_API bool r_core_visual_esil (RCore *core); 780 R_API int r_core_search_preludes(RCore *core, bool log); 781 R_API int r_core_search_prelude(RCore *core, ut64 from, ut64 to, const ut8 *buf, int blen, const ut8 *mask, int mlen); 782 R_API RList* /*<RIOMap*>*/ r_core_get_boundaries_prot (RCore *core, int protection, const char *mode, const char *prefix); 783 784 R_API int r_core_patch (RCore *core, const char *patch); 785 786 R_API void r_core_hack_help(const RCore *core); 787 R_API int r_core_hack(RCore *core, const char *op); 788 R_API bool r_core_dump(RCore *core, const char *file, ut64 addr, ut64 size, int append); 789 R_API void r_core_diff_show(RCore *core, RCore *core2); 790 R_API void r_core_clippy(RCore *core, const char *msg); 791 792 /* watchers */ 793 R_API void r_core_cmpwatch_free (RCoreCmpWatcher *w); 794 R_API RCoreCmpWatcher *r_core_cmpwatch_get (RCore *core, ut64 addr); 795 R_API int r_core_cmpwatch_add (RCore *core, ut64 addr, int size, const char *cmd); 796 R_API int r_core_cmpwatch_del (RCore *core, ut64 addr); 797 R_API int r_core_cmpwatch_update (RCore *core, ut64 addr); 798 R_API int r_core_cmpwatch_show (RCore *core, ut64 addr, int mode); 799 R_API int r_core_cmpwatch_revert (RCore *core, ut64 addr); 800 801 /* undo */ 802 R_API RCoreUndo *r_core_undo_new(ut64 offset, const char *action, const char *revert); 803 R_API void r_core_undo_print(RCore *core, int mode, RCoreUndoCondition *cond); 804 R_API void r_core_undo_free(RCoreUndo *cu); 805 R_API void r_core_undo_push(RCore *core, RCoreUndo *cu); 806 R_API void r_core_undo_pop(RCore *core); 807 808 /* logs */ 809 typedef int (*RCoreLogCallback)(RCore *core, int count, const char *message); 810 R_API void r_core_log_free(RCoreLog *log); 811 R_API void r_core_log_init (RCoreLog *log); 812 R_API char *r_core_log_get(RCore *core, int index); 813 R_API RCoreLog *r_core_log_new (void); 814 R_API bool r_core_log_run(RCore *core, const char *buf, RCoreLogCallback cb); 815 R_API int r_core_log_list(RCore *core, int n, int count, char fmt); 816 R_API void r_core_log_add(RCore *core, const char *msg); 817 R_API void r_core_log_del(RCore *core, int n); 818 819 // TODO MOVE SOMEWHERE ELSE 820 typedef char *(*PrintItemCallback)(void *user, void *p, bool selected); 821 R_API char *r_str_widget_list(void *user, RList *list, int rows, int cur, PrintItemCallback cb); 822 R_API PJ *r_core_pj_new(RCore *core); 823 /* help */ 824 R_API void r_core_cmd_help(const RCore *core, const char * help[]); 825 826 /* anal stats */ 827 828 typedef struct { 829 ut32 youarehere; 830 ut32 flags; 831 ut32 comments; 832 ut32 functions; 833 ut32 blocks; 834 ut32 in_functions; 835 ut32 symbols; 836 ut32 strings; 837 ut32 perm; 838 } RCoreAnalStatsItem; 839 typedef struct { 840 RCoreAnalStatsItem *block; 841 } RCoreAnalStats; 842 843 R_API bool core_anal_bbs(RCore *core, const char* input); 844 R_API bool core_anal_bbs_range (RCore *core, const char* input); 845 R_API char *r_core_anal_hasrefs(RCore *core, ut64 value, int mode); 846 R_API char *r_core_anal_get_comments(RCore *core, ut64 addr); 847 R_API RCoreAnalStats* r_core_anal_get_stats (RCore *a, ut64 from, ut64 to, ut64 step); 848 R_API void r_core_anal_stats_free (RCoreAnalStats *s); 849 850 R_API void r_core_syscmd_ls(const char *input); 851 R_API void r_core_syscmd_cat(const char *file); 852 R_API void r_core_syscmd_mkdir(const char *dir); 853 854 R_API int r_line_hist_offset_up(RLine *line); 855 R_API int r_line_hist_offset_down(RLine *line); 856 857 // TODO : move into debug or syscall++ 858 R_API char *cmd_syscall_dostr(RCore *core, st64 num, ut64 addr); 859 860 /* tasks */ 861 862 typedef void (*RCoreTaskCallback)(void *user, char *out); 863 864 typedef enum { 865 R_CORE_TASK_STATE_BEFORE_START, 866 R_CORE_TASK_STATE_RUNNING, 867 R_CORE_TASK_STATE_SLEEPING, 868 R_CORE_TASK_STATE_DONE 869 } RTaskState; 870 871 typedef struct r_core_task_t { 872 int id; 873 RTaskState state; 874 bool transient; // delete when finished 875 int refcount; 876 RThreadSemaphore *running_sem; 877 void *user; 878 RCore *core; 879 bool dispatched; 880 RThreadCond *dispatch_cond; 881 RThreadLock *dispatch_lock; 882 RThread *thread; 883 char *cmd; 884 char *res; 885 bool cmd_log; 886 RConsContext *cons_context; 887 RCoreTaskCallback cb; 888 } RCoreTask; 889 890 typedef void (*RCoreTaskOneShot)(void *); 891 892 R_API void r_core_echo(RCore *core, const char *msg); 893 R_API RTable *r_core_table(RCore *core, const char *name); 894 895 R_API void r_core_task_scheduler_init (RCoreTaskScheduler *tasks, RCore *core); 896 R_API void r_core_task_scheduler_fini (RCoreTaskScheduler *tasks); 897 R_API RCoreTask *r_core_task_get(RCoreTaskScheduler *scheduler, int id); 898 R_API RCoreTask *r_core_task_get_incref(RCoreTaskScheduler *scheduler, int id); 899 R_API void r_core_task_print(RCore *core, RCoreTask *task, PJ *pj, int mode); 900 R_API void r_core_task_list(RCore *core, int mode); 901 R_API int r_core_task_running_tasks_count(RCoreTaskScheduler *scheduler); 902 R_API const char *r_core_task_status(RCoreTask *task); 903 R_API RCoreTask *r_core_task_new(RCore *core, bool create_cons, const char *cmd, RCoreTaskCallback cb, void *user); 904 R_API void r_core_task_incref(RCoreTask *task); 905 R_API void r_core_task_decref(RCoreTask *task); 906 R_API void r_core_task_enqueue(RCoreTaskScheduler *scheduler, RCoreTask *task); 907 R_API void r_core_task_enqueue_oneshot(RCoreTaskScheduler *scheduler, RCoreTaskOneShot func, void *user); 908 R_API int r_core_task_run_sync(RCoreTaskScheduler *scheduler, RCoreTask *task); 909 R_API void r_core_task_sync_begin(RCoreTaskScheduler *scheduler); 910 R_API void r_core_task_sync_end(RCoreTaskScheduler *scheduler); 911 R_API void r_core_task_yield(RCoreTaskScheduler *scheduler); 912 R_API void r_core_task_sleep_begin(RCoreTask *task); 913 R_API void r_core_task_sleep_end(RCoreTask *task); 914 R_API void r_core_task_break(RCoreTaskScheduler *scheduler, int id); 915 R_API void r_core_task_break_all(RCoreTaskScheduler *scheduler); 916 R_API int r_core_task_del(RCoreTaskScheduler *scheduler, int id); 917 R_API void r_core_task_del_all_done(RCoreTaskScheduler *scheduler); 918 R_API RCoreTask *r_core_task_self(RCoreTaskScheduler *scheduler); 919 R_API void r_core_task_join(RCoreTaskScheduler *scheduler, RCoreTask *current, int id); 920 typedef void (*inRangeCb) (RCore *core, ut64 from, ut64 to, int vsize, void *cb_user); 921 R_API int r_core_search_value_in_range (RCore *core, RInterval search_itv, 922 ut64 vmin, ut64 vmax, int vsize, inRangeCb cb, void *cb_user); 923 924 R_API RCoreAutocomplete *r_core_autocomplete_add(RCoreAutocomplete *parent, const char* cmd, int type, bool lock); 925 R_API void r_core_autocomplete_free(RCoreAutocomplete *obj); 926 R_API void r_core_autocomplete_reload (RCore *core); 927 R_API RCoreAutocomplete *r_core_autocomplete_find(RCoreAutocomplete *parent, const char* cmd, bool exact); 928 R_API bool r_core_autocomplete_remove(RCoreAutocomplete *parent, const char* cmd); 929 R_API void r_core_anal_propagate_noreturn(RCore *core, ut64 addr); 930 931 /* PLUGINS */ 932 extern RCorePlugin r_core_plugin_java; 933 extern RCorePlugin r_core_plugin_a2f; 934 935 /* DECOMPILER PRINTING FUNCTIONS */ 936 /** 937 * @brief Prints the data contained in the specified RAnnotatedCode in JSON format. 938 * 939 * The function will print the output in console using the function r_cons_printf(); 940 * 941 * @param code Pointer to a RAnnotatedCode. 942 */ 943 R_API void r_core_annotated_code_print_json(RAnnotatedCode *code); 944 /** 945 * @brief Prints the decompiled code from the specified RAnnotatedCode. 946 * 947 * This function is used for printing the output of commands pdg and pdgo. 948 * It can print the decompiled code with or without offsets. If line_offsets is a null pointer, 949 * the output will be printed without offsets (pdg), otherwise, the output will be 950 * printed with offsets. 951 * This function will print the output in console using the function r_cons_printf(); 952 * 953 * @param code Pointer to a RAnnotatedCode. 954 * @param line_offsets Pointer to a @ref RVector that contains offsets for the decompiled code. 955 */ 956 R_API void r_core_annotated_code_print(RAnnotatedCode *code, RVector *line_offsets); 957 /** 958 * @brief Prints the decompiled code as comments 959 * 960 * This function is used for the output of command pdg* 961 * Output will be printed in console using the function r_cons_printf(); 962 * 963 * @param code Pointer to a RAnnotatedCode. 964 */ 965 R_API void r_core_annotated_code_print_comment_cmds(RAnnotatedCode *code); 966 967 #endif 968 969 #ifdef __cplusplus 970 } 971 #endif 972 973 #endif 974