fielding 98/10/09 14:22:27
Modified: . debugging.html Log: Add information about using truss Revision Changes Path 1.5 +31 -2 apache-devsite/debugging.html Index: debugging.html =================================================================== RCS file: /export/home/cvs/apache-devsite/debugging.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- debugging.html 1998/10/09 20:53:45 1.4 +++ debugging.html 1998/10/09 21:22:27 1.5 @@ -21,11 +21,13 @@ <OL> <LI><A HREF="#gdb">Using '<CODE>gdb</CODE>'</A> <LI><A HREF="#backtrace">Getting a live backtrace</A> +<LI><A HREF="#truss">Using '<CODE>truss/trace/strace</CODE>' to + trace system calls and signals</A> </OL> <HR> -<P><A NAME="gdb"><B>Using '<CODE>gdb</CODE>'</B></A> +<H3><A NAME="gdb"><B>Using '<CODE>gdb</CODE>'</B></A></H3> <P>If you use the gcc or egcs compilers, it is likely that the best debugger for your system is gdb. This is only a brief summary of how @@ -162,7 +164,7 @@ <HR> -<P><A NAME="backtrace"><B>Getting a live backtrace</B></A> +<H3><A NAME="backtrace"><B>Getting a live backtrace</B></A></H3> <P>A backtrace will let you know the hierarchy of procedures that were called to get to a particular point in the process. On some platforms @@ -210,6 +212,33 @@ #4 0x449fc in main (argc=3, argv=0xefffeee4) at http_main.c:4534 (gdb) </PRE> +<P> + +<HR> + +<H3><A NAME="truss"><B>Using '<CODE>truss/trace/strace</CODE>' to + trace system calls and signals</B></A></H3> + +<P>Most Unix-based systems have at least one command for displaying +a trace of system calls and signals as they are accessed by a running +process. This command is called <CODE>truss</CODE> on most SVR4-based +systems and either <CODE>trace</CODE> or <CODE>strace</CODE> on many +other systems. + +<P>A useful tip for using the <CODE>truss</CODE> command on Solaris is +the <CODE>-f</CODE> option; it tells truss to follow and continue tracing +any child processes forked by the main process. The easiest way to get +a full trace of a server is to do something like: +<PRE> + % <font color=green>truss -f httpd -d /usr/local/apache >& outfile</font> +</PRE> +and let it run through a few requests before killing the parent. You can +then view the entire trace in outfile, or use something like +<PRE> + % <font color=green>egrep '^10698:' outfile</font> +</PRE> +to view just the trace of the process id 10698. +<P> <HR>