Rizin
unix-like reverse engineering framework and cli tools
cmd_info.c File Reference
#include <string.h>
#include <rz_bin.h>
#include <rz_config.h>
#include <rz_cons.h>
#include <rz_core.h>
#include <rz_demangler.h>
#include "../bin/pdb/pdb_downloader.h"
#include "../core_private.h"

Go to the source code of this file.

Macros

#define GET_CHECK_CUR_BINFILE(core)
 

Enumerations

enum  PrintSourceInfoType { PRINT_SOURCE_INFO_LINES_ALL , PRINT_SOURCE_INFO_LINES_HERE , PRINT_SOURCE_INFO_FILES }
 

Functions

static int bin_is_executable (RzBinObject *obj)
 
static bool is_equal_file_hashes (RzList *lfile_hashes, RzList *rfile_hashes, bool *equal)
 
static bool source_file_collect_cb (void *user, const void *k, const void *v)
 
static bool print_source_info (RzCore *core, PrintSourceInfoType type, RzCmdStateOutput *state)
 
RZ_IPI int rz_cmd_info_kuery (void *data, const char *input)
 
RZ_IPI RzCmdStatus rz_cmd_info_archs_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_all_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_entry_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_entryexits_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_exports_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_cur_export_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_symbols_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_cur_symbol_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_imports_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_libs_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_main_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_relocs_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_sections_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_cur_section_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_section_bars_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_cmd_info_segments_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_cur_segment_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_strings_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_whole_strings_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_purge_string_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_cmd_info_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_classes_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_class_as_source_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_cmd_info_class_fields_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_class_methods_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_signature_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_fields_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_headers_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_cmd_info_binary_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_plugins_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_dwarf_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_pdb_load_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_pdb_show_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_pdb_download_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_pdb_extract_handler (RzCore *core, int argc, const char **argv)
 
static bool print_demangler_info (const RzDemanglerPlugin *plugin, void *user)
 
RZ_IPI char ** rz_cmd_info_demangle_lang_choices (RzCore *core)
 
RZ_IPI RzCmdStatus rz_cmd_info_demangle_handler (RzCore *core, int argc, const char **argv)
 
RZ_IPI RzCmdStatus rz_cmd_info_demangle_list_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_memory_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_resources_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_hashes_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_versions_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_trycatch_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_sourcelines_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_sourcelines_here_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_source_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 
RZ_IPI RzCmdStatus rz_cmd_info_guess_size_handler (RzCore *core, int argc, const char **argv, RzCmdStateOutput *state)
 

Macro Definition Documentation

◆ GET_CHECK_CUR_BINFILE

#define GET_CHECK_CUR_BINFILE (   core)
Value:
RzBinFile *bf = rz_bin_cur(core->bin); \
if (!bf) { \
RZ_LOG_ERROR("No binary object currently selected.\n"); \
}
RZ_API RzBinFile * rz_bin_cur(RzBin *bin)
Definition: bin.c:895
@ RZ_CMD_STATUS_ERROR
command handler had issues while running (e.g. allocation error, etc.)
Definition: rz_cmd.h:26
XX curplugin == o->plugin.
Definition: rz_bin.h:298

Definition at line 176 of file cmd_info.c.

Enumeration Type Documentation

◆ PrintSourceInfoType

Enumerator
PRINT_SOURCE_INFO_LINES_ALL 
PRINT_SOURCE_INFO_LINES_HERE 
PRINT_SOURCE_INFO_FILES 

Definition at line 60 of file cmd_info.c.

