Dtrace in a jail

Ben Woods woodsb02 at gmail.com
Tue Sep 1 15:32:53 UTC 2015


Hi everyone,

I am just discovering dtrace, having heard about it a number of times but
never investigated further. I like what I see so far!

Is there a way to use Dtrace to debug programs being run in a jail?
Attempting to run Dtrace from within the jail results in the following
error:
# dtrace -l
dtrace: failed to initialize dtrace: DTrace device not available on system

I want to debug a program I am running in a jail which is crashing a few
seconds after being run. It doesn't crash in my FreeBSD 10.2 host, but does
in the FreeBSD 9.3 jail.

Since I want to run Dtrace on the pid provider on my program, I want my
program to be executed by the Dtrace application. Something like:

# dtrace -l -n 'pid$target::strcmp:entry{}' -c "./foo hello"


But this results in the same error about Dtrace device not being available
on the system (within the jail).

If I instead run Dtrace and pass it the jexec command, I think it is
tracing the jexec program, rather than my program that is then being
executed within the jail. I.e. I don't think this works as expected:

# dtrace -l -n 'pid$target::strcmp:entry{}' -c "jexec 1 foo hello"


Any hints on how I can trace this program running in the jail?

Thanks,
Ben


-- 

--
From: Benjamin Woods
woodsb02 at gmail.com


More information about the freebsd-dtrace mailing list