Rizin
unix-like reverse engineering framework and cli tools
cmd_meta.c File Reference
#include <rz_analysis.h>
#include <rz_bin.h>
#include <rz_cons.h>
#include <rz_core.h>
#include <rz_util.h>
#include <rz_types.h>
#include <sdb.h>
#include "../core_private.h"

Go to the source code of this file.

Macros

#define META_NAME_LENGTH
 

Functions

char * getcommapath (RzCore *core)
 
RZ_IPI void rz_core_meta_comment_add (RzCore *core, const char *comment, ut64 addr)
 
static const char * meta_get_flag (RzCore *core, ut64 addr)
 
static void meta_variable_comment_print (RzCore *Core, RzAnalysisVar *var, RzCmdStateOutput *state)
 
static RzCmdStatus meta_variable_comment_list (RzCore *core, RzAnalysisVarKind kind, RzCmdStateOutput *state)
 
static RzCmdStatus meta_variable_comment_list_all (RzCore *core, RzCmdStateOutput *state)
 
static RzCmdStatus meta_variable_comment_append (RzCore *core, const char *name, const char *comment)
 
static RzCmdStatus meta_variable_comment_remove (RzCore *core, const char *name)
 
static RzCmdStatus meta_variable_comment_editor (RzCore *core, const char *name)
 
