FreeBSD's malloc has a feature to emit utrace syscalls for debugging when MALLOC_OPTIONS contains the "U" character. Using ktrace, one can find the following entries with kdump: 4059 perl5.8.0 CALL utrace(0xbfbff2a4,0xc) 4059 perl5.8.0 USER 12 00 00 00 00 01 00 00 00 30 90 11 08 4059 perl5.8.0 RET utrace 0 These lines can easily be converted into malloc/free/realloc calls. However, with truss the output looks as follows: utrace(0xbfbff2a4,0xc) = 0 (0x0) That is, the first argument is only a pointer to the utrace buffer. I propose to change truss to dump the contents of the buffer instead: utrace(0x000000005000000000b01108) = 0 (0x0) The second parameter (the size of the buffer) has gone, because it can be determined by the length of the buffer string. Fix: This patch should be applied in the /usr/src/usr.bin/truss directory:
https://reviews.freebsd.org/D3819 uses kdump's code to handle this.
A commit references this bug: Author: bdrewery Date: Tue Oct 6 21:58:39 UTC 2015 New revision: 288957 URL: https://svnweb.freebsd.org/changeset/base/288957 Log: truss: Add support for utrace(2). This uses the kdump(1) utrace support code directly until a common library is created. This allows malloc(3) tracing with MALLOC_CONF=utrace:true and rtld tracing with LD_UTRACE=1. Unknown utrace(2) data is just printed as hex. PR: 43819 [inspired by] Reviewed by: jhb MFC after: 2 weeks Relnotes: yes Differential Revision: https://reviews.freebsd.org/D3819 Changes: head/lib/libc/sys/utrace.2 head/usr.bin/kdump/Makefile head/usr.bin/kdump/kdump.c head/usr.bin/kdump/utrace.c head/usr.bin/truss/Makefile head/usr.bin/truss/syscall.h head/usr.bin/truss/syscalls.c head/usr.bin/truss/truss.1