Hi,
I've been building a Linux-main DynamoRIO/DrMemory tracer client, whose one of the task is logging syscalls using drsys_iterate_args() and noticed that drsys_arg_t.arg_name is always NULL for Linux syscalls, while Windows works much better. I think I understand why, and wanted to raise and discuss it before attempting a patch:
arg_name is
only written at
report_memarg_ex() in drsyscall/drsyscall.c, which is in turn reached from report_memarg_type(). On Windows, most NtXYZ syscalls have dedicated handlers, e.g. in drsyscall_windows.c. On Linux, we mostly rely on the static table in table_linux.c.
Furthermore, report_memarg_ex is only called for memory-referencing arguments. Inlined scalar args (fd, flags, counts, anything with SYSARG_INLINED) go through a completely separate path in the drsys_iterate_args() iterator that never calls report_memarg_ex, so arg_name is never set for them regardless of platform.
I think that a good solution would be to introduce a const char* arg_name field in sysinfo_arg_t from drsyscall_os.h - it already defines type_name, add arg->arg_name = sysinfo->arg[compacted].arg_name in the inline scalar branch and populate the field in table_linux.c for the syscalls that need it.
As I said, that's my first contribution to this framework, so I mightve missed something, but I'm willing to work on it
Greets, Bartek