Skip to content

Instantly share code, notes, and snippets.

@dap
Created September 14, 2009 18:36
Show Gist options
  • Save dap/186834 to your computer and use it in GitHub Desktop.
Save dap/186834 to your computer and use it in GitHub Desktop.
Debug segfault on Solaris
How to debug an Apache segfault on Solaris 10
1. Ensure that the /var/core directory exists.
2. $ mdb /usr/local/sbin/httpd
3. At the MDB prompt:
> ::run -X
The "-X" above is actually a parameter to the httpd binary.
4. Do whatever makes it segfault.
5. Get a stack dump from mdb:
> ::stack
6. Fix your shit up.
mdb will follow forks, so when Apache forks a child process to handle the request,
you can opt to follow that or stay with the parent. Likewise, if Apache goes to
invoke a CGI, you can opt to follow the CGI. Very useful. "::dcmds" will show
additional commands which can be run such as "::getenv", "::stackregs", "::nm",
"::objects", and "::mappings". Word.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment