[cfe-dev] How to debug a clang compiled executable.

Michael Jackson mike.jackson at bluequartz.net
Wed Jul 28 12:58:17 PDT 2010

I have a clang compiled executable that is aborting during runtime  
whereas a GCC compiled version runs just fine. Since I am completely  
new to debugging a compiler not sure how I should proceed. I tried  
using gdb (from Xcode 3.1.4 on OS X 10.5) to debug the executable but  
it seems that no debug symbols are being compiled in? gdb did catch  
the abort and I tried to get a backtrace with "bt" and I got the  

Program received signal SIGABRT, Aborted.
0x92993e42 in __kill ()
(gdb) bt
#0  0x92993e42 in __kill ()
#1  0x92993e34 in kill$UNIX2003 ()
#2  0x92a0623a in raise ()
#3  0x92a12622 in __abort ()
#4  0x929de43e in __chk_fail ()
#5  0x929c1ca9 in __strncat_chk ()
Die: DW_TAG_restrict_type (abbrev = 33, offset = 7574)
	has children: FALSE
		DW_AT_type (DW_FORM_ref4) constant ref: 3194 (adjusted)
		DW_AT_decl_file (DW_FORM_data1) constant: 2
		DW_AT_decl_line (DW_FORM_data1) constant: 0
Dwarf Error: Cannot find type of die [in module /Users/Shared/Kitware- 

The program was compiled with the following:

/Users/Shared/Toolkits/llvm/bin/clang  -DVTK_IN_VTK -Wall -Wextra - 
Wformat=2 -Wno-format-nonliteral -Wunused -Wpointer-arith -Winvalid- 
pch -Wcast-align -Wdisabled-optimization -Wnewline-eof -fdiagnostics- 
show-option -Wno-deprecated-declarations -Wno-uninitialized -g -fstack- 
protector-all -D_FORTIFY_SOURCE=2   -g -arch i386 ....

Clang itself was compiled as a "Release with Assertions" as part of a  
llvm build using CMake.
515:[mjackson at ferb:tools]$ clang --version
clang version 2.8 (trunk 109582)
Target: i386-apple-darwin9
Thread model: posix

Any help would be appreciated. Thanks
Mike Jackson                      www.bluequartz.net
Principal Software Engineer       mike.jackson at bluequartz.net
BlueQuartz Software               Dayton, Ohio

More information about the cfe-dev mailing list