llvm-project/lldb/source
Greg Clayton 12ba733ce8 When we have a symbol, like "NSLog" that we try to call in an expression, make sure we prioritize the external symbols over the internal one.
This is a temporary fix until a more comprehensive fix can be made for finding functions that we call in expressions.

We find "NSLog" in ClangExpressionDeclMap::FindExternalVisibleDecls() in after a call to target->GetImages().FindFunctions(...). Note that there are two symbols: NSLog from CFNetwork which is not external, and NSLog from Foundation which _is_ external. We do something with the external symbol with:

                    if (extern_symbol)
                    {
                        AddOneFunction (context, NULL, extern_symbol, current_id);
                        context.m_found.function = true;
                    }

Then later we try to lookup the _Z5NSLogP8NSStringz name and we don't find it so we call ClangExpressionDeclMap::GetFunctionAddress() with "_Z5NSLogP8NSStringz" as the name and the sc_list_size is zero at the "if" statement at line 568 because we don't find the mangled name and we extract the basename "NSLog" and call:

            FindCodeSymbolInContext(ConstString(basename), m_parser_vars->m_sym_ctx, sc_list);
            sc_list_size = sc_list.GetSize();

and we get a list size of two again, and we proceed to search for the symbol again, this time ignoring the external vs non-external-ness of the symbols that we find. This fix ensures we prioritize the external symbol until we get a real fix from Sean Callanan when he gets back to make sure we don't do multiple lookups for the same symbol we already resolved.

<rdar://problem/19879282>

llvm-svn: 231420
2015-03-05 23:12:02 +00:00
..
API Add a required #include 2015-03-04 21:33:45 +00:00
Breakpoint Don't #include clang headers from BreakpointLocation.h 2015-03-04 17:43:00 +00:00
Commands Further reduce header footprint of Debugger.h. 2015-03-04 01:58:01 +00:00
Core Further reduce header footprint of Debugger.h. 2015-03-04 01:58:01 +00:00
DataFormatters Don't #include FormatManager.h from Debugger.h 2015-03-03 23:11:11 +00:00
Expression When we have a symbol, like "NSLog" that we try to call in an expression, make sure we prioritize the external symbols over the internal one. 2015-03-05 23:12:02 +00:00
Host Don't #include ClangASTContext.h from Module.h 2015-03-03 18:34:26 +00:00
Interpreter Further reduce header footprint of Debugger.h. 2015-03-04 01:58:01 +00:00
Plugins Don't #include clang headers from BreakpointLocation.h 2015-03-04 17:43:00 +00:00
Symbol Correctly resolve symbol names containing linker annotations 2015-03-04 10:25:22 +00:00
Target Don't #include clang headers from BreakpointLocation.h 2015-03-04 17:43:00 +00:00
Utility Appease the Windows bot 2015-03-04 23:19:36 +00:00
CMakeLists.txt Resubmit "[CMake] Change lldbAPI to be a CMake OBJECT library." 2015-02-24 22:17:57 +00:00
Makefile Use PARALLEL_DIRS instead of DIRS in the Makefile 2014-10-14 06:26:33 +00:00
lldb-log.cpp Make sure to #include <atomic> when using std::atomic. 2014-09-19 20:12:32 +00:00
lldb.cpp Reduce the number of components initialized by lldb-server to reduce static binary size. 2015-03-02 15:14:50 +00:00