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

Sean McBride sean at rogue-research.com
Wed Jul 28 13:29:11 PDT 2010

On Wed, 28 Jul 2010 15:58:17 -0400, Michael Jackson said:

>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
>	attributes:
>		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 ....

strncat_chk is used because you defined _FORTIFY_SOURCE.  IIRC, it helps
check for overruns using C string functions.  I believe in 10.5 the
_FORTIFY_SOURCE version of strncat was screwy, ah, here you go:


I think it's fixed on 10.6.

Try again without -D_FORTIFY_SOURCE=2, and maybe remove -fstack-
protector-all too.

Sean McBride, B. Eng                 sean at rogue-research.com
Rogue Research                        www.rogue-research.com 
Mac Software Developer              Montréal, Québec, Canada

More information about the cfe-dev mailing list