60  {
PrintSourceInfoType
Definition: cmd_info.c:60
@ PRINT_SOURCE_INFO_LINES_ALL
Definition: cmd_info.c:61
@ PRINT_SOURCE_INFO_FILES
Definition: cmd_info.c:63
@ PRINT_SOURCE_INFO_LINES_HERE
Definition: cmd_info.c:62

Function Documentation

◆ bin_is_executable()

static int bin_is_executable ( RzBinObject obj)
static

Definition at line 13 of file cmd_info.c.

13  {
14  RzListIter *it;
15  RzBinSection *sec;
16  if (obj) {
17  if (obj->info && obj->info->arch) {
18  return true;
19  }
20  rz_list_foreach (obj->sections, it, sec) {
21  if (sec->perm & RZ_PERM_X) {
22  return true;
23  }
24  }
25  }
26  return false;
27 }
#define RZ_PERM_X
Definition: rz_types.h:95
char * arch
Definition: rz_bin.h:214
RzBinInfo * info
Definition: rz_bin.h:287
RzList * sections
Definition: rz_bin.h:267

References rz_bin_info_t::arch, rz_bin_object_t::info, rz_bin_section_t::perm, RZ_PERM_X, and rz_bin_object_t::sections.

Referenced by rz_cmd_info_handler().

◆ is_equal_file_hashes()

static bool is_equal_file_hashes ( RzList lfile_hashes,
RzList rfile_hashes,
bool equal 
)
static

Definition at line 29 of file cmd_info.c.

29  {
30  rz_return_val_if_fail(lfile_hashes, false);
31  rz_return_val_if_fail(rfile_hashes, false);
32  rz_return_val_if_fail(equal, false);
33 
34  *equal = true;
35  RzBinFileHash *fh_l, *fh_r;
36  RzListIter *hiter_l, *hiter_r;
37  rz_list_foreach (lfile_hashes, hiter_l, fh_l) {
38  rz_list_foreach (rfile_hashes, hiter_r, fh_r) {
39  if (strcmp(fh_l->type, fh_r->type)) {
40  continue;
41  }
42  if (!!strcmp(fh_l->hex, fh_r->hex)) {
43  *equal = false;
44  return true;
45  }
46  }
47  }
48  return true;
49 }
#define rz_return_val_if_fail(expr, val)
Definition: rz_assert.h:108
const char * type
Definition: rz_bin.h:205
const char * hex
Definition: rz_bin.h:206

References rz_bin_file_hash_t::hex, rz_return_val_if_fail, and rz_bin_file_hash_t::type.

Referenced by rz_cmd_info_hashes_handler().

◆ print_demangler_info()

static bool print_demangler_info ( const RzDemanglerPlugin plugin,
void *  user 
)
static

Definition at line 535 of file cmd_info.c.

535  {
536  if (!user) {
537  rz_cons_printf("%-6s %-8s %s\n", plugin->language, plugin->license, plugin->author);
538  return true;
539  }
541  switch (state->mode) {
543  rz_cons_println(plugin->language);
544  break;
545  case RZ_OUTPUT_MODE_JSON:
546  pj_o(state->d.pj);
547  pj_ks(state->d.pj, "language", plugin->language);
548  pj_ks(state->d.pj, "license", plugin->license);
549  pj_ks(state->d.pj, "author", plugin->author);
550  pj_end(state->d.pj);
551  break;
553  rz_table_add_rowf(state->d.t, "sss", plugin->language, plugin->license, plugin->author);
554  break;
555  default:
557  break;
558  }
559  return true;
560 }
RZ_API int rz_cons_printf(const char *format,...)
Definition: cons.c:1202
RZ_API void rz_cons_println(const char *str)
Definition: cons.c:233
#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_API void rz_table_add_rowf(RzTable *t, const char *fmt,...)
Definition: table.c:316
@ RZ_OUTPUT_MODE_TABLE
Definition: rz_types.h:46
@ RZ_OUTPUT_MODE_JSON
Definition: rz_types.h:40
@ RZ_OUTPUT_MODE_QUIET
Definition: rz_types.h:42
Represent the output state of a command handler.
Definition: rz_cmd.h:91
const char * language
demangler language
Definition: rz_demangler.h:17
const char * author
demangler author
Definition: rz_demangler.h:18
const char * license
demangler license
Definition: rz_demangler.h:19
Definition: dis.h:43

References rz_demangler_plugin_t::author, rz_demangler_plugin_t::language, rz_demangler_plugin_t::license, pj_end(), pj_ks(), pj_o(), rz_cons_printf(), rz_cons_println(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_QUIET, RZ_OUTPUT_MODE_TABLE, rz_table_add_rowf(), and rz_warn_if_reached.

Referenced by rz_cmd_info_demangle_handler(), and rz_cmd_info_demangle_list_handler().

◆ print_source_info()

static bool print_source_info ( RzCore core,
PrintSourceInfoType  type,
RzCmdStateOutput state 
)
static

Definition at line 66 of file cmd_info.c.

66  {
67  RzBinFile *binfile = core->bin->cur;
68  if (!binfile || !binfile->o) {
69  rz_cons_printf("No file loaded.\n");
70  return false;
71  }
72  RzBinSourceLineInfo *li = binfile->o->lines;
73  if (!li) {
74  rz_cons_printf("No source info available.\n");
75  return true;
76  }
77  switch (type) {
79  // collect all filenames uniquely
80  HtPP *files = ht_pp_new0();
81  if (!files) {
82  return false;
83  }
84  for (size_t i = 0; i < li->samples_count; i++) {
86  if (!s->line || !s->file) {
87  continue;
88  }
89  ht_pp_insert(files, s->file, NULL);
90  }
91  // sort them alphabetically
92  RzPVector sorter;
93  rz_pvector_init(&sorter, free);
94  ht_pp_foreach(files, source_file_collect_cb, &sorter);
95  rz_pvector_sort(&sorter, (RzPVectorComparator)strcmp);
96  ht_pp_free(files);
97  // print them!
98  if (state->mode == RZ_OUTPUT_MODE_JSON) {
99  pj_a(state->d.pj);
100  void **it;
101  rz_pvector_foreach (&sorter, it) {
102  pj_s(state->d.pj, *it);
103  }
104  pj_end(state->d.pj);
105  } else {
106  rz_cons_printf("[Source file]\n");
107  void **it;
108  rz_pvector_foreach (&sorter, it) {
109  const char *file = *it;
110  rz_cons_printf("%s\n", file);
111  }
112  }
113  rz_pvector_fini(&sorter);
114  break;
115  }
118  break;
124  }
126  break;
127  }
128  return true;
129 }
lzma_index ** i
Definition: index.h:629
RZ_API void rz_core_bin_print_source_line_info(RzCore *core, const RzBinSourceLineInfo *li, RzCmdStateOutput *state)
Definition: cbin.c:1811
RZ_API void rz_core_bin_print_source_line_sample(RzCore *core, const RzBinSourceLineSample *s, RzCmdStateOutput *state)
Definition: cbin.c:1778
RZ_API void rz_cmd_state_output_array_start(RzCmdStateOutput *state)
Mark the start of an array of elements in the output.
Definition: cmd_api.c:2558
RZ_API void rz_cmd_state_output_array_end(RzCmdStateOutput *state)
Mark the end of an array of elements in the output.
Definition: cmd_api.c:2572
static bool source_file_collect_cb(void *user, const void *k, const void *v)
Definition: cmd_info.c:51
#define NULL
Definition: cris-opc.c:27
RZ_API const RzBinSourceLineSample * rz_bin_source_line_info_get_next(const RzBinSourceLineInfo *sli, RZ_NONNULL const RzBinSourceLineSample *cur)
Definition: dbginfo.c:182
RZ_API const RzBinSourceLineSample * rz_bin_source_line_info_get_first_at(const RzBinSourceLineInfo *sli, ut64 addr)
Find the first sample that affects the given address. i.e. find the first sample with the highest add...
Definition: dbginfo.c:151
checking print the parsed form of the magic use in n conjunction with m to debug a new magic file n before installing it n output MIME type special files
Definition: file_opts.h:46
RZ_API void Ht_() free(HtName_(Ht) *ht)
Definition: ht_inc.c:130
int type
Definition: mipsasm.c:17
static RzSocket * s
Definition: rtr.c:28
RZ_API PJ * pj_s(PJ *j, const char *k)
Definition: pj.c:197
RZ_API PJ * pj_a(PJ *j)
Definition: pj.c:81
RZ_API void rz_pvector_sort(RzPVector *vec, RzPVectorComparator cmp)
Definition: vector.c:408
RZ_API void rz_pvector_init(RzPVector *vec, RzPVectorFree free)
Definition: vector.c:298
RZ_API void rz_pvector_fini(RzPVector *vec)
Definition: vector.c:331
int(* RzPVectorComparator)(const void *a, const void *b)
Definition: rz_vector.h:40
#define rz_pvector_foreach(vec, it)
Definition: rz_vector.h:334
Definition: gzappend.c:170
RzBinObject * o
Definition: rz_bin.h:305
RzBinSourceLineInfo * lines
Definition: rz_bin.h:284
RzBinSourceLineSample * samples
All source line references for given adresses.
Definition: rz_bin.h:486
A single sample of source line info for a specific address.
Definition: rz_bin.h:441
RZ_DEPRECATE RzBinFile * cur
never use this in new code! Get a file from the binfiles list or track it yourself.
Definition: rz_bin.h:330
RzBin * bin
Definition: rz_core.h:298
ut64 offset
Definition: rz_core.h:301

References rz_core_t::bin, rz_bin_t::cur, files, free(), i, rz_bin_object_t::lines, NULL, rz_bin_file_t::o, rz_core_t::offset, pj_a(), pj_end(), pj_s(), PRINT_SOURCE_INFO_FILES, PRINT_SOURCE_INFO_LINES_ALL, PRINT_SOURCE_INFO_LINES_HERE, rz_bin_source_line_info_get_first_at(), rz_bin_source_line_info_get_next(), rz_cmd_state_output_array_end(), rz_cmd_state_output_array_start(), rz_cons_printf(), rz_core_bin_print_source_line_info(), rz_core_bin_print_source_line_sample(), RZ_OUTPUT_MODE_JSON, rz_pvector_fini(), rz_pvector_foreach, rz_pvector_init(), rz_pvector_sort(), s, rz_bin_source_line_info_t::samples, rz_bin_source_line_info_t::samples_count, source_file_collect_cb(), and type.

Referenced by rz_cmd_info_source_handler(), rz_cmd_info_sourcelines_handler(), and rz_cmd_info_sourcelines_here_handler().

