Skip to content

Commit

Permalink
libcommon: DOF parsing
Browse files Browse the repository at this point in the history
This commit adds a DOF parser, derived from DTrace v1 but simplified.
The parser is intended to run in a strict-mode seccomp jail, and does no
I/O except via pre-provided file descriptors.  The host side should do
I/O using the functions in dof_parser_host.h.

The seccomp parser child returns output as a stream of dof_parsed_t
records, which are variable-length records with an early size member
(the reader code in dof_parser_host.c takes care of reading the right
amount of data).  Errors are returned as PIT_ERR records in this stream,
or signified by a simple crash (in which case the invoker can simply
restart it).

The parser has a notably noisy debugging mechanism which can be turned
on via make dof_dbg=yes (it is separate from make debugging=yes because
it makes the daemon emit lots of stuff on stderr, which you're unlikely
to want unless you're actually debugging USDT itself).

Signed-off-by: Nick Alcock <nick.alcock@oracle.com>
Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
  • Loading branch information
nickalcock authored and kvanhees committed Oct 25, 2022
1 parent f387a2d commit 3fac45f
Show file tree
Hide file tree
Showing 5 changed files with 1,404 additions and 2 deletions.
8 changes: 7 additions & 1 deletion Makeoptions
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
# The implementation of the configurable make options.
#
# Oracle Linux DTrace.
# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
# Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved.
# Licensed under the Universal Permissive License v 1.0 as shown at
# http://oss.oracle.com/licenses/upl.

debugging ?= no
dof_dbg ?= no
coverage ?= no
verbose ?= no

Expand All @@ -14,12 +15,17 @@ help::
@printf "make debugging=yes [targets] Disable optimization to make debugger use easier\n" >&2
@printf "make coverage=yes [targets] Turn on coverage support in the testsuite\n" >&2
@printf "make verbose=yes [target] Enable verbose building\n" >&2
@printf "make dof_dbg=yes [targets] Turn on especially noisy DOF parser debugging\n" >&2
@printf "\n" >&2

ifneq ($(debugging),no)
override CFLAGS += -O0 -g
endif

ifneq ($(dof_dbg),no)
override CFLAGS += -DDOF_DEBUG
endif

ifneq ($(coverage),no)
override CFLAGS += -O0 --coverage
override LDFLAGS += --coverage
Expand Down
2 changes: 1 addition & 1 deletion libcommon/Build
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ LIBS += libcommon
libcommon_TARGET = libcommon
libcommon_DIR := $(current-dir)
libcommon_CPPFLAGS := -Ilibcommon -Ilibproc
libcommon_SOURCES = uprobes.c dt_list.c
libcommon_SOURCES = dof_parser.c dof_parser_host.c uprobes.c dt_list.c
libcommon_LIBSOURCES = libcommon

0 comments on commit 3fac45f

Please sign in to comment.