我们有一个使用最新版本的gcc(g ++ - 7.2)编译的应用程序 不幸的是,生产服务器很老了,并且有一个非常旧版本的gdb(6.5.25-el5rh)
现场调试软件很困难,因为gdb
没有显示核心文件的回溯。
使用gdb打开核心文件会产生以下消息:
GNU gdb Red Hat Linux (6.5-25.el5rh)
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1".
warning: Can't read pathname for load map: Erreur d'entrée/sortie.
[...]
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libnss_files.so.2...done.
Loaded symbols for /lib/libnss_files.so.2
Core was generated by `[binary_filename]'.
Program terminated with signal 11, Segmentation fault.
Die: DW_TAG_unspecified_type (abbrev = 218, offset = 2719370)
has children: FALSE
attributes:
DW_AT_name (DW_FORM_strp) string: "decltype(nullptr)"
Dwarf Error: Cannot find type of die [in module [path_to_binary]]
我在http://wiki.dwarfstd.org/index.php?title=C%2B%2B0x:_Null_pointer上发现nullptr
可以翻译为DW_TAG_unspecified_type
。
这个旧版本的gdb问题是nullptr
吗?是否有可能要求gcc避免为nullptr生成矮信息?
精密工业:
[local_installation]/generated/bin/g++ -v
:
COLLECT_GCC=./g++
COLLECT_LTO_WRAPPER=[local_installation]/generated/libexec/gcc/i686-pc-linux-gnu/7.2.0/lto-wrapper
Cible : i686-pc-linux-gnu
Configuré avec: [local_installation]/gcc-7.2.0/configure --prefix=[local_installation]/generated --disable-multilib --disable-libstdcxx-dual-abi --with-dwarf2 --enable-cxx-flags=-gdwarf-2
Modèle de thread: posix
gcc version 7.2.0 (GCC)
CXXFLAGS
:
-pipe -fpermissive -Wshadow -Wextra -Wundef -Wno-deprecated-declarations -std=gnu++17 -D_GLIBCXX_USE_CXX11_ABI=0 -gdwarf-2 -gstrict-dwarf $(INCLUDES) -O2 -Wall -W -D_REENTRANT $(DEFINES)
此致