◆ rz_cmd_info_all_handler()

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

Definition at line 187 of file cmd_info.c.

187  {
188  GET_CHECK_CUR_BINFILE(core);
189  ut32 mask = RZ_CORE_BIN_ACC_INFO;
190  mask |= RZ_CORE_BIN_ACC_IMPORTS;
191  mask |= RZ_CORE_BIN_ACC_ENTRIES;
192  mask |= RZ_CORE_BIN_ACC_EXPORTS;
193  mask |= RZ_CORE_BIN_ACC_CLASSES;
194  mask |= RZ_CORE_BIN_ACC_SYMBOLS;
195  mask |= RZ_CORE_BIN_ACC_SECTIONS;
196  mask |= RZ_CORE_BIN_ACC_MEM;
197  mask |= RZ_CORE_BIN_ACC_STRINGS;
198  if (state->mode == RZ_OUTPUT_MODE_JSON) {
199  pj_o(state->d.pj);
200  }
201  bool res = rz_core_bin_print(core, bf, mask, NULL, state, NULL);
202  if (state->mode == RZ_OUTPUT_MODE_JSON) {
203  pj_end(state->d.pj);
204  }
205  return res ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
206 }
#define mask()
RZ_API bool rz_core_bin_print(RzCore *core, RZ_NONNULL RzBinFile *bf, ut32 mask, RzCoreBinFilter *filter, RzCmdStateOutput *state, RzList *hashes)
Print (to RzCons or inside RzCmdStateOutput) the binary information specified in mask.
Definition: cbin.c:386
#define GET_CHECK_CUR_BINFILE(core)
Definition: cmd_info.c:176
uint32_t ut32
@ RZ_CMD_STATUS_OK
command handler exited in the right way
Definition: rz_cmd.h:24

References GET_CHECK_CUR_BINFILE, mask, NULL, pj_end(), pj_o(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_bin_print(), and RZ_OUTPUT_MODE_JSON.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_archs_handler()

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

Definition at line 183 of file cmd_info.c.

183  {
185 }
RZ_API bool rz_core_bin_archs_print(RZ_NONNULL RzBin *bin, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:5217
static RzCmdStatus bool2status(bool val)
Definition: core_private.h:208

References rz_core_t::bin, bool2status(), and rz_core_bin_archs_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_binary_handler()

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

Definition at line 436 of file cmd_info.c.

436  {
437  GET_CHECK_CUR_BINFILE(core);
438  return bool2status(rz_core_bin_info_print(core, bf, state));
439 }
RZ_API bool rz_core_bin_info_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:3044

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_info_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_class_as_source_handler()

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

Definition at line 406 of file cmd_info.c.

406  {
407  GET_CHECK_CUR_BINFILE(core);
408  return bool2status(rz_core_bin_class_as_source_print(core, bf, argv[1]));
409 }
RZ_API bool rz_core_bin_class_as_source_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, const char *class_name)
Definition: cbin.c:3773
static static fork const void static count static fd const char const char static newpath char char argv
Definition: sflib.h:40

References argv, bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_class_as_source_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_class_fields_handler()

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

Definition at line 411 of file cmd_info.c.

411  {
412  GET_CHECK_CUR_BINFILE(core);
413  return bool2status(rz_core_bin_class_fields_print(core, bf, state, argv[1]));
414 }
RZ_API bool rz_core_bin_class_fields_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, const char *class_name)
Definition: cbin.c:3814

References argv, bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_class_fields_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_class_methods_handler()

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

Definition at line 416 of file cmd_info.c.

416  {
417  GET_CHECK_CUR_BINFILE(core);
418  return bool2status(rz_core_bin_class_methods_print(core, bf, state, argv[1]));
419 }
RZ_API bool rz_core_bin_class_methods_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, const char *class_name)
Definition: cbin.c:3881

References argv, bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_class_methods_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_classes_handler()

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

Definition at line 401 of file cmd_info.c.

401  {
402  GET_CHECK_CUR_BINFILE(core);
403  return bool2status(rz_core_bin_classes_print(core, bf, state));
404 }
RZ_API bool rz_core_bin_classes_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:3939

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_classes_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_cur_export_handler()

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

Definition at line 223 of file cmd_info.c.

223  {
224  GET_CHECK_CUR_BINFILE(core);
226 }
RZ_API bool rz_core_bin_cur_export_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2050

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_cur_export_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_cur_section_handler()

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

Definition at line 269 of file cmd_info.c.

269  {
270  GET_CHECK_CUR_BINFILE(core);
271  RzList *hashes = rz_list_new_from_array((const void **)argv + 1, argc - 1);
272  if (!hashes) {
273  return RZ_CMD_STATUS_ERROR;
274  }
275  bool res = rz_core_bin_cur_section_print(core, bf, state, hashes);
276  rz_list_free(hashes);
277  return bool2status(res);
278 }
RZ_API bool rz_core_bin_cur_section_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzList *hashes)
Definition: cbin.c:2541
RZ_API RZ_OWN RzList * rz_list_new_from_array(RZ_NONNULL const void **arr, size_t arr_size)
Allocates a new RzList and adds an array elements to it.
Definition: list.c:260
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
Definition: list.c:137

References argv, bool2status(), GET_CHECK_CUR_BINFILE, RZ_CMD_STATUS_ERROR, rz_core_bin_cur_section_print(), rz_list_free(), and rz_list_new_from_array().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_cur_segment_handler()

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

Definition at line 351 of file cmd_info.c.

351  {
352  GET_CHECK_CUR_BINFILE(core);
353  RzList *hashes = rz_list_new_from_array((const void **)argv + 1, argc - 1);
354  if (!hashes) {
355  return RZ_CMD_STATUS_ERROR;
356  }
357  bool res = rz_core_bin_cur_segment_print(core, bf, state, hashes);
358  rz_list_free(hashes);
359  return bool2status(res);
360 }
RZ_API bool rz_core_bin_cur_segment_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzList *hashes)
Definition: cbin.c:2549

References argv, bool2status(), GET_CHECK_CUR_BINFILE, RZ_CMD_STATUS_ERROR, rz_core_bin_cur_segment_print(), rz_list_free(), and rz_list_new_from_array().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_cur_symbol_handler()

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

Definition at line 233 of file cmd_info.c.

233  {
234  GET_CHECK_CUR_BINFILE(core);
236 }
RZ_API bool rz_core_bin_cur_symbol_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2036

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_cur_symbol_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_demangle_handler()

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

Definition at line 576 of file cmd_info.c.

