[lldb-dev] LLDB Expression Parser Name Mangling
apepper at blueshiftinc.com
Mon Jun 30 10:52:34 PDT 2014
* I sent this earlier before I registered, sorry in advance if this
shows up as a duplicate.
I have been familiarizing myself with the expression parsing code in
LLDB with the intention of finding and fixing several expression parser
The first issue that I have been investigating in detail is related to
calling c_str() on a standard string. The expression fails because LLDB
is not able to match up the mangled function name with any names in the
symbol table. There is special handling for standard strings in
IRForTarget::GetFunctionAddress to support two variants of the mangled
name prefix of, _ZNKSbIc and _ZNKSs. The _ZNKSbIc represents
basic_string<char> whereas _ZNKSs represents string which is a typedef
of basic_string<char>. In this case the full name in the g++ compiled
dwarf symbols is _ZNKSs5c_strEv, Clang also generates the same symbol.
The call to m_decl_map->GetFunctionAddress is failing because the
mangled name that is being generated by the JIT compiled expression is
actually the fully specified name,
_ZNKSbIcSt17char_traits<char>St15allocator<char>E5c_strEv, which is
equivalent to basic_string<char,char_traits<char>,allocator<char>>.
I have been walking through the expression parsing code but have not
been able to locate where this name is actually generated. I am
guessing the name is generated during the ParseAST but I have not been
able to track it down yet, any help would be appreciated.
More information about the lldb-dev