[cfe-users] Segmentation fault on startup from Objective-C program

Lobron, David via cfe-users cfe-users at lists.llvm.org
Thu May 12 08:55:35 PDT 2016


Hello clang experts,

I am working to get an existing codeline built and running with LLVM clang, version 3.7.  My current target program is written in Objective-C, and I'm using libobjc2 version 1.8.1 (the shared library it produces is libobjc.so.4.6).  I'm also using tcmalloc, version gperftools-r218.  This is on an Ubuntu Linux system, 3.2.0-98-generic.

I'm finding that my ObjC program crashes on startup.  The stack trace (copied below) terminates in some tcmalloc functions, and seems to be due to an attempt to reference memory outside allowed bounds.  I'm not sure where to start debugging this.  I would welcome any help from more knowledgeable people on this list.

Thank you,

David

Stack trace from gdb:

Program received signal SIGSEGV, Segmentation fault.
tcmalloc::ThreadCache::Init (this=0x81b098, tid=<error reading variable: access outside bounds of object referenced via synthetic pointer>) at src/thread_cache.cc:116
116	  max_size_ = 0;
(gdb) bt
#0  tcmalloc::ThreadCache::Init (this=0x81b098, tid=<error reading variable: access outside bounds of object referenced via synthetic pointer>)
    at src/thread_cache.cc:116
#1  0x0000000000481187 in tcmalloc::ThreadCache::NewHeap (tid=140737353979840) at src/thread_cache.cc:398
#2  0x000000000048100b in tcmalloc::ThreadCache::CreateCacheIfNecessary () at src/thread_cache.cc:375
#3  0x00000000004766ab in GetCache () at ./src/thread_cache.h:423
#4  (anonymous namespace)::do_malloc_no_errno (size=24) at src/tcmalloc.cc:1236
#5  0x00000000004ad1f2 in do_malloc_no_errno_or_cpp_alloc (size=24) at src/tcmalloc.cc:1167
#6  do_calloc (n=<optimized out>, elem_size=<optimized out>) at src/tcmalloc.cc:1253
#7  tc_calloc (n=<optimized out>, elem_size=<optimized out>) at src/tcmalloc.cc:1749
#8  0x00007ffff5e70251 in SparseArrayNewWithDepth () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#9  0x00007ffff5e7035e in SparseArrayNew () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#10 0x00007ffff5e70e3b in init_selector_tables () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#11 0x00007ffff5e6b916 in __objc_exec_class () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#12 0x00007ffff5e7511f in .objc_load_function () from /home/dlobron/build/clangport/akamai/common/lib/libobjc.so.4.6
#13 0x00007ffff7dea13a in call_init (l=<optimized out>, argc=argc at entry=3, argv=argv at entry=0x7fffffffe1c8, env=env at entry=0x7fffffffe1e8) at dl-init.c:78
#14 0x00007ffff7dea223 in call_init (env=<optimized out>, argv=<optimized out>, argc=<optimized out>, l=<optimized out>) at dl-init.c:36
#15 _dl_init (main_map=0x7ffff7ffe1c8, argc=3, argv=0x7fffffffe1c8, env=0x7fffffffe1e8) at dl-init.c:126
#16 0x00007ffff7ddb30a in _dl_start_user () from /lib64/ld-linux-x86-64.so.2
#17 0x0000000000000003 in ?? ()
#18 0x00007fffffffe4b5 in ?? ()
#19 0x00007fffffffe4fa in ?? ()
#20 0x00007fffffffe4fd in ?? ()
#21 0x0000000000000000 in ?? ()


More information about the cfe-users mailing list