简体   繁体   中英

C++: Do I need GCC and GDB with the same version to debug

I am developing in C++ on Windows with minGW. I have debugging problems at the moment.

I must use an old version of GCC (4.4). So I was just wondering if it is possible to compile with this old GCC and debug with a new GDB?

What is the link between the two of them?

(Any pointers regarding debugger crashes would be greatly appreciated too! I just know that I need to be sure to use debug DLLs)

GDB and GCC are separate programs -- separate source bases (with a bit of shared code, though not much), generally separate maintainers, different release schedules, and different version numbers. They do share a bit of culture and of course there is some coordination.

GDB is reasonably good about backward compatibility. It even keeps workarounds for bugs in debuginfo emitted by older versions of GCC and sometimes other compilers. What this means is that you can usually upgrade GDB while keeping the same GCC version.

The reverse, though, is not always the case. Sometimes a new version of GCC emits debug info that an older GDB cannot understand. In this situation you must upgrade GDB as well. In some limited situations you can pass a compatibility flag to GCC to ask for downgraded debug info, but this isn't always possible. And, since it is simple to upgrade GDB, you might as well.

It is not mandatory for GCC and gdb to be of same version. You can debug your executable with the version of gdb you have in your hand. Gdb a.out

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