truss status (was: cvs commit: src/sys/dev/lmc if_lmc.h)

Robert Watson rwatson at FreeBSD.org
Mon Jul 24 12:10:48 UTC 2006


On Mon, 24 Jul 2006, Greg 'groggy' Lehey wrote:

> On Friday, 21 July 2006 at 13:29:38 +0200, Dag-Erling Smrgrav wrote:
>> Tom Rhodes <trhodes at FreeBSD.org> writes:
>>> Wait.  I'm lost.  Isn't truss(1) broken on FreeBSD?
>>
>> Depends on your definition of broken.  It kind of works provided you have 
>> /proc mounted.  Still, there's really not much point in using it; ktrace(1) 
>> is better in almost all respects.
>
> truss is good in that it gives immediate output.  I used it recently under 
> 6.1, and I somehow missed that it was broken.

A few things are wrong with truss, none that make it completely broken:

(1) In the past there were a number of reports of problems with race
     conditions during truss attach/detach.  These reports have entirely
     disappeared, as far as I can tell, due to process locking fixes, procfs
     fixes, debugging fixes, etc.  If they still exist, they should be
     investigated, but up-to-date debugging infomation will be needed.

(2) truss relies on procfs, which is known to be evil, and as such, doesn't
     work out of the box since we don't mount procfs out of the box.  Several
     people have worked on enhancing ptrace() so that it can be used to
     implement truss, but no one has finished this work.  I think the necessary
     ptrace() traps now exist for system calls so that this could be done.

(3) truss is believed not to work properly with threaded applications.  ktrace
     has been extended to know about thread IDs, and has always been able to
     generate traces properly for threaded apps, whereas truss likely doesn't
     see events from more than one thread (or if it does, it likely gets very
     mixed up).  It might be good to confirm this.

Robert N M Watson
Computer Laboratory
University of Cambridge


More information about the cvs-all mailing list