Skip to content

Commit 441f4e4

Browse files
authored
Handle the new 'pd:' subcommands, using r2ghidra-git for now ##shell
1 parent cd4107c commit 441f4e4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

libr/core/cmd_print.inc.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ static RCoreHelpMessage help_msg_pd = {
317317
"pD", " N", "disassemble N bytes",
318318
"pd", " -N", "disassemble N instructions backwards",
319319
"pd", " N", "disassemble N instructions",
320+
"pd:", "[cmd]", "run pseudo-decompiler plugin command (pdg is now pd:g, ..)",
320321
"pd--", " N", "context disassembly of N instructions",
321322
"pda", "", "disassemble all possible opcodes (byte per byte)",
322323
"pdaj", "", "disassemble all possible opcodes (byte per byte) in JSON",
@@ -7313,10 +7314,17 @@ static int cmd_print(void *data, const char *input) {
73137314
processed_cmd = true;
73147315
break;
73157316
}
7317+
case ':': // "pd:"
7318+
if (input[2] == '?') {
7319+
// nothing
7320+
} else if (!input[2]) {
7321+
r_core_cmd0 (core, "pd:?");
7322+
} else {
7323+
R_LOG_ERROR ("Unknown subcommand");
7324+
}
7325+
return 0;
73167326
case 'c': // "pdc" // "pDc"
7317-
if (input[2] == '.') {
7318-
// do nothing, all the decompilers should be handling "pdc." to be listed
7319-
} else if (input[2] == 'l') {
7327+
if (input[2] == 'l') {
73207328
linear_pseudo (core, input + 3);
73217329
} else {
73227330
r_core_pseudo_code (core, input + 2);

libr/core/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1786,6 +1786,7 @@ static void init_cmd_suggestions(RCore *core) {
17861786
// Using fallbackcmd.* prefix to distinguish from regular SDB entries
17871787
sdb_set (core->sdb, "fallbackcmd.pdd", "?e You need to install the plugin with r2pm -ci r2dec", 0);
17881788
sdb_set (core->sdb, "fallbackcmd.pdg", "?e You need to install the plugin with r2pm -ci r2ghidra", 0);
1789+
sdb_set (core->sdb, "fallbackcmd.pd:g", "?e You need to install the plugin with r2pm -ci r2ghidra", 0);
17891790
sdb_set (core->sdb, "fallbackcmd.pdz", "?e You need to install the plugin with r2pm -ci r2retdec", 0);
17901791
sdb_set (core->sdb, "fallbackcmd.pdv", "?e You need to install the plugin with r2pm -ci east", 0);
17911792

0 commit comments

Comments
 (0)