[cmake-developers] [CMake 0015901]: `-Og` dose not produce debug symbol in CMake

Mantis Bug Tracker mantis at public.kitware.com
Mon Jan 4 03:50:02 EST 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://cmake.org/Bug/view.php?id=15901 
====================================================================== 
Reported By:                acgtyrant
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   15901
Category:                   CMake
Reproducibility:            always
Severity:                   minor
Priority:                   normal
Status:                     new
====================================================================== 
Date Submitted:             2016-01-04 03:50 EST
Last Modified:              2016-01-04 03:50 EST
====================================================================== 
Summary:                    `-Og` dose not produce debug symbol in CMake
Description: 
Use `-Og` in CMAKE_CXX_FLAGS, the compiled result does not contain any
`.debug_*` section.

Steps to Reproduce: 
CMakeList.txt:

	set(CMAKE_CXX_FLAGS "-std=c++11 -Wall -Wextra -Og")
	add_executable(Demo tmp.cc)

tmp.cc:

	#include <iostream>

	int main(void) {
	  std::cout << "Hello, world" << std::endl;
	  return 0;
	}

Put CMakeList.txt and tmp.cc in the same directory, then execute `cmake .; make;
objdump -h Demo | grep .debug`, no result.

For comparison, I compile the tmp.cc by myself: `g++ -std=c++11 -Wall -Wextra
-Og tmp.cc; objdump -h a.out | grep .debug`. It returns:

	 26 .debug_aranges 00000030  0000000000000000  0000000000000000  00000d32  2**0
	 27 .debug_info   00002a64  0000000000000000  0000000000000000  00000d62  2**0
	 28 .debug_abbrev 00000651  0000000000000000  0000000000000000  000037c6  2**0
	 29 .debug_line   00000372  0000000000000000  0000000000000000  00003e17  2**0
	 30 .debug_str    00001a02  0000000000000000  0000000000000000  00004189  2**0
	 31 .debug_loc    0000009e  0000000000000000  0000000000000000  00005b8b  2**0

Additional Information: 
$ LANG=C gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/5.3.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-5.3.0/configure --prefix=/usr
--libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man
--infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++ --enable-shared
--enable-threads=posix --enable-libmpx --with-system-zlib --with-isl
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-clocale=gnu
--disable-libstdcxx-pch --disable-libssp --enable-gnu-unique-object
--enable-linker-build-id --enable-lto --enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --enable-gnu-indirect-function --disable-multilib
--disable-werror --enable-checking=release
Thread model: posix
gcc version 5.3.0 (GCC) 
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-01-04 03:50 acgtyrant      New Issue                                    
======================================================================



More information about the cmake-developers mailing list