576  {
577  char *output = NULL;
578  if (!rz_demangler_resolve(core->bin->demangler, argv[2], argv[1], &output)) {
579  rz_cons_printf("Language '%s' is unsupported\nList of supported languages:\n", argv[1]);
581  return RZ_CMD_STATUS_ERROR;
582  }
584  free(output);
585  return RZ_CMD_STATUS_OK;
586 }
static bool print_demangler_info(const RzDemanglerPlugin *plugin, void *user)
Definition: cmd_info.c:535
RZ_API bool rz_demangler_resolve(RZ_NONNULL RzDemangler *dem, RZ_NULLABLE const char *symbol, RZ_NONNULL const char *language, RZ_NONNULL RZ_OWN char **output)
Resolves a symbol based on its language and return an output that needs to be freed.
Definition: demangler.c:187
RZ_API void rz_demangler_plugin_iterate(RZ_NONNULL RzDemangler *dem, RZ_NONNULL RzDemanglerIter iter, RZ_NULLABLE void *data)
Iterates over the plugin list.
Definition: demangler.c:127
bool(* RzDemanglerIter)(const RzDemanglerPlugin *plugin, void *data)
Definition: rz_demangler.h:27
RzDemangler * demangler
Definition: rz_bin.h:364
diff_output_t output
Definition: zipcmp.c:237

References argv, rz_core_t::bin, rz_bin_t::demangler, free(), NULL, output, print_demangler_info(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_printf(), rz_cons_println(), rz_demangler_plugin_iterate(), and rz_demangler_resolve().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_demangle_lang_choices()

RZ_IPI char** rz_cmd_info_demangle_lang_choices ( RzCore core)

Definition at line 562 of file cmd_info.c.

562  {
563  char **res = RZ_NEWS0(char *, rz_list_length(core->bin->demangler->plugins) + 1);
564  if (!res) {
565  return NULL;
566  }
567  const RzDemanglerPlugin *plugin;
568  RzListIter *it;
569  int i = 0;
570  rz_list_foreach (core->bin->demangler->plugins, it, plugin) {
571  res[i++] = strdup(plugin->language);
572  }
573  return res;
574 }
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
Definition: list.c:109
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")
#define RZ_NEWS0(x, y)
Definition: rz_types.h:282
RzList * plugins
Definition: rz_demangler.h:24

References rz_core_t::bin, rz_bin_t::demangler, i, rz_demangler_plugin_t::language, NULL, rz_demangler_t::plugins, rz_list_length(), RZ_NEWS0, and strdup().

◆ rz_cmd_info_demangle_list_handler()

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

Definition at line 588 of file cmd_info.c.

588  {
590  rz_cmd_state_output_set_columnsf(state, "sss", "language", "license", "author");
593  return RZ_CMD_STATUS_OK;
594 }
RZ_API void rz_cmd_state_output_set_columnsf(RzCmdStateOutput *state, const char *fmt,...)
Specify the columns of the command output.
Definition: cmd_api.c:2589

References rz_core_t::bin, rz_bin_t::demangler, print_demangler_info(), rz_cmd_state_output_array_end(), rz_cmd_state_output_array_start(), rz_cmd_state_output_set_columnsf(), RZ_CMD_STATUS_OK, and rz_demangler_plugin_iterate().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_dwarf_handler()

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

Definition at line 463 of file cmd_info.c.

463  {
464  GET_CHECK_CUR_BINFILE(core);
465  return bool2status(rz_core_bin_dwarf_print(core, bf, state));
466 }
RZ_API bool rz_core_bin_dwarf_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:4880

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_dwarf_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_entry_handler()

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

Definition at line 208 of file cmd_info.c.

208  {
209  GET_CHECK_CUR_BINFILE(core);
210  return bool2status(rz_core_bin_entries_print(core, bf, state));
211 }
RZ_API bool rz_core_bin_entries_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:1907

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_entries_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_entryexits_handler()

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

Definition at line 213 of file cmd_info.c.

213  {
214  GET_CHECK_CUR_BINFILE(core);
215  return bool2status(rz_core_bin_initfini_print(core, bf, state));
216 }
RZ_API bool rz_core_bin_initfini_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:1901

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_initfini_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_exports_handler()

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

Definition at line 218 of file cmd_info.c.

218  {
219  GET_CHECK_CUR_BINFILE(core);
220  return bool2status(rz_core_bin_exports_print(core, bf, state, NULL));
221 }
RZ_API bool rz_core_bin_exports_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzCoreBinFilter *filter)
Definition: cbin.c:2044

References bool2status(), GET_CHECK_CUR_BINFILE, NULL, and rz_core_bin_exports_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_fields_handler()

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

Definition at line 426 of file cmd_info.c.

426  {
427  GET_CHECK_CUR_BINFILE(core);
428  return bool2status(rz_core_bin_fields_print(core, bf, state));
429 }
RZ_API bool rz_core_bin_fields_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:4070

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_fields_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_guess_size_handler()

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

Definition at line 706 of file cmd_info.c.

706  {
707  GET_CHECK_CUR_BINFILE(core);
708  if (state->mode == RZ_OUTPUT_MODE_JSON) {
709  pj_o(state->d.pj);
710  pj_k(state->d.pj, "size");
711  }
712  bool res = rz_core_bin_size_print(core, bf, state);
713  if (state->mode == RZ_OUTPUT_MODE_JSON) {
714  pj_end(state->d.pj);
715  }
716  return bool2status(res);
717 }
RZ_API bool rz_core_bin_size_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:5151
RZ_API PJ * pj_k(PJ *j, const char *k)
Definition: pj.c:104

References bool2status(), GET_CHECK_CUR_BINFILE, pj_end(), pj_k(), pj_o(), rz_core_bin_size_print(), and RZ_OUTPUT_MODE_JSON.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_handler()

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

Definition at line 379 of file cmd_info.c.

379  {
380  if (!core->file) {
381  return RZ_CMD_STATUS_ERROR;
382  }
383  if (state->mode == RZ_OUTPUT_MODE_JSON) {
384  pj_o(state->d.pj);
385  pj_k(state->d.pj, "core");
386  }
387  RzBinFile *bf = rz_bin_cur(core->bin);
388  bool res = rz_core_file_info_print(core, bf, state);
389  if (bf && bin_is_executable(bf->o)) {
390  if (state->mode == RZ_OUTPUT_MODE_JSON) {
391  pj_k(state->d.pj, "bin");
392  }
393  rz_core_bin_info_print(core, bf, state);
394  }
395  if (state->mode == RZ_OUTPUT_MODE_JSON) {
396  pj_end(state->d.pj);
397  }
398  return bool2status(res);
399 }
RZ_API bool rz_core_file_info_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *binfile, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2943
static int bin_is_executable(RzBinObject *obj)
Definition: cmd_info.c:13
RzCoreFile * file
Definition: rz_core.h:314

References rz_core_t::bin, bin_is_executable(), bool2status(), rz_core_t::file, rz_bin_file_t::o, pj_end(), pj_k(), pj_o(), rz_bin_cur(), RZ_CMD_STATUS_ERROR, rz_core_bin_info_print(), rz_core_file_info_print(), and RZ_OUTPUT_MODE_JSON.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_hashes_handler()

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

Definition at line 612 of file cmd_info.c.

