简体   繁体   中英

How can including GDB debugging symbols 'break packages'?

When I am building packages on Gentoo. I get this warning that '-ggdb3' flag can 'break packages.

I have yet to find an instance of when that is true. Although I once found some code which broke under different optimisation settings, that's different from including debugging symbols.

Could some provide an example of code which would compile without debugging symbols and not compile (or go wrong in some other way at runtime) with them?

I have never had a single test fail (or much less, a package break) due to debugging symbols being included. I've only been bitten by optimization bugs when dealing with PPC .

However, you must consider what you are building. If the executable is going to be copied into something like an initrd, you generally want it either stripped (or compiled without debugging symbols), especially if statically linking.

In the "old days" I built an entire Linux from Scratch system leaving debugging on for every single binary. Sure, the install was significantly larger, memory usage was less than ideal, but I never had any problems at all, either in compilation or subsequent execution.

It is hard to prove a negative, and one can't through anecdote, but a year of running this as a second desktop/toy server would lead me to conclude that it is really not a problem.

I think the flag you are getting is the standard warning that a package will give in Gentoo if you set USE flags with which it was not tested, or with which it is not really meant to be installed. As long as you know what the flag is---and in this case, you seem to---and you are not placing it in any "mission critical" setting (ie, you will get blamed if something goes wrong) seems safe to ignore those warnings.

Sometimes when you turn on debugging symbols, it actually changes the code that is generated by the compiler, in which case there is always the possibility of going from "correct code" to "incorrect code".

I don't know what specific changes "-ggdb3" enables, but perhaps this is what you are being warned about.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM