Skip to content

Commit

Permalink
Update libdemangle to latest main and add LD command as alias of iDl (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio authored Apr 1, 2024
1 parent 8f7f03c commit 5cd4cff
Show file tree
Hide file tree
Showing 7 changed files with 33 additions and 3 deletions.
6 changes: 6 additions & 0 deletions librz/core/cmd/cmd_plugins.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: LGPL-3.0-only

#include <rz_core.h>
#include <cmd_descs.h>

RZ_IPI RzCmdStatus rz_plugins_load_handler(RzCore *core, int argc, const char **argv) {
return rz_lib_open(core->lib, rz_str_trim_head_ro(argv[1])) ? RZ_CMD_STATUS_OK : RZ_CMD_STATUS_ERROR;
Expand Down Expand Up @@ -57,3 +58,8 @@ RZ_IPI RzCmdStatus rz_plugins_io_print_handler(RzCore *core, int argc, const cha
RZ_IPI RzCmdStatus rz_plugins_parser_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
return rz_core_parser_plugins_print(core->parser, state);
}

RZ_IPI RzCmdStatus rz_plugins_demanglers_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state) {
// alias for iDl
return rz_cmd_info_demangle_list_handler(core, argc, argv, state);
}
12 changes: 12 additions & 0 deletions librz/core/cmd_descs/cmd_descs.c
Original file line number Diff line number Diff line change
Expand Up @@ -11739,6 +11739,14 @@ static const RzCmdDescHelp plugins_parser_print_help = {
.args = plugins_parser_print_args,
};

static const RzCmdDescArg plugins_demanglers_print_args[] = {
{ 0 },
};
static const RzCmdDescHelp plugins_demanglers_print_help = {
.summary = "List the demanglers plugins (alias for iDl)",
.args = plugins_demanglers_print_args,
};

static const RzCmdDescHelp o_help = {
.summary = "Open files and handle opened files",
};
Expand Down Expand Up @@ -21453,6 +21461,10 @@ RZ_IPI void rzshell_cmddescs_init(RzCore *core) {
RzCmdDesc *plugins_parser_print_cd = rz_cmd_desc_argv_state_new(core->rcmd, L_cd, "Lp", RZ_OUTPUT_MODE_STANDARD | RZ_OUTPUT_MODE_JSON, rz_plugins_parser_print_handler, &plugins_parser_print_help);
rz_warn_if_fail(plugins_parser_print_cd);

RzCmdDesc *plugins_demanglers_print_cd = rz_cmd_desc_argv_state_new(core->rcmd, L_cd, "LD", RZ_OUTPUT_MODE_TABLE | RZ_OUTPUT_MODE_QUIET | RZ_OUTPUT_MODE_JSON, rz_plugins_demanglers_print_handler, &plugins_demanglers_print_help);
rz_warn_if_fail(plugins_demanglers_print_cd);
rz_cmd_desc_set_default_mode(plugins_demanglers_print_cd, RZ_OUTPUT_MODE_TABLE);

RzCmdDesc *o_cd = rz_cmd_desc_group_new(core->rcmd, root_cd, "o", rz_open_handler, &open_help, &o_help);
rz_warn_if_fail(o_cd);
RzCmdDesc *open_write_cd = rz_cmd_desc_argv_new(core->rcmd, o_cd, "o+", rz_open_write_handler, &open_write_help);
Expand Down
2 changes: 2 additions & 0 deletions librz/core/cmd_descs/cmd_descs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1610,6 +1610,8 @@ RZ_IPI RzCmdStatus rz_plugins_bin_print_handler(RzCore *core, int argc, const ch
RZ_IPI RzCmdStatus rz_plugins_io_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "Lp"
RZ_IPI RzCmdStatus rz_plugins_parser_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "LD"
RZ_IPI RzCmdStatus rz_plugins_demanglers_print_handler(RzCore *core, int argc, const char **argv, RzCmdStateOutput *state);
// "o"
RZ_IPI RzCmdStatus rz_open_handler(RzCore *core, int argc, const char **argv);
// "o+"
Expand Down
10 changes: 10 additions & 0 deletions librz/core/cmd_descs/cmd_plugins.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,14 @@ commands:
args: []
modes:
- RZ_OUTPUT_MODE_STANDARD
- RZ_OUTPUT_MODE_JSON
- name: LD
cname: plugins_demanglers_print
summary: List the demanglers plugins (alias for iDl)
type: RZ_CMD_DESC_TYPE_ARGV_STATE
args: []
default_mode: RZ_OUTPUT_MODE_TABLE
modes:
- RZ_OUTPUT_MODE_TABLE
- RZ_OUTPUT_MODE_QUIET
- RZ_OUTPUT_MODE_JSON
2 changes: 1 addition & 1 deletion librz/demangler/demangler.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ DEFINE_DEMANGLER_PLUGIN(cpp, "c++", "LGPL3", "deroad", libdemangle_handler_cxx);
DEFINE_DEMANGLER_PLUGIN(swift, "swift", "MIT", "pancake", libdemangle_handler_swift);
#endif

DEFINE_DEMANGLER_PLUGIN(rust, "rust", "LGPL3", "Dhruv Maroo", libdemangle_handler_rust);
DEFINE_DEMANGLER_PLUGIN(rust, "rust", "LGPL3", "Dhruv Maroo/RizinOrg", libdemangle_handler_rust);
DEFINE_DEMANGLER_PLUGIN(java, "java", "LGPL3", "deroad", libdemangle_handler_java);
DEFINE_DEMANGLER_PLUGIN(msvc, "msvc", "LGPL3", "inisider", libdemangle_handler_msvc);
DEFINE_DEMANGLER_PLUGIN(objc, "objc", "LGPL3", "pancake", libdemangle_handler_objc);
Expand Down
2 changes: 1 addition & 1 deletion subprojects/libdemangle.wrap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wrap-git]
url = https://github.com/rizinorg/rz-libdemangle.git
revision = 3eb0ef8efdf8d22bd5cfde1f7df1c1e48ef75a70
revision = 498e00785ebdff8867f403799e6b709d98cd82f6
depth = 1
2 changes: 1 addition & 1 deletion test/db/tools/rz_bin
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ msvc LGPL3 inisider
objc LGPL3 pancake
pascal LGPL3 deroad
c++ GPL-2,LGPL3 FSF/deroad
rust LGPL3 Dhruv Maroo
rust LGPL3 Dhruv Maroo/RizinOrg
swift MIT pancake
EOF
RUN
Expand Down

0 comments on commit 5cd4cff

Please sign in to comment.