aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/truss
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2015-12-15 00:05:07 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2015-12-15 00:05:07 +0000
commitd6fb4894981bcd8641fbe8cab52057dc2a58ad3a (patch)
tree707e5b0c03ebbaee1e67aa7ea0d0744fcfd7e272 /usr.bin/truss
parent37ded2a72c6f737220e8da45af53123388aa6062 (diff)
downloadsrc-d6fb4894981bcd8641fbe8cab52057dc2a58ad3a.tar.gz
src-d6fb4894981bcd8641fbe8cab52057dc2a58ad3a.zip
Start on a new library (libsysdecode) that provides routines for decoding
system call information such as system call arguments. Initially this will consist of pulling duplicated code out of truss and kdump though it may prove useful for other utilities in the future. This commit moves the shared utrace(2) record parser out of kdump into the library and updates kdump and truss to use it. One difference from the previous version is that the library version treats unknown events that start with the "RTLD" signature as unknown events. This simplifies the interface and allows the consumer to decide how to handle all non-recognized events. Instead, this function only generates a string description for known malloc() and RTLD records. Reviewed by: bdrewery Differential Revision: https://reviews.freebsd.org/D4537
Notes
Notes: svn path=/head/; revision=292236
Diffstat (limited to 'usr.bin/truss')
-rw-r--r--usr.bin/truss/Makefile3
-rw-r--r--usr.bin/truss/Makefile.depend.amd641
-rw-r--r--usr.bin/truss/syscalls.c6
3 files changed, 4 insertions, 6 deletions
diff --git a/usr.bin/truss/Makefile b/usr.bin/truss/Makefile
index e78436513c6c..a300da17b398 100644
--- a/usr.bin/truss/Makefile
+++ b/usr.bin/truss/Makefile
@@ -4,8 +4,7 @@ NO_WERROR=
PROG= truss
SRCS= cloudabi.c ioctl.c main.c setup.c syscalls.c
-.PATH: ${.CURDIR:H}/kdump
-SRCS+= utrace.c
+LIBADD= sysdecode
CFLAGS+= -I${.CURDIR} -I. -I${.CURDIR}/../../sys
CLEANFILES= ioctl.c
diff --git a/usr.bin/truss/Makefile.depend.amd64 b/usr.bin/truss/Makefile.depend.amd64
index bf32fa45b6f3..ad9c8b3d5906 100644
--- a/usr.bin/truss/Makefile.depend.amd64
+++ b/usr.bin/truss/Makefile.depend.amd64
@@ -11,6 +11,7 @@ DIRDEPS = \
lib/${CSU_DIR} \
lib/libc \
lib/libcompiler_rt \
+ lib/libsysdecode \
.include <dirdeps.mk>
diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c
index ec74de9e8bcf..990403e657a4 100644
--- a/usr.bin/truss/syscalls.c
+++ b/usr.bin/truss/syscalls.c
@@ -65,6 +65,7 @@ __FBSDID("$FreeBSD$");
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sysdecode.h>
#include <time.h>
#include <unistd.h>
#include <vis.h>
@@ -75,9 +76,6 @@ __FBSDID("$FreeBSD$");
#include "extern.h"
#include "syscall.h"
-/* usr.bin/kdump/utrace.c */
-int kdump_print_utrace(FILE *, void *, size_t, int);
-
/* 64-bit alignment on 32-bit platforms. */
#if !defined(__LP64__) && defined(__powerpc__)
#define QUAD_ALIGN 1
@@ -1108,7 +1106,7 @@ print_utrace(FILE *fp, void *utrace_addr, size_t len)
unsigned char *utrace_buffer;
fprintf(fp, "{ ");
- if (kdump_print_utrace(fp, utrace_addr, len, 0)) {
+ if (sysdecode_utrace(fp, utrace_addr, len)) {
fprintf(fp, " }");
return;
}