Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am trying to run gdb to debug my Ubuntu 9.10 Apache2 install and having a couple of problems:

  1. It seems like the package installed by Ubuntu for Apache2 does not include debugging symbols; is there a different version of the package I should be using for developing/debugging?

  2. When I try to run gdb, I get an error that looks to be caused by some missing environment variable. Are there additional options I should pass to "run" to get this to work?

Here is the output of the debugger session:

root@aj-ubuntu:/usr/sbin# gdb apache2
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/sbin/apache2...(no debugging symbols found)...done.
(gdb) run -X
Starting program: /usr/sbin/apache2 -X
[Thread debugging using libthread_db enabled]
apache2: bad user name ${APACHE_RUN_USER}

Program exited with code 01.
(gdb)

Thanks in advance, -aj

share|improve this question

4 Answers 4

up vote 1 down vote accepted

For the first Ubuntu run a symbol server: https://lists.ubuntu.com/archives/ubuntu-devel-announce/2006-September/000195.html

For the second that looks like an apache config issue, does apache run peoperly when started by the init script?

share|improve this answer
    
a better link is wiki.ubuntu.com/DebuggingProgramCrash –  sendmoreinfo Feb 22 '11 at 22:30

There are some settings in apache2.conf which use environment variables. use ". /etc/apache2/envvars" prior apache2 start

share|improve this answer

Running the command source /etc/apache2/envvars in bash loaded the necessary variables for me.

share|improve this answer

You need to set the environment variables before calling the binary directly. If you want to do this from sudo in a Debian based distro you can use:

source /etc/apache2/envvars
sudo -E gdb /usr/sbin/apache2
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.