7 #include "../core_private.h"
16 for (; *
a && *
b;
a++,
b++) {
32 if (!strncmp(
f->name, kw, strlen(kw))) {
49 const size_t prefix_len = strlen(
prefix);
51 if (prefix_len > 0 && strncmp(
f->name,
prefix, prefix_len)) {
54 if (prefix_len > strlen(
f->name)) {
60 const char *
name =
f->name;
61 int name_len = strlen(
name);
62 rz_list_foreach (
flags, iter2,
f2) {
63 if (prefix_len > strlen(
f2->name)) {
66 if (prefix_len > 0 && strncmp(
f2->name,
prefix, prefix_len)) {
70 if (matching < prefix_len || matching == name_len) {
73 if (matching > name_len) {
76 if (matching < name_len) {
81 const int kw_len = strlen(kw);
89 rz_list_foreach (
flags, iter2,
f2) {
90 if (strncmp(
f2->name, kw, kw_len)) {
96 if (matching < fname_len) {
100 fname_len = matching;
113 rz_list_foreach (
list, iter2,
fn) {
114 if (!strcmp(
fn, kw)) {
144 const int name_len = strlen(
name);
145 rz_list_foreach (children,
iter,
fn) {
168 const char *
name =
v;
169 switch (
ctx->state->mode) {
192 if (!strncmp(comment,
"base64:", 7)) {
193 const char *b64str = comment + 7;
196 RZ_LOG_ERROR(
"Failed to decode base64-encoded string: \"%s\"\n", b64str);
213 " because there is already \"%s\" flag\n",
282 if (!fcn->
labels->count) {
322 static int cmpflag(
const void *_a,
const void *_b) {
324 return (flag1->
offset - flag2->offset);
333 switch (
state->mode) {
336 pj_kn(pj,
"offset",
f->offset);
337 pj_ks(pj,
"name",
f->name);
340 pj_ks(pj,
"realname",
f->realname);
347 if (
f->offset !=
addr) {
379 switch (
state->mode) {
413 char *lmatch =
NULL, *umatch =
NULL;
417 rz_list_foreach (temp,
iter, flag) {
429 char *
match = (curseek - loff) < (uoff - curseek) ? lmatch : umatch;
447 rz_list_foreach (
f->zones,
iter, zi) {
448 switch (
state->mode) {
506 max =
m->itv.addr +
m->itv.size;
556 switch (
state->mode) {
645 char *
p = strchr(
pfx,
'*');
661 switch (
state->mode) {
732 const char *cur_name = rz_flag_space_cur_name(
core->
flags);
875 if (!item && !strncmp(
argv[1],
"fcn.", 4)) {
RZ_IPI void rz_core_flag_range_print(RzFlag *f, RzCmdStateOutput *state, ut64 range_from, ut64 range_to)
RZ_IPI void rz_core_flag_print(RzFlag *f, RzCmdStateOutput *state)
RZ_API int rz_core_cmd0(RzCore *core, const char *cmd)
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
RZ_IPI RzCmdStatus rz_flag_space_stack_pop_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_local_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
static int flag_to_flag(RzCore *core, const char *glob)
RZ_IPI RzCmdStatus rz_flag_graph_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_range_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_zone_remove_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_local_list_all_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
static void flag_zone_list(RzFlag *f, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_relocate_handler(RzCore *core, int argc, const char **argv)
static bool flag_set_comment(RzFlagItem *item, const char *comment)
RZ_IPI RzCmdStatus rz_flag_ordinals_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_list_at_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_zone_add_handler(RzCore *core, int argc, const char **argv)
static int cmpflag(const void *_a, const void *_b)
RZ_IPI RzCmdStatus rz_flag_base_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_append_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_alias_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_hexdump_handler(RzCore *core, int argc, const char **argv)
static bool flag_to_flag_foreach(RzFlagItem *fi, void *user)
RZ_IPI RzCmdStatus rz_flag_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_local_add_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_exists_handler(RzCore *core, int argc, const char **argv)
static const char * __isOnlySon(RzCore *core, RzList *flags, const char *kw)
RZ_IPI RzCmdStatus rz_flag_comment_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_space_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_space_move_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_remove_all_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_color_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_tag_search_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_remove_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_space_rename_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_rename_handler(RzCore *core, int argc, const char **argv)
static bool flagbar_foreach(RzFlagItem *fi, void *user)
RZ_IPI RzCmdStatus rz_flag_zone_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_tag_add_handler(RzCore *core, int argc, const char **argv)
static void print_space_stack(RzFlag *f, int ordinal, const char *name, bool selected, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_describe_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
static bool listFlag(RzFlagItem *flag, void *user)
static bool adjust_offset(RzFlagItem *flag, void *user)
static bool print_function_labels_cb(void *user, const ut64 addr, const void *v)
RZ_IPI RzCmdStatus rz_flag_realname_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_move_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_add_handler(RzCore *core, int argc, const char **argv)
static void flag_ordinals(RzCore *core, const char *glob)
RZ_IPI RzCmdStatus rz_flag_space_stack_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI void rz_core_flag_describe(RzCore *core, ut64 addr, bool strict_offset, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_space_remove_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_zone_around_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_distance_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_zone_remove_all_handler(RzCore *core, int argc, const char **argv)
static void flagbars(RzCore *core, const char *glob)
RZ_IPI RzCmdStatus rz_flag_length_handler(RzCore *core, int argc, const char **argv)
static void flag_tag_print(RzCore *core, const char *tag, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_describe_closest_handler(RzCore *core, int argc, const char **argv)
static void __printRecursive(RzCore *core, RzList *list, const char *name, RzOutputMode mode, int depth)
static RzList * __childrenFlagsOf(RzCore *core, RzList *flags, const char *prefix)
RZ_IPI RzCmdStatus rz_flag_space_stack_push_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_space_add_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_space_remove_all_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_list_ascii_handler(RzCore *core, int argc, const char **argv)
RZ_IPI RzCmdStatus rz_flag_tag_list_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
RZ_IPI RzCmdStatus rz_flag_local_remove_handler(RzCore *core, int argc, const char **argv)
static size_t countMatching(const char *a, const char *b)
RZ_IPI RzCmdStatus rz_flag_describe_at_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
static bool rename_flag_ordinal(RzFlagItem *fi, void *user)
RZ_API int rz_cons_get_size(int *rows)
RZ_API int rz_cons_printf(const char *format,...)
RZ_API bool rz_cons_is_breaked(void)
RZ_API void rz_cons_println(const char *str)
static RzCmdStatus bool2status(bool val)
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags cmd
RZ_DEPRECATE RZ_API RzAnalysisFunction * rz_analysis_get_fcn_in(RzAnalysis *analysis, ut64 addr, int type)
RZ_API int rz_flag_rename(RzFlag *f, RzFlagItem *item, const char *name)
RZ_API RzFlagItem * rz_flag_get_i(RzFlag *f, ut64 off)
RZ_API void rz_flag_foreach_space_glob(RzFlag *f, const char *glob, const RzSpace *space, RzFlagItemCb cb, void *user)
RZ_API const char * rz_flag_item_set_color(RzFlagItem *item, const char *color)
RZ_API void rz_flag_item_set_comment(RzFlagItem *item, const char *comment)
RZ_API const RzList * rz_flag_get_list(RzFlag *f, ut64 off)
RZ_API bool rz_flag_unset_all_off(RzFlag *f, ut64 off)
RZ_API RzList * rz_flag_all_list(RzFlag *f, bool by_space)
RZ_API void rz_flag_item_set_alias(RzFlagItem *item, const char *alias)
RZ_API RzFlagItem * rz_flag_get_at(RzFlag *f, ut64 off, bool closest)
RZ_API RzFlagItem * rz_flag_get(RzFlag *f, const char *name)
RZ_API RzFlagItem * rz_flag_set(RzFlag *f, const char *name, ut64 off, ut32 size)
RZ_API void rz_flag_unset_all(RzFlag *f)
RZ_API bool rz_flag_move(RzFlag *f, ut64 at, ut64 to)
RZ_API int rz_flag_unset_glob(RzFlag *f, const char *glob)
RZ_API void rz_flag_foreach_space(RzFlag *f, const RzSpace *space, RzFlagItemCb cb, void *user)
RZ_API int rz_flag_relocate(RzFlag *f, ut64 off, ut64 off_mask, ut64 to)
RZ_API void rz_flag_item_set_realname(RzFlagItem *item, const char *realname)
RZ_API void rz_flag_foreach_glob(RzFlag *f, const char *glob, RzFlagItemCb cb, void *user)
unsigned short prefix[65536]
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API const KEY_TYPE bool * found
RZ_API bool rz_analysis_function_delete_label(RzAnalysisFunction *fcn, const char *name)
RZ_API bool rz_analysis_function_set_label(RzAnalysisFunction *fcn, const char *name, ut64 addr)
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API void rz_list_sort(RZ_NONNULL RzList *list, RZ_NONNULL RzListComparator cmp)
Sorts via merge sort or via insertion sort a list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
static static fork const void static count static fd const char const char static newpath char char argv
static const char struct stat static buf struct stat static buf static idle const char static path static fd const char static len const void static prot const char struct module static image struct kernel_sym static table unsigned char static buf static fsuid unsigned struct dirent unsigned static count const struct iovec static count static pid const void static len static flags const struct sched_param static p static pid static policy struct timespec static tp static suid unsigned fn
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_API void rz_print_rangebar(RzPrint *p, ut64 startA, ut64 endA, ut64 min, ut64 max, int cols)
#define rz_warn_if_reached()
#define rz_return_val_if_fail(expr, val)
RZ_API ut8 * rz_base64_decode_dyn(const char *in, int len)
enum rz_cmd_status_t RzCmdStatus
@ RZ_CMD_STATUS_OK
command handler exited in the right way
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
RZ_API ut64 rz_io_size(RzIO *io)
RZ_API RzIOMap * rz_io_map_get(RzIO *io, ut64 addr)
#define RZ_LOG_INFO(fmtstr,...)
#define RZ_LOG_DEBUG(fmtstr,...)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API ut64 rz_num_math(RzNum *num, const char *str)
RZ_API PJ * pj_kb(PJ *j, const char *k, bool v)
RZ_API PJ * pj_ki(PJ *j, const char *k, int d)
RZ_API PJ * pj_k(PJ *j, const char *k)
RZ_API PJ * pj_end(PJ *j)
RZ_API PJ * pj_s(PJ *j, const char *k)
RZ_API PJ * pj_ks(PJ *j, const char *k, const char *v)
RZ_API PJ * pj_kn(PJ *j, const char *k, ut64 n)
#define RZ_STR_ISNOTEMPTY(x)
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API RZ_OWN char * rz_str_escape(RZ_NONNULL const char *buf)
#define RZ_STR_ISEMPTY(x)
RZ_API const char * rz_str_trim_head_ro(const char *str)
RZ_API const char * rz_str_pad(const char ch, int len)
RzOutputMode
Enum to describe the way data are printed.
@ RZ_OUTPUT_MODE_STANDARD
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void static flags void flags
Represent the output state of a command handler.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
RZ_API bool rz_flag_zone_reset(RzFlag *f)
RZ_API bool rz_flag_zone_around(RzFlag *f, ut64 addr, const char **prev, const char **next)
RZ_API bool rz_flag_zone_del(RzFlag *f, const char *name)
RZ_API bool rz_flag_zone_add(RzFlag *f, const char *name, ut64 addr)