Allegro "debug" library files

What's the difference between the "debug" library files and the others?


There are debugging symbols so the debugger won't display garbage ?


To expand and this answer : Typically, the "debug" version of a library keeps track of data which would otherwise not be preserved during compilation, such as function names.
Also, line numbers relative to the original code, and it's compiled with less optimizations, which makes the executable behave more like the source code, and thus easier to follow in a debugger if you have the corresponding source code.
(With maximum optimization, the compiler could remove variables as it uses registers instead, and do some very smart stuff like inline functions and loop unrolling...)

Chris Katko

In otherwords if your game crashes, it'll say:

??? + ???                 //actual place where it exploded
??? + ???
??? + ???

Without debug symbols. And this:

allegro_function4()+[linenumber] //actual place where it exploded

With debug symbols. If the error blows up in Allegro (or a syscall) you want those symbols.

Also, debugging (usually) shuts off optimization because often times aggressive optimizations change the structure of the code so much that the symbols become difficult for a compiler to figure out. The compiled code is vastly different from the SOURCE code (because it was changed to optimize it), so it has a much harder time trying to link "line X of source file Y" to "bytecode 320282" in memory.


Additionally, Allegro's debug libraries enable internal asserts. E.g. if you pass NULL to al_draw_bitmap, you'll get an assert as opposed to a segfault. Additionally, the debug versions of the library will log things to a log file (this can be enabled in release versions as well, so it's just a change in the default).

Thread #617000. Printed from