20120416 truss for debugging apps on solaris - plembo/onemoretech GitHub Wiki
title: truss for debugging apps on Solaris link: https://onemoretech.wordpress.com/2012/04/16/truss-for-debugging-apps-on-solaris/ author: lembobro description: post_id: 2534 created: 2012/04/16 11:55:17 created_gmt: 2012/04/16 15:55:17 comment_status: closed post_name: truss-for-debugging-apps-on-solaris status: publish post_type: post
truss for debugging apps on Solaris
One of my original Unix mentors recently proved to me how important an ally Solaris's truss command can be. Some pointers below. The scenario is typical: trying to start a particularly important Apache instance on Solaris that just won't stay up. Because this was a bare metal restore of the whole system, some part of the environment configuration was suspect. But which one? Not to worry. All we have to do is fire up truss and look at its output. To make things more manageable it's best to pipe that output to a file for analysis. The steps: 1. Go to the console and start a dump file using:
script truss.out
Note: You can also use the "-o" option on newer versions of truss (if available on your system) to create an output file. 2. Start the command as follows:
truss -f [command binary]
for example:
truss -f /usr/sbin/httpd
If you're trying to debug the behavior of an already running process use the following:
truss -fp [processid]
like:
truss -fp 14588
3. Once the command has completed (or if it continues and you need to break out with a CNTRL-c) type exit to stop writing to the dump file. 4. Open the truss.out file and check it for issues. A good strategy is to start by looking for all the "open" statements to see what files the command tried to open and the status of each.
Copyright 2004-2019 Phil Lembo