---- [email protected] wrote:
>
> ---- Sorin Manolache <[email protected]> wrote:
> > On 2012-06-21 22:04, [email protected] wrote:
> > >
> > > ---- Ben Noordhuis <[email protected]> wrote:
> > >> On Thu, Jun 21, 2012 at 8:43 PM, <[email protected]> wrote:
> > >>> I tried that, which allowed me to start Apache, but am getting a
> > >>> segfault.
> > >>
> > >> Run it through gdb and inspect the backtrace. Compiling with debug
> > >> symbols and optimizations disabled (-g -O0) will help.
> > >
> > >
> > > Sorin,
> > >
> > > The apxs already has "-g" and "-O2" looks like. How do I change that to
> > > "-O0"? Or, do I just run the gcc compile manually?
> >
> > Try adding
> >
> > -Wc,-O0 -Wc,-g -Wc,-fno-inline -Wl,-g
> >
> > to your apxs command line.
> >
> > > Also how do I "run it through gdb", since apachectl is a script?
> >
> > You don't run apachectl, you run the apache binary.
> >
> > gdb
> >
> > Then in gdb type:
> > file /path/to/your/httpd_or_apache2
> > set args -d /path/to/your/server_root_dir -f /path/to/your/conf/file -X
> >
> > If apachectl sets some environment variables first, which are then used
> > in the conf file (as in the standard debian installation) then you'll
> > have to set them manually in gdb, e.g.
> >
> > set environment APACHE_RUN_USER www-data
> > set environment APACHE_RUN_GROUP www-data
> >
> > Last, type
> >
> > run
> >
> > For example, on my debian I'd do
> >
> > file /usr/sbin/apache2
> > set args -d /etc/apache2 -f /etc/apache2/apache2.conf -X
> > And a couple of set environments and then run.
> >
> > S
> >
> > >
> > > Sorry for the questions, but not too familiar with this stuff :(...
> > >
> > > Jim
> > >
> >
> >
>
>
> Hi Sorin,
>
> Thanks for that. I did as you suggested (again, just to be sure) and got:
>
>
> (gdb) b header_post_config
> Function "header_post_config" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 1 (header_post_config) pending.
> (gdb)
> Function "header_post_config" not defined.
> Make breakpoint pending on future shared library load? (y or [n]) y
> Breakpoint 2 (header_post_config) pending.
> (gdb) run -d /apps/httpd2222 -f /apps/httpd2222/conf/httpd.conf -X
> Starting program: /apps/httpd2222/bin/httpd -d /apps/httpd2222 -f
> /apps/httpd2222/conf/httpd.conf -X
> [Thread debugging using libthread_db enabled]
> [New Thread 182897612000 (LWP 9669)]
> Breakpoint 3 at 0x2a97a69070: file mod_headers.c, line 1026.
> Pending breakpoint "header_post_config" resolved
> Note: breakpoint 3 also set at pc 0x2a97a69070.
> Breakpoint 4 at 0x2a97a69070: file mod_headers.c, line 1026.
> Pending breakpoint "header_post_config" resolved
> mod_headers-jl V0.09 - start calling OAM API
> In register_hooks
> In create_headers_dir_config
> In create_headers_dir_config
> In header_cmd
> In header_inout_cmd
> In parse_format_tag
> In parse_misc_string
> In create_headers_dir_config
> In header_cmd
> In header_inout_cmd
> In parse_format_tag
> In parse_misc_string
> [Switching to Thread 182897612000 (LWP 9669)]
>
> Breakpoint 3, header_post_config (pconf=0x573138, plog=0x5a52c8,
> ptemp=0x5a72d8, s=0x59d3a8) at mod_headers.c:1026
> 1026 printf("In header_post_config\n");
> (gdb) s
> 1025 {
> (gdb) n
> 1026 printf("In header_post_config\n");
> (gdb) n
> In header_post_config
> 1027 header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
> (gdb) n
> 1029 }
> (gdb) n
> 0x00000000004360c7 in ap_run_post_config (pconf=0x573138, plog=0x5a52c8,
> ptemp=0x5a72d8, s=0x59d3a8) at config.c:91
> 91 AP_IMPLEMENT_HOOK_RUN_ALL(int, post_config,
> (gdb) n
>
> Program received signal SIGSEGV, Segmentation fault.
> 0x0000003518d6c1e1 in BN_num_bits () from /lib64/libcrypto.so.4
>
>
> Looks like it blew up the same place as earlier...
>
> Jim
Hi,
Just for comparison, here's the gdb debug when I *DON'T* have the .so loaded
(apxs without the -L/-l, and no LoadFile in httpd.conf):
In parse_format_tag
In parse_misc_string
[Switching to Thread 182897612000 (LWP 10442)]
Breakpoint 2, header_post_config (pconf=0x573138, plog=0x5a52c8,
ptemp=0x5a72d8, s=0x59d3a8) at mod_headers.c:1026
1026 printf("In header_post_config\n");
(gdb) n
1025 {
(gdb) n
1026 printf("In header_post_config\n");
(gdb) n
In header_post_config
1027 header_ssl_lookup = APR_RETRIEVE_OPTIONAL_FN(ssl_var_lookup);
(gdb) n
1029 }
(gdb) n
0x00000000004360c7 in ap_run_post_config (pconf=0x573138, plog=0x5a52c8,
ptemp=0x5a72d8, s=0x59d3a8) at config.c:91
91 AP_IMPLEMENT_HOOK_RUN_ALL(int, post_config,
(gdb) n
main (argc=Variable "argc" is not available.
) at main.c:692
692 apr_pool_destroy(ptemp);
(gdb) n
695 apr_hook_deregister_all();
(gdb) n
696 apr_pool_clear(pconf);
(gdb) n
698 for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
(gdb) n
696 apr_pool_clear(pconf);
(gdb) n
warning: Temporarily disabling breakpoints for unloaded shared library
"/apps/httpd2222/modules/mod_headers.so"
698 for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
(gdb) n
699 ap_register_hooks(*mod, pconf);
(gdb) n
698 for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
(gdb) n
699 ap_register_hooks(*mod, pconf);
(gdb) n
698 for (mod = ap_prelinked_modules; *mod != NULL; mod++) {
(gdb)
Jim