612  {
613  ut64 limit = rz_config_get_i(core->config, "bin.hashlimit");
614  RzBinInfo *info = rz_bin_get_info(core->bin);
615  if (!info) {
616  eprintf("Cannot get bin info\n");
617  return RZ_CMD_STATUS_ERROR;
618  }
619 
620  GET_CHECK_CUR_BINFILE(core);
621 
622  RzList *new_hashes = rz_bin_file_compute_hashes(core->bin, bf, limit);
623  RzList *old_hashes = rz_bin_file_set_hashes(core->bin, new_hashes);
624  bool equal = true;
625  if (!rz_list_empty(new_hashes) && !rz_list_empty(old_hashes)) {
626  if (!is_equal_file_hashes(new_hashes, old_hashes, &equal)) {
627  eprintf("Cannot compare file hashes\n");
628  rz_list_free(old_hashes);
629  return RZ_CMD_STATUS_ERROR;
630  }
631  }
632  RzBinFileHash *fh_old, *fh_new;
633  RzListIter *hiter_old, *hiter_new;
634  switch (state->mode) {
635  case RZ_OUTPUT_MODE_JSON:
636  pj_o(state->d.pj);
637  rz_list_foreach (new_hashes, hiter_new, fh_new) {
638  pj_ks(state->d.pj, fh_new->type, fh_new->hex);
639  }
640  if (!equal) {
641  // print old hashes prefixed with `o` character like `omd5` and `isha1`
642  rz_list_foreach (old_hashes, hiter_old, fh_old) {
643  char *key = rz_str_newf("o%s", fh_old->type);
644  pj_ks(state->d.pj, key, fh_old->hex);
645  free(key);
646  }
647  }
648  pj_end(state->d.pj);
649  break;
651  if (!equal) {
652  eprintf("File has been modified.\n");
653  hiter_new = rz_list_iterator(new_hashes);
654  hiter_old = rz_list_iterator(old_hashes);
655  while (rz_list_iter_next(hiter_new) && rz_list_iter_next(hiter_old)) {
656  fh_new = (RzBinFileHash *)rz_list_iter_get(hiter_new);
657  fh_old = (RzBinFileHash *)rz_list_iter_get(hiter_old);
658  if (strcmp(fh_new->type, fh_old->type)) {
659  eprintf("Wrong file hashes structure");
660  }
661  if (!strcmp(fh_new->hex, fh_old->hex)) {
662  eprintf("= %s %s\n", fh_new->type, fh_new->hex); // output one line because hash remains same `= hashtype hashval`
663  } else {
664  // output diff-like two lines, one with old hash val `- hashtype hashval` and one with new `+ hashtype hashval`
665  eprintf("- %s %s\n+ %s %s\n",
666  fh_old->type, fh_old->hex,
667  fh_new->type, fh_new->hex);
668  }
669  }
670  } else { // hashes are equal
671  rz_list_foreach (new_hashes, hiter_new, fh_new) {
672  rz_cons_printf("%s %s\n", fh_new->type, fh_new->hex);
673  }
674  }
675  break;
676  default:
678  break;
679  }
680  rz_list_free(old_hashes);
681  return RZ_CMD_STATUS_OK;
682 }
RZ_API RZ_OWN RzList * rz_bin_file_set_hashes(RzBin *bin, RZ_OWN RzList *new_hashes)
Set file_hashes on current RzBinInfo.
Definition: bfile.c:488
RZ_API RZ_OWN RzList * rz_bin_file_compute_hashes(RzBin *bin, RzBinFile *bf, ut64 limit)
Definition: bfile.c:411
RZ_DEPRECATE RZ_API RZ_BORROW RzBinInfo * rz_bin_get_info(RzBin *bin)
Definition: bin.c:585
RzBinInfo * info(RzBinFile *bf)
Definition: bin_ne.c:86
static bool is_equal_file_hashes(RzList *lfile_hashes, RzList *rfile_hashes, bool *equal)
Definition: cmd_info.c:29
RZ_API ut64 rz_config_get_i(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:119
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 static offset struct stat static buf void long static basep static whence static length const void static len key
Definition: sflib.h:118
RZ_API RZ_BORROW RzListIter * rz_list_iterator(const RzList *list)
returns the first RzList iterator int the list
Definition: list.c:51
static uint32_t const uint8_t uint32_t uint32_t limit
Definition: memcmplen.h:45
#define eprintf(x, y...)
Definition: rlcc.c:7
RZ_API char * rz_str_newf(const char *fmt,...) RZ_PRINTF_CHECK(1
@ RZ_OUTPUT_MODE_STANDARD
Definition: rz_types.h:39
RzConfig * config
Definition: rz_core.h:300
ut64(WINAPI *w32_GetEnabledXStateFeatures)()

References rz_core_t::bin, rz_core_t::config, eprintf, free(), GET_CHECK_CUR_BINFILE, rz_bin_file_hash_t::hex, info(), is_equal_file_hashes(), key, limit, pj_end(), pj_ks(), pj_o(), rz_bin_file_compute_hashes(), rz_bin_file_set_hashes(), rz_bin_get_info(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get_i(), rz_cons_printf(), rz_list_free(), rz_list_iterator(), RZ_OUTPUT_MODE_JSON, RZ_OUTPUT_MODE_STANDARD, rz_str_newf(), rz_warn_if_reached, rz_bin_file_hash_t::type, and ut64().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_headers_handler()

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

Definition at line 431 of file cmd_info.c.

431  {
432  GET_CHECK_CUR_BINFILE(core);
433  return bool2status(rz_core_bin_headers_print(core, bf));
434 }
RZ_API bool rz_core_bin_headers_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf)
Definition: cbin.c:4122

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_headers_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_imports_handler()

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

Definition at line 238 of file cmd_info.c.

238  {
239  GET_CHECK_CUR_BINFILE(core);
240  return bool2status(rz_core_bin_imports_print(core, bf, state, NULL));
241 }
RZ_API bool rz_core_bin_imports_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzCoreBinFilter *filter)
Definition: cbin.c:2058

References bool2status(), GET_CHECK_CUR_BINFILE, NULL, and rz_core_bin_imports_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_kuery()

RZ_IPI int rz_cmd_info_kuery ( void *  data,
const char *  input 
)

Definition at line 131 of file cmd_info.c.

131  {
132  RzCore *core = (RzCore *)data;
133  RzBinObject *o = rz_bin_cur_object(core->bin);
134  Sdb *db = o ? o->kv : NULL;
135  switch (input[0]) {
136  case 'v':
137  if (db) {
138  char *o = sdb_querys(db, NULL, 0, input + 2);
139  if (o && *o) {
140  rz_cons_print(o);
141  }
142  free(o);
143  }
144  break;
145  case '*':
147  break;
148  case '.':
149  case ' ':
150  if (db) {
151  char *o = sdb_querys(db, NULL, 0, input + 1);
152  if (o && *o) {
153  rz_cons_print(o);
154  }
155  free(o);
156  }
157  break;
158  case '\0':
159  if (db) {
160  char *o = sdb_querys(db, NULL, 0, "*");
161  if (o && *o) {
162  rz_cons_print(o);
163  }
164  free(o);
165  }
166  break;
167  case '?':
168  default:
169  eprintf("Usage: ik [sdb-query]\n");
170  eprintf("Usage: ik* # load all header information\n");
171  return 1;
172  }
173  return 0;
174 }
RZ_API RzBinObject * rz_bin_cur_object(RzBin *bin)
Definition: bin.c:900
RZ_API void rz_core_bin_export_info(RzCore *core, int mode)
Definition: cbin.c:108
RZ_API char * sdb_querys(Sdb *r, char *buf, size_t len, const char *_cmd)
Definition: query.c:164
#define RZ_MODE_RIZINCMD
Definition: rz_types.h:26
RZ_DEPRECATE RZ_BORROW Sdb * kv
deprecated, put info in C structures instead of this (holds a copy of another pointer....
Definition: rz_bin.h:291
Definition: sdb.h:63
static bool input(void *ud, zip_uint8_t *data, zip_uint64_t length)

References rz_core_t::bin, eprintf, free(), input(), rz_bin_object_t::kv, NULL, rz_bin_cur_object(), rz_core_bin_export_info(), RZ_MODE_RIZINCMD, and sdb_querys().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_libs_handler()

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

Definition at line 243 of file cmd_info.c.

243  {
244  GET_CHECK_CUR_BINFILE(core);
245  return bool2status(rz_core_bin_libs_print(core, bf, state));
246 }
RZ_API bool rz_core_bin_libs_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2163

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_libs_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_main_handler()

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

Definition at line 248 of file cmd_info.c.

248  {
249  GET_CHECK_CUR_BINFILE(core);
250  return bool2status(rz_core_bin_main_print(core, bf, state));
251 }
RZ_API bool rz_core_bin_main_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2192

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_main_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_memory_handler()

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

Definition at line 596 of file cmd_info.c.

596  {
597  GET_CHECK_CUR_BINFILE(core);
598  return bool2status(rz_core_bin_memory_print(core, bf, state));
599 }
RZ_API bool rz_core_bin_memory_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:4955

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_memory_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_pdb_download_handler()

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

Definition at line 507 of file cmd_info.c.

507  {
508  SPDBOptions pdbopts;
509  pdbopts.extract = rz_config_get_i(core->config, "pdb.extract");
510  pdbopts.symbol_store_path = rz_config_get(core->config, "pdb.symstore");
511  pdbopts.symbol_server = rz_config_get(core->config, "pdb.server");
512  if (state->mode == RZ_OUTPUT_MODE_JSON) {
513  pj_o(state->d.pj);
514  }
515  int r = rz_bin_pdb_download(core->bin, state->mode == RZ_OUTPUT_MODE_JSON ? state->d.pj : NULL, state->mode == RZ_OUTPUT_MODE_JSON, &pdbopts);
516  if (state->mode == RZ_OUTPUT_MODE_JSON) {
517  pj_end(state->d.pj);
518  }
519  if (r > 0 && state->mode != RZ_OUTPUT_MODE_JSON) {
520  RZ_LOG_ERROR("Error while downloading pdb file\n");
521  return RZ_CMD_STATUS_ERROR;
522  }
523  return RZ_CMD_STATUS_OK;
524 }
RZ_API RZ_BORROW const char * rz_config_get(RzConfig *cfg, RZ_NONNULL const char *name)
Definition: config.c:75
#define r
Definition: crypto_rc6.c:12
RZ_API int rz_bin_pdb_download(RZ_NONNULL RzBin *bin, RZ_NULLABLE PJ *pj, int isradjson, RZ_NONNULL SPDBOptions *options)
Download PDB file for currently opened RzBin file.
#define RZ_LOG_ERROR(fmtstr,...)
Definition: rz_log.h:58
const char * symbol_server
const char * symbol_store_path

References rz_core_t::bin, rz_core_t::config, SPDBOptions::extract, NULL, pj_end(), pj_o(), r, rz_bin_pdb_download(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_config_get(), rz_config_get_i(), RZ_LOG_ERROR, RZ_OUTPUT_MODE_JSON, SPDBOptions::symbol_server, and SPDBOptions::symbol_store_path.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_pdb_load_handler()

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

Definition at line 468 of file cmd_info.c.

468  {
469  char *filename = argc > 1 ? strdup(argv[1]) : rz_core_bin_pdb_get_filename(core);
470  if (!filename) {
471  RZ_LOG_ERROR("Cannot find the right PDB file to load\n");
472  return RZ_CMD_STATUS_ERROR;
473  }
474  if (!rz_file_exists(filename)) {
475  RZ_LOG_ERROR("Cannot open file '%s'\n", filename);
476  free(filename);
477  return RZ_CMD_STATUS_ERROR;
478  }
479 
481  free(filename);
482  return status;
483 }
RZ_API RZ_OWN char * rz_core_bin_pdb_get_filename(RZ_NONNULL RzCore *core)
Definition: cbin.c:4886
RZ_API bool rz_core_bin_pdb_load(RZ_NONNULL RzCore *core, RZ_NONNULL const char *filename)
Definition: cbin.c:5264
const char * filename
Definition: ioapi.h:137
static const char struct stat static buf struct stat static buf static vhangup int status
Definition: sflib.h:145
enum rz_cmd_status_t RzCmdStatus
RZ_API bool rz_file_exists(const char *str)
Definition: file.c:192

References argv, bool2status(), free(), RZ_CMD_STATUS_ERROR, rz_core_bin_pdb_get_filename(), rz_core_bin_pdb_load(), rz_file_exists(), RZ_LOG_ERROR, status, and strdup().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_pdb_show_handler()

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

Definition at line 485 of file cmd_info.c.

485  {
486  char *filename = argc > 1 ? strdup(argv[1]) : rz_core_bin_pdb_get_filename(core);
487  if (!filename) {
488  RZ_LOG_ERROR("Cannot find the right PDB file to load\n");
489  return RZ_CMD_STATUS_ERROR;
490  }
491  if (!rz_file_exists(filename)) {
492  RZ_LOG_ERROR("Cannot open file '%s'\n", filename);
493  free(filename);
494  return RZ_CMD_STATUS_ERROR;
495  }
496  RzPdb *pdb = rz_core_pdb_load_info(core, filename);
497  if (!pdb) {
498  free(filename);
499  return false;
500  }
501  rz_core_pdb_info_print(core, core->analysis->typedb, pdb, state);
502  rz_bin_pdb_free(pdb);
503  free(filename);
504  return RZ_CMD_STATUS_OK;
505 }
RZ_API void rz_core_pdb_info_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzTypeDB *db, RZ_NONNULL RzPdb *pdb, RZ_NONNULL RzCmdStateOutput *state)
Print parsed PDB file info.
Definition: cpdb.c:273
RZ_API RzPdb * rz_core_pdb_load_info(RZ_NONNULL RzCore *core, RZ_NONNULL const char *file)
Parse PDB file info and integrate with typedb.
Definition: cpdb.c:245
RZ_API void rz_bin_pdb_free(RzPdb *pdb)
Free PDB instance.
Definition: pdb.c:366
RzTypeDB * typedb
Definition: rz_analysis.h:602
RzAnalysis * analysis
Definition: rz_core.h:322

References rz_core_t::analysis, argv, free(), rz_bin_pdb_free(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_bin_pdb_get_filename(), rz_core_pdb_info_print(), rz_core_pdb_load_info(), rz_file_exists(), RZ_LOG_ERROR, strdup(), and rz_analysis_t::typedb.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_plugins_handler()

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

Definition at line 441 of file cmd_info.c.

441  {
442  if (argc < 2) {
444  return RZ_CMD_STATUS_OK;
445  }
446 
447  const char *plugin_name = argv[1];
448  const RzBinPlugin *bp = rz_bin_plugin_get(core->bin, plugin_name);
449  if (bp) {
451  return RZ_CMD_STATUS_OK;
452  }
453 
454  const RzBinXtrPlugin *xbp = rz_bin_xtrplugin_get(core->bin, plugin_name);
455  if (xbp) {
457  return RZ_CMD_STATUS_OK;
458  }
459 
460  return RZ_CMD_STATUS_ERROR;
461 }
RZ_API const RzBinPlugin * rz_bin_plugin_get(RZ_NONNULL RzBin *bin, RZ_NONNULL const char *name)
Get a RzBinPlugin by name.
Definition: bin.c:1197
RZ_API const RzBinXtrPlugin * rz_bin_xtrplugin_get(RZ_NONNULL RzBin *bin, RZ_NONNULL const char *name)
Get a RzBinXtrPlugin by name.
Definition: bin.c:1214
RZ_IPI RzCmdStatus rz_core_bin_plugin_print(const RzBinPlugin *bp, RzCmdStateOutput *state)
Definition: cbin.c:4783
RZ_API RzCmdStatus rz_core_bin_plugins_print(RzBin *bin, RzCmdStateOutput *state)
Definition: cbin.c:4855
RZ_IPI RzCmdStatus rz_core_binxtr_plugin_print(const RzBinXtrPlugin *bx, RzCmdStateOutput *state)
Definition: cbin.c:4823

References argv, rz_core_t::bin, rz_bin_plugin_get(), rz_bin_xtrplugin_get(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_core_bin_plugin_print(), rz_core_bin_plugins_print(), and rz_core_binxtr_plugin_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_purge_string_handler()

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

Definition at line 372 of file cmd_info.c.

372  {
373  char *strpurge = core->bin->strpurge;
374  char tmp[2048];
375  rz_config_set(core->config, "bin.str.purge", rz_strf(tmp, "%s%s0x%" PFMT64x, strpurge ? strpurge : "", strpurge && *strpurge ? "," : "", core->offset));
376  return RZ_CMD_STATUS_OK;
377 }
RZ_API RzConfigNode * rz_config_set(RzConfig *cfg, RZ_NONNULL const char *name, const char *value)
Definition: config.c:267
#define rz_strf(buf,...)
Convenience macro for local temporary strings.
Definition: rz_str.h:59
#define PFMT64x
Definition: rz_types.h:393
char * strpurge
Definition: rz_bin.h:354

References rz_core_t::bin, rz_core_t::config, rz_core_t::offset, PFMT64x, RZ_CMD_STATUS_OK, rz_config_set(), rz_strf, rz_bin_t::strpurge, and autogen_x86imm::tmp.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_relocs_handler()

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

Definition at line 253 of file cmd_info.c.

253  {
254  GET_CHECK_CUR_BINFILE(core);
255  return bool2status(rz_core_bin_relocs_print(core, bf, state));
256 }
RZ_API bool rz_core_bin_relocs_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2224

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_relocs_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_resources_handler()

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

Definition at line 601 of file cmd_info.c.

601  {
602  GET_CHECK_CUR_BINFILE(core);
603  RzList *hashes = rz_list_new_from_array((const void **)argv + 1, argc - 1);
604  if (!hashes) {
605  return RZ_CMD_STATUS_ERROR;
606  }
607  bool res = rz_core_bin_resources_print(core, bf, state, hashes);
608  rz_list_free(hashes);
609  return bool2status(res);
610 }
RZ_API bool rz_core_bin_resources_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RZ_NULLABLE RzList *hashes)
Definition: cbin.c:5045

References argv, bool2status(), GET_CHECK_CUR_BINFILE, RZ_CMD_STATUS_ERROR, rz_core_bin_resources_print(), rz_list_free(), and rz_list_new_from_array().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_section_bars_handler()

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

Definition at line 280 of file cmd_info.c.

280  {
282  RzBinObject *o = rz_bin_cur_object(core->bin);
283  if (!o) {
284  RZ_LOG_ERROR("No binary object at current address\n");
285  return RZ_CMD_STATUS_ERROR;
286  }
287 
289  if (!sections) {
290  RZ_LOG_ERROR("Cannot retrieve sections\n");
291  return RZ_CMD_STATUS_ERROR;
292  }
293 
294  int cols = rz_cons_get_size(NULL);
296  if (!list) {
297  goto sections_err;
298  }
299 
300  RzListIter *iter;
302  rz_list_foreach (sections, iter, section) {
303  char humansz[8];
304  RzInterval pitv = (RzInterval){ section->paddr, section->size };
305  RzInterval vitv = (RzInterval){ section->vaddr, section->vsize };
306 
307  rz_num_units(humansz, sizeof(humansz), section->size);
308  RzListInfo *info = rz_listinfo_new(section->name, pitv, vitv, section->perm, humansz);
309  if (!info) {
310  RZ_LOG_ERROR("Cannot print section bars\n");
311  goto list_err;
312  }
314  }
315  RzTable *table = rz_core_table(core);
316  if (!table) {
317  RZ_LOG_ERROR("Cannot print section bars\n");
318  goto list_err;
319  }
320  rz_table_visual_list(table, list, core->offset, -1, cols, core->io->va);
321 
322  char *s = rz_table_tostring(table);
323  if (!s) {
324  RZ_LOG_ERROR("Cannot print section bars\n");
325  goto table_err;
326  }
327  rz_cons_printf("%s\n", s);
328  free(s);
329  res = RZ_CMD_STATUS_OK;
330 
331 table_err:
332  rz_table_free(table);
333 list_err:
335 sections_err:
337  return res;
338 }
RzList * sections(RzBinFile *bf)
Definition: bin_ne.c:110
RZ_API RZ_OWN RzList * rz_bin_object_get_sections(RZ_NONNULL RzBinObject *obj)
Get list of RzBinSection representing only the sections of the binary object.
Definition: bobj.c:774
RZ_API int rz_cons_get_size(int *rows)
Definition: cons.c:1446
RZ_API RzTable * rz_core_table(RzCore *core)
Definition: core.c:3449
static void list(RzEgg *egg)
Definition: rz-gg.c:52
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
Definition: list.c:248
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
Definition: list.c:288
struct rz_interval_t RzInterval
void(* RzListFree)(void *ptr)
Definition: rz_list.h:11
RZ_API char * rz_num_units(char *buf, size_t len, ut64 number)
Definition: unum.c:108
RZ_API void rz_table_visual_list(RzTable *table, RzList *list, ut64 seek, ut64 len, int width, bool va)
Definition: table.c:1205
RZ_API void rz_table_free(RzTable *t)
Definition: table.c:114
RZ_API char * rz_table_tostring(RzTable *t)
Definition: table.c:510
RzIO * io
Definition: rz_core.h:313
int va
Definition: rz_io.h:63
uint32_t size
RZ_API RzListInfo * rz_listinfo_new(const char *name, RzInterval pitv, RzInterval vitv, int perm, const char *extra)
Definition: visual.c:4020
RZ_API void rz_listinfo_free(RzListInfo *info)
Definition: visual.c:4032

References rz_core_t::bin, free(), info(), rz_core_t::io, list(), NULL, rz_core_t::offset, rz_bin_cur_object(), rz_bin_object_get_sections(), RZ_CMD_STATUS_ERROR, RZ_CMD_STATUS_OK, rz_cons_get_size(), rz_cons_printf(), rz_core_table(), rz_list_append(), rz_list_free(), rz_list_newf(), rz_listinfo_free(), rz_listinfo_new(), RZ_LOG_ERROR, rz_num_units(), rz_table_free(), rz_table_tostring(), rz_table_visual_list(), s, sections(), section::size, and rz_io_t::va.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_sections_handler()

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

Definition at line 258 of file cmd_info.c.

258  {
259  GET_CHECK_CUR_BINFILE(core);
260  RzList *hashes = rz_list_new_from_array((const void **)argv + 1, argc - 1);
261  if (!hashes) {
262  return RZ_CMD_STATUS_ERROR;
263  }
264  bool res = rz_core_bin_sections_print(core, bf, state, NULL, hashes);
265  rz_list_free(hashes);
266  return bool2status(res);
267 }
RZ_API bool rz_core_bin_sections_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzCoreBinFilter *filter, RzList *hashes)
Definition: cbin.c:2472

References argv, bool2status(), GET_CHECK_CUR_BINFILE, NULL, RZ_CMD_STATUS_ERROR, rz_core_bin_sections_print(), rz_list_free(), and rz_list_new_from_array().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_segments_handler()

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

Definition at line 340 of file cmd_info.c.

340  {
341  GET_CHECK_CUR_BINFILE(core);
342  RzList *hashes = rz_list_new_from_array((const void **)argv + 1, argc - 1);
343  if (!hashes) {
344  return RZ_CMD_STATUS_ERROR;
345  }
346  bool res = rz_core_bin_segments_print(core, bf, state, NULL, hashes);
347  rz_list_free(hashes);
348  return bool2status(res);
349 }
RZ_API bool rz_core_bin_segments_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzCoreBinFilter *filter, RzList *hashes)
Definition: cbin.c:2633

References argv, bool2status(), GET_CHECK_CUR_BINFILE, NULL, RZ_CMD_STATUS_ERROR, rz_core_bin_segments_print(), rz_list_free(), and rz_list_new_from_array().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_signature_handler()

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

Definition at line 421 of file cmd_info.c.

421  {
422  GET_CHECK_CUR_BINFILE(core);
424 }
RZ_API bool rz_core_bin_signatures_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:4038

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_signatures_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_source_handler()

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

Definition at line 702 of file cmd_info.c.

702  {
704 }
static bool print_source_info(RzCore *core, PrintSourceInfoType type, RzCmdStateOutput *state)
Definition: cmd_info.c:66

References bool2status(), print_source_info(), and PRINT_SOURCE_INFO_FILES.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_sourcelines_handler()

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

Definition at line 694 of file cmd_info.c.

694  {
696 }

References bool2status(), print_source_info(), and PRINT_SOURCE_INFO_LINES_ALL.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_sourcelines_here_handler()

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

Definition at line 698 of file cmd_info.c.

698  {
700 }

References bool2status(), print_source_info(), and PRINT_SOURCE_INFO_LINES_HERE.

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_strings_handler()

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

Definition at line 362 of file cmd_info.c.

362  {
363  GET_CHECK_CUR_BINFILE(core);
364  return bool2status(rz_core_bin_strings_print(core, bf, state));
365 }
RZ_API bool rz_core_bin_strings_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2853

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_strings_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_symbols_handler()

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

Definition at line 228 of file cmd_info.c.

228  {
229  GET_CHECK_CUR_BINFILE(core);
230  return bool2status(rz_core_bin_symbols_print(core, bf, state, NULL));
231 }
RZ_API bool rz_core_bin_symbols_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state, RzCoreBinFilter *filter)
Definition: cbin.c:2030

