Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux/C++ How to debug release application

I have linux c++ multithreaded application. Now it's tested on production servers and have segfault. Problem is that I cannot reproduce that error on any of my test servers and have no access to production servers. I have no dump or any other useful information. Only line: segfault at 0000000046bf0fb8 rip 000000000048ac6b rsp 0000000046bf0fa0 error 6

I would like to ask community can I get from such line some information which will help decrease area of possible places where I should search. I cannot run debug build on production because of its slow speed. What can I add to release which help me debug? This bug looks like multithread bug, and hard to reproduce. But I'm not sure, because application works with a lot of different emails from MTA.

Platform: Linux

Compiler line: g++ -O3 -D_REENTRANT

Thank you.

upd.: Thanks for your answers. I can include debug information. I'd like to know base methods of debugging release builds. For example I have dump and release version. How should I continue. What should I read about that? Can you explain in few words how you debug your application if possible? Thank you.

like image 649
Dmitriy Avatar asked May 27 '09 09:05

Dmitriy


1 Answers

As Andy mentioned, leave the debugging symbols in when you make your release builds.

If this makes the size of the finished executable unacceptably large, then you can make a copy of the final executable and run it through strip to remove the debug symbols. This way you have two executables that are identical except one has debug symbols and the other does not. Put the one without symbols on the production server. When it segfaults, debug against the copy of the executable that still contains debug symbols.

like image 92
Dan Moulding Avatar answered Sep 28 '22 08:09

Dan Moulding