How to debug into the OpenSSL(openssl-0.9.8a) source code

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to debug into the OpenSSL(openssl-0.9.8a) source code

Vicky Zhang
Hello everybody,
I am not able to debug into the OpenSSL library(openssl-0.9.8a) with my Microsoft Visual C++ .net IDE. As mentioned in the INSTALL.W32 I have add 'debug' to the mk1mf.pl lines in the do_* batch file. I am using do_masm.bat. I have obtained the out32dll.dbg folder with 30 *.pdb files and 2 *.dll files without any errors during creation. I use these pdb files with my applications by coping the pdb files and the dll files to my application directory where my .exe file is located(In fact I think I just need copy libeay32.pdb and ssleay32.pdb, right?). I also set up the including directory and the additional dependency to including the OpenSSL headers and dlls, and my code can run without any problem.
But I am not able to step into the openssl codes. For example, if I try to step into code SSL_set_connect_state(m_pSSL); Instead of go inside the function SSL_set_connect_state(), it just steps over. 
If I set a breakpoint into the OpenSSL source code, the breakpoint is question marked and the hint will say that:
        The breakpoint will not currently be hit. No executable code is currently loaded at this location. 
But during my application execution, I got:
'alfssl2_server.exe': Loaded 'C:\Jie\vscode\alfssl2_work_client\Debug\ssleay32.dll', Symbols loaded.
'alfssl2_server.exe': Loaded 'C:\Jie\vscode\alfssl2_work_client\Debug\libeay32.dll', Symbols loaded. 
My application is running in debug mode, in my applicatioin’s project properties, 
Debug Information Format is: Program Database(/Zi)
Runtime Library: Multi-threaded Debug DLL(/MDd)
Am I missing something? Do I need set something in the project properties?
Thanks a lot in advance!
Jie
 


New Yahoo! Messenger with Voice. Call regular phones from your PC and save big.
Reply | Threaded
Open this post in threaded view
|

Re: How to debug into the OpenSSL(openssl-0.9.8a) source code

wrowe
Jie Zhang wrote:

> Hello everybody,
>
> I am not able to debug into the OpenSSL library(openssl-0.9.8a) with my Microsoft
> Visual C++ .net IDE.
> But during my application execution, I got:
>
> 'alfssl2_server.exe': Loaded
> 'C:\Jie\vscode\alfssl2_work_client\Debug\ssleay32.dll', Symbols loaded.
>
> 'alfssl2_server.exe': Loaded 'C:\Jie\vscode\alfssl2_work_client\Debug\libeay32.dll', Symbols loaded.
>
> My application is running in debug mode, in my applicatioin’s project properties,
>
> Debug Information Format is: Program Database(/Zi)
>
> Runtime Library: Multi-threaded Debug DLL(/MDd)

I don't use the 'debug' flavor, I make sure my compile includes /Zi /Oy- and
my link includes /debug /opt:ref

This usually works for me (although it optimizes out alot of locals, I usually
only need to see the arguments passed down the call stack.)

Bill
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: How to debug into the OpenSSL(openssl-0.9.8a) source code

Venkata Sairam


-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of William A. Rowe,
Jr.
Sent: Wednesday, March 29, 2006 6:30 AM
To: [hidden email]
Subject: Re: How to debug into the OpenSSL(openssl-0.9.8a) source code


Jie Zhang wrote:

> Hello everybody,
>
> I am not able to debug into the OpenSSL library(openssl-0.9.8a) with my Microsoft
> Visual C++ .net IDE.
> But during my application execution, I got:
>
> 'alfssl2_server.exe': Loaded
> 'C:\Jie\vscode\alfssl2_work_client\Debug\ssleay32.dll', Symbols loaded.
>
> 'alfssl2_server.exe': Loaded 'C:\Jie\vscode\alfssl2_work_client\Debug\libeay32.dll', Symbols loaded.
>
> My application is running in debug mode, in my applicatioin’s project properties,
>
> Debug Information Format is: Program Database(/Zi)
>
> Runtime Library: Multi-threaded Debug DLL(/MDd)

I don't use the 'debug' flavor, I make sure my compile includes /Zi /Oy- and
my link includes /debug /opt:ref

This usually works for me (although it optimizes out alot of locals, I usually
only need to see the arguments passed down the call stack.)

Bill


Hi

I am also encountering the same problem. I tried adding in options as suggested. I had modified the CFLAG and LFLAG as below.
CFLAG= /MD /Ox /O2 /Zi /Oy /Ob2 /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE -DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_KRB5    

LFLAGS=/nologo /subsystem:console /machine:I386 /debug /opt:ref

I dont get any errors from openssl. I get 28 *.pdb files in the out32dll folder. But I am not able to debug into openssl9.8a using these.

Am i missing anything?

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to debug into the OpenSSL(openssl-0.9.8a) source code

wrowe
Venkata Sairam wrote:
> I am also encountering the same problem. I tried adding in options as suggested. I had modified the CFLAG and LFLAG as below.
> CFLAG= /MD /Ox /O2 /Zi /Oy /Ob2 /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE -DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_KRB5    
>
> LFLAGS=/nologo /subsystem:console /machine:I386 /debug /opt:ref

NOT /Oy !!!  That's a BS optimization, sure it reduces processing time
at the cost of making your stack worthless.

/Oy-

The minus sign is NOT a typo.  Turn off the option, then report back.

Bill
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

RE: How to debug into the OpenSSL(openssl-0.9.8a) source code

