It is time to take stock of what has been done so far with a view
to charting a practical way forward.
Go back to proposal
First of all, let me remind what I stated in proposal[1] and what I really made.
Actually, I guess it is no secret, that strace has an unique database storage of system
calls for a wide range of architectures, such as microblaze, riscv, avr32, well-known
x86 etc. So asinfo (advanced system call information) tool had to operate with this
database and provide any information based on strace database in the most convenient way.
Well, on the whole, I suppose, that I handled it. Sure, I exaggerate a little bit the list
of features in proposal, but I’ve added more meaningful functionality, that I talk about below.
Final architecture
After weeks of growing and refining, the asinfo tool gets the program model as shown in Figure 1.
Fig. 1. Architecture diagram
Usability
The usability of program can be examined in some good cases, here we go.
1) asinfo provides brief information about architecture
moreover, it is possible to type multiple architectures at a time
The strace architecture database is quite large
2) Well, as Linux kernel allows userspace to work in a different mode or launch
some non-native (in sense of bitness) binaries, asinfo provides information
about most commonly used application binary interfaces (ABIs), you can request
list of ABIs or set it manually
Some architectures, like mips64, contains at least 3 ABIs, so while working with
multiple architectures, there is no need to enumerate all ABIs, just use ‘all’
3) Perhaps, the bare essential part of asinfo tool is system call part.
In the basic case, you can get strict mapping from system call name to number
and reverse
or find occurence of input system call name
It is worth mentioning, that usabilty (system call part) of other related tools
such as [2] thus ends, but asinfo in addition suggests filtering with extended
regular expression
And the class filtering, where, for instance, user can request tool to show all
signal related system calls
The main advantage of tool is it can work in multiarch mode with the
opportunity to show discrepancies in system call characteristics
Besides that, you can switch second system call characteristic to number of
arguments
4) Also, the single arch mode allows program to take a guess about the current
architecture and ABI, if they are not specified. The following example with
x86_64 architecture and 64bit userspace environment
5) To get rid of built-in output formating and to use in combination with other tools,
use raw printing
Current state
For now I’ve completed all preparations, which are necessary to
share source code between strace and asinfo binaries
(Merged [3]):
e398011d Move SUPPORTED_PERSONALITIES to a separate file
b1fab45b Move string_to_uint* functions to a separate file
3d565ef2 Move sysent shorthand notations to separate files
b4f16886 Move err/mem subroutines to separate files
Speaking about main work, I’ve implemented asinfo tool and pushed
to forked github repository [4]:
60deb084 Generate arch_includes.h and arch_personalities.h
a25b0d09 asinfo: add man page
bb30d149 Add asinfo to build strace deb/rpm packages
f3e95004 Update NEWS
TO-DO
Complete work on tests for asinfo
Merge asinfo to main strace repository
Changelog
All weekly reports with progress are available in strace mailing list [5].
v10
Add asinfo binary to deb/rpm build.
Add ‘--raw’ parameter to print out without formating.
Update MAN page and usage.
Fix issues and typos.
v9
Add MAN page.
Add script to generate source code describing architecture.
Use new number_set API.
Fix issues and typos.
Fix broken make dist with regard to asinfo.
v8
Add multiarch mode for syscall_dispatcher, which allows to show
descrepancy in syscall numbers/name/arguments (number).
Add syscall filtering(as in strace).
Fix issues and typos.
Refine push back interface for syscall_service.
Refine push back interface for arch_service.
v7
Introduce multiarch mode for arch_dispatcher and abi_dispatcher.
Introduce new arch_description storage (arch_definitions.h).
Fix issues and typos.
v6
Adapt syscall dispatcher to the new program architecture.
Implement usage.
Refine command_dispatcher.
Fix issues and typos.
v5,v4,v3
Add command_dispatcher
Introduce syscall_dispatcher(raw version).
Introduce push back interface for syscall_service.
Fix issues and typos.
v2
Refine arch_dispatcher.
Introduce abi_dispatcher.
Add all architectures/ABIs supported by strace.
Introduce push back interface for arch_service.
Fix issues and typos.
v1 and older minor implementation:
Introduce pipeline architecture.
Implement the first version of arch_dispatcher.
Introduce define-based interface to interact with array of arch_description.
Acknowledgments
Apart from anything else, I would say, that participation in Google Summer of
Code program provides a valuable experience in open-source.
And I would like to thank my mentors for reviewing patches and I look forward
to continued cooperation to merge asinfo into main strace git repo.