Mailing List Archive

Debug symbols for libgpgme-11.dll
Hi!

Is there somewhere I can get a debug build of the Windows version of the
GPGME library (libgpgme-11.dll), or a PDB file containing the debug
symbols? I'm hitting some access violations while using the library in my
code, and would like to do some debugging

Thanks!

--
Regards,
Daniel Lo Nigro
https://d.sb/ | Twitter <http://twitter.com/Daniel15> | Facebook
<http://www.facebook.com/daaniel>
Re: Debug symbols for libgpgme-11.dll [ In reply to ]
Hi,

On Sunday, February 3, 2019 8:35:26 PM CET Daniel Lo Nigro wrote:
> Is there somewhere I can get a debug build of the Windows version of the
> GPGME library (libgpgme-11.dll), or a PDB file containing the debug
> symbols? I'm hitting some access violations while using the library in my
> code, and would like to do some debugging

Sorry, currently there are no MSVC compatible debug symbols available. We
compile with GCC and the debug info is incompatible.

My suggestion is to run your code with an environment variable set like:

set GPGME_DEBUG=9;c:\tmp\gpgme.log

(assuming c:\tmp exists and is writable) this will show you a lot of what is
going on inside GPGME.


Access violations sound like maybe a NULL pointer variable where there should
not be one or an unterminated string. (Or random / uninitialized pointers
passed as we mostly check for NULL pointers).


Best Regards,
Andre

--
GnuPG e.V., Rochusstr. 44, D-40479 D?sseldorf. VR 11482 D?sseldorf
Vorstand: W.Koch, M.Gollowitzer, A.Heinecke. Mail: board@gnupg.org
Finanzamt D-Altstadt, St-Nr: 103/5923/1779. Tel: +49-2104-4938799
Re: Debug symbols for libgpgme-11.dll [ In reply to ]
In that case, is there a pre-compiled version with GDB debug symbols
available? I should be able to attach GDB instead of Visual Studio and at
least get a stack trace of where the error is being thrown in the native
library.

Or would I need to compile it myself with optimizations disabled?

Sent from my phone.

On Mon, Feb 4, 2019, 3:26 AM Andre Heinecke <aheinecke@gnupg.org wrote:

> Hi,
>
> On Sunday, February 3, 2019 8:35:26 PM CET Daniel Lo Nigro wrote:
> > Is there somewhere I can get a debug build of the Windows version of the
> > GPGME library (libgpgme-11.dll), or a PDB file containing the debug
> > symbols? I'm hitting some access violations while using the library in my
> > code, and would like to do some debugging
>
> Sorry, currently there are no MSVC compatible debug symbols available. We
> compile with GCC and the debug info is incompatible.
>
> My suggestion is to run your code with an environment variable set like:
>
> set GPGME_DEBUG=9;c:\tmp\gpgme.log
>
> (assuming c:\tmp exists and is writable) this will show you a lot of what
> is
> going on inside GPGME.
>
>
> Access violations sound like maybe a NULL pointer variable where there
> should
> not be one or an unterminated string. (Or random / uninitialized pointers
> passed as we mostly check for NULL pointers).
>
>
> Best Regards,
> Andre
>
> --
> GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf. VR 11482 Düsseldorf
> Vorstand: W.Koch, M.Gollowitzer, A.Heinecke. Mail: board@gnupg.org
> Finanzamt D-Altstadt, St-Nr: 103/5923/1779. Tel: +49-2104-4938799
Re: Debug symbols for libgpgme-11.dll [ In reply to ]
Hi,

On Monday, February 4, 2019 9:28:55 AM CET Daniel Lo Nigro wrote:
> In that case, is there a pre-compiled version with GDB debug symbols
> available? I should be able to attach GDB instead of Visual Studio and at
> least get a stack trace of where the error is being thrown in the native
> library.

I would not be so sure, I had bad experiences using GDB in the past on
Windows. But you can of course try. Our code is compiled with gcc / mingw from
debian stretch.

I've uploaded a dll of 1.12.1-beta43 (the version in Gpg4win-3.1.5) with
debugsyms (as created by the Gpg4win buildsystem) at: https://heinecke.or.at/
div/libgpgme-11.dll

> Or would I need to compile it myself with optimizations disabled?

Might be better because then you could also add debug output in the codepath
where it is crashing for you.

Regards,
Andre