Venkata Sairam
-----Original Message-----
From: [hidden email]
[mailto:[hidden email]]On Behalf Of William A. Rowe,
Jr.
Sent: Wednesday, March 29, 2006 11:22 AM
To: [hidden email]
Subject: Re: How to debug into the OpenSSL(openssl-0.9.8a) source code


Venkata Sairam wrote:
> I am also encountering the same problem. I tried adding in options as suggested. I had modified the CFLAG and LFLAG as below.
> CFLAG= /MD /Ox /O2 /Zi /Oy /Ob2 /W3 /WX /Gs0 /GF /Gy /nologo -DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32 -D_CRT_SECURE_NO_DEPRECATE -DOPENSSL_SYSNAME_WINNT -DUNICODE -D_UNICODE -DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2 -DOPENSSL_NO_KRB5    
>
> LFLAGS=/nologo /subsystem:console /machine:I386 /debug /opt:ref

NOT /Oy !!!  That's a BS optimization, sure it reduces processing time
at the cost of making your stack worthless.

/Oy-

The minus sign is NOT a typo.  Turn off the option, then report back.

Bill

Hi

I tried using with the Oy- option. I get 28 *.exe and 28 *.pdb. The pdb are to debug the exe provided. My program uses libeay32.dll and ssleay32.dll directly and I would like to step into openssl codes once a openssl function is called. I think I would want libeay32.pdb and ssleay32.pdb which is not provided by the process above. How do i generate this?

-Venkata

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: How to debug into the OpenSSL(openssl-0.9.8a) source code

Emre Binisik
In reply to this post by Vicky Zhang
Jie Zhang schrieb:

> Hello everybody,
> I am not able to debug into the OpenSSL library(openssl-0.9.8a) with my Microsoft Visual C++ .net IDE. As mentioned in the INSTALL.W32 I have add 'debug' to the mk1mf.pl lines in the do_* batch file. I am using do_masm.bat. I have obtained the out32dll.dbg folder with 30 *.pdb files and 2 *.dll files without any errors during creation. I use these pdb files with my applications by coping the pdb files and the dll files to my application directory where my .exe file is located(In fact I think I just need copy libeay32.pdb and ssleay32.pdb, right?). I also set up the including directory and the additional dependency to including the OpenSSL headers and dlls, and my code can run without any problem.
> But I am not able to step into the openssl codes. For example, if I try to step into code SSL_set_connect_state(m_pSSL); Instead of go inside the function SSL_set_connect_state(), it just steps over.
> If I set a breakpoint into the OpenSSL source code, the breakpoint is question marked and the hint will say that:
>         The breakpoint will not currently be hit. No executable code is currently loaded at this location.
> But during my application execution, I got:
> 'alfssl2_server.exe': Loaded
> 'C:\Jie\vscode\alfssl2_work_client\Debug\ssleay32.dll', Symbols loaded.
> 'alfssl2_server.exe': Loaded 'C:\Jie\vscode\alfssl2_work_client\Debug\libeay32.dll', Symbols loaded.
> My application is running in debug mode, in my applicatioin’s project properties,
> Debug Information Format is: Program Database(/Zi)
> Runtime Library: Multi-threaded Debug DLL(/MDd)
> Am I missing something? Do I need set something in the project properties?
> Thanks a lot in advance!
> Jie
>
> ------------------------------------------------------------------------
> New Yahoo! Messenger with Voice. Call regular phones from your PC
> <http://us.rd.yahoo.com/mail_us/taglines/postman5/*http://us.rd.yahoo.com/evt=39666/*http://beta.messenger.yahoo.com>
> and save big.
Dear Jie Zhang,
I would try to use the static library version, so you don't need to step
into a Dll.
I use do_ms.bat with the line
perl util\mk1mf.pl debug no-asm VC-WIN32 >ms\ntd.mak
nmake -f ms\ntd.mak

/MDd is good.

Regards
Emre Binisik


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]
Reply | Threaded
Open this post in threaded view
|

Thank you all !

Vicky Zhang
In reply to this post by Vicky Zhang
Hi Everybody,

Thank you all very much! Especially Bill's suggestion. I have not get used
to this system yet and I am not sure if this reply can reach the system.
After I got Bill's suggestion, I tried it combine with the "debug" flavor
and it works great. So I replied to thank Bill but it seems the reply has
lost in somewhere or I just did not do it right.

So here is what I did:
Add 'debug' to the mk1mf.pl lines in the do_* batch file. I am using
do_masm.bat.

Then use "ms\do_masm" to get the ntdll.mak file.

Then as Bill's suggestion, I put /Zi /Oy into the CFLAG option.
So my CFLAG is:
CFLAG= /MDd /Od -DDEBUG -D_DEBUG /W3 /WX /Gs0 /GF /Gy /nologo /Zi /Oy
-DOPENSSL_SYSNAME_WIN32 -DWIN32_LEAN_AND_MEAN -DL_ENDIAN -DDSO_WIN32
-D_CRT_SECURE_NO_DEPRECATE -DBN_ASM -DMD5_ASM -DSHA1_ASM -DRMD160_ASM
-DOPENSSL_USE_APPLINK -I. /Fdout32dll -DOPENSSL_NO_RC5 -DOPENSSL_NO_MDC2
-DOPENSSL_NO_KRB5    

After 'nmake -f ms\ntdll.mak', I obtained the out32dll.dbg folder with
30 *.pdb files and 2 *.dll files. And I copied the 2 *.dll file and
libeay32.pdb and ssleay32.pdb to where my application's exe file located.

I did not put /debug into LFLAG because the 'debug' flavor already did that.
I put /Oy instead /Oy- is because I did not understand it. But it do work.

Thank you all again!

Jie

______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    [hidden email]
Automated List Manager                           [hidden email]