Skip to content

Commit

Permalink
Handle axt.. as a valid command ##shell
Browse files Browse the repository at this point in the history
  • Loading branch information
trufae authored Nov 27, 2024
1 parent 6f03c4b commit 36a9e8e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
9 changes: 7 additions & 2 deletions libr/core/cmd_anal.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10516,7 +10516,12 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
break;
}
} else {
addr = core->offset;
const char *dotdot = strstr (input, "..");
if (dotdot) {
addr = r_num_tail (core->num, core->offset, dotdot + 2);
} else {
addr = core->offset;
}
}
RVecAnalRef *list = r_anal_xrefs_get (core->anal, addr);
if (list) {
Expand Down Expand Up @@ -10681,7 +10686,7 @@ static bool cmd_anal_refs(RCore *core, const char *input) {
ref->addr, ref->type, addr, is_at_end? "": ",");
i++;
}
} else if (input[1] == ' ' || input[1] == 0) { // "axt"
} else if (input[1] == ' ' || input[1] == 0 || input[1] == '.') { // "axt"
RAnalFunction *fcn;
RAnalRef *ref;
R_VEC_FOREACH (list, ref) {
Expand Down
20 changes: 20 additions & 0 deletions test/db/cmd/cmd_ax
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,23 @@ EXPECT=<<EOF
0x600ff8
EOF
RUN

NAME=axt..dotdot
FILE=bins/mach0/ls-m1
ARGS=-a arm -b 64
CMDS=<<EOF
aa
axt..7950
?e --
axt ..7950
?e --
axt sym.imp.write
EOF
EXPECT=<<EOF
sym.func.10000699c 0x1000069bc [CALL:--x] bl sym.imp.write
--
sym.func.10000699c 0x1000069bc [CALL:--x] bl sym.imp.write
--
sym.func.10000699c 0x1000069bc [CALL:--x] bl sym.imp.write
EOF
RUN

0 comments on commit 36a9e8e

Please sign in to comment.