Build OpenSSL on Linux with -g for debugging

I have a segfault coming from OpenSSL (in particular SSL_read ) that I would like to debug. I think the best step for this is to build the library using debugging symbols so that I can enter the function and see how it happens. I don’t understand how: a) to build the library myself and b) to crack the makefile to give me debug symbols. Does anyone have experience working with this particular library or have general recommendations on this method of building and modifying?

Received this error:

 ./config -d Operating system: x86_64-whatever-linux2 This system (debug-linux-x86_64) is not supported. See file INSTALL for details. 

Not sure what to do here. OS Information:

 $ cat /proc/version Linux version 3.2.0-24-virtual (buildd@yellow) (gcc version 4.6.3 (Ubuntu/Linaro 4.6.31ubuntu5) ) #37-Ubuntu SMP Wed Apr 25 10:17:19 UTC 2012 $ uname -srvio Linux 3.2.0-24-virtual #37-Ubuntu SMP Wed Apr 25 10:17:19 UTC 2012 x86_64 GNU/Linux 
+5
debugging compilation build openssl makefile
source share
3 answers

You can follow the simple instructions mentioned here to create OpenSSL. To create a debug build, add the -d flag when running ./config , i.e. ./config -d [other options] . The OpenSSL building is described in detail here .

+4
source share

In newer versions of OpenSSL, it looks like flags passed in. / Configure, which is entered directly into the gcc line at compilation. I just did ./Configure -g linux-x86_64 and successfully received debugging symbols in my assembly.

+2
source share

After completing the normal configuration step, do the following from the shell:

 $ find . -name Makefile | xargs sed -i -e 's#-O3#-g#g' 

It modifies the generated makefiles; instead of the optimization option -O3 it places the -g parameter (generates debugging characters).

+1
source share

All Articles