Running gdb on Ubuntu 9.10 Apache2 Install
I am trying to run gdb to debug my Ubuntu 9.10 Apache2 install and having a couple of problems:
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?
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
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?
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