Commit Graph

70 Commits

Author SHA1 Message Date
Ruslan Bukin
27e54fb59e Make libproc compilable on AArch64. 2015-07-01 13:59:26 +00:00
Simon J. Gerraty
ccfb965433 Add META_MODE support.
Off by default, build behaves normally.
WITH_META_MODE we get auto objdir creation, the ability to
start build from anywhere in the tree.

Still need to add real targets under targets/ to build packages.

Differential Revision:       D2796
Reviewed by: brooks imp
2015-06-13 19:20:56 +00:00
Simon J. Gerraty
44d314f704 dirdeps.mk now sets DEP_RELDIR 2015-06-08 23:35:17 +00:00
Simon J. Gerraty
98e0ffaefb Merge sync of head 2015-05-27 01:19:58 +00:00
Baptiste Daroussin
f8eb7ac92c Fix underlinking 2015-05-19 22:23:15 +00:00
Stanislav Sedov
0faaddb8db Fix debug symbols loading in libproc: 0 is a valid file descriptor.
Reported by:	Chris Torek <chris.torek@gmail.com>
2015-03-13 04:26:48 +00:00
Rui Paulo
eda94c07de Teach libproc how to find debugging symbols in /usr/lib/debug.
MFC after:	1 week
2015-02-13 03:18:29 +00:00
George V. Neville-Neil
fcb5606706 Initial version of DTrace on ARM32.
Submitted by:	Howard Su based on work by Oleksandr Tymoshenko
Reviewed by:	ian, andrew, rpaulo, markj
2015-02-10 19:41:30 +00:00
Mark Johnston
c7fa6f0bb0 Stop iterating and return if the caller-supplied callback function returns
a non-zero value.

MFC after:	1 week
2015-01-31 03:22:00 +00:00
Mark Johnston
cd9c993950 Ensure that we don't try to demangle a symbol name if we failed to look
up the symbol. Add a test to exercise this code path.

Reviewed by:	adrian
2015-01-25 00:34:43 +00:00
Mark Johnston
3f1cbdbeb1 Fix a memory leak that occured when looking up CTF info for a symbol. 2014-12-23 15:40:57 +00:00
Baptiste Daroussin
6b129086dc Convert libraries to use LIBADD
While here reduce a bit overlinking
2014-11-25 11:07:26 +00:00
Simon J. Gerraty
9268022b74 Merge from head@274682 2014-11-19 01:07:58 +00:00
Mark Johnston
ec04549052 Remove an incorrect and useless debug print.
X-MFC-With:	r272488
2014-10-04 02:34:30 +00:00
Mark Johnston
41da933c87 Hook up support for userland CTF support in DTrace. This required some
modifications to libproc to support fetching the CTF info for a given file.

With this change, dtrace(1) is able to resolve type info for function and
USDT probe arguments, and function return values. In particular, the args[n]
syntax should now work for referencing arguments of userland probes,
provided that the requisite CTF info is available.

The uctf tests pass if the test programs are compiled with CTF info. The
current infrastructure around the DTrace test suite doesn't support this
yet.

Differential Revision:	https://reviews.freebsd.org/D891
MFC after:		1 month
Relnotes:		yes
Sponsored by:		EMC / Isilon Storage Division
2014-10-03 23:20:37 +00:00
Mark Johnston
540cc663b1 Factor out some of the duplicated code in the symbol lookup functions, in
preparation for adding userland CTF support to DTrace.

MFC after:	1 month
Sponsored by:	EMC / Isilon Storage Division
2014-09-25 19:08:06 +00:00
Mark Johnston
9351ac6d69 Add some ATF tests for libproc.
Differential Revision:	D710
Reviewed by:	jmmv, ngie, rpaulo
2014-09-21 21:25:41 +00:00
Mark Johnston
24a08d303e Fix a bug in r265255: only return NULL if the requested map wasn't found.
Submitted by:	Luke Chang-Hsien Tsai <luke.tw@gmail.com>
MFC after:	1 week
2014-08-24 17:02:27 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Dimitry Andric
96ec3cdd8e In r268463, I misplaced a return in demangle(), causing the function to
erroneously skip symbols that were not mangled at all.  Fix this by
moving the return into the preceding if block.

While here, simplify the code by letting __cxa_demangle() allocate the
needed space for the demangled symbol.  This also fixes a memory leak,
which would occur whenever __cxa_demangle() failed.

Reported by:	pgj
MFC after:	3 days
2014-08-09 12:25:06 +00:00
Dimitry Andric
3d12a34380 In libproc, avoid calling __cxa_demangle(), and thus depending on either
libcxxrt or libsupc++, if WITHOUT_CXX is defined.

Noticed by:	sbruno
MFC after:	1 week
2014-07-09 17:31:57 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
cc3f4b9965 Merge from head 2014-05-08 23:54:15 +00:00
Warner Losh
c6063d0da8 Use src.opts.mk in preference to bsd.own.mk except where we need stuff
from the latter.
2014-05-06 04:22:01 +00:00
Simon J. Gerraty
b736a4db5b New/updated dependencies 2014-05-05 18:31:00 +00:00
Mark Johnston
92f92525d1 If the traced process stops because it received a signal, libproc needs
to ensure that the signal is forwarded when proc_continue() is called.

