User Tools

Site Tools


apache:troubleshooting:using_the_apache_source_code_to_locate_problems

Apache - Troubleshooting - Using the Apache source code to locate problems

The source code is divided up into the following directories:

$SRCROOT/serverThe source code for the core server.
$SRCROOT/includeThe header files for the core server.
$SRCROOT/srclib/aprThe source code for the portable runtime environment.
$SRCROOT/srclib/apr-utilThe source code for the portable runtime utility code.
$SRCROOT/supportThe source code for the utilities.
$SRCROOT/modulesContains 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.

apache/troubleshooting/using_the_apache_source_code_to_locate_problems.txt · Last modified: 2021/02/02 11:27 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki