Fix syscall preprocessing
'rizin' is missing a lot of syscalls for i.e. arm. We can check that with: rizin -a x86_64 -b 64 -k linux -q -c asl vs rizin -a arm -b 64 -k linux -q -c asl 'rz_syscall_item_new_from_string' splits the incoming string by commas and expects at least 3 items as a result. This patch fixes syscall preprocessing by appending empty strings to match the expected number of items after a split. This is a clone of a fix posted to radare2 [1]. [1] https://github.com/radareorg/radare2/pull/21508
This commit is contained in:
parent
7a3da1691c
commit
067c32ad18
2 changed files with 27 additions and 2 deletions
|
|
@ -12,6 +12,16 @@ with open(sys.argv[1], encoding="utf8") as inf:
|
|||
with open(sys.argv[2], "w", encoding="utf8") as outf:
|
||||
for line in inf:
|
||||
if not line.startswith("_") and "=" in line:
|
||||
arr = re.split("=|,", line)
|
||||
arr = [el.strip() for el in re.split("=|,", line)]
|
||||
print("%s.%s=%s" % (arr[1], arr[2], arr[0]), file=outf)
|
||||
print(line, file=outf, end="")
|
||||
|
||||
# Can't just append the original line, because
|
||||
# rz_syscall_item_new_from_string splits it by commas
|
||||
# and wants at least 3 items in the result, whereas
|
||||
# original lines, at least in some archs, have only
|
||||
# two items.
|
||||
while len(arr) < 4:
|
||||
arr.append("")
|
||||
print("%s=%s" % (arr[0], ",".join(arr[1:])), file=outf)
|
||||
else:
|
||||
print(line, file=outf, end="")
|
||||
|
|
|
|||
|
|
@ -24,6 +24,21 @@ call
|
|||
EOF
|
||||
RUN
|
||||
|
||||
NAME=syscall
|
||||
FILE==
|
||||
CMDS=<<EOF
|
||||
e asm.arch=arm
|
||||
e asm.bits=64
|
||||
e asm.os=linux
|
||||
asn fstat
|
||||
asr 80
|
||||
EOF
|
||||
EXPECT=<<EOF
|
||||
80
|
||||
fstat
|
||||
EOF
|
||||
RUN
|
||||
|
||||
NAME=noreturn errno
|
||||
FILE=bins/mach0/BatteryLife.arm_64.1
|
||||
CMDS=<<EOF
|
||||
|
|
|
|||
Loading…
Reference in a new issue