Skip to content

Commit

Permalink
Rename ib as ooi ##shell
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored Jul 4, 2024
1 parent 5928f46 commit 4536740
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 47 deletions.
31 changes: 0 additions & 31 deletions libr/core/cmd_info.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -570,22 +570,6 @@ static bool is_equal_file_hashes(RList *lfile_hashes, RList *rfile_hashes, bool
return true;
}

static int __r_core_bin_reload(RCore *r, const char *file, ut64 baseaddr) {
int result = 0;
RIODesc *cd = r->io->desc;
if (baseaddr == UT64_MAX) {
baseaddr = 0;
}
if (cd) {
RBinFile *bf = r_bin_file_find_by_fd (r->bin, cd->fd);
if (bf) {
result = r_bin_reload (r->bin, bf->id, baseaddr);
}
}
r_core_bin_set_env (r, r_bin_cur (r->bin));
return result;
}

static RList *r_core_bin_files(RCore *core) {
RList *list = r_list_newf (NULL);
if (core->allbins) {
Expand Down Expand Up @@ -1911,21 +1895,6 @@ static int cmd_info(void *data, const char *input) {
r_bin_list_archs (core->bin, NULL, 1);
}
break;
case 'b': // "ib"
{
const char *arg = strchr (input, ' ');
if (arg) {
arg++;
}
ut64 baddr = arg? r_num_math (core->num, arg) : r_config_get_i (core->config, "bin.baddr");
// XXX: this will reload the bin using the buffer.
// An assumption is made that assumes there is an underlying
// plugin that will be used to load the bin (e.g. malloc://)
// TODO: Might be nice to reload a bin at a specified offset?
__r_core_bin_reload (core, NULL, baddr);
r_core_block_read (core);
}
break;
case 'e': // "ie"
{
RList *objs = r_core_bin_files (core);
Expand Down
35 changes: 35 additions & 0 deletions libr/core/cmd_open.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ static RCoreHelpMessage help_msg_oo = {
"oo", "", "reopen current file",
"oo+", "", "reopen in read-write",
"oob", " [baddr]", "reopen loading rbin info (change base address?)",
"ooi", "", "reopen bin info without reloading the file",
"ooc", "", "reopen core with current file",
"ood", "[?]", "reopen in debug mode",
"oom", "[?]", "reopen in malloc://",
Expand Down Expand Up @@ -1729,6 +1730,23 @@ static bool find_desc_by_name(void *user, void *data, ut32 id) {
return true;
}

static int cmd_ooi(RCore *r, const char *file, ut64 baseaddr) {
int result = 0;
RIODesc *cd = r->io->desc;
if (baseaddr == UT64_MAX) {
baseaddr = 0;
}
if (cd) {
RBinFile *bf = r_bin_file_find_by_fd (r->bin, cd->fd);
if (bf) {
result = r_bin_reload (r->bin, bf->id, baseaddr);
}
}
r_core_bin_set_env (r, r_bin_cur (r->bin));
return result;
}


static bool cmd_onn(RCore *core, const char* input) {
const char *arg0 = input;
while (*arg0 && *arg0 != ' ') {
Expand Down Expand Up @@ -2345,6 +2363,23 @@ static int cmd_open(void *data, const char *input) {
r_core_cmd0 (core, "oc `o.`");
}
break;
case 'i': // "ooi" // reload info
if (input[2] == '?') {
r_core_cmd_help_match (core, help_msg_oo, "ooi");
} else {
const char *arg = strchr (input, ' ');
if (arg) {
arg++;
}
ut64 baddr = arg? r_num_math (core->num, arg) : r_config_get_i (core->config, "bin.baddr");
// XXX: this will reload the bin using the buffer.
// An assumption is made that assumes there is an underlying
// plugin that will be used to load the bin (e.g. malloc://)
// TODO: Might be nice to reload a bin at a specified offset?
cmd_ooi (core, NULL, baddr);
r_core_block_read (core);
}
break;
case 'b': // "oob" : reopen with bin info
if (input[2] == '?') {
r_core_cmd_help_match (core, help_msg_oo, "oob");
Expand Down
14 changes: 7 additions & 7 deletions test/db/anal/java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ RUN

NAME=use java prototypes command to print methods and fields
FILE=malloc://4096
CMDS=e asm.comments=false ; e asm.cmt.flgrefs=false ; e scr.color=false ; e asm.lines.jmp=false ; e asm.xrefs=false ; wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000 ; ib ; af ; java prototypes m ; java prototypes f
CMDS=e asm.comments=false ; e asm.cmt.flgrefs=false ; e scr.color=false ; e asm.lines.jmp=false ; e asm.xrefs=false ; wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000 ; ooi ; af ; java prototypes m ; java prototypes f
EXPECT=<<EOF
public void <init> (); // @0x02eb
public static java.lang.String a (java.lang.String); // @0x030a
Expand All @@ -64,7 +64,7 @@ e scr.color=false
e asm.lines.jmp=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib
ooi
af;
java calc_flags l;
java calc_flags m static private;
Expand Down Expand Up @@ -138,7 +138,7 @@ e scr.color=false
e asm.lines.jmp=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib;af;
ooi;af;
s 0x425; p8 2;
java flags_str_at m 0x425
java set_flags 0x425 0x009
Expand All @@ -162,7 +162,7 @@ e scr.color=false
e asm.lines.jmp=false
e asm.xrefs=false
wx cafebabe0000002f004008002208003a08003c0700310700360700370700380700390900040019090004001c090004001d0a000400170a000400180a0006001e0a0006001f0a000600200a000700160a0007001a0a0007001b0a000700210a000800160c002e00250c0031002b0c0031002c0c003100300c003200260c0032002a0c003300300c003400300c003500270c003b00230c003d00280c003e002401000001000328294901001428294c6a6176612f6c616e672f537472696e673b01000328295601001b2843294c6a6176612f6c616e672f537472696e674275666665723b01000428492943010016284949294c6a6176612f6c616e672f537472696e673b010026284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01002c284c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e674275666665723b010038284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b01004a284c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b4c6a6176612f6c616e672f537472696e673b294c6a6176612f6c616e672f537472696e673b0100083c636c696e69743e0100063c696e69743e010004436f64650100124c6a6176612f6c616e672f537472696e673b01000161010006617070656e6401000162010001630100066368617241740100136a6176612f6c616e672f457863657074696f6e0100106a6176612f6c616e672f537472696e670100166a6176612f6c616e672f537472696e674275666665720100106a6176612f7574696c2f566563746f720100086b77696373356a650100066c656e6774680100086f736d666e73656e010009737562737472696e67010008746f537472696e67010008537461636b4d617000310004000800000003000a003100300000000a003300300000000a00340030000000050001002e00250001002f0000001100010001000000052ab70015b1000000000009003100290001002f0000002300030001000000172ab20009b2000ab8000db3000b2ab2000bb8000c594bb000000000000a0031002c0001002f000000dc00040005000000572ab6000f3b12014e04360415049900442db6000f1aa20036bb000759b700112db600132bb600132cb60013b600144cbb000759b700112db600132b031008b60010b60013b600144ea7ffc8033604a7ffbda70004572db00001000b0051005400050001003f0000006b0006000b0005010700060700060700060100000010000501070006070006070006010000004b000501070006070006070006010000005100050107000607000607000601000000540005010700060700060700060100010700050055000501070006070006070006010000000a0031002b0001002f000000bc000400040000003dbb000759b700114d043e1d990029033e1d2ab6000fa2001a2c2a1db6000e2b1db6000e8292b6001257840301a7ffe4033ea7ffd9a70004572cb60014b00001000a0034003700050001003f000000650006000a000407000607000607000701000000100004070006070006070007010000002f00040700060700060700070100000034000407000607000607000701000000370004070006070006070007010001070005003800040700060700060700070100000008002d00250001002f0000001c00010000000000101202b300091203b3000a1201b3000bb1000000000000
ib;af;
ooi;af;
java resolve_cp k 5
java resolve_cp e 5
java resolve_cp c 5
Expand All @@ -182,7 +182,7 @@ a3dpY3M1amU=
EOF
RUN

NAME=af java multiple classes loaded via malloc and ib
NAME=af java multiple classes loaded via malloc and ooi
BROKEN=1
FILE=malloc://1024
CMDS=<<EOF
Expand All @@ -194,15 +194,15 @@ e asm.lines.jmp=false
e asm.xrefs=false
e asm.flags.middle=0
wx cafebabe00000033001707000201001b7261646172655f746573745f63617365732f6368616c6c656e67650700040100106a6176612f6c616e672f4f626a6563740100063c696e69743e010003282956010004436f64650a000300090c0005000601000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c650100047468697301001d4c7261646172655f746573745f63617365732f6368616c6c656e67653b01001573696d706c655f636173655f73746d745f3476616c01000328294901000169010001490100016a0100016b01000d537461636b4d61705461626c6501000a536f7572636546696c6501000e6368616c6c656e67652e6a617661002100010003000000000002000100050006000100070000002f00010001000000052ab70008b100000002000a00000006000100000003000b0000000c000100000005000c000d00000008000e000f00010007000000c10002000300000048033b033ca7003c1a08703d1caa0000000000003200000000000000030000002000000026000000320000002c840202a70011840203a7000b840209a70005033c1a100aa1ffc41bac00000003000a0000002a000a000000050004000600070007000b0008002c00090032000a0038000b003e000c004000060046000f000b0000002000030002004600100011000000040044001200110001000b00350013001100020014000000110006fd00070101fc002401050505fa000100010015000000020016
ib;if;
ooi;if;
pd 3 @ sym.java_lang_Object._init_
# pd 20 @ s sym.radare_test_cases_challenge.simple_case_stmt_4val
o malloc://1024 0xa00~a
s 0xa00
wx cafebabe0000003300180700020100177261646172655f746573745f63617365732f6c6f6f70730700040100106a6176612f6c616e672f4f626a6563740100063c696e69743e010003282956010004436f64650a000300090c0005000601000f4c696e654e756d6265725461626c650100124c6f63616c5661726961626c655461626c65010004746869730100194c7261646172655f746573745f63617365732f6c6f6f70733b01000f73696d706c655f666f725f6c6f6f7001000328294201000169010001490100016a0100016b01000d537461636b4d61705461626c6501001c73696d706c655f666f725f6c6f6f705f6d756c74695f72657475726e01000a536f7572636546696c6501000a6c6f6f70732e6a617661002100010003000000000003000100050006000100070000002f00010001000000052ab70008b100000002000a00000006000100000003000b0000000c000100000005000c000d00000008000e000f000100070000006c0002000300000017033d033b043d10643ca700068400011a1ba1fffb1c91ac00000003000a0000000e000300000006000200080014000b000b000000200003000400130010001100000009000e001200110001000200150013001100020014000000090002fe000c0101010200080015000f0001000700000095000200030000002b033d033b043d10643ca7001a1c1a823d1c1100ffa000061c91ac1c1100ff703d8400011a1ba1ffe71c91ac00000003000a0000002200080000000e00020010000c00110010001300170014001a00150020001000280018000b00000020000300040027001000110000000900220012001100010002002900130011000200140000000a0003fe000c0101010d0800010016000000020017
oba 0xa00
pdf
ib
ooi
af
pdf
# s sym.radare_test_cases_challenge.simple_case_stmt_4val; pdf
Expand Down
1 change: 1 addition & 0 deletions test/db/cmd/cmd_fuzzed
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ FILE=-
CMDS=<<EOF
e scr.null =true
ibbbbbbbk
ooi
EOF
EXPECT=<<EOF
EOF
Expand Down
Loading

0 comments on commit 4536740

Please sign in to comment.