freebsd-dev/usr.bin/truss/Makefile
John Baldwin a5f14abfd2 Add support to libsysdecode for decoding system call names.
A new sysdecode_syscallname() function accepts a system call code and
returns a string of the corresponding name (or NULL if the code is
unknown).  To support different process ABIs, the new function accepts a
value from a new sysdecode_abi enum as its first argument to select the
ABI in use.  Current ABIs supported include FREEBSD (native binaries),
FREEBSD32, LINUX, LINUX32, and CLOUDABI64.  Note that not all ABIs are
supported by all platforms.  In general, a given ABI is only supported
if a platform can execute binaries for that ABI.

To simplify the implementation, libsysdecode's build reuses the
existing pre-generated files from the kernel source tree rather than
duplicating new copies of said files during the build.

kdump(1) and truss(1) now use these functions to map system call
identifiers to names.  For kdump(1), a new 'syscallname()' function
consolidates duplicated code from ktrsyscall() and ktrsyscallret().
The Linux ABI no longer requires custom handling for ktrsyscall() and
linux_ktrsyscall() has been removed as a result.

Reviewed by:	bdrewery
Differential Revision:	https://reviews.freebsd.org/D4823
2016-01-26 19:07:09 +00:00

42 lines
883 B
Makefile

# $FreeBSD$
NO_WERROR=
PROG= truss
SRCS= cloudabi.c main.c setup.c syscalls.c
LIBADD= sysdecode
CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys
ABIS+= freebsd
# Each ABI is expected to have an ABI.c, MACHINE_ARCH-ABI.c or
# MACHINE_CPUARCH-ABI.c file that will be used to map the syscall arguments.
.if ${MACHINE_ARCH} == "aarch64"
ABIS+= cloudabi64
.endif
.if ${MACHINE_CPUARCH} == "i386"
ABIS+= i386-linux
.endif
.if ${MACHINE_CPUARCH} == "amd64"
ABIS+= amd64-linux32
ABIS+= freebsd32
ABIS+= cloudabi64
.endif
.if ${MACHINE_ARCH} == "powerpc64"
ABIS+= freebsd32
.endif
.for abi in ${ABIS}
# Find the right file to handle this ABI.
abi_src=
ABI_SRCS= ${abi}.c ${MACHINE_ARCH}-${abi}.c ${MACHINE_CPUARCH}-${abi}.c
.for f in ${ABI_SRCS}
.if exists(${.CURDIR}/${f}) && empty(abi_src)
abi_src= ${f}
.endif
.endfor
SRCS:= ${SRCS} ${abi_src}
.endfor
.include <bsd.prog.mk>