--
GnuPG e.V., Rochusstr. 44, D-40479 D?sseldorf. VR 11482 D?sseldorf
Vorstand: W.Koch, M.Gollowitzer, A.Heinecke. Mail: board@gnupg.org
Finanzamt D-Altstadt, St-Nr: 103/5923/1779. Tel: +49-2104-4938799
Re: Debug symbols for libgpgme-11.dll [ In reply to ]
Hey Andre, thanks for your reply. I also managed to compile my own version,
however both my build and your build seem to be missing the debug symbols
for libgpgme itself. I was trying to use a tool called "cv2pdb" (
https://github.com/rainers/cv2pdb) to convert the debug symbols into a PDB
file that Visual Studio can use, however it didn't work properly, and its
author said that the library is missing the symbols:

There is only debug information for the mingw runtime in the original DLL.
> You can check by dumping the output of `objdump.exe -W
> libgpgme-11-original.dll` and searching for `DW_TAG_compile_unit`.
>
> I guess something went wrong when building a debug version of that DLL.
>

See https://github.com/rainers/cv2pdb/issues/50

Is there some build step that is unintentionally stripping out symbols from
the object files before linking, or something like that? I don't write any
C or C++ so I'm unfamiliar with the build processes.

--
Regards,
Daniel Lo Nigro
https://d.sb/ | Twitter <http://twitter.com/Daniel15> | Facebook
<http://www.facebook.com/daaniel>


On Tue, Feb 5, 2019 at 2:40 AM Andre Heinecke <aheinecke@gnupg.org> wrote:

> Hi,
>
> On Monday, February 4, 2019 9:28:55 AM CET Daniel Lo Nigro wrote:
> > In that case, is there a pre-compiled version with GDB debug symbols
> > available? I should be able to attach GDB instead of Visual Studio and at
> > least get a stack trace of where the error is being thrown in the native
> > library.
>
> I would not be so sure, I had bad experiences using GDB in the past on
> Windows. But you can of course try. Our code is compiled with gcc / mingw
> from
> debian stretch.
>
> I've uploaded a dll of 1.12.1-beta43 (the version in Gpg4win-3.1.5) with
> debugsyms (as created by the Gpg4win buildsystem) at:
> https://heinecke.or.at/
> div/libgpgme-11.dll <https://heinecke.or.at/div/libgpgme-11.dll>
>
> > Or would I need to compile it myself with optimizations disabled?
>
> Might be better because then you could also add debug output in the
> codepath
> where it is crashing for you.
>
> Regards,
> Andre
>
> --
> GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf. VR 11482 Düsseldorf
> Vorstand: W.Koch, M.Gollowitzer, A.Heinecke. Mail: board@gnupg.org
> Finanzamt D-Altstadt, St-Nr: 103/5923/1779. Tel: +49-2104-4938799
Re: Debug symbols for libgpgme-11.dll [ In reply to ]
I worked this out. Even though I passed CFLAGS and CXXFLAGS to the
./autogen.sh or ./configure call in the root directory, it seems like the
gpg4win build process didn't pass the flags to the package builds.

I manually modified
src/playground/build/gpgme-1.12.1-beta43-build/src/Makefile and changed
these flags:

CFLAGS: Added -gdwarf -O0
CXXFLAGS: Changed -O2 to -gdwarf -O0

Then I re-ran make, and ran the resulting .dll through cv2pdb. Now the
debug symbols appear to be working in Visual Studio, although I haven't had
time to actually try and debug an issue yet.

https://d.sb/2019/02/devenv_05-23.01.28.png
--
Regards,
Daniel Lo Nigro
https://d.sb/ | Twitter <http://twitter.com/Daniel15> | Facebook
<http://www.facebook.com/daaniel>


On Tue, Feb 5, 2019 at 10:14 AM Daniel Lo Nigro <d@d.sb> wrote:

> Hey Andre, thanks for your reply. I also managed to compile my own
> version, however both my build and your build seem to be missing the debug
> symbols for libgpgme itself. I was trying to use a tool called "cv2pdb" (
> https://github.com/rainers/cv2pdb) to convert the debug symbols into a
> PDB file that Visual Studio can use, however it didn't work properly, and
> its author said that the library is missing the symbols:
>
> There is only debug information for the mingw runtime in the original DLL.
>> You can check by dumping the output of `objdump.exe -W
>> libgpgme-11-original.dll` and searching for `DW_TAG_compile_unit`.
>>
>> I guess something went wrong when building a debug version of that DLL.
>>
>
> See https://github.com/rainers/cv2pdb/issues/50
>
> Is there some build step that is unintentionally stripping out symbols
> from the object files before linking, or something like that? I don't write
> any C or C++ so I'm unfamiliar with the build processes.
>
> --
> Regards,
> Daniel Lo Nigro
> https://d.sb/ | Twitter <http://twitter.com/Daniel15> | Facebook
> <http://www.facebook.com/daaniel>
>
>
> On Tue, Feb 5, 2019 at 2:40 AM Andre Heinecke <aheinecke@gnupg.org> wrote:
>
>> Hi,
>>
>> On Monday, February 4, 2019 9:28:55 AM CET Daniel Lo Nigro wrote:
>> > In that case, is there a pre-compiled version with GDB debug symbols
>> > available? I should be able to attach GDB instead of Visual Studio and
>> at
>> > least get a stack trace of where the error is being thrown in the native
>> > library.
>>
>> I would not be so sure, I had bad experiences using GDB in the past on
>> Windows. But you can of course try. Our code is compiled with gcc / mingw
>> from
>> debian stretch.
>>
>> I've uploaded a dll of 1.12.1-beta43 (the version in Gpg4win-3.1.5) with
>> debugsyms (as created by the Gpg4win buildsystem) at:
>> https://heinecke.or.at/
>> div/libgpgme-11.dll <https://heinecke.or.at/div/libgpgme-11.dll>
>>
>> > Or would I need to compile it myself with optimizations disabled?
>>
>> Might be better because then you could also add debug output in the
>> codepath
>> where it is crashing for you.
>>
>> Regards,
>> Andre
>>
>> --
>> GnuPG e.V., Rochusstr. 44, D-40479 Düsseldorf. VR 11482 Düsseldorf
>> Vorstand: W.Koch, M.Gollowitzer, A.Heinecke. Mail: board@gnupg.org
>> Finanzamt D-Altstadt, St-Nr: 103/5923/1779. Tel: +49-2104-4938799
>
>