References bool2status(), GET_CHECK_CUR_BINFILE, NULL, and rz_core_bin_symbols_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_trycatch_handler()

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

Definition at line 689 of file cmd_info.c.

689  {
690  GET_CHECK_CUR_BINFILE(core);
691  return bool2status(rz_core_bin_trycatch_print(core, bf, state));
692 }
RZ_API bool rz_core_bin_trycatch_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:5102

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_trycatch_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_versions_handler()

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

Definition at line 684 of file cmd_info.c.

684  {
685  GET_CHECK_CUR_BINFILE(core);
686  return bool2status(rz_core_bin_versions_print(core, bf, state));
687 }
RZ_API bool rz_core_bin_versions_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:5084

References bool2status(), GET_CHECK_CUR_BINFILE, and rz_core_bin_versions_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_info_whole_strings_handler()

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

Definition at line 367 of file cmd_info.c.

367  {
368  RzBinFile *bf = rz_bin_cur(core->bin);
370 }
RZ_API bool rz_core_bin_whole_strings_print(RZ_NONNULL RzCore *core, RZ_NONNULL RzBinFile *bf, RZ_NONNULL RzCmdStateOutput *state)
Definition: cbin.c:2917

References rz_core_t::bin, bool2status(), rz_bin_cur(), and rz_core_bin_whole_strings_print().

