[lldb-dev] [Bug 26978] New: LLDB stack overflow while dealing with symbols for a process on Linux

Kate Stone via lldb-dev lldb-dev at lists.llvm.org
Thu Mar 17 14:37:40 PDT 2016


The cxa_demangle implementation definitely consumes stack aggressively, especially when compiled -O0.  I’d definitely recommend an 8MB+ stack for any thread that may wind up demangling arbitrary C++ symbols.  The new “fast demangler” is much more conservative with stack space but doesn’t yet support the full name mangling specification, so complex symbols often rely on falling back to cxa_demangle.

Kate Stone k8stone at apple.com <mailto:k8stone at apple.com>
 Xcode Low Level Tools

> On Mar 17, 2016, at 2:19 PM, Greg Clayton via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> 
> Make stacks bigger when making threads on linux?
> 
>> On Mar 17, 2016, at 1:39 PM, Jeffrey Tan via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> 
>> Seems like the crashes happens because of abi::__cxa_demangle() for mangled symbol name " _ZNSt9_Any_data9_M_accessIPPZN5folly6fibers12FiberManager16runInMainContextIZN8facebook8memcache15CacheClientImplINS6_17CControllerCommonINS1_7dynamicEEEE11multiOpSyncINS6_11McOperationILi11EEESt6vect".
>> 
>> This is blocking us from releasing our C++ debugging support. Anyone know of a quick workaround I can fix it locally? Thanks!
>> 
>> On Thu, Mar 17, 2016 at 12:25 PM, via lldb-dev <lldb-dev at lists.llvm.org> wrote:
>> Bug ID	26978
>> Summary	LLDB stack overflow while dealing with symbols for a process on Linux           
>> Product	lldb
>> Version	3.8
>> Hardware	PC
>> OS	Linux
>> Status	NEW
>> Severity	release blocker
>> Priority	P
>> Component	All Bugs
>> Assignee	lldb-dev at lists.llvm.org
>> Reporter	jeffrey.fudan at gmail.com
>> CC	llvm-bugs at lists.llvm.org
>> Classification	Unclassified
>> 
>> While using lldb to attach a process in our company on Linux, lldb segment
>> fault with a huge stack(more than 30K stack frames). I assume it crashes
>> because of stack overflow. Let me know what additional information you needed(I
>> have coredump):
>> 
>> #0  0x00007f28ce530819 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2724b80) at cp-demangle.c:4286
>> #1  0x00007f28ce5321e6 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2724bb0) at cp-demangle.c:4324
>> #2  0x00007f28ce5321e6 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2724c10) at cp-demangle.c:4324
>> #3  0x00007f28ce532010 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2724c70) at cp-demangle.c:4489
>> #4  0x00007f28ce5319c0 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2724c88) at cp-demangle.c:4923
>> #5  0x00007f28ce532056 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2724ca0) at cp-demangle.c:4493
>> #6  0x00007f28ce5321e6 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2724cd0) at cp-demangle.c:4324
>> #7  0x00007f28ce532010 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2725030) at cp-demangle.c:4489
>> #8  0x00007f28ce535353 in d_print_mod (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, mod=<optimized out>) at cp-demangle.c:5539
>> #9  0x00007f28ce535dbe in d_print_mod_list (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, mods=mods at entry=0x7f28c1f2ba30,
>> suffix=suffix at entry=0) at cp-demangle.c:5468
>> #10 0x00007f28ce5366a1 in d_print_function_type (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, mods=0x7f28c1f2ba30, dc=0x7f28c2725138) at
>> cp-demangle.c:5609
>> #11 0x00007f28ce53110c in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725138) at cp-demangle.c:4808
>> #12 0x00007f28ce530a01 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2725150) at cp-demangle.c:4434
>> #13 0x00007f28ce5321e6 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c27251b0) at cp-demangle.c:4324
>> #14 0x00007f28ce5336b3 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725108) at cp-demangle.c:4529
>> #15 0x00007f28ce534448 in d_print_comp (dpi=0x7f28c2728c00, options=<optimized
>> out>, dc=0x7f28c2725270) at cp-demangle.c:4793
>> #16 0x00007f28ce5319c0 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725288) at cp-demangle.c:4923
>> #17 0x00007f28ce532056 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c27252a0) at cp-demangle.c:4493
>> #18 0x00007f28ce5321e6 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c27252d0) at cp-demangle.c:4324
>> #19 0x00007f28ce534448 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725318) at cp-demangle.c:4793
>> #20 0x00007f28ce530a01 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2725330) at cp-demangle.c:4434
>> #21 0x00007f28ce5321e6 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725390) at cp-demangle.c:4324
>> #22 0x00007f28ce53123b in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c27253a8) at cp-demangle.c:4742
>> #23 0x00007f28ce53123b in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c27253c0) at cp-demangle.c:4742
>> #24 0x00007f28ce5336b3 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725108) at cp-demangle.c:4529
>> #25 0x00007f28ce53123b in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c27252e8) at cp-demangle.c:4742
>> #26 0x00007f28ce5319c0 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725300) at cp-demangle.c:4923
>> #27 0x00007f28ce5366e1 in d_print_function_type (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, mods=0x7f28c1f2cc70, dc=0x7f28c2725318) at
>> cp-demangle.c:5617
>> #28 0x00007f28ce53110c in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725318) at cp-demangle.c:4808
>> #29 0x00007f28ce530a01 in d_print_comp (dpi=0x7f28c2728c00, options=17,
>> dc=0x7f28c2725330) at cp-demangle.c:4434
>> ....
>> 
>> #31767 0x00007f28ce5336b3 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725108) at cp-demangle.c:4529
>> #31768 0x00007f28ce53123b in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725408) at cp-demangle.c:4742
>> #31769 0x00007f28ce534448 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=0x7f28c2725450) at cp-demangle.c:4793
>> #31770 0x00007f28ce530a01 in d_print_comp (dpi=dpi at entry=0x7f28c2728c00,
>> options=options at entry=17, dc=dc at entry=0x7f28c2725468) at cp-demangle.c:4434
>> #31771 0x00007f28ce536f53 in d_demangle_callback (options=17,
>> opaque=0x7f28c2723cc0, callback=0x7f28ce52c820
>> <d_growable_string_callback_adapter>, dc=0x7f28c2725468) at cp-demangle.c:4063
>> #31772 0x00007f28ce536f53 in d_demangle_callback (mangled=<optimized out>,
>>    mangled at entry=0x0, callback=callback at entry=0x7f28ce52c820
>> <d_growable_string_callback_adapter>, opaque=opaque at entry=0x7f28c2728db0,
>> options=17) at cp-demangle.c:5865
>> #31773 0x00007f28ce53709f in __cxa_demangle (options=17, palc=<synthetic
>> pointer>, mangled=0x0) at cp-demangle.c:5886
>> 
>> #31774 0x00007f28ce53709f in __cxa_demangle
>> (mangled_name=mangled_name at entry=0x7f28ace3d460
>> "_ZNSt9_Any_data9_M_accessIPPZN5folly6fibers12FiberManager16runInMainContextIZN8facebook8memcache15CacheClientImplINS6_17CControllerCommonINS1_7dynamicEEEE11multiOpSyncINS6_11McOperationILi11EEESt6vect"...,
>> output_buffer=output_buffer at entry=0x0, length=length at entry=0x0,
>> status=status at entry=0x0) at cp-demangle.c:5950
>> #31775 0x00007f28d015dc57 in
>> lldb_private::Mangled::GetDemangledName(lldb::LanguageType) const
>> (this=this at entry=0x7f28c0d48310,
>> language=language at entry=lldb::eLanguageTypeC_plus_plus)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/Mangled.cpp:316
>> 
>> #31776 0x00007f28d025bdca in lldb_private::Symtab::InitNameIndexes()
>> (this=0x7f28ac1a8ff0) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Symbol/Symtab.cpp:334
>> #31777 0x00007f28d025d0b8 in
>> lldb_private::Symtab::FindAllSymbolsWithNameAndType(lldb_private::ConstString
>> const&, lldb::SymbolType, std::vector<unsigned int, std::allocator<unsigned
>> int> >&) (this=this at entry=0x7f28ac1a8ff0, name=...,
>> symbol_type=symbol_type at entry=lldb::eSymbolTypeAny, symbol_indexes=...) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Symbol/Symtab.cpp:819
>> 
>> #31778 0x00007f28d0160ec2 in
>> lldb_private::Module::FindSymbolsWithNameAndType(lldb_private::ConstString
>> const&, lldb::SymbolType, lldb_private::SymbolContextList&)
>> (this=0x7f28ac0605a0, name=...,
>> symbol_type=symbol_type at entry=lldb::eSymbolTypeAny, sc_list=...) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/Module.cpp:1432
>> #31779 0x00007f28d016781d in
>> lldb_private::ModuleList::FindSymbolsWithNameAndType(lldb_private::ConstString
>> const&, lldb::SymbolType, lldb_private::SymbolContextList&, bool) const
>> (this=this at entry=0x7f28c27294b0, name=...,
>> symbol_type=symbol_type at entry=lldb::eSymbolTypeAny, sc_list=...,
>> append=append at entry=false) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/ModuleList.cpp:573
>> #31780 0x00007f28d0514626 in
>> JITLoaderGDB::GetSymbolAddress(lldb_private::ModuleList&,
>> lldb_private::ConstString const&, lldb::SymbolType) const
>> (this=this at entry=0x7f28ac042990, module_list=..., name=...,
>> symbol_type=symbol_type at entry=lldb::eSymbolTypeAny) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:500
>> 
>> #31781 0x00007f28d05164cb in
>> JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList&) (this=0x7f28ac042990,
>> module_list=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp:177
>> 
>> #31782 0x00007f28d030c910 in
>> lldb_private::JITLoaderList::ModulesDidLoad(lldb_private::ModuleList&)
>> (this=<optimized out>, module_list=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/JITLoaderList.cpp:76
>> #31783 0x00007f28d02a90f8 in
>> lldb_private::Process::ModulesDidLoad(lldb_private::ModuleList&)
>> (this=this at entry=0x894160, module_list=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Process.cpp:6370
>> ---Type <return> to continue, or q <return> to quit---
>> #31784 0x00007f28d03f3091 in
>> lldb_private::process_gdb_remote::ProcessGDBRemote::ModulesDidLoad(lldb_private::ModuleList&)
>> (this=0x894160, module_list=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:4927
>> #31785 0x00007f28d02d3131 in
>> lldb_private::Target::ModulesDidLoad(lldb_private::ModuleList&) (this=0x88f8b0,
>> module_list=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Target.cpp:1400
>> #31786 0x00007f28d02dcb58 in
>> lldb_private::Target::ModuleAdded(lldb_private::ModuleList const&,
>> std::shared_ptr<lldb_private::Module> const&) (this=0x88f8b0, module_list=...,
>> module_sp=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Target.cpp:1364
>> #31787 0x00007f28d0168f28 in
>> lldb_private::ModuleList::AppendImpl(std::shared_ptr<lldb_private::Module>
>> const&, bool) (this=0x88fbb0, module_sp=...,
>> use_notifier=use_notifier at entry=true)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/ModuleList.cpp:110
>> #31788 0x00007f28d0168f6a in
>> lldb_private::ModuleList::Append(std::shared_ptr<lldb_private::Module> const&)
>> (this=<optimized out>, module_sp=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/ModuleList.cpp:117
>> #31789 0x00007f28d02d1def in
>> lldb_private::Target::GetSharedModule(lldb_private::ModuleSpec const&,
>> lldb_private::Error*) (this=this at entry=0x88f8b0, module_spec=...,
>> error_ptr=error_ptr at entry=0x0)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Target.cpp:1924
>> #31790 0x00007f28d0620b48 in
>> lldb_private::DynamicLoader::LoadModuleAtAddress(lldb_private::FileSpec const&,
>> unsigned long, unsigned long, bool) (this=<optimized out>, file=...,
>> link_map_addr=139710961516544, base_addr=139710941827072,
>> base_addr_is_offset=<optimized out>) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Core/DynamicLoader.cpp:192
>> #31791 0x00007f28d038764a in DynamicLoaderPOSIXDYLD::LoadAllCurrentModules()
>> (this=0x7f28ac038570)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:521
>> #31792 0x00007f28d03898f0 in DynamicLoaderPOSIXDYLD::DidAttach()
>> (this=0x7f28ac038570)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp:181
>> #31793 0x00007f28d02a646c in lldb_private::Process::CompleteAttach()
>> (this=0x894160) at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Process.cpp:3443
>> #31794 0x00007f28d02a7236 in
>> lldb_private::Process::AttachCompletionHandler::PerformAction(std::shared_ptr<lldb_private::Event>&)
>> (this=0x8b8920, event_sp=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Process.cpp:3194
>> #31795 0x00007f28d02af98c in
>> lldb_private::Process::HandlePrivateEvent(std::shared_ptr<lldb_private::Event>&)
>> (this=this at entry=0x894160, event_sp=...)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Process.cpp:4184
>> #31796 0x00007f28d02b09bd in lldb_private::Process::RunPrivateStateThread(bool)
>> (this=0x894160, is_secondary_thread=<optimized out>)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Target/Process.cpp:4429
>> #31797 0x00007f28d0108421 in
>> lldb_private::HostNativeThreadBase::ThreadCreateTrampoline(void*)
>> (arg=0x8b8900)
>>    at
>> /home/engshare/third-party2/lldb/3.8.0.rc3/src/llvm/tools/lldb/source/Host/common/HostNativeThreadBase.cpp:81
>> #31798 0x00007f28cea24aa1 in start_thread () at /lib64/libpthread.so.0
>> #31799 0x00007f28cdd8693d in clone () at /lib64/libc.so.6
>> 
>> 
>> You are receiving this mail because:
>> 	• You are the assignee for the bug.
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
>> 
>> 
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 
> _______________________________________________
> lldb-dev mailing list
> lldb-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20160317/0b0b8c90/attachment-0001.html>


More information about the lldb-dev mailing list