static bool meta_set_string (RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
 
static bool meta_set_flag (RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
 
static void meta_remove_all (RzCore *core, RzAnalysisMetaType mtype)
 
static void meta_remove (RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
 
static void meta_remove_size (RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size)
 
RZ_IPI RzCmdStatus rz_meta_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_list_at_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_comment_at_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_append_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_filelink_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_editor_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_function_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
static void meta_function_comment_remove (RzAnalysis *analysis, RzAnalysisFunction *fcn)
 
RZ_IPI RzCmdStatus rz_comment_function_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_function_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_comment_unique_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_space_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_space_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_space_rename_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_space_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_space_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_var_comment_append_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_var_comment_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_var_comment_editor_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_var_comment_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_var_reg_comment_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_var_bp_comment_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_var_stack_comment_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_type_current_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_data_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_data_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_data_at_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_data_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_data_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_string_at_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_string_pascal_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_utf8_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_8bit_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_wide16_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_wide32_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_string_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_format_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_format_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_format_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_format_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_magic_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_magic_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_magic_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_magic_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_hidden_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_hidden_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_hidden_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_hidden_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_type_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_type_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_meta_type_remove_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_type_remove_all_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_meta_type_editor_handler (RzCore *core, int argc, const char **argv)
 

Macro Definition Documentation

◆ META_NAME_LENGTH

#define META_NAME_LENGTH

Definition at line 13 of file cmd_meta.c.

Function Documentation

◆ getcommapath()

char* getcommapath ( RzCore core)

Definition at line 1607 of file visual.c.

1607  {
1608  char *cwd;
1609  const char *dir = rz_config_get(core->config, "dir.projects");
1610  const char *prj = rz_config_get(core->config, "prj.name");
1611  if (dir && *dir && prj && *prj) {
1612  char *abspath = rz_file_abspath(dir);
1613  /* use prjdir as base directory for comma-ent files */
1614  cwd = rz_str_newf("%s" RZ_SYS_DIR "%s.d", abspath, prj);
1615  free(abspath);
1616  } else {
1617  /* use cwd as base directory for comma-ent files */
1618  cwd = rz_sys_getdir();
1619  }
1620  return cwd;
1621 }
RZ_API RZ_BORROW const char * rz_config_get(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:75
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
RZ_API char * rz_file_abspath(const char *file)
Definition: file.c:267
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_sys_getdir(void)
Get current working directory.
Definition: sys.c:521
#define RZ_SYS_DIR
Definition: rz_types.h:218
RzConfig * config
Definition: rz_core.h:300

References rz_core_t::config, test-lz4-speed::cwd, free(), rz_config_get(), rz_file_abspath(), rz_str_newf(), RZ_SYS_DIR, and rz_sys_getdir().

Referenced by rz_comment_filelink_handler(), and visual_comma().

◆ meta_function_comment_remove()

static void meta_function_comment_remove ( RzAnalysis analysis,
RzAnalysisFunction fcn 
)
static

Definition at line 268 of file cmd_meta.c.

268  {
269  RzAnalysisBlock *bb;
270  RzListIter *iter;
271  rz_list_foreach (fcn->bbs, iter, bb) {
272  int i;
273  for (i = 0; i < bb->size; i++) {
274  ut64 addr = bb->addr + i;
275  rz_meta_del(analysis, RZ_META_TYPE_COMMENT, addr, 1);
276  }
277  }
278 }
lzma_index ** i
Definition: index.h:629
RZ_API void rz_meta_del(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, ut64 size)
Definition: meta.c:187
@ RZ_META_TYPE_COMMENT
Definition: rz_analysis.h:295
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static int addr
Definition: z80asm.c:58

References addr, rz_analysis_bb_t::addr, rz_analysis_function_t::bbs, i, rz_meta_del(), RZ_META_TYPE_COMMENT, rz_analysis_bb_t::size, and ut64().

Referenced by rz_comment_function_remove_all_handler(), and rz_comment_function_remove_handler().

◆ meta_get_flag()

static const char* meta_get_flag ( RzCore core,
ut64  addr 
)
static

Definition at line 24 of file cmd_meta.c.

24  {
25  RzFlagItem *fi;
26  fi = rz_flag_get_i(core->flags, addr);
27  return fi ? fi->name : NULL;
28 }
#define NULL
Definition: cris-opc.c:27
RZ_API RzFlagItem * rz_flag_get_i(RzFlag *f, ut64 off)
Definition: flag.c:317
RzFlag * flags
Definition: rz_core.h:330
char * name
Definition: rz_flag.h:35

References addr, rz_core_t::flags, rz_flag_item_t::name, NULL, and rz_flag_get_i().

Referenced by meta_set_flag().

◆ meta_remove()

static void meta_remove ( RzCore core,
RzAnalysisMetaType  mtype,
ut64  addr 
)
static

◆ meta_remove_all()

◆ meta_remove_size()

static void meta_remove_size ( RzCore core,
RzAnalysisMetaType  mtype,
ut64  addr,
ut64  size 
)
static

Definition at line 173 of file cmd_meta.c.

173  {
174  rz_meta_del(core->analysis, mtype, addr, size);
175 }
voidpf void uLong size
Definition: ioapi.h:138

References addr, rz_core_t::analysis, and rz_meta_del().

Referenced by rz_meta_data_remove_handler().

◆ meta_set_flag()

static bool meta_set_flag ( RzCore core,
RzAnalysisMetaType  mtype,
ut64  addr,
ut64  size,
const char *  str 
)
static

Definition at line 160 of file cmd_meta.c.

160  {
161  const char *flag = meta_get_flag(core, addr);
162  return rz_meta_set(core->analysis, mtype, addr, size, flag ? flag : str);
163 }
static const char * meta_get_flag(RzCore *core, ut64 addr)
Definition: cmd_meta.c:24
RZ_API bool rz_meta_set(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, ut64 size, const char *str)
Definition: meta.c:191

References addr, rz_core_t::analysis, meta_get_flag(), rz_meta_set(), and cmd_descs_generate::str.

Referenced by rz_meta_data_handler(), rz_meta_hidden_handler(), and rz_meta_type_handler().

◆ meta_set_string()

static bool meta_set_string ( RzCore core,
RzAnalysisMetaType  mtype,
ut64  addr,
ut64  size,
const char *  str 
)
static

Definition at line 156 of file cmd_meta.c.

156  {
157  return rz_meta_set(core->analysis, mtype, addr, size, str);
158 }

References addr, rz_core_t::analysis, rz_meta_set(), and cmd_descs_generate::str.

Referenced by rz_meta_format_handler(), and rz_meta_magic_handler().

◆ meta_variable_comment_append()

static RzCmdStatus meta_variable_comment_append ( RzCore core,
const char *  name,
const char *  comment 
)
static

Definition at line 88 of file cmd_meta.c.

88  {
90  if (!fcn) {
91  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
92  return RZ_CMD_STATUS_ERROR;
93  }
94  char *heap_comment = NULL;
95  if (RZ_STR_ISNOTEMPTY(comment)) { // new comment given
96  if (!strncmp(comment, "base64:", 7)) {
97  heap_comment = (char *)sdb_decode(comment + 7, NULL);
98  comment = heap_comment;
99  }
100  }
102  if (!var) {
103  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
104  return RZ_CMD_STATUS_ERROR;
105  }
106  if (var->comment) {
107  if (comment && *comment) {
108  char *text = rz_str_newf("%s\n%s", var->comment, comment);
109  free(var->comment);
110  var->comment = text;
111  } else {
112  rz_cons_println(var->comment);
113  }
114  } else {
115  var->comment = strdup(comment);
116  }
117  free(heap_comment);
118  return RZ_CMD_STATUS_OK;
119 }
RZ_API ut8 * sdb_decode(const char *in, int *len)
Definition: base64.c:37
RZ_API void rz_cons_println(const char *str)
Definition: cons.c:233
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
Definition: fcn.c:1687
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
#define RZ_STR_ISNOTEMPTY(x)
Definition: rz_str.h:68
#define PFMT64x
Definition: rz_types.h:393
Definition: z80asm.h:102
ut64 offset
Definition: rz_core.h:301
RZ_API RZ_BORROW RzAnalysisVar * rz_analysis_function_get_var_byname(RzAnalysisFunction *fcn, const char *name)
Definition: var.c:247

References rz_core_t::analysis, rz_analysis_var_t::comment, free(), NULL, rz_core_t::offset, PFMT64x, rz_analysis_function_get_var_byname(), rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_println(), RZ_LOG_ERROR, RZ_STR_ISNOTEMPTY, rz_str_newf(), sdb_decode(), strdup(), and create_tags_rz::text.

Referenced by rz_meta_var_comment_append_handler().

◆ meta_variable_comment_editor()

static RzCmdStatus meta_variable_comment_editor ( RzCore core,
const char *  name 
)
static

Definition at line 137 of file cmd_meta.c.

137  {
139  if (!fcn) {
140  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
141  return RZ_CMD_STATUS_ERROR;
142  }
144  if (!var) {
145  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
146  return RZ_CMD_STATUS_ERROR;
147  }
148  char *comment = rz_core_editor(core, NULL, var->comment);
149  if (comment) {
150  free(var->comment);
151  var->comment = comment;
152  }
153  return RZ_CMD_STATUS_OK;
154 }
RZ_API RZ_OWN char * rz_core_editor(const RzCore *core, RZ_NULLABLE const char *file, RZ_NULLABLE const char *str)
Definition: core.c:3214

References rz_core_t::analysis, rz_analysis_var_t::comment, free(), NULL, rz_core_t::offset, PFMT64x, rz_analysis_function_get_var_byname(), rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_editor(), and RZ_LOG_ERROR.

Referenced by rz_meta_var_comment_editor_handler().

◆ meta_variable_comment_list()

static RzCmdStatus meta_variable_comment_list ( RzCore core,
RzAnalysisVarKind  kind,
RzCmdStateOutput state 
)
static

Definition at line 57 of file cmd_meta.c.

57  {
59  if (!fcn) {
60  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
61  return RZ_CMD_STATUS_ERROR;
62  }
63  void **it;
64  rz_pvector_foreach (&fcn->vars, it) {
65  RzAnalysisVar *var = *it;
66  if (var->kind != kind || !var->comment) {
67  continue;
68  }
70  }
71  return RZ_CMD_STATUS_OK;
72 }
static void meta_variable_comment_print(RzCore *Core, RzAnalysisVar *var, RzCmdStateOutput *state)
Definition: cmd_meta.c:30
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
RzAnalysisVarKind kind
Definition: rz_analysis.h:728
Definition: dis.h:43

References rz_core_t::analysis, rz_analysis_var_t::comment, rz_analysis_var_t::kind, meta_variable_comment_print(), rz_core_t::offset, PFMT64x, rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, RZ_LOG_ERROR, rz_pvector_foreach, and rz_analysis_function_t::vars.

Referenced by rz_meta_var_bp_comment_list_handler(), rz_meta_var_reg_comment_list_handler(), and rz_meta_var_stack_comment_list_handler().

◆ meta_variable_comment_list_all()

static RzCmdStatus meta_variable_comment_list_all ( RzCore core,
RzCmdStateOutput state 
)
static

Definition at line 74 of file cmd_meta.c.

74  {
76  if (!fcn) {
77  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
78  return RZ_CMD_STATUS_ERROR;
79  }
80  void **it;
81  rz_pvector_foreach (&fcn->vars, it) {
82  RzAnalysisVar *var = *it;
84  }
85  return RZ_CMD_STATUS_OK;
86 }

References rz_core_t::analysis, meta_variable_comment_print(), rz_core_t::offset, PFMT64x, rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, RZ_LOG_ERROR, rz_pvector_foreach, and rz_analysis_function_t::vars.

Referenced by rz_meta_var_comment_list_handler().

◆ meta_variable_comment_print()

static void meta_variable_comment_print ( RzCore Core,
RzAnalysisVar var,
RzCmdStateOutput state 
)
static

Definition at line 30 of file cmd_meta.c.

30  {
31  PJ *pj = state->d.pj;
32  switch (state->mode) {
34  pj_o(pj);
35  pj_ks(pj, "name", var->name);
36  pj_ks(pj, "comment", var->comment);
37  pj_end(pj);
38  break;
40  rz_cons_printf("%s : %s\n", var->name, var->comment);
41  break;
42  case RZ_OUTPUT_MODE_RIZIN: {
43  char *b64 = sdb_encode((const ut8 *)var->comment, strlen(var->comment));
44  if (!b64) {
45  return;
46  }
47  rz_cons_printf("\"Cv%c %s base64:%s @ 0x%08" PFMT64x "\"\n", var->kind, var->name, b64, var->fcn->addr);
48  free(b64);
49  break;
50  }
51  default:
53  break;
54  }
55 }
RZ_API char * sdb_encode(const ut8 *bin, int len)
Definition: base64.c:18
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
uint8_t ut8
Definition: lh5801.h:11
#define rz_warn_if_reached()
Definition: rz_assert.h:29
RZ_API PJ * pj_end(PJ *j)
Definition: pj.c:87
RZ_API PJ * pj_o(PJ *j)
Definition: pj.c:75
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
Definition: pj.c:170
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ RZ_OUTPUT_MODE_RIZIN
Definition: rz_types.h:41
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
Definition: rz_pj.h:12
RzAnalysisFunction * fcn
Definition: rz_analysis.h:726

References rz_analysis_function_t::addr, rz_analysis_var_t::comment, rz_analysis_var_t::fcn, free(), rz_analysis_var_t::kind, rz_analysis_var_t::name, PFMT64x, pj_end(), pj_ks(), pj_o(), rz_cons_printf(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_RIZIN, RZ_OUTPUT_MODE_STANDARD, rz_warn_if_reached, and sdb_encode().

Referenced by meta_variable_comment_list(), and meta_variable_comment_list_all().

◆ meta_variable_comment_remove()

static RzCmdStatus meta_variable_comment_remove ( RzCore core,
const char *  name 
)
static

Definition at line 121 of file cmd_meta.c.

121  {
123  if (!fcn) {
124  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset\n", core->offset);
125  return RZ_CMD_STATUS_ERROR;
126  }
128  if (!var) {
129  RZ_LOG_ERROR("Can't find variable named `%s`\n", name);
130  return RZ_CMD_STATUS_ERROR;
131  }
132  free(var->comment);
133  var->comment = NULL;
134  return RZ_CMD_STATUS_OK;
135 }

References rz_core_t::analysis, rz_analysis_var_t::comment, free(), NULL, rz_core_t::offset, PFMT64x, rz_analysis_function_get_var_byname(), rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, and RZ_LOG_ERROR.

Referenced by rz_meta_var_comment_remove_handler().

◆ rz_comment_append_handler()

RZ_IPI RzCmdStatus rz_comment_append_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 215 of file cmd_meta.c.

215  {
217  return RZ_CMD_STATUS_OK;
218 }
RZ_IPI void rz_core_meta_append(RzCore *core, const char *newcomment, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:376
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40

References argv, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_append(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_at_handler()

RZ_IPI RzCmdStatus rz_comment_at_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 207 of file cmd_meta.c.

207  {
208  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
209  if (comment) {
210  rz_cons_println(comment);
211  }
212  return RZ_CMD_STATUS_OK;
213 }
RZ_API const char * rz_meta_get_string(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr)
Definition: meta.c:146

References rz_core_t::analysis, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_cons_println(), rz_meta_get_string(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_editor_handler()

RZ_IPI RzCmdStatus rz_comment_editor_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 258 of file cmd_meta.c.

258  {
260  return RZ_CMD_STATUS_OK;
261 }
RZ_IPI void rz_core_meta_editor(RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmeta.c:394

References rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_editor(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_filelink_handler()

RZ_IPI RzCmdStatus rz_comment_filelink_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 230 of file cmd_meta.c.

230  {
231  if (argc > 1) {
232  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
233  if (RZ_STR_ISNOTEMPTY(comment)) {
234  // Append filename to the current comment
235  char *nc = rz_str_newf("%s ,(%s)", comment, argv[1]);
237  free(nc);
238  } else {
239  char *newcomment = rz_str_newf(",(%s)", argv[1]);
240  rz_meta_set_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset, newcomment);
241  free(newcomment);
242  }
243  } else {
244  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, core->offset);
245  if (RZ_STR_ISNOTEMPTY(comment)) {
246  char *cmtfile = rz_str_between(comment, ",(", ")");
247  if (cmtfile && *cmtfile) {
248  char *cwd = getcommapath(core);
249  rz_cons_printf("%s" RZ_SYS_DIR "%s\n", cwd, cmtfile);
250  free(cwd);
251  }
252  free(cmtfile);
253  }
254  }
255  return RZ_CMD_STATUS_OK;
256 }
char * getcommapath(RzCore *core)
Definition: visual.c:1607
RZ_API bool rz_meta_set_string(RzAnalysis *a, RzAnalysisMetaType type, ut64 addr, const char *s)
Definition: meta.c:141
RZ_API char * rz_str_between(const char *str, const char *prefix, const char *suffix)
Definition: str.c:3264

References rz_core_t::analysis, argv, test-lz4-speed::cwd, free(), getcommapath(), rz_core_t::offset, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_meta_get_string(), rz_meta_set_string(), RZ_META_TYPE_COMMENT, rz_str_between(), RZ_STR_ISNOTEMPTY, rz_str_newf(), and RZ_SYS_DIR.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_function_list_handler()

RZ_IPI RzCmdStatus rz_comment_function_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 263 of file cmd_meta.c.

263  {
265  return RZ_CMD_STATUS_OK;
266 }
RZ_IPI void rz_core_meta_print_list_in_function(RzCore *core, RzAnalysisMetaType type, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:370

References rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_print_list_in_function(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_function_remove_all_handler()

RZ_IPI RzCmdStatus rz_comment_function_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 290 of file cmd_meta.c.

290  {
291  RzListIter *it;
292  RzAnalysisFunction *fcn;
293  rz_list_foreach (core->analysis->fcns, it, fcn) {
295  }
296  return RZ_CMD_STATUS_OK;
297 }
static void meta_function_comment_remove(RzAnalysis *analysis, RzAnalysisFunction *fcn)
Definition: cmd_meta.c:268
RzList * fcns
Definition: rz_analysis.h:565

References rz_core_t::analysis, rz_analysis_t::fcns, meta_function_comment_remove(), and RZ_CMD_STATUS_OK.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_function_remove_handler()

RZ_IPI RzCmdStatus rz_comment_function_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 280 of file cmd_meta.c.

280  {
282  if (!fcn) {
283  RZ_LOG_ERROR("Cannot find the function at the 0x%08" PFMT64x " offset", core->offset);
284  return RZ_CMD_STATUS_ERROR;
285  }
287  return RZ_CMD_STATUS_OK;
288 }

References rz_core_t::analysis, meta_function_comment_remove(), rz_core_t::offset, PFMT64x, rz_analysis_get_fcn_in(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, and RZ_LOG_ERROR.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_handler()

RZ_IPI RzCmdStatus rz_comment_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 197 of file cmd_meta.c.

197  {
199  return RZ_CMD_STATUS_OK;
200 }

References argv, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_append(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_list_handler()

RZ_IPI RzCmdStatus rz_comment_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 202 of file cmd_meta.c.

202  {
204  return RZ_CMD_STATUS_OK;
205 }
RZ_IPI void rz_core_meta_print_list_all(RzCore *core, RzAnalysisMetaType type, RzCmdStateOutput *state)
Definition: cmeta.c:364

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_remove_all_handler()

RZ_IPI RzCmdStatus rz_comment_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 225 of file cmd_meta.c.

225  {
227  return RZ_CMD_STATUS_OK;
228 }

References rz_core_t::analysis, RZ_CMD_STATUS_OK, rz_meta_del(), RZ_META_TYPE_COMMENT, and UT64_MAX.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_remove_handler()

RZ_IPI RzCmdStatus rz_comment_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 220 of file cmd_meta.c.

220  {
222  return RZ_CMD_STATUS_OK;
223 }

References rz_core_t::analysis, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_meta_del(), and RZ_META_TYPE_COMMENT.

Referenced by rzshell_cmddescs_init().

◆ rz_comment_unique_handler()

RZ_IPI RzCmdStatus rz_comment_unique_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 299 of file cmd_meta.c.

299  {
300  char *comment = NULL;
301  if (!strncmp(argv[1], "base64:", 7)) {
302  char *s = (char *)sdb_decode(argv[1] + 7, NULL);
303  if (s) {
304  comment = s;
305  }
306  } else {
307  comment = strdup(argv[1]);
308  }
309  if (comment) {
310  rz_core_meta_comment_add(core, comment, core->offset);
311  free(comment);
312  }
313  return RZ_CMD_STATUS_OK;
314 }
RZ_IPI void rz_core_meta_comment_add(RzCore *core, const char *comment, ut64 addr)
Definition: cmd_meta.c:17
static RzSocket * s
Definition: rtr.c:28

References argv, free(), NULL, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_comment_add(), s, sdb_decode(), and strdup().

Referenced by rzshell_cmddescs_init().

◆ rz_core_meta_comment_add()

RZ_IPI void rz_core_meta_comment_add ( RzCore core,
const char *  comment,
ut64  addr 
)

Definition at line 17 of file cmd_meta.c.

17  {
18  const char *oldcomment = rz_meta_get_string(core->analysis, RZ_META_TYPE_COMMENT, addr);
19  if (!oldcomment || (oldcomment && !strstr(oldcomment, comment))) {
21  }
22 }

References addr, rz_core_t::analysis, rz_meta_get_string(), rz_meta_set_string(), and RZ_META_TYPE_COMMENT.

Referenced by add_arch_platform_flag_comment_cb(), and rz_comment_unique_handler().

◆ rz_meta_data_at_handler()

RZ_IPI RzCmdStatus rz_meta_data_at_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 401 of file cmd_meta.c.

401  {
402  ut64 size = 0;
404  if (mi) {
405  rz_cons_printf("%" PFMT64u "\n", size);
406  }
407  return RZ_CMD_STATUS_OK;
408 }
RZ_API RzAnalysisMetaItem * rz_meta_get_at(RzAnalysis *a, ut64 addr, RzAnalysisMetaType type, RZ_OUT RZ_NULLABLE ut64 *size)
Definition: meta.c:207
@ RZ_META_TYPE_DATA
Definition: rz_analysis.h:289
#define PFMT64u
Definition: rz_types.h:395

References rz_core_t::analysis, mi, rz_core_t::offset, PFMT64u, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_meta_get_at(), RZ_META_TYPE_DATA, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_data_handler()

RZ_IPI RzCmdStatus rz_meta_data_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 382 of file cmd_meta.c.

382  {
383  ut64 i, addr = core->offset;
384  ut64 size = rz_num_math(core->num, argv[1]);
385  ut64 repeat = argc > 2 ? rz_num_math(core->num, argv[2]) : 1;
386  if (size == 0 || repeat == 0) {
387  RZ_LOG_ERROR("Data size or repeat count cannot be zero\n");
388  return RZ_CMD_STATUS_ERROR;
389  }
390  for (i = 0; i < repeat; i++, addr += size) {
392  }
393  return RZ_CMD_STATUS_OK;
394 }
static bool meta_set_flag(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
Definition: cmd_meta.c:160
static void repeat(struct parse *, sopno, int, int)
Definition: regcomp.c:1155
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
Definition: unum.c:456
RzNum * num
Definition: rz_core.h:316

References addr, argv, i, meta_set_flag(), rz_core_t::num, rz_core_t::offset, repeat(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, RZ_LOG_ERROR, RZ_META_TYPE_DATA, rz_num_math(), and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_data_list_handler()

RZ_IPI RzCmdStatus rz_meta_data_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 396 of file cmd_meta.c.

396  {
398  return RZ_CMD_STATUS_OK;
399 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_DATA.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_data_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_data_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 428 of file cmd_meta.c.

428  {
430  return RZ_CMD_STATUS_OK;
431 }
static void meta_remove_all(RzCore *core, RzAnalysisMetaType mtype)
Definition: cmd_meta.c:165

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_DATA.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_data_remove_handler()

RZ_IPI RzCmdStatus rz_meta_data_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 410 of file cmd_meta.c.

410  {
411  if (argc > 1) {
412  ut64 i, addr = core->offset;
413  ut64 size = rz_num_math(core->num, argv[1]);
414  ut64 repeat = argc > 2 ? rz_num_math(core->num, argv[2]) : 1;
415  if (size == 0 || repeat == 0) {
416  RZ_LOG_ERROR("Data size or repeat count cannot be zero\n");
417  return RZ_CMD_STATUS_ERROR;
418  }
419  for (i = 0; i < repeat; i++, addr += size) {
421  }
422  } else {
423  meta_remove(core, RZ_META_TYPE_DATA, core->offset);
424  }
425  return RZ_CMD_STATUS_OK;
426 }
static void meta_remove(RzCore *core, RzAnalysisMetaType mtype, ut64 addr)
Definition: cmd_meta.c:169
static void meta_remove_size(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size)
Definition: cmd_meta.c:173

References addr, argv, i, meta_remove(), meta_remove_size(), rz_core_t::num, rz_core_t::offset, repeat(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, RZ_LOG_ERROR, RZ_META_TYPE_DATA, rz_num_math(), and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_format_handler()

RZ_IPI RzCmdStatus rz_meta_format_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 509 of file cmd_meta.c.

509  {
510  ut64 size = rz_num_math(core->num, argv[1]);
511  return bool2status(meta_set_string(core, RZ_META_TYPE_FORMAT, core->offset, size, argv[2]));
512 }
static bool meta_set_string(RzCore *core, RzAnalysisMetaType mtype, ut64 addr, ut64 size, const char *str)
Definition: cmd_meta.c:156
static RzCmdStatus bool2status(bool val)
Definition: core_private.h:208
@ RZ_META_TYPE_FORMAT
Definition: rz_analysis.h:292

References argv, bool2status(), meta_set_string(), rz_core_t::num, rz_core_t::offset, RZ_META_TYPE_FORMAT, rz_num_math(), and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_format_list_handler()

RZ_IPI RzCmdStatus rz_meta_format_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 514 of file cmd_meta.c.

514  {
516  return RZ_CMD_STATUS_OK;
517 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_FORMAT.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_format_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_format_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 524 of file cmd_meta.c.

524  {
526  return RZ_CMD_STATUS_OK;
527 }

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_FORMAT.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_format_remove_handler()

RZ_IPI RzCmdStatus rz_meta_format_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 519 of file cmd_meta.c.

519  {
520  meta_remove(core, RZ_META_TYPE_FORMAT, core->offset);
521  return RZ_CMD_STATUS_OK;
522 }

References meta_remove(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_FORMAT.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_hidden_handler()

RZ_IPI RzCmdStatus rz_meta_hidden_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 549 of file cmd_meta.c.

549  {
550  ut64 size = rz_num_math(core->num, argv[1]);
551  return bool2status(meta_set_flag(core, RZ_META_TYPE_HIDE, core->offset, size, argv[1]));
552 }
@ RZ_META_TYPE_HIDE
Definition: rz_analysis.h:294

References argv, bool2status(), meta_set_flag(), rz_core_t::num, rz_core_t::offset, RZ_META_TYPE_HIDE, rz_num_math(), and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_hidden_list_handler()

RZ_IPI RzCmdStatus rz_meta_hidden_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 554 of file cmd_meta.c.

554  {
556  return RZ_CMD_STATUS_OK;
557 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_HIDE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_hidden_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_hidden_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 564 of file cmd_meta.c.

564  {
566  return RZ_CMD_STATUS_OK;
567 }

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_HIDE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_hidden_remove_handler()

RZ_IPI RzCmdStatus rz_meta_hidden_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 559 of file cmd_meta.c.

559  {
560  meta_remove(core, RZ_META_TYPE_HIDE, core->offset);
561  return RZ_CMD_STATUS_OK;
562 }

References meta_remove(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_HIDE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_list_at_handler()

RZ_IPI RzCmdStatus rz_meta_list_at_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 182 of file cmd_meta.c.

182  {
184  return RZ_CMD_STATUS_OK;
185 }
RZ_IPI void rz_core_meta_print_list_at(RzCore *core, ut64 addr, RzCmdStateOutput *state)
Definition: cmeta.c:326

References rz_core_t::offset, RZ_CMD_STATUS_OK, and rz_core_meta_print_list_at().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_list_handler()

RZ_IPI RzCmdStatus rz_meta_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 177 of file cmd_meta.c.

177  {
179  return RZ_CMD_STATUS_OK;
180 }
@ RZ_META_TYPE_ANY
Definition: rz_analysis.h:288

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_ANY.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_magic_handler()

RZ_IPI RzCmdStatus rz_meta_magic_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 529 of file cmd_meta.c.

529  {
530  ut64 size = rz_num_math(core->num, argv[1]);
531  return bool2status(meta_set_string(core, RZ_META_TYPE_MAGIC, core->offset, size, argv[2]));
532 }
@ RZ_META_TYPE_MAGIC
Definition: rz_analysis.h:293

References argv, bool2status(), meta_set_string(), rz_core_t::num, rz_core_t::offset, RZ_META_TYPE_MAGIC, rz_num_math(), and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_magic_list_handler()

RZ_IPI RzCmdStatus rz_meta_magic_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 534 of file cmd_meta.c.

534  {
536  return RZ_CMD_STATUS_OK;
537 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_MAGIC.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_magic_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_magic_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 544 of file cmd_meta.c.

544  {
546  return RZ_CMD_STATUS_OK;
547 }

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_MAGIC.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_magic_remove_handler()

RZ_IPI RzCmdStatus rz_meta_magic_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 539 of file cmd_meta.c.

539  {
540  meta_remove(core, RZ_META_TYPE_MAGIC, core->offset);
541  return RZ_CMD_STATUS_OK;
542 }

References meta_remove(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_MAGIC.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 192 of file cmd_meta.c.

192  {
194  return RZ_CMD_STATUS_OK;
195 }

References rz_core_t::analysis, RZ_CMD_STATUS_OK, rz_meta_del(), RZ_META_TYPE_ANY, and UT64_MAX.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_remove_handler()

RZ_IPI RzCmdStatus rz_meta_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 187 of file cmd_meta.c.

187  {
188  rz_meta_del(core->analysis, RZ_META_TYPE_ANY, core->offset, 1);
189  return RZ_CMD_STATUS_OK;
190 }

References rz_core_t::analysis, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_meta_del(), and RZ_META_TYPE_ANY.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_space_handler()

RZ_IPI RzCmdStatus rz_meta_space_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 316 of file cmd_meta.c.

316  {
317  RzSpaces *ms = &core->analysis->meta_spaces;
318  rz_spaces_add(ms, argv[1]);
319  return RZ_CMD_STATUS_OK;
320 }
RZ_API RzSpace * rz_spaces_add(RzSpaces *sp, const char *name)
Definition: spaces.c:96
RzSpaces meta_spaces
Definition: rz_analysis.h:601

References rz_core_t::analysis, argv, rz_analysis_t::meta_spaces, RZ_CMD_STATUS_OK, and rz_spaces_add().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_space_list_handler()

RZ_IPI RzCmdStatus rz_meta_space_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 322 of file cmd_meta.c.

322  {
323  RzSpaces *ms = &core->analysis->meta_spaces;
324  rz_core_spaces_print(core, ms, state);
325  return RZ_CMD_STATUS_OK;
326 }
RZ_IPI void rz_core_spaces_print(RzCore *core, RzSpaces *spaces, RzCmdStateOutput *state)
Definition: cmeta.c:9

References rz_core_t::analysis, rz_analysis_t::meta_spaces, RZ_CMD_STATUS_OK, and rz_core_spaces_print().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_space_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_space_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 340 of file cmd_meta.c.

340  {
341  RzSpaces *ms = &core->analysis->meta_spaces;
342  rz_spaces_unset(ms, NULL);
343  return RZ_CMD_STATUS_OK;
344 }
RZ_API bool rz_spaces_unset(RzSpaces *sp, const char *name)
Definition: spaces.c:141

References rz_core_t::analysis, rz_analysis_t::meta_spaces, NULL, RZ_CMD_STATUS_OK, and rz_spaces_unset().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_space_remove_handler()

RZ_IPI RzCmdStatus rz_meta_space_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 334 of file cmd_meta.c.

334  {
335  RzSpaces *ms = &core->analysis->meta_spaces;
336  rz_spaces_unset(ms, argv[1]);
337  return RZ_CMD_STATUS_OK;
338 }

References rz_core_t::analysis, argv, rz_analysis_t::meta_spaces, RZ_CMD_STATUS_OK, and rz_spaces_unset().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_space_rename_handler()

RZ_IPI RzCmdStatus rz_meta_space_rename_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 328 of file cmd_meta.c.

328  {
329  RzSpaces *ms = &core->analysis->meta_spaces;
330  rz_spaces_rename(ms, argv[1], argv[2]);
331  return RZ_CMD_STATUS_OK;
332 }
RZ_API bool rz_spaces_rename(RzSpaces *sp, const char *oname, const char *nname)
Definition: spaces.c:196

References rz_core_t::analysis, argv, rz_analysis_t::meta_spaces, RZ_CMD_STATUS_OK, and rz_spaces_rename().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_8bit_handler()

RZ_IPI RzCmdStatus rz_meta_string_8bit_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 471 of file cmd_meta.c.

471  {
472  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
474  return RZ_CMD_STATUS_ERROR;
475  }
476  return RZ_CMD_STATUS_OK;
477 }
RZ_API bool rz_core_meta_string_add(RzCore *core, ut64 addr, ut64 size, RzStrEnc encoding, RZ_NULLABLE const char *name)
add a string to RzCore
Definition: cmeta.c:474
@ RZ_STRING_ENC_8BIT
Definition: rz_str.h:20

References argv, NULL, rz_core_t::num, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_meta_string_add(), rz_num_math(), RZ_STRING_ENC_8BIT, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_at_handler()

RZ_IPI RzCmdStatus rz_meta_string_at_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 446 of file cmd_meta.c.

446  {
447  ut64 size = 0;
449  if (!mi) {
450  return RZ_CMD_STATUS_OK;
451  }
452  rz_core_meta_print(core, mi, core->offset, size, false, state);
453  return RZ_CMD_STATUS_OK;
454 }
RZ_IPI void rz_core_meta_print(RzCore *core, RzAnalysisMetaItem *d, ut64 start, ut64 size, bool show_full, RzCmdStateOutput *state)
Definition: cmeta.c:74
@ RZ_META_TYPE_STRING
Definition: rz_analysis.h:291

References rz_core_t::analysis, mi, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_print(), rz_meta_get_at(), RZ_META_TYPE_STRING, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_handler()

RZ_IPI RzCmdStatus rz_meta_string_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 433 of file cmd_meta.c.

433  {
434  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
436  return RZ_CMD_STATUS_ERROR;
437  }
438  return RZ_CMD_STATUS_OK;
439 }
@ RZ_STRING_ENC_GUESS
Definition: rz_str.h:33

References argv, NULL, rz_core_t::num, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_meta_string_add(), rz_num_math(), RZ_STRING_ENC_GUESS, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_list_handler()

RZ_IPI RzCmdStatus rz_meta_string_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 441 of file cmd_meta.c.

441  {
443  return RZ_CMD_STATUS_OK;
444 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_STRING.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_pascal_handler()

RZ_IPI RzCmdStatus rz_meta_string_pascal_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 456 of file cmd_meta.c.

456  {
458  return RZ_CMD_STATUS_ERROR;
459  }
460  return RZ_CMD_STATUS_OK;
461 }
RZ_API bool rz_core_meta_pascal_string_add(RzCore *core, ut64 addr, RzStrEnc encoding, RZ_NULLABLE const char *name)
add a pascal string to RzCore
Definition: cmeta.c:516
@ RZ_STRING_ENC_UTF8
Definition: rz_str.h:21

References NULL, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_meta_pascal_string_add(), and RZ_STRING_ENC_UTF8.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_string_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 504 of file cmd_meta.c.

504  {
506  return RZ_CMD_STATUS_OK;
507 }

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_STRING.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_remove_handler()

RZ_IPI RzCmdStatus rz_meta_string_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 499 of file cmd_meta.c.

499  {
500  meta_remove(core, RZ_META_TYPE_STRING, core->offset);
501  return RZ_CMD_STATUS_OK;
502 }

References meta_remove(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_STRING.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_utf8_handler()

RZ_IPI RzCmdStatus rz_meta_string_utf8_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 463 of file cmd_meta.c.

463  {
464  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
466  return RZ_CMD_STATUS_ERROR;
467  }
468  return RZ_CMD_STATUS_OK;
469 }

References argv, NULL, rz_core_t::num, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_meta_string_add(), rz_num_math(), RZ_STRING_ENC_UTF8, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_wide16_handler()

RZ_IPI RzCmdStatus rz_meta_string_wide16_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 479 of file cmd_meta.c.

479  {
480  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
481  bool big_endian = rz_config_get_b(core->config, "cfg.bigendian");
483  if (!rz_core_meta_string_add(core, core->offset, size, enc, NULL)) {
484  return RZ_CMD_STATUS_ERROR;
485  }
486  return RZ_CMD_STATUS_OK;
487 }
RZ_API bool rz_config_get_b(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:142
RzStrEnc
Definition: rz_str.h:19
@ RZ_STRING_ENC_UTF16LE
Definition: rz_str.h:23
@ RZ_STRING_ENC_UTF16BE
Definition: rz_str.h:25

References argv, rz_core_t::config, NULL, rz_core_t::num, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get_b(), rz_core_meta_string_add(), rz_num_math(), RZ_STRING_ENC_UTF16BE, RZ_STRING_ENC_UTF16LE, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_string_wide32_handler()

RZ_IPI RzCmdStatus rz_meta_string_wide32_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 489 of file cmd_meta.c.

489  {
490  ut64 size = argc > 1 ? rz_num_math(core->num, argv[1]) : 0;
491  bool big_endian = rz_config_get_b(core->config, "cfg.bigendian");
493  if (!rz_core_meta_string_add(core, core->offset, size, enc, NULL)) {
494  return RZ_CMD_STATUS_ERROR;
495  }
496  return RZ_CMD_STATUS_OK;
497 }
@ RZ_STRING_ENC_UTF32LE
Definition: rz_str.h:24
@ RZ_STRING_ENC_UTF32BE
Definition: rz_str.h:26

References argv, rz_core_t::config, NULL, rz_core_t::num, rz_core_t::offset, RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get_b(), rz_core_meta_string_add(), rz_num_math(), RZ_STRING_ENC_UTF32BE, RZ_STRING_ENC_UTF32LE, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_type_current_handler()

RZ_IPI RzCmdStatus rz_meta_type_current_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 374 of file cmd_meta.c.

374  {
375  const char *comment = rz_meta_get_string(core->analysis, RZ_META_TYPE_VARTYPE, core->offset);
376  if (comment) {
377  rz_cons_println(comment);
378  }
379  return RZ_CMD_STATUS_OK;
380 }
@ RZ_META_TYPE_VARTYPE
Definition: rz_analysis.h:297

References rz_core_t::analysis, rz_core_t::offset, RZ_CMD_STATUS_OK, rz_cons_println(), rz_meta_get_string(), and RZ_META_TYPE_VARTYPE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_type_editor_handler()

RZ_IPI RzCmdStatus rz_meta_type_editor_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 589 of file cmd_meta.c.

589  {
591  return RZ_CMD_STATUS_OK;
592 }

References rz_core_t::offset, RZ_CMD_STATUS_OK, rz_core_meta_editor(), and RZ_META_TYPE_VARTYPE.

◆ rz_meta_type_handler()

RZ_IPI RzCmdStatus rz_meta_type_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 569 of file cmd_meta.c.

569  {
570  meta_set_flag(core, RZ_META_TYPE_VARTYPE, core->offset, 1, argv[1]);
571  return RZ_CMD_STATUS_OK;
572 }

References argv, meta_set_flag(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_VARTYPE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_type_list_handler()

RZ_IPI RzCmdStatus rz_meta_type_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 574 of file cmd_meta.c.

574  {
576  return RZ_CMD_STATUS_OK;
577 }

References RZ_CMD_STATUS_OK, rz_core_meta_print_list_all(), and RZ_META_TYPE_VARTYPE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_type_remove_all_handler()

RZ_IPI RzCmdStatus rz_meta_type_remove_all_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 584 of file cmd_meta.c.

584  {
586  return RZ_CMD_STATUS_OK;
587 }

References meta_remove_all(), RZ_CMD_STATUS_OK, and RZ_META_TYPE_VARTYPE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_type_remove_handler()

RZ_IPI RzCmdStatus rz_meta_type_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 579 of file cmd_meta.c.

579  {
581  return RZ_CMD_STATUS_OK;
582 }

References meta_remove(), rz_core_t::offset, RZ_CMD_STATUS_OK, and RZ_META_TYPE_VARTYPE.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_bp_comment_list_handler()

RZ_IPI RzCmdStatus rz_meta_var_bp_comment_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 366 of file cmd_meta.c.

366  {
368 }
static RzCmdStatus meta_variable_comment_list(RzCore *core, RzAnalysisVarKind kind, RzCmdStateOutput *state)
Definition: cmd_meta.c:57
@ RZ_ANALYSIS_VAR_KIND_BPV
Definition: rz_analysis.h:704

References meta_variable_comment_list(), and RZ_ANALYSIS_VAR_KIND_BPV.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_comment_append_handler()

RZ_IPI RzCmdStatus rz_meta_var_comment_append_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 346 of file cmd_meta.c.

346  {
347  return meta_variable_comment_append(core, argv[1], argv[2]);
348 }
static RzCmdStatus meta_variable_comment_append(RzCore *core, const char *name, const char *comment)
Definition: cmd_meta.c:88

References argv, and meta_variable_comment_append().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_comment_editor_handler()

RZ_IPI RzCmdStatus rz_meta_var_comment_editor_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 354 of file cmd_meta.c.

354  {
355  return meta_variable_comment_editor(core, argv[1]);
356 }
static RzCmdStatus meta_variable_comment_editor(RzCore *core, const char *name)
Definition: cmd_meta.c:137

References argv, and meta_variable_comment_editor().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_comment_list_handler()

RZ_IPI RzCmdStatus rz_meta_var_comment_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 358 of file cmd_meta.c.

358  {
360 }
static RzCmdStatus meta_variable_comment_list_all(RzCore *core, RzCmdStateOutput *state)
Definition: cmd_meta.c:74

References meta_variable_comment_list_all().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_comment_remove_handler()

RZ_IPI RzCmdStatus rz_meta_var_comment_remove_handler ( RzCore core,
int  argc,
const char **  argv 
)

Definition at line 350 of file cmd_meta.c.

350  {
351  return meta_variable_comment_remove(core, argv[1]);
352 }
static RzCmdStatus meta_variable_comment_remove(RzCore *core, const char *name)
Definition: cmd_meta.c:121

References argv, and meta_variable_comment_remove().

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_reg_comment_list_handler()

RZ_IPI RzCmdStatus rz_meta_var_reg_comment_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 362 of file cmd_meta.c.

362  {
364 }
@ RZ_ANALYSIS_VAR_KIND_REG
Definition: rz_analysis.h:703

References meta_variable_comment_list(), and RZ_ANALYSIS_VAR_KIND_REG.

Referenced by rzshell_cmddescs_init().

◆ rz_meta_var_stack_comment_list_handler()

RZ_IPI RzCmdStatus rz_meta_var_stack_comment_list_handler ( RzCore core,
int  argc,
const char **  argv,
RzCmdStateOutput state 
)

Definition at line 370 of file cmd_meta.c.

370  {
372 }
@ RZ_ANALYSIS_VAR_KIND_SPV
Definition: rz_analysis.h:705

References meta_variable_comment_list(), and RZ_ANALYSIS_VAR_KIND_SPV.

Referenced by rzshell_cmddescs_init().