Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../server/data/WWW/manual.neu/./debugging.html
Real path: /www/server/data/WWW/manual.neu/debugging.html
Zurück
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <link href="/css/apsite.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" /> <meta name="author" content="Documentation Group" /><meta name="email" content="docs@httpd.apache.org" /> <title>Apache HTTPD Debugging Guide - The Apache HTTP Server Project</title> </head> <body> <div id="page-header"> <p class="menu"> </p> <p class="apache"> </p> <a href="/"> <img alt="" width="800" height="72" src="/images/httpd_logo_wide_new.png" /> </a> </div> <!-- LEFT SIDE NAVIGATION --> <div id="apmenu"> <h1 id="essentials">Essentials</h1> <ul> <li><a href="/ABOUT_APACHE.html">About</a></li> <li><a href="http://www.apache.org/licenses/">License</a></li> <li><a href="http://wiki.apache.org/httpd/FAQ">FAQ</a></li> <li><a href="/security_report.html">Security Reports</a></li> </ul> <h1 id="downloading">Download!</h1> <ul> <li><a href="/download.cgi">From a Mirror</a></li> </ul> <h1 id="documentation"><a href="/docs/">Documentation</a></h1> <ul> <li><a href="/docs/2.4/">Version 2.4</a></li> <li><a href="/docs/2.2/">Version 2.2</a></li> <li><a href="/docs/2.0/">Version 2.0</a></li> <li><a href="/docs/trunk/">Trunk (dev)</a></li> <li><a href="http://wiki.apache.org/httpd/">Wiki</a></li> </ul> <h1 id="get-support">Get Support</h1> <ul> <li><a href="/support.html">Support</a></li> </ul> <h1 id="get-involved">Get Involved</h1> <ul> <li><a href="/lists.html">Mailing Lists</a></li> <li><a href="/bug_report.html">Bug Reports</a></li> <li><a href="/dev/">Developer Info</a></li> </ul> <h1 id="subprojects">Subprojects</h1> <ul> <li><a href="/docs-project/">Docs</a></li> <li><a href="/test/">Test</a></li> <li><a href="/test/flood/">Flood</a></li> <li><a href="/apreq/">libapreq</a></li> <li><a href="/modules">Modules</a></li> <li><a href="/mod_fcgid/">mod_fcgid</a></li> <li><a href="/mod_ftp/">mod_ftp</a></li> </ul> <h1 id="miscellaneous"><a href="/info/">Miscellaneous</a></h1> <ul> <li><a href="/contributors/">Contributors</a></li> <li><a href="http://www.apache.org/foundation/thanks.html">Sponsors</a></li> <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> </ul> </div> <!-- RIGHT SIDE INFORMATION --> <div id="apcontents"> <h1 id="apache-debugging-guide">Apache Debugging Guide</h1> <p>This document is a collection of notes regarding tools and techniques for debugging Apache httpd and its modules.</p> <p>Got more tips? Send 'em to <a href="mailto:docs@httpd.apache.org">docs@httpd.apache.org</a>. Thanks!</p> <ol> <li> <p><a href="#gdb">Using gdb</a> </p> </li> <li> <p><a href="#backtrace">Getting a live backtrace on unix</a> </p> </li> <li> <p><a href="#backtrace-win">Getting a live backtrace on Windows</a> </p> </li> <li> <p><a href="#crashes">Debugging intermittent crashes</a> </p> </li> <li> <p><a href="#truss">Using truss</a> </p> </li> <li> <p><a href="#gcore">Getting the server to dump core</a> </p> </li> <li> <p><a href="#sol27">Solaris and coredumps</a> </p> </li> <li> <p><a href="#tcpdump">Getting and analyzing a TCP packet trace</a> </p> </li> </ol> <h1 id="gdb">Using gdb</h1> <p>If you use the gcc compiler, it is likely that the best debugger for your system is gdb. This is only a brief summary of how to run gdb on Apache -- you should look at the info and man files for gdb to get more information on gdb commands and common debugging techniques. Before running gdb, be sure that the server is compiled with the <code>-g</code> option in <code>CFLAGS</code> to include the symbol information in the object files.</p> <p>The only tricky part of running gdb on Apache is forcing the server into a single-process mode so that the parent process being debugged does the request-handling work instead of forking child processes. We have provided the <code>-X</code> option for that purpose, which will work fine for most cases. However, some modules don't like starting up with <code>-X</code> , but are happy if you force only one child to run (using " <code>MaxClients 1</code> "); you can then use gdb's attach command to debug the child server.</p> <p>The following example, with <font color="green">user input in green</font>, shows the output of gdb run on a server executable (httpd) in the current working directory and using the server root of <code>/usr/local/apache</code> : <pre> % gdb httpd GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16.gnat.1.13 (sparc-sun-solaris2.5), Copyright 1996 Free Software Foundation, Inc... (gdb) b ap_process_request Breakpoint 1 at 0x49fb4: file http_request.c, line 1164. (gdb) run -X -d /usr/local/apache Starting program: /usr/local/apache/src/httpd -X -d /usr/local/apache</p> <div class="codehilite"><pre><span class="k">[at this point I make a request from another window]</span> <span class="na">Breakpoint 1, ap_process_request (r</span><span class="o">=</span><span class="s">0x95250) at http_request.c:1164</span> <span class="err">1164</span> <span class="err">if</span> <span class="err">(ap_extended_status)</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="err">1165</span> <span class="err">ap_time_process_request(r-&gt</span><span class="c">;connection-&gt;child_num,...</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="err">1167</span> <span class="err">process_request_internal(r)</span><span class="c">;</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="na">process_request_internal (r</span><span class="o">=</span><span class="s">0x95250) at http_request.c:1028</span> <span class="err">1028</span> <span class="err">if</span> <span class="err">(!r-&gt</span><span class="c">;proxyreq &amp;&amp; r-&gt;parsed_uri.path) {</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="na">1029 access_status</span> <span class="o">=</span> <span class="s">ap_unescape_url(r-&gt;parsed_uri.path);</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="err">1030</span> <span class="err">if</span> <span class="err">(access_status)</span> <span class="err">{</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="err">1036</span> <span class="err">ap_getparents(r-&gt</span><span class="c">;uri); /* OK...</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="na">1038 if ((access_status</span> <span class="o">=</span> <span class="s">location_walk(r))) {</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="na">1043 if ((access_status</span> <span class="o">=</span> <span class="s">ap_translate_name(r))) {</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="err">1048</span> <span class="err">if</span> <span class="err">(!r-&gt</span><span class="c">;proxyreq) {</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="na">1053 if (r-&gt;method_number</span> <span class="o">=</span><span class="s">= M_TRACE) {</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="err">1062</span> <span class="err">if</span> <span class="err">(r-&gt</span><span class="c">;proto_num &gt; HTTP_VERSION(1,0) &amp;&amp;</span> <span class="err">ap_...</span> <span class="err">(gdb)</span> <span class="err">n</span> <span class="na">1071 if ((access_status</span> <span class="o">=</span> <span class="s">directory_walk(r))) {</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="na">directory_walk (r</span><span class="o">=</span><span class="s">0x95250) at http_request.c:288</span> <span class="na">288 core_server_config *sconf</span> <span class="o">=</span> <span class="s">ap_get_module_...</span> <span class="err">(gdb)</span> <span class="err">b</span> <span class="err">ap_send_error_response</span> <span class="err">Breakpoint</span> <span class="err">2</span> <span class="err">at</span> <span class="err">0x47dcc:</span> <span class="err">file</span> <span class="err">http_protocol.c,</span> <span class="err">line</span> <span class="err">2090.</span> <span class="err">(gdb)</span> <span class="err">c</span> <span class="err">Continuing.</span> <span class="na">Breakpoint 2, ap_send_error_response (r</span><span class="o">=</span><span class="s">0x95250, recursive_error=0)</span> <span class="err">at</span> <span class="err">http_protocol.c:2090</span> <span class="na">2090 BUFF *fd</span> <span class="o">=</span> <span class="s">r-&gt;connection-&gt;client;</span> <span class="err">(gdb)</span> <span class="err">where</span> <span class="c">#0 ap_send_error_response (r=0x95250, recursive_error=0)</span> <span class="err">at</span> <span class="err">http_protocol.c:2090</span> <span class="c">#1 0x49b10 in ap_die (type=403, r=0x95250) at http_request.c:989</span> <span class="c">#2 0x49b60 in decl_die (status=403, phase=0x62db8 "check access",</span> <span class="na">r</span><span class="o">=</span><span class="s">0x95250)</span> <span class="err">at</span> <span class="err">http_request.c:1000</span> <span class="c">#3 0x49f68 in process_request_internal (r=0x95250) at</span> <span class="err">http_request.c:1141</span> <span class="c">#4 0x49fe0 in ap_process_request (r=0x95250) at http_request.c:1167</span> <span class="c">#5 0x439d8 in child_main (child_num_arg=550608) at http_main.c:3826</span> <span class="c">#6 0x43b5c in make_child (s=0x7c3e8, slot=0, now=907958743)</span> <span class="err">at</span> <span class="err">http_main.c:3898</span> <span class="c">#7 0x43ca8 in startup_children (number_to_start=6) at http_main.c:3972</span> <span class="c">#8 0x44260 in standalone_main (argc=392552, argv=0x75800) at</span> <span class="err">http_main.c:4250</span> <span class="c">#9 0x449fc in main (argc=4, argv=0xefffee8c) at http_main.c:4534</span> <span class="err">(gdb)</span> <span class="err">s</span> <span class="na">2091 int status</span> <span class="o">=</span> <span class="s">r-&gt;status;</span> <span class="err">(gdb)</span> <span class="err">p</span> <span class="err">status</span> <span class="na">$1</span> <span class="o">=</span> <span class="s">403</span> <span class="err">(gdb)</span> </pre></div> <p></pre> There are a few things to note about the above example:</p> <ol> <li> <p>the " <code>gdb httpd</code> " command does not include any command-line options for httpd: those are provided when the " <code>run</code> " command is done within gdb;</p> </li> <li> <p>I set a breakpoint before starting the run so that execution would stop at the top of ap_process_request();</p> </li> <li> <p>the " <code>s</code> " command steps through the code and into called procedures, whereas the " <code>n</code> " (next) command steps through the code but not into called procedures.</p> </li> <li> <p>additional breakpoints can be set with the " <code>b</code> " command, and the run continued with the " <code>c</code> " command.</p> </li> <li> <p>use the " <code>where</code> " command (a.k.a. " <code>bt</code> ") to see a stack backtrace that shows the order of called procedures and their parameter values.</p> </li> <li> <p>use the " <code>p</code> " command to print the value of a variable.</p> </li> </ol> <p>A file in the the root directory called <code>.gdbinit</code> provides useful macros for printing out various internal structures of httpd like tables ( <code>dump_table</code> ), brigades ( <code>dump_brigade</code> ) and filter chains ( <code>dump_filters</code> ).</p> <p>If you are debugging a repeatable crash, simply run gdb as above and make the request -- gdb should capture the crash and provide a prompt where it occurs.</p> <p>If you are debugging an apparent infinite loop, simply run gdb as above and type a Control-C -- gdb will interrupt the process and provide a prompt where it was stopped.</p> <p>If you are debugging a system crash and you have a core file from the crash, then do the following: <pre> % gdb httpd -c core (gdb) where</pre> and it will (hopefully) print a stack backtrace of where the core dump occurred during processing.</p> <h1 id="backtrace">Getting a live backtrace on unix</h1> <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 you can get a live backtrace of any process.</p> <p>For SVR4-based variants of Unix, the <code>pstack</code> command for proc can be used to display a a live backtrace. For example, on Solaris it looks like <pre> % /usr/proc/bin/pstack 10623 10623: httpd -d /usr/local/apache ef5b68d8 poll (efffcd08, 0, 3e8) ef5d21e0 select (0, ef612c28, 0, 0, 3e8, efffcd08) + 288 00042574 wait_or_timeout (0, 75000, 75000, 7c3e8, 60f40, 52c00) + 78 00044310 standalone_main (5fd68, 75800, 75c00, 75000, 2, 64) + 240 000449f4 main (3, efffeee4, efffeef4, 75fe4, 1, 0) + 374 000162fc _start (0, 0, 0, 0, 0, 0) + 5c </pre> Another technique is to use gdb to attach to the running process and then using "where" to print the backtrace, as in <pre> % gdb httpd 10623 GDB is free software and you are welcome to distribute copies of it under certain conditions; type "show copying" to see the conditions. There is absolutely no warranty for GDB; type "show warranty" for details. GDB 4.16.gnat.1.13 (sparc-sun-solaris2.5), Copyright 1996 Free Software Foundation, Inc...</p> <div class="codehilite"><pre><span class="sr">/usr/</span><span class="nb">local</span><span class="sr">/apache/s</span><span class="n">rc</span><span class="o">/</span><span class="mi">10623</span><span class="p">:</span> <span class="n">No</span> <span class="n">such</span> <span class="n">file</span> <span class="ow">or</span> <span class="n">directory</span><span class="o">.</span> <span class="n">Attaching</span> <span class="n">to</span> <span class="n">program</span> <span class="err">`</span><span class="sr">/usr/</span><span class="nb">local</span><span class="sr">/apache/s</span><span class="n">rc</span><span class="o">/</span><span class="n">httpd</span><span class="err">'</span><span class="p">,</span> <span class="n">process</span> <span class="mi">10623</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libsocket</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libnsl</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libc</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libdl</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libintl</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libmp</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">lib</span><span class="o">/</span><span class="n">libw</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="n">Reading</span> <span class="n">symbols</span> <span class="n">from</span> <span class="sr">/usr/</span><span class="n">platform</span><span class="sr">/SUNW,Ultra-1/</span><span class="n">lib</span><span class="o">/</span><span class="n">libc_psr</span><span class="o">.</span><span class="n">so</span><span class="mf">.1</span><span class="o">...</span><span class="n">done</span><span class="o">.</span> <span class="mh">0xef5b68d8</span> <span class="n">in</span> <span class="p">()</span> <span class="p">(</span><span class="n">gdb</span><span class="p">)</span> <span class="n">where</span> <span class="c1">#0 0xef5b68d8 in ()</span> <span class="c1">#1 0xef5d21e8 in select ()</span> <span class="c1">#2 0x4257c in wait_or_timeout (status=0x0) at http_main.c:2357</span> <span class="c1">#3 0x44318 in standalone_main (argc=392552, argv=0x75800) at...</span> <span class="c1">#4 0x449fc in main (argc=3, argv=0xefffeee4) at http_main.c:4534</span> <span class="p">(</span><span class="n">gdb</span><span class="p">)</span> </pre></div> </pre> <h1 id="backtrace-win">Getting a live backtrace on Windows</h1> <ol> <li> <p>Unzip the <code>-symbols.zip</code> files (obtained from the Apache download site) in the root Apache2 directory tree (where bin\, htdocs\, modules\ etc. are usually found.) These.pdb files should unpack alongside the.exe,.dll,.so binary files they represent, e.g., mod_usertrack.pdb will unpack alongside mod_usertrack.so.</p> </li> <li> <p>Invoke <code>drwtsn32</code> and ensure you are creating a crash dump file, you are dumping all thread contexts, your log and crash dump paths make sense, and (depending on the nature of the bug) you pick an appropriate crash dump type. (Full is quite large, but necessary sometimes for a programmer-type to load your crash dump into a debugger and begin unwinding exactly what has happened. Mini is sufficient for your first pass through the process.)</p> </li> <li> <p>Note that if you previously installed and then uninstalled other debugging software, you may need to invoke <code>drwtsn32 -i</code> in order to make Dr Watson your default crash dump tool. This will replace the 'report problem to MS' dialogs. (Don't do this if you have a full debugger such as Visual Studio or windbg installed on the machine, unless you back up the registry value for <code>Debugger</code> under the <code>HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug</code> registry tree. Developers using multiple tools might want to keep copies of their different tools Debugger entries there, for fast switching.)</p> </li> <li> <p>Invoke the Task Manager, Choose 'show processes from all users', and modify the <code>View -&gt; Select Columns</code> to include <strong>at least</strong> the <code>PID</code> and <code>Thread Count</code>. You can change this just once and Task Manager should keep your preference.</p> </li> <li> <p>Now, track down the errant Apache that is hanging. The parent process has about three threads, we don't care about that one. The child worker process we want has many more threads (a few more than you configured with the ThreadsPerChild directive.) The process name is Apache (for 1.3 and 2.0) or httpd (for 2.2 and 2.4). Make note of the child worker's PID.</p> </li> <li> <p>Using the {pid} number you noted above, invoke the command</p> <blockquote> <p><code>drwtsn32 -p {pid}</code> </p> </blockquote> </li> </ol> <p>Voila, you will find in your 'log file path' a <code>drwtsn32.log</code> file, and if you choose to 'append to existing log file', jump through the 'App:' sections until you find the one for the process you just killed. Now you can identify about where 'Stack Back Trace' points to help identify what the server is doing.</p> <p>You will note that many threads look identical, almost all of them polling for the next connection, and you don't care about those. You will want to see the ones that are deep inside of a request at the time you kill them, and only the stack back trace entries for those. This can give folks a clue of where that request is hanging, which handler module picked up the request, and what filter it might be stuck in.</p> <h1 id="crashes">Debugging intermittent crashes</h1> <p>For situations where a child process is crashing intermittently, the server must be configured and started such that it produces core dumps which can be analyzed further.</p> <p>To ensure that a core dump is written to a directory which is writable by the user which child processes run as (such as <code>apache</code> ), the <a href="http://httpd.apache.org/docs/current/mod/mpm_common.html#coredumpdirectory"></a> directive must be added to <code>httpd.conf</code> ; for example: <code>CoreDumpDirectory /tmp</code> Before starting up the server, any process limits on core dump file size must be lifted; for example: <code># ulimit -c unlimited # apachectl start</code> On some platforms, further steps might be needed to enable core dumps - see <a href="#sol27">Solaris and coredumps</a> below.</p> <p>When a child process crashes, a message like the following will be logged to the error_log:</p> <blockquote> <p><code>[Mon Sep 05 13:35:39 2005] [notice] child pid 2027 exit signal Segmentation fault (11), possible coredump in /tmp</code> </p> </blockquote> <p>If the text "possible coredump in /tmp" does not appear in the error line, check that the ulimit was set correctly, that the permissions on the configured <code>CoreDumpDirectory</code> are suitable and that platform specific steps ( <a href="#sol27">Solaris and coredumps</a> ) have been done if needed.</p> <p>To analyse the core dump, pass the core dump filename on the gdb command-line, and enter the command <code>bt full</code> at the gdb prompt: <pre> % gdb /usr/local/apache2/bin/httpd /tmp/core.2027 ... Core was generated by `/usr/local/apache2/bin/httpd -k start' ... (gdb) bt full </pre></p> <p>If attempting to debug a threaded server, for example when using the <code>worker</code> MPM, use the following gdb command: <pre> (gdb) thread apply all bt full </pre></p> <h1 id="truss">Using 'truss/trace/strace' to trace system calls and signals</h1> <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> <p>A useful tip for using the <code>truss</code> command on Solaris is the <code>-f</code> option (often also works with <code>strace</code> ); 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> % truss -f httpd -d /usr/local/apache >& outfile</pre><pre> % egrep '^10698:' outfile</pre> to view just the trace of the process id 10698.</p> <p>If attempting to truss a threaded server, for example when using the <code>worker</code> MPM, the <code>truss</code> option <code>-l</code> is very useful as it prints also the LWP id after the process id. You can use something like <pre> % egrep '^10698/1:' outfile</pre> to view just the trace of the process id 10698 and LWP id 1.</p> <p>Other useful options for truss are</p> <ul> <li> <p><code>-a</code> to print all command line parameters used for this executable.</p> </li> <li> <p><code>-e</code> to print all environment variables used for this executable.</p> </li> <li> <p><code>-d</code> to print timestamps.</p> </li> </ul> <h1 id="gcore">Getting the server to dump core</h1> <p>Strangely enough, sometimes you actually want to force the server to crash so that you can get a look at some nutty behavior. Normally this can be done simply by using the <code>gcore</code> command. However, for security reasons, most Unix systems do not allow a setuid process to dump core, since the file contents might reveal something that is supposed to be protected in memory.</p> <p>Here is one way to get a core file from a setuid Apache httpd process on Solaris, without knowing which httpd child might be the one to die [note: it is probably easier to use the MaxClients trick in the first section above]. <code># for pid in</code>ps -eaf | fgrep httpd | cut -d' ' -f4<code>do truss -f -l -t\!all -S SIGSEGV -p $pid 2&gt;&amp;1 | egrep SIGSEGV &amp; done</code> The <a href="http://www.dejanews.com/=zzz_maf/getdoc.xp?AN=352257973">undocumented '-S' flag</a> to truss will halt the process in place upon receipt of a given signal (SIGSEGV in this case). At this point you can use: <pre> # gcore PID</pre> and then look at the backtrace as discussed above for <a href="#gdb">gdb</a>.</p> <h1 id="sol27">Solaris and coredumps</h1> <p>On Solaris use <a href="http://docs.sun.com/app/docs/doc/816-5166/coreadm-1m"></a> to make <code>setuid()</code> processes actually dump core. By default a setuid() process does not dump core. This is the reason why httpd servers started as root with child processes running as a different user (such as <code>apache</code> ) do not coredump even when the <a href="http://httpd.apache.org/docs/current/mod/mpm_common.html#coredumpdirectory"></a> directive had been set to an appropriate and writable directory and <strong> <code>ulimit -c</code> </strong> has a sufficient size. See also <a href="#crashes">Debugging intermittent crashes</a> above.</p> <p>Example: <code>-bash-3.00# coreadm global core file pattern: /var/core/core.%f.%p.u%u global core file content: default init core file pattern: core init core file content: default global core dumps: disabled per-process core dumps: enabled global setid core dumps: enabled per-process setid core dumps: enabled global core dump logging: disabled</code> </p> <h1 id="tcpdump">Getting and analyzing a TCP packet trace</h1> <p>This is too deep a subject to fully describe in this documentation. Here are some pointers to useful discussions and tools:</p> <ul> <li> <p><code>snoop</code> is a packet sniffer that is part of Solaris.</p> </li> <li> <p><a href="http://www.tcpdump.org/">tcpdump</a> is a packet sniffer that is available for Unix-based systems and Windows ( <a href="http://www.winpcap.org/windump/">windump</a> ). It is part of many free Unix-based distributions.</p> </li> <li> <p><a href="http://www.wireshark.org/">Wireshark</a> is another packet sniffer that is available for Unix-based systems and Windows. It has a nice GUI and allows the analysis of the sniffed data.</p> </li> <li> <p><a href="http://jarok.cs.ohiou.edu/software/tcptrace/">tcptrace</a> is a TCP dump file analysis tool.</p> </li> <li> <p><a href="http://www.tcpshow.org/">tcpshow</a> is another one.</p> </li> </ul> <!-- FOOTER --> <div id="footer"> <p>Copyright © 2012 The Apache Software Foundation.<br /> Apache HTTP Server, Apache, and the Apache feather logo are trademarks of The Apache Software Foundation.</p> </div> </div> </body> </html>