Edgar Kaziakhmedov
76422e4ebc
Introduce asinfo tool
The main purpose of this query tool is to present all information concluded
at sysent.h files in a convenient way.
The asinfo tool has the following staged architecture:
(command dispatcher)->(architecture dispatcher)->
(abi dispatcher)->(system call dispatcher).
Each dispatcher accepts proccesed data from previous one.
This point can be illustrated by the following example:
$ asinfo --get-arch --get-sname write
Firstly, arch_dispatcher will return the current architecture, based on
uname return value, after that in case of no options for abi_dispatcher,
it perceives empty parameter as get-abi parameter and returns ABI mode set at
compile time of strace package. Therefore, syscall_dispatcher accepts this
architecture/ABI and works with specific set of system calls. It is worth
mentioning that it supports all architectures/ABIs supported by strace.
Also, tool can work in multi-arch mode. for instance:
$ ./tools/asinfo/asinfo --set-arch mips64,mips --set-abi n64,all
--get-snum 100,8,%ipc
For more info, use asinfo -h.
* Makefile.am (SUBDIRS): Add tools directory.
* configure.ac (AC_CONFIG_FILES): Add Makefiles.
* tools/Makefile.am: New file.
* tools/asinfo/Makefile.am: New file.
* tools/asinfo/dispatchers.h: New file. Prototype abi_dispatcher,
arch_dispatcher, and syscall_dispatcher.
* tools/asinfo/dispatchers.c: New file. Implement them.
* tools/asinfo/error_interface.h: New file. Introduce error_service to
improve informativeness of output errors. Prototype methods to work with
error_service.
* tools/asinfo/error_interface.c: New file. Implement it.
* tools/asinfo/arch_interface.h: New file. Introduce struct
arch_descriptor. Introduce arch_service. Prototype methods to simplify
work with the arch_service.
* tools/asinfo/arch_interface.c: New file. Implement it.
* tools/asinfo/syscall_interface.h: New file. Introduce syscall_service.
Prototype methods to simplify work with syscall_service.
* tools/asinfo/syscall_interface.c: New file. Implement it.
* tools/asinfo/request_msgs.h: New file. Introduce main requests.
* tools/asinfo/asinfo.c: New file. Implement support of all options.
Implement usage. Implement version.
* tools/asinfo/arch_definitions.h: New file. Introduce useful storage
for architectures.
* tools/asinfo/gen_asinfo_files.sh: New file.
* bootstrap: Add it.
* tools/asinfo/Makefile.am: Include Makemodule.am.
(asinfo_SOURCES): Add $(ARCH_AUX_FILES).
* tools/asinfo/README-arch: New README explaining how to add new
architecture/ABI to asinfo tool.
* configure.ac (AC_CONFIG_FILES): Add asinfo.1.
(asinfo_manpage_date): New m4 define.
(ASINFO_MANPAGE_DATE): New define/subst.
* tools/asinfo/asinfo.1.in: New file.
* tools/asinfo/gen_asinfo_files.sh: Add asinfo.1 to .gitignore
generation.
* debian/control (strace): Add asinfo description.
* debian/strace.install: Add path to asinfo binary.
* debian/strace.manpages: Add path to asinfo manual page.
* strace.spec.in (%files): Add asinfo binary.
Update NEWS
This set of tests cover all possible cases in asinfo tool. However,
as asinfo uses some libraries provided by strace (such as basic_filters)
there is no need to test them again in asinfo context.
Also, the set of syscalls for specific architecture (hence, its number) might
be expanded in the future, so to overcome this obstacle and avoid duplication
of the same strings reference output ptintings are stored in
ref_asinfo_output.h file.
As for syscall-related checks, tests use old syscalls as samples, so their
numbers and names can't be changed.
* configure.ac (AC_CONFIG_FILES): Add tests Makefile to be generated.
* tools/asinfo/Makefile.am (SUBDIRS): Add tests dir.
* tools/asinfo/tests/Makefile.m: New file.
* tools/asinfo/tests/init.sh: New file. Main subroutines for tests.
* tools/asinfo/tests/ref_asinfo_output.h: New file.
* tools/asinfo/tests/com_disp_wrong_keys.c: Likewise.
* tools/asinfo/tests/com_disp_wrong_keys.test: Likewise.
* tools/asinfo/tests/format_output.c: Likewise.
* tools/asinfo/tests/format_output.test: Likewise.
* tools/asinfo/tests/get_arch_abi.c: Likewise.
* tools/asinfo/tests/get_arch_abi.test: Likewise.
* tools/asinfo/tests/get_sname.c: Likewise.
* tools/asinfo/tests/get_sname.test: Likewise.
* tools/asinfo/tests/get_snum.c: Likewise.
* tools/asinfo/tests/get_snum.test: Likewise.
* tools/asinfo/tests/list_arch.c: Likewise.
* tools/asinfo/tests/list_arch.test: Likewise.
* tools/asinfo/tests/multiarch_get_sname.c: Likewise.
* tools/asinfo/tests/multiarch_get_sname.test: Likewise.
* tools/asinfo/tests/multiarch_get_snum.c: Likewise.
* tools/asinfo/tests/multiarch_get_snum.test: Likewise.
* tools/asinfo/tests/set_abi.c: Likewise.
* tools/asinfo/tests/set_abi.test: Likewise.
* tools/asinfo/tests/set_arch.c: Likewise.
* tools/asinfo/tests/set_arch.test: Likewise.
* tools/asinfo/tests/set_mult_abi.c: Likewise.
* tools/asinfo/tests/set_mult_abi.test: Likewise.
* tools/asinfo/tests/set_mult_arch.c: Likewise.
* tools/asinfo/tests/set_mult_arch.test: Likewise.
Signed-off-by: Edgar Kaziakhmedov <edos.edgar@gmail.com>
Adjusted-and-rebased-by: Dmitry V. Levin <ldv@altlinux.org>