====== Apache - Troubleshooting - Using the Apache source code to locate problems ====== The source code is divided up into the following directories: |$SRCROOT/server|The source code for the core server.| |$SRCROOT/include|The header files for the core server.| |$SRCROOT/srclib/apr|The source code for the portable runtime environment.| |$SRCROOT/srclib/apr-util|The source code for the portable runtime utility code.| |$SRCROOT/support|The source code for the utilities.| |$SRCROOT/modules|Contains the source code for the modules.| ---- ===== Using find to locate the C code that comprises that function (or macro) ===== If a stacktrace or debugging session shows that a specific routine is at fault, the **find** command can be used to locate the C code that comprises that function (or macro). ---- ==== Locate the header file that contains a specific function prototype ==== To find the definition of the portable runtime function **apr_array_make**: find . -name \*.h | xargs egrep "apr_array_make" returns: ./srclib/apr/include/apr_tables.h:APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, ... ... **NOTE:** This shows that the **apr_array_make** function prototype is located in the file **apr_tables.h**. ---- ==== Locate the source file that contains the function definition ==== Once the function prototype is located, the find and grep utilities can be used to to locate the source file that contains the function definition: find . -name \*.c | xargs egrep "apr_array_header_t.*apr_array_make" returns: /srclib/apr/tables/apr_tables.c:APR_DECLARE(apr_array_header_t *) apr_array_make(apr_pool_t *p, ... ... **NOTE:** This shows that the function definition is located in the file **apr_tables.c**. Depending on how functions (and macros) are defined, the results may require some additional visual processing.