summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Module.h74
-rw-r--r--lldb/include/lldb/Core/ModuleList.h1
-rw-r--r--lldb/include/lldb/Symbol/SymbolContext.h6
-rw-r--r--lldb/include/lldb/Symbol/Symtab.h4
-rw-r--r--lldb/lldb.xcodeproj/project.pbxproj6
-rw-r--r--lldb/source/API/SBTarget.cpp43
-rw-r--r--lldb/source/Breakpoint/BreakpointResolverName.cpp13
-rw-r--r--lldb/source/Commands/CommandCompletions.cpp27
-rw-r--r--lldb/source/Commands/CommandObjectImage.cpp51
-rw-r--r--lldb/source/Commands/CommandObjectSource.cpp5
-rw-r--r--lldb/source/Core/AddressResolverName.cpp16
-rw-r--r--lldb/source/Core/Disassembler.cpp53
-rw-r--r--lldb/source/Core/Module.cpp79
-rw-r--r--lldb/source/Core/ModuleList.cpp22
-rw-r--r--lldb/source/Expression/ClangExpressionDeclMap.cpp16
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp32
-rw-r--r--lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp30
-rw-r--r--lldb/source/Symbol/SymbolContext.cpp46
18 files changed, 330 insertions, 194 deletions
diff --git a/lldb/include/lldb/Core/Module.h b/lldb/include/lldb/Core/Module.h
index 0889b094ed3..862d67b3634 100644
--- a/lldb/include/lldb/Core/Module.h
+++ b/lldb/include/lldb/Core/Module.h
@@ -143,13 +143,18 @@ public:
/// NULL otherwise.
//------------------------------------------------------------------
const Symbol *
- FindFirstSymbolWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
+ FindFirstSymbolWithNameAndType (const ConstString &name,
+ lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
size_t
- FindSymbolsWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type, SymbolContextList &sc_list);
+ FindSymbolsWithNameAndType (const ConstString &name,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
size_t
- FindSymbolsMatchingRegExAndType (const RegularExpression &regex, lldb::SymbolType symbol_type, SymbolContextList &sc_list);
+ FindSymbolsMatchingRegExAndType (const RegularExpression &regex,
+ lldb::SymbolType symbol_type,
+ SymbolContextList &sc_list);
//------------------------------------------------------------------
/// Find functions by name.
@@ -176,7 +181,11 @@ public:
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
uint32_t
- FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list);
+ FindFunctions (const ConstString &name,
+ uint32_t name_type_mask,
+ bool symbols_ok,
+ bool append,
+ SymbolContextList& sc_list);
//------------------------------------------------------------------
/// Find functions by name.
@@ -197,7 +206,10 @@ public:
/// The number of matches added to \a sc_list.
//------------------------------------------------------------------
uint32_t
- FindFunctions (const RegularExpression& regex, bool append, SymbolContextList& sc_list);
+ FindFunctions (const RegularExpression& regex,
+ bool symbols_ok,
+ bool append,
+ SymbolContextList& sc_list);
//------------------------------------------------------------------
/// Find global and static variables by name.
@@ -223,7 +235,10 @@ public:
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
uint32_t
- FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variable_list);
+ FindGlobalVariables (const ConstString &name,
+ bool append,
+ uint32_t max_matches,
+ VariableList& variable_list);
//------------------------------------------------------------------
/// Find global and static variables by regular exression.
@@ -248,7 +263,10 @@ public:
/// The number of matches added to \a variable_list.
//------------------------------------------------------------------
uint32_t
- FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variable_list);
+ FindGlobalVariables (const RegularExpression& regex,
+ bool append,
+ uint32_t max_matches,
+ VariableList& variable_list);
//------------------------------------------------------------------
/// Find types by name.
@@ -284,43 +302,11 @@ public:
/// The number of matches added to \a type_list.
//------------------------------------------------------------------
uint32_t
- FindTypes (const SymbolContext& sc, const ConstString &name, bool append, uint32_t max_matches, TypeList& types);
-
- //------------------------------------------------------------------
- /// Find types by name.
- ///
- /// @param[in] sc
- /// A symbol context that scopes where to extract a type list
- /// from.
- ///
- /// @param[in] regex
- /// A regular expression to use when matching the name.
- ///
- /// @param[in] append
- /// If \b true, any matches will be appended to \a
- /// variable_list, else matches replace the contents of
- /// \a variable_list.
- ///
- /// @param[in] max_matches
- /// Allow the number of matches to be limited to \a
- /// max_matches. Specify UINT32_MAX to get all possible matches.
- ///
- /// @param[in] encoding
- /// Limit the search to specific types, or get all types if
- /// set to Type::invalid.
- ///
- /// @param[in] udt_name
- /// If the encoding is a user defined type, specify the name
- /// of the user defined type ("struct", "union", "class", etc).
- ///
- /// @param[out] type_list
- /// A type list gets populated with any matches.
- ///
- /// @return
- /// The number of matches added to \a type_list.
- //------------------------------------------------------------------
-// uint32_t
-// FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& type_list);
+ FindTypes (const SymbolContext& sc,
+ const ConstString &name,
+ bool append,
+ uint32_t max_matches,
+ TypeList& types);
//------------------------------------------------------------------
/// Get const accessor for the module architecture.
diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h
index 4c1e4d94945..d4c4dde4937 100644
--- a/lldb/include/lldb/Core/ModuleList.h
+++ b/lldb/include/lldb/Core/ModuleList.h
@@ -164,6 +164,7 @@ public:
size_t
FindFunctions (const ConstString &name,
uint32_t name_type_mask,
+ bool include_symbols,
bool append,
SymbolContextList &sc_list);
diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h
index c066f01f74b..f1c96de3d4d 100644
--- a/lldb/include/lldb/Symbol/SymbolContext.h
+++ b/lldb/include/lldb/Symbol/SymbolContext.h
@@ -206,6 +206,7 @@ public:
//------------------------------------------------------------------
size_t
FindFunctionsByName (const ConstString &name,
+ bool include_symbols,
bool append,
SymbolContextList &sc_list) const;
@@ -277,7 +278,10 @@ public:
/// A symbol context to append to the list.
//------------------------------------------------------------------
void
- Append(const SymbolContext& sc);
+ Append (const SymbolContext& sc);
+
+ bool
+ AppendIfUnique (const SymbolContext& sc);
//------------------------------------------------------------------
/// Clear the object's state.
diff --git a/lldb/include/lldb/Symbol/Symtab.h b/lldb/include/lldb/Symbol/Symtab.h
index bce9ba67aae..7ff009dd32c 100644
--- a/lldb/include/lldb/Symbol/Symtab.h
+++ b/lldb/include/lldb/Symbol/Symtab.h
@@ -24,8 +24,8 @@ class Symtab
{
public:
typedef enum Debug {
- eDebugNo, // Not a debug symbol
- eDebugYes, // A debug symbol
+ eDebugNo, // Not a debug symbol
+ eDebugYes, // A debug symbol
eDebugAny
} Debug;
diff --git a/lldb/lldb.xcodeproj/project.pbxproj b/lldb/lldb.xcodeproj/project.pbxproj
index cc91d0c65f0..de5dd4065cd 100644
--- a/lldb/lldb.xcodeproj/project.pbxproj
+++ b/lldb/lldb.xcodeproj/project.pbxproj
@@ -2882,6 +2882,7 @@
__STDC_LIMIT_MACROS,
LLDB_CONFIGURATION_DEBUG,
);
+ GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -2912,6 +2913,7 @@
__STDC_LIMIT_MACROS,
LLDB_CONFIGURATION_RELEASE,
);
+ GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -3100,6 +3102,7 @@
__STDC_LIMIT_MACROS,
LLDB_CONFIGURATION_BUILD_AND_INTEGRATION,
);
+ GCC_VERSION = "";
GCC_WARN_64_TO_32_BIT_CONVERSION = NO;
GCC_WARN_ABOUT_MISSING_NEWLINE = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@@ -3129,6 +3132,7 @@
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_MODEL_TUNING = G5;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
INSTALL_PATH = /Developer/usr/bin;
@@ -3222,6 +3226,7 @@
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
INSTALL_PATH = /Developer/usr/bin;
@@ -3260,6 +3265,7 @@
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_MODEL_TUNING = G5;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
+ GCC_VERSION = "";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = "lldb-Info.plist";
INSTALL_PATH = /Developer/usr/bin;
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 820327b12a9..2bb70afcbdd 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -155,7 +155,28 @@ SBTarget::Launch
if (getenv("LLDB_LAUNCH_FLAG_DISABLE_ASLR"))
launch_flags |= eLaunchFlagDisableASLR;
- if ((launch_flags & eLaunchFlagLaunchInTTY) || getenv("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY"))
+ static const char *g_launch_tty = NULL;
+ static bool g_got_launch_tty = false;
+ if (!g_got_launch_tty)
+ {
+ // Get the LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY only once
+ g_got_launch_tty = true;
+ g_launch_tty = ::getenv ("LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY");
+ if (g_launch_tty)
+ {
+ // LLDB_LAUNCH_FLAG_LAUNCH_IN_TTY is a path to a terminal to reuse
+ // if the first character is '/', else it is a boolean value.
+ if (g_launch_tty[0] != '/')
+ {
+ if (Args::StringToBoolean(g_launch_tty, false, NULL))
+ g_launch_tty = "";
+ else
+ g_launch_tty = NULL;
+ }
+ }
+ }
+
+ if ((launch_flags & eLaunchFlagLaunchInTTY) || g_launch_tty)
{
ArchSpec arch (m_opaque_sp->GetArchitecture ());
@@ -182,14 +203,18 @@ SBTarget::Launch
exec_path_plus_argv.push_back(NULL);
- lldb::pid_t pid = Host::LaunchInNewTerminal (NULL,
- &exec_path_plus_argv[0],
- envp,
- working_directory,
- &arch,
- true,
- launch_flags & eLaunchFlagDisableASLR);
-
+ const char *tty_name = NULL;
+ if (g_launch_tty && g_launch_tty[0] == '/')
+ tty_name = g_launch_tty;
+
+ lldb::pid_t pid = Host::LaunchInNewTerminal (tty_name,
+ &exec_path_plus_argv[0],
+ envp,
+ working_directory,
+ &arch,
+ true,
+ launch_flags & eLaunchFlagDisableASLR);
+
if (pid != LLDB_INVALID_PROCESS_ID)
{
sb_process = AttachToProcessWithID(pid, error);
diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp
index 0914e12ee97..f244e3b56de 100644
--- a/lldb/source/Breakpoint/BreakpointResolverName.cpp
+++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp
@@ -155,6 +155,8 @@ BreakpointResolverName::SearchCallback
return Searcher::eCallbackReturnStop;
}
+ const bool include_symbols = false;
+ const bool append = false;
switch (m_match_type)
{
case Breakpoint::Exact:
@@ -162,14 +164,21 @@ BreakpointResolverName::SearchCallback
{
if (m_func_name_type_mask & (eFunctionNameTypeBase | eFunctionNameTypeFull))
context.module_sp->FindSymbolsWithNameAndType (m_func_name, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_func_name, m_func_name_type_mask, false, func_list);
+ context.module_sp->FindFunctions (m_func_name,
+ m_func_name_type_mask,
+ include_symbols,
+ append,
+ func_list);
}
break;
case Breakpoint::Regexp:
if (context.module_sp)
{
context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex, true, func_list);
+ context.module_sp->FindFunctions (m_regex,
+ include_symbols,
+ append,
+ func_list);
}
break;
case Breakpoint::Glob:
diff --git a/lldb/source/Commands/CommandCompletions.cpp b/lldb/source/Commands/CommandCompletions.cpp
index 8a1cd5adfc5..3102f558488 100644
--- a/lldb/source/Commands/CommandCompletions.cpp
+++ b/lldb/source/Commands/CommandCompletions.cpp
@@ -599,35 +599,24 @@ CommandCompletions::SymbolCompleter::SearchCallback (
bool complete
)
{
- SymbolContextList func_list;
- SymbolContextList sym_list;
-
- if (context.module_sp != NULL)
+ if (context.module_sp)
{
- if (context.module_sp)
- {
- context.module_sp->FindSymbolsMatchingRegExAndType (m_regex, lldb::eSymbolTypeCode, sym_list);
- context.module_sp->FindFunctions (m_regex, true, func_list);
- }
+ SymbolContextList sc_list;
+ const bool include_symbols = true;
+ const bool append = true;
+ context.module_sp->FindFunctions (m_regex, include_symbols, append, sc_list);
SymbolContext sc;
// Now add the functions & symbols to the list - only add if unique:
- for (uint32_t i = 0; i < func_list.GetSize(); i++)
+ for (uint32_t i = 0; i < sc_list.GetSize(); i++)
{
- if (func_list.GetContextAtIndex(i, sc))
+ if (sc_list.GetContextAtIndex(i, sc))
{
if (sc.function)
{
m_match_set.insert (sc.function->GetMangled().GetDemangledName());
}
- }
- }
-
- for (uint32_t i = 0; i < sym_list.GetSize(); i++)
- {
- if (sym_list.GetContextAtIndex(i, sc))
- {
- if (sc.symbol && sc.symbol->GetAddressRangePtr())
+ else if (sc.symbol && sc.symbol->GetAddressRangePtr())
{
m_match_set.insert (sc.symbol->GetMangled().GetDemangledName());
}
diff --git a/lldb/source/Commands/CommandObjectImage.cpp b/lldb/source/Commands/CommandObjectImage.cpp
index 58907bfd2d1..1f6cd50941d 100644
--- a/lldb/source/Commands/CommandObjectImage.cpp
+++ b/lldb/source/Commands/CommandObjectImage.cpp
@@ -360,33 +360,36 @@ LookupFunctionInModule (CommandInterpreter &interpreter, Stream &strm, Module *m
if (module && name && name[0])
{
SymbolContextList sc_list;
-
- SymbolVendor *symbol_vendor = module->GetSymbolVendor();
- if (symbol_vendor)
+ const bool include_symbols = false;
+ const bool append = true;
+ uint32_t num_matches = 0;
+ if (name_is_regex)
{
- uint32_t num_matches = 0;
- if (name_is_regex)
- {
- RegularExpression function_name_regex (name);
- num_matches = symbol_vendor->FindFunctions(function_name_regex, true, sc_list);
-
- }
- else
- {
- ConstString function_name(name);
- num_matches = symbol_vendor->FindFunctions(function_name, eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector, true, sc_list);
- }
+ RegularExpression function_name_regex (name);
+ num_matches = module->FindFunctions (function_name_regex,
+ include_symbols,
+ append,
+ sc_list);
+ }
+ else
+ {
+ ConstString function_name (name);
+ num_matches = module->FindFunctions (function_name,
+ eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
+ include_symbols,
+ append,
+ sc_list);
+ }
- if (num_matches)
- {
- strm.Indent ();
- strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
- DumpFullpath (strm, &module->GetFileSpec(), 0);
- strm.PutCString(":\n");
- DumpSymbolContextList (interpreter, strm, sc_list, true);
- }
- return num_matches;
+ if (num_matches)
+ {
+ strm.Indent ();
+ strm.Printf("%u match%s found in ", num_matches, num_matches > 1 ? "es" : "");
+ DumpFullpath (strm, &module->GetFileSpec(), 0);
+ strm.PutCString(":\n");
+ DumpSymbolContextList (interpreter, strm, sc_list, true);
}
+ return num_matches;
}
return 0;
}
diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp
index 88c18be5551..65983d78029 100644
--- a/lldb/source/Commands/CommandObjectSource.cpp
+++ b/lldb/source/Commands/CommandObjectSource.cpp
@@ -289,6 +289,7 @@ public:
SymbolContextList sc_list;
ConstString name(m_options.symbol_name.c_str());
+ bool include_symbols = false;
bool append = true;
size_t num_matches = 0;
@@ -302,13 +303,13 @@ public:
{
matching_modules.Clear();
target->GetImages().FindModules (&module_spec, NULL, NULL, NULL, matching_modules);
- num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeBase, append, sc_list);
+ num_matches += matching_modules.FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list);
}
}
}
else
{
- num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeBase, append, sc_list);
+ num_matches = target->GetImages().FindFunctions (name, eFunctionNameTypeBase, include_symbols, append, sc_list);
}
SymbolContext sc;
diff --git a/lldb/source/Core/AddressResolverName.cpp b/lldb/source/Core/AddressResolverName.cpp
index d5bdd89b607..040a8621855 100644
--- a/lldb/source/Core/AddressResolverName.cpp
+++ b/lldb/source/Core/AddressResolverName.cpp
@@ -102,9 +102,11 @@ AddressResolverName::SearchCallback
return Searcher::eCallbackReturnStop;
}
+ const bool include_symbols = false;
+ const bool append = false;
switch (m_match_type)
{
- case AddressResolver::Exact:
+ case AddressResolver::Exact:
if (context.module_sp)
{
context.module_sp->FindSymbolsWithNameAndType (m_func_name,
@@ -112,22 +114,26 @@ AddressResolverName::SearchCallback
sym_list);
context.module_sp->FindFunctions (m_func_name,
eFunctionNameTypeBase | eFunctionNameTypeFull | eFunctionNameTypeMethod | eFunctionNameTypeSelector,
- false,
+ include_symbols,
+ append,
func_list);
}
break;
- case AddressResolver::Regexp:
+
+ case AddressResolver::Regexp:
if (context.module_sp)
{
context.module_sp->FindSymbolsMatchingRegExAndType (m_regex,
eSymbolTypeCode,
sym_list);
context.module_sp->FindFunctions (m_regex,
- true,
+ include_symbols,
+ append,
func_list);
}
break;
- case AddressResolver::Glob:
+
+ case AddressResolver::Glob:
if (log)
log->Warning ("glob is not supported yet.");
break;
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index e6fe1b018a5..64a4c2c762b 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -99,39 +99,44 @@ Disassembler::Disassemble
Stream &strm
)
{
- if (exe_ctx.target == NULL && name)
- return false;
-
SymbolContextList sc_list;
-
- if (module)
- {
- if (!module->FindFunctions (name,
- eFunctionNameTypeBase |
- eFunctionNameTypeFull |
- eFunctionNameTypeMethod |
- eFunctionNameTypeSelector,
- true,
- sc_list))
- return false;
- }
- else
+ if (name)
{
- if (exe_ctx.target->GetImages().FindFunctions (name,
+ const bool include_symbols = true;
+ if (module)
+ {
+ module->FindFunctions (name,
+ eFunctionNameTypeBase |
+ eFunctionNameTypeFull |
+ eFunctionNameTypeMethod |
+ eFunctionNameTypeSelector,
+ include_symbols,
+ true,
+ sc_list);
+ }
+ else if (exe_ctx.target)
+ {
+ exe_ctx.target->GetImages().FindFunctions (name,
eFunctionNameTypeBase |
eFunctionNameTypeFull |
eFunctionNameTypeMethod |
eFunctionNameTypeSelector,
+ include_symbols,
false,
- sc_list))
- {
- return Disassemble (debugger, arch, exe_ctx, sc_list, num_mixed_context_lines, show_bytes, strm);
- }
- else if (exe_ctx.target->GetImages().FindSymbolsWithNameAndType(name, eSymbolTypeCode, sc_list))
- {
- return Disassemble (debugger, arch, exe_ctx, sc_list, num_mixed_context_lines, show_bytes, strm);
+ sc_list);
}
}
+
+ if (sc_list.GetSize ())
+ {
+ return Disassemble (debugger,
+ arch,
+ exe_ctx,
+ sc_list,
+ num_mixed_context_lines,
+ show_bytes,
+ strm);
+ }
return false;
}
diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp
index 6226fb26f2a..ef8e3938a6e 100644
--- a/lldb/source/Core/Module.cpp
+++ b/lldb/source/Core/Module.cpp
@@ -321,21 +321,88 @@ Module::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_
}
uint32_t
-Module::FindFunctions(const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList& sc_list)
+Module::FindFunctions (const ConstString &name,
+ uint32_t name_type_mask,
+ bool include_symbols,
+ bool append,
+ SymbolContextList& sc_list)
{
+ if (!append)
+ sc_list.Clear();
+
+ const uint32_t start_size = sc_list.GetSize();
+
+ // Find all the functions (not symbols, but debug information functions...
SymbolVendor *symbols = GetSymbolVendor ();
if (symbols)
- return symbols->FindFunctions(name, name_type_mask, append, sc_list);
- return 0;
+ symbols->FindFunctions(name, name_type_mask, append, sc_list);
+
+ // Now check our symbol table for symbols that are code symbols if requested
+ if (include_symbols)
+ {
+ ObjectFile *objfile = GetObjectFile();
+ if (objfile)
+ {
+ Symtab *symtab = objfile->GetSymtab();
+ if (symtab)
+ {
+ std::vector<uint32_t> symbol_indexes;
+ symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes);
+ const uint32_t num_matches = symbol_indexes.size();
+ if (num_matches)
+ {
+ SymbolContext sc(this);
+ for (uint32_t i=0; i<num_matches; i++)
+ {
+ sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
+ sc_list.AppendIfUnique (sc);
+ }
+ }
+ }
+ }
+ }
+ return sc_list.GetSize() - start_size;
}
uint32_t
-Module::FindFunctions(const RegularExpression& regex, bool append, SymbolContextList& sc_list)
-{
+Module::FindFunctions (const RegularExpression& regex,
+ bool include_symbols,
+ bool append,
+ SymbolContextList& sc_list)
+{
+ if (!append)
+ sc_list.Clear();
+
+ const uint32_t start_size = sc_list.GetSize();
+
SymbolVendor *symbols = GetSymbolVendor ();
if (symbols)
return symbols->FindFunctions(regex, append, sc_list);
- return 0;
+ // Now check our symbol table for symbols that are code symbols if requested
+ if (include_symbols)
+ {
+ ObjectFile *objfile = GetObjectFile();
+ if (objfile)
+ {
+ Symtab *symtab = objfile->GetSymtab();
+ if (symtab)
+ {
+ std::vector<uint32_t> symbol_indexes;
+ symtab->AppendSymbolIndexesMatchingRegExAndType (regex, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes);
+ const uint32_t num_matches = symbol_indexes.size();
+ if (num_matches)
+ {
+ SymbolContext sc(this);
+ for (uint32_t i=0; i<num_matches; i++)
+ {
+ sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
+ sc_list.AppendIfUnique (sc);
+ }
+ }
+ }
+ }
+ }
+ return sc_list.GetSize() - start_size;
}
uint32_t
diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp
index dea3ac03bf8..7b448d4dd6d 100644
--- a/lldb/source/Core/ModuleList.cpp
+++ b/lldb/source/Core/ModuleList.cpp
@@ -141,7 +141,11 @@ ModuleList::GetModuleAtIndex(uint32_t idx)
}
size_t
-ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, bool append, SymbolContextList &sc_list)
+ModuleList::FindFunctions (const ConstString &name,
+ uint32_t name_type_mask,
+ bool include_symbols,
+ bool append,
+ SymbolContextList &sc_list)
{
if (!append)
sc_list.Clear();
@@ -150,14 +154,17 @@ ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, boo
collection::const_iterator pos, end = m_modules.end();
for (pos = m_modules.begin(); pos != end; ++pos)
{
- (*pos)->FindFunctions (name, name_type_mask, true, sc_list);
+ (*pos)->FindFunctions (name, name_type_mask, include_symbols, true, sc_list);
}
return sc_list.GetSize();
}
uint32_t
-ModuleList::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variable_list)
+ModuleList::FindGlobalVariables (const ConstString &name,
+ bool append,
+ uint32_t max_matches,
+ VariableList& variable_list)
{
size_t initial_size = variable_list.GetSize();
Mutex::Locker locker(m_modules_mutex);
@@ -171,7 +178,10 @@ ModuleList::FindGlobalVariables (const ConstString &name, bool append, uint32_t
uint32_t
-ModuleList::FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variable_list)
+ModuleList::FindGlobalVariables (const RegularExpression& regex,
+ bool append,
+ uint32_t max_matches,
+ VariableList& variable_list)
{
size_t initial_size = variable_list.GetSize();
Mutex::Locker locker(m_modules_mutex);
@@ -185,7 +195,9 @@ ModuleList::FindGlobalVariables (const RegularExpression& regex, bool append, ui
size_t
-ModuleList::FindSymbolsWithNameAndType (const ConstString &name, SymbolType symbol_type, SymbolContextList &sc_list)
+ModuleList::FindSymbolsWithNameAndType (const ConstString &name,
+ SymbolType symbol_type,
+ SymbolContextList &sc_list)
{
Mutex::Locker locker(m_modules_mutex);
sc_list.Clear();
diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp
index 5c377cf14db..9484d714d57 100644
--- a/lldb/source/Expression/ClangExpressionDeclMap.cpp
+++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp
@@ -429,8 +429,9 @@ ClangExpressionDeclMap::GetFunctionAddress
return false;
SymbolContextList sc_list;
-
- m_parser_vars->m_sym_ctx.FindFunctionsByName(name, false, sc_list);
+ const bool include_symbols = true;
+ const bool append = false;
+ m_parser_vars->m_sym_ctx.FindFunctionsByName(name, include_symbols, append, sc_list);
if (!sc_list.GetSize())
return false;
@@ -1557,7 +1558,12 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
}
else
{
- m_parser_vars->m_sym_ctx.FindFunctionsByName (name, false, sc_list);
+ const bool include_symbols = true;
+ const bool append = false;
+ m_parser_vars->m_sym_ctx.FindFunctionsByName (name,
+ include_symbols,
+ append,
+ sc_list);
bool found_specific = false;
Symbol *generic_symbol = NULL;
@@ -1590,9 +1596,9 @@ ClangExpressionDeclMap::GetDecls (NameSearchContext &context, const ConstString
if (!found_specific)
{
if (generic_symbol)
- AddOneFunction(context, NULL, generic_symbol);
+ AddOneFunction (context, NULL, generic_symbol);
else if (non_extern_symbol)
- AddOneFunction(context, NULL, non_extern_symbol);
+ AddOneFunction (context, NULL, non_extern_symbol);
}
ClangNamespaceDecl namespace_decl (m_parser_vars->m_sym_ctx.FindNamespace(name));
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f778f454fda..bb0182c6855 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -3566,17 +3566,27 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
// in the DWARF for C++ methods... Default to public for now...
if (accessibility == eAccessNone)
accessibility = eAccessPublic;
-
- clang::CXXMethodDecl *cxx_method_decl;
- cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type,
- type_name_cstr,
- clang_type,
- accessibility,
- is_virtual,
- is_static,
- is_inline,
- is_explicit);
- type_handled = cxx_method_decl != NULL;
+
+ if (!is_static && !die->HasChildren())
+ {
+ // We have a C++ member function with no children (this pointer!)
+ // and clang will get mad if we try and make a function that isn't
+ // well formed in the DWARF, so we will just skip it...
+ type_handled = true;
+ }
+ else
+ {
+ clang::CXXMethodDecl *cxx_method_decl;
+ cxx_method_decl = ast.AddMethodToCXXRecordType (class_opaque_type,
+ type_name_cstr,
+ clang_type,
+ accessibility,
+ is_virtual,
+ is_static,
+ is_inline,
+ is_explicit);
+ type_handled = cxx_method_decl != NULL;
+ }
}
}
}
diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 56141bc73c0..f524a516d61 100644
--- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -323,25 +323,11 @@ SymbolFileSymtab::FindFunctions(const ConstString &name, uint32_t name_type_mask
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolFileSymtab::FindFunctions (name = '%s')",
name.GetCString());
-
- Symtab *symtab = m_obj_file->GetSymtab();
- if (symtab)
- {
- const uint32_t start_size = sc_list.GetSize();
- std::vector<uint32_t> symbol_indexes;
- symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes);
- const uint32_t num_matches = symbol_indexes.size();
- if (num_matches)
- {
- SymbolContext sc(m_obj_file->GetModule());
- for (uint32_t i=0; i<num_matches; i++)
- {
- sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]);
- sc_list.Append(sc);
- }
- }
- return sc_list.GetSize() - start_size;
- }
+ // If we ever support finding STABS or COFF debug info symbols,
+ // we will need to add support here. We are not trying to find symbols
+ // here, just "lldb_private::Function" objects that come from complete
+ // debug information. Any symbol queries should go through the symbol
+ // table itself in the module's object file.
return 0;
}
@@ -351,7 +337,11 @@ SymbolFileSymtab::FindFunctions(const RegularExpression& regex, bool append, Sym
Timer scoped_timer (__PRETTY_FUNCTION__,
"SymbolFileSymtab::FindFunctions (regex = '%s')",
regex.GetText());
-
+ // If we ever support finding STABS or COFF debug info symbols,
+ // we will need to add support here. We are not trying to find symbols
+ // here, just "lldb_private::Function" objects that come from complete
+ // debug information. Any symbol queries should go through the symbol
+ // table itself in the module's object file.
return 0;
}
diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp
index 2f5ff3a2434..93cf560b915 100644
--- a/lldb/source/Symbol/SymbolContext.cpp
+++ b/lldb/source/Symbol/SymbolContext.cpp
@@ -345,23 +345,23 @@ SymbolContext::Dump(Stream *s, Target *target) const
bool
lldb_private::operator== (const SymbolContext& lhs, const SymbolContext& rhs)
{
- return lhs.target_sp.get() == rhs.target_sp.get() &&
- lhs.module_sp.get() == rhs.module_sp.get() &&
- lhs.comp_unit == rhs.comp_unit &&
- lhs.function == rhs.function &&
- LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0 &&
- lhs.symbol == rhs.symbol;
+ return lhs.function == rhs.function
+ && lhs.symbol == rhs.symbol
+ && lhs.module_sp.get() == rhs.module_sp.get()
+ && lhs.comp_unit == rhs.comp_unit
+ && lhs.target_sp.get() == rhs.target_sp.get()
+ && LineEntry::Compare(lhs.line_entry, rhs.line_entry) == 0;
}
bool
lldb_private::operator!= (const SymbolContext& lhs, const SymbolContext& rhs)
{
- return lhs.target_sp.get() != rhs.target_sp.get() ||
- lhs.module_sp.get() != rhs.module_sp.get() ||
- lhs.comp_unit != rhs.comp_unit ||
- lhs.function != rhs.function ||
- LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0 ||
- lhs.symbol != rhs.symbol;
+ return lhs.function != rhs.function
+ && lhs.symbol != rhs.symbol
+ && lhs.module_sp.get() != rhs.module_sp.get()
+ && lhs.comp_unit != rhs.comp_unit
+ && lhs.target_sp.get() != rhs.target_sp.get()
+ && LineEntry::Compare(lhs.line_entry, rhs.line_entry) != 0;
}
bool
@@ -410,7 +410,10 @@ SymbolContext::FindNamespace (const ConstString &name) const
}
size_t
-SymbolContext::FindFunctionsByName (const ConstString &name, bool append, SymbolContextList &sc_list) const
+SymbolContext::FindFunctionsByName (const ConstString &name,
+ bool include_symbols,
+ bool append,
+ SymbolContextList &sc_list) const
{
if (!append)
sc_list.Clear();
@@ -422,10 +425,10 @@ SymbolContext::FindFunctionsByName (const ConstString &name, bool append, Symbol
}
if (module_sp != NULL)
- module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, true, sc_list);
+ module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list);
if (target_sp)
- target_sp->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, true, sc_list);
+ target_sp->GetImages().FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list);
return sc_list.GetSize();
}
@@ -475,6 +478,19 @@ SymbolContextList::Append(const SymbolContext& sc)
m_symbol_contexts.push_back(sc);
}
+bool
+SymbolContextList::AppendIfUnique (const SymbolContext& sc)
+{
+ collection::const_iterator pos, end = m_symbol_contexts.end();
+ for (pos = m_symbol_contexts.begin(); pos != end; ++pos)
+ {
+ if (*pos == sc)
+ return false;
+ }
+ m_symbol_contexts.push_back(sc);
+ return true;
+}
+
void
SymbolContextList::Clear()
{
OpenPOWER on IntegriCloud