MFC after:	3 weeks
2014-05-04 03:34:32 +00:00
Mark Johnston
acc0eea6b0 Allow "a.out" as an alias for the executable if no other matching entries
are found. This improves compatibility with Solaris' libproc and fixes a
number of failing DTrace tests that rely on this feature.

MFC after:	3 weeks
2014-05-03 04:44:03 +00:00
Simon J. Gerraty
9d2ab4a62d Merge head 2014-04-27 08:13:43 +00:00
Mark Johnston
1e6b385830 Fix some off-by-one errors. The kve_end and rdl_eaddr fields contain the
first address after the end of the map entry and should therefore be
excluded.

MFC after:	2 weeks
2014-04-14 00:24:04 +00:00
Warner Losh
3bdf775801 NO_MAN= has been deprecated in favor of MAN= for some time, go ahead
and finish the job. ncurses is now the only Makefile in the tree that
uses it since it wasn't a simple mechanical change, and will be
addressed in a future commit.
2014-04-13 05:21:56 +00:00
Warner Losh
40b86d77c7 The proper way to request no man pages currently is NO_MAN=xxx. Use it
in preference to the user WITHOUT_MAN knob, which should never be set
in normal src Makefiles.
2014-04-05 17:54:36 +00:00
Mark Johnston
fbce8e1683 Consistently add the relocation offset only when the ELF type is not
ET_EXEC. This fixes several problems with the DTrace pid provider not
being able to match probes.

Reviewed by:	rpaulo
MFC after:	2 weeks
2013-11-11 16:57:57 +00:00
Mark Johnston
813b26945c Modify the libproc breakpoint add/remove functions to stop the target
process if it has not already been stopped, since this is required for
ptrace(2) to work.

libdtrace does not seem to stop target processes before trying to remove
their breakpoints, so we were previously failing to remove the breakpoint
on r_debug_state() in rtld. This was causing processes to die with SIGTRAP
if they called dlopen(3) after dtrace(1) had detached.

Reported by:	symbolics@gmx.com
Reviewed by:	rpaulo
MFC after:	1 month
2013-11-05 03:23:54 +00:00
Mark Johnston
4ec6017e0b Fix an off-by-one error when checking whether a given address is within
the extent of a symbol.

Submitted by:	Prashanth Kumar <pra_udupi@yahoo.co.in>
Reviewed by:	rpaulo
MFC after:	1 week
2013-10-29 03:52:05 +00:00
Mark Johnston
fb15925c14 Revert r257248 and fix the problem in a way that doesn't violate style(9).
Suggested by:	jmg
2013-10-29 03:12:31 +00:00
Mark Johnston
2e14fd4313 Fix the build with gcc. 2013-10-28 12:42:27 +00:00
Mark Johnston
7a514b6277 Remove an incorrect debug printf. 2013-10-28 01:41:59 +00:00
Mark Johnston
30e81f7e3b Clean up the debug printing in libproc a bit. In particular:
* Don't print any error messages to stderr unless DEBUG is defined.
* Add a DPRINTFX macro for use when errno isn't set.
* Print the error string from libelf when appropriate.
2013-10-27 20:39:10 +00:00
Mark Johnston
25aecfbb23 Fix the libproc build when DEBUG is defined. 2013-10-17 03:39:21 +00:00
Simon J. Gerraty
d1d0158641 Merge from head 2013-09-05 20:18:59 +00:00
Rui Paulo
7bc9877d20 Fix the return value when we found a symbol in .dynstr. This nasty bug was
preventing a lot of symbol lookups in dtruss -s, for example.
2013-08-10 07:39:15 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
David E. O'Brien
d9a447559b Sync with HEAD. 2013-02-08 16:10:16 +00:00
John Baldwin
4e67575ec9 - Compute the correct size to reallocate when doubling the size of the
array of loaded objects to avoid a buffer overrun.
- Use reallocf() to avoid leaking memory if the realloc() fails.

PR:		kern/175648
Submitted by:	yuri@rawbw.com (1)
MFC after:	1 week
2013-01-28 15:48:31 +00:00
Sergey Kandaurov
322f22f7b5 Fix libproc test case to work with clang premature optimization
observed with -O2 (used by default).
Avoid function inlining for t1_bkpt_t on which we set a breakpoint.
Otherwise the address of the function is never called thus the
breakpoint never triggers.

Reported by:	zont
Reviewed by:	rpaulo
2012-12-26 05:11:48 +00:00
Simon J. Gerraty
43d24beb7b Avoid circular dependency with librtld_db 2012-11-08 21:33:13 +00:00
Simon J. Gerraty
7cd2dcf076 Updated/new Makefile.depend 2012-11-08 21:24:17 +00:00
Justin Hibbits
c757049235 Implement DTrace for PowerPC. This includes both 32-bit and 64-bit.
There is one known issue:  Some probes will display an error message along the
lines of:  "Invalid address (0)"

I tested this with both a simple dtrace probe and dtruss on a few different
binaries on 32-bit.  I only compiled 64-bit, did not run it, but I don't expect
problems without the modules loaded.  Volunteers are welcome.

MFC after:	1 month
2012-11-07 23:45:09 +00:00