Referenced by rzshell_cmddescs_init().

◆ rz_cmd_pdb_extract_handler()

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

Definition at line 526 of file cmd_info.c.

526  {
527  const char *file_cab = argv[1];
528  const char *output_dir = argv[2];
529  if (!rz_bin_pdb_extract_in_folder(file_cab, output_dir)) {
530  return RZ_CMD_STATUS_ERROR;
531  }
532  return RZ_CMD_STATUS_OK;
533 }
RZ_API bool rz_bin_pdb_extract_in_folder(RZ_NONNULL const char *file_cab, RZ_NONNULL const char *output_dir)
Extracts compressed PDB files into a folder.
Definition: cab_extract.c:209

References argv, rz_bin_pdb_extract_in_folder(), RZ_CMD_STATUS_ERROR, and RZ_CMD_STATUS_OK.

Referenced by rzshell_cmddescs_init().

◆ source_file_collect_cb()

static bool source_file_collect_cb ( void *  user,
const void *  k,
const void *  v 
)
static

Definition at line 51 of file cmd_info.c.

51  {
52  RzPVector *r = user;
53  char *f = strdup(k);
54  if (f) {
56  }
57  return true;
58 }
const char * k
Definition: dsignal.c:11
static void ** rz_pvector_push(RzPVector *vec, void *x)
Definition: rz_vector.h:300
#define f(i)
Definition: sha256.c:46

References f, k, r, rz_pvector_push(), and strdup().

Referenced by print_source_info().