Skip to content

Commit 827d36b

Browse files
trufaeradare
andauthored
Add r2dec.vars option to hide local variable definitions (#381)
Co-authored-by: pancake <[email protected]>
1 parent c066aec commit 827d36b

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ r2dec.debug | do not catch exceptions in r2dec.
8282
r2dec.paddr | if true, all xrefs uses physical addresses compare.
8383
r2dec.slow | if true load all the data before to avoid multirequests to r2.
8484
r2dec.theme | defines the color theme to be used on r2dec.
85+
r2dec.vars | if true, shows local variable definitions.
8586
r2dec.xrefs | if true, shows all xrefs in the pseudo code.
8687
e scr.html | outputs html data instead of text.
8788
e scr.color | enables syntax colors.

c/r2dec-plugin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ static bool r_cmd_pdd_init(RCorePluginSession *cps) {
262262
SETPREF("r2dec.highlight", "default", "highlights the current address.");
263263
SETPREF("r2dec.paddr", "false", "if true, all xrefs uses physical addresses compare.");
264264
SETPREF("r2dec.slow", "false", "load all the data before to avoid multirequests to r2.");
265+
SETPREF("r2dec.vars", "true", "if true, shows local variable definitions.");
265266
SETPREF("r2dec.xrefs", "false", "if true, shows all xrefs in the pseudo code.");
266267
r_config_lock (cfg, true);
267268

@@ -289,6 +290,7 @@ static int r_cmd_pdd_init(void *user, const char *cmd) {
289290
SETPREF("r2dec.highlight", "default", "highlights the current address.");
290291
SETPREF("r2dec.paddr", "false", "if true, all xrefs uses physical addresses compare.");
291292
SETPREF("r2dec.slow", "false", "load all the data before to avoid multirequests to r2.");
293+
SETPREF("r2dec.vars", "true", "if true, shows local variable definitions.");
292294
SETPREF("r2dec.xrefs", "false", "if true, shows all xrefs in the pseudo code.");
293295
r_config_lock (cfg, true);
294296

js/libdec/core/scope.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ function _print_locals(locals, address, spaced) {
88
if (Global().evars.honor.blocks) {
99
return;
1010
}
11+
if (!Global().evars.honor.vars) {
12+
return;
13+
}
1114
var a = Global().printer.auto;
1215
for (var i = 0; i < locals.length; i++) {
1316
var local = Extra.is.string(locals[i]) ? a(locals[i]) : locals[i].toString(true);

js/libdec/r2util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ export default (function() {
193193
casts: r2pipe.bool('e r2dec.casts') || has_option(args, '--casts'),
194194
assembly: r2pipe.bool('e r2dec.asm') || has_option(args, '--assembly'),
195195
blocks: r2pipe.bool('e r2dec.blocks') || has_option(args, '--blocks'),
196+
vars: r2pipe.bool('e r2dec.vars'),
196197
xrefs: r2pipe.bool('e r2dec.xrefs') || has_option(args, '--xrefs'),
197198
paddr: r2pipe.bool('e r2dec.paddr') || has_option(args, '--paddr'),
198199
offsets: has_option(args, '--offsets'),

0 commit comments

Comments
 (0)