开发者

How to know library is debug library or release?

开发者 https://www.devze.com 2023-02-19 04:39 出处:网络
I am using mysql cpp library . I checkout the recent copy from there bzr trunk and used cmake to generate l开发者_如何学编程ibrary .

I am using mysql cpp library . I checkout the recent copy from there bzr trunk and used cmake to generate l开发者_如何学编程ibrary .

First time I used release mode and second time I used debug mode to build. The both library have

a mysql_debug.cpp
U mysql_debug

Is there a way to check in program (C or C++ code) or using nm that library is Release library or Debug library


I have seen false negatives with nm so I do not trust it. When I want to check to see if an object file has debug info I run objdump -x on the object file or library and look to see if there are headers that say dbg, stabs, or dwarf. This is not the most elegant solution by any means, but it has never been wrong and it is real easy to see the difference in when you have a debug and release build to compare.


Do objdump -x , store the output in a file and search for dll . If you see the library linking with windows release library then its Release version otherwise debug version.


Differences between debug and release builds are typically due to invalid code being optimized differently, rather than incompatibilities, so it is sheer luck that one of them works and the other doesn't (it could also be the other way 'round).

Run the program under valgrind to see whether that flags any illegal accesses.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号