Skip to content

Commit cf54e9c

Browse files
authored
Fix bug in 'as command' not showing the right syscall ##analysis
1 parent 19c8568 commit cf54e9c

2 files changed

Lines changed: 24 additions & 2 deletions

File tree

libr/core/cmd_anal.inc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,10 +2329,10 @@ R_API char *cmd_syscall_dostr(RCore *core, st64 n, ut64 addr) {
23292329
char str[64], snstr[32];
23302330
st64 N = n;
23312331
int defVector = r_syscall_get_swi (core->anal->syscall);
2332-
if (defVector > 0) {
2332+
if (addr != UT64_MAX && defVector > 0) {
23332333
n = -1;
23342334
}
2335-
if (n == -1 || defVector > 0) {
2335+
if (n == -1) {
23362336
n = (int)r_debug_reg_get (core->dbg, "oeax");
23372337
if (!n || n == -1) {
23382338
n = r_debug_reg_get (core->dbg, "SN");

test/db/anal/syscalls

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,25 @@ EXPECT=<<EOF
1717
EOF
1818
EXPECT_ERR=
1919
RUN
20+
21+
NAME=as <num> honors user argument
22+
FILE=-
23+
CMDS=<<EOF
24+
-a x86
25+
-b 64
26+
-e asm.os=linux
27+
as 0
28+
as 1
29+
as 2
30+
as 4
31+
as write
32+
EOF
33+
EXPECT=<<EOF
34+
0 = read (0, 0x00000000, 0)
35+
1 = write (0, "", 0)
36+
2 = open ("", 0x00000000, 0x00000000)
37+
4 = stat (0x00000000, 0x00000000)
38+
1 = write (0, "", 0)
39+
EOF
40+
EXPECT_ERR=
41+
RUN

0 commit comments

Comments
 (0)