summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/SearchFilter.h18
-rw-r--r--lldb/include/lldb/Target/Platform.h10
-rw-r--r--lldb/include/lldb/Target/Target.h49
-rw-r--r--lldb/source/Core/SearchFilter.cpp23
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp14
-rw-r--r--lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h3
-rw-r--r--lldb/source/Target/Platform.cpp1
-rw-r--r--lldb/source/Target/Target.cpp90
8 files changed, 194 insertions, 14 deletions
diff --git a/lldb/include/lldb/Core/SearchFilter.h b/lldb/include/lldb/Core/SearchFilter.h
index 715acf3971b..0101ec2862b 100644
--- a/lldb/include/lldb/Core/SearchFilter.h
+++ b/lldb/include/lldb/Core/SearchFilter.h
@@ -274,6 +274,24 @@ protected:
};
//----------------------------------------------------------------------
+/// @class SearchFilterForNonModuleSpecificSearches SearchFilter.h "lldb/Core/SearchFilter.h"
+/// @brief This is a SearchFilter that searches through all modules. It also consults the Target::ModuleIsExcludedForNonModuleSpecificSearches.
+//----------------------------------------------------------------------
+class SearchFilterForNonModuleSpecificSearches :
+ public SearchFilter
+{
+public:
+ SearchFilterForNonModuleSpecificSearches (lldb::TargetSP &targetSP) : SearchFilter(targetSP) {};
+ ~SearchFilterForNonModuleSpecificSearches () {}
+
+ virtual bool
+ ModulePasses (const FileSpec &module_spec);
+
+ virtual bool
+ ModulePasses (const lldb::ModuleSP &module_sp);
+};
+
+//----------------------------------------------------------------------
/// @class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h"
/// @brief This is a SearchFilter that restricts the search to a given module.
//----------------------------------------------------------------------
diff --git a/lldb/include/lldb/Target/Platform.h b/lldb/include/lldb/Target/Platform.h
index cc4689b4bfd..9d2e6ca2acb 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -417,7 +417,15 @@ namespace lldb_private {
m_sdk_build = sdk_build;
}
-
+ // There may be modules that we don't want to find by default for operations like "setting breakpoint by name".
+ // The platform will return "true" from this call if the passed in module happens to be one of these.
+
+ virtual bool
+ ModuleIsExcludedForNonModuleSpecificSearches (Target &target, const lldb::ModuleSP &module_sp)
+ {
+ return false;
+ }
+
protected:
bool m_is_host;
// Set to true when we are able to actually set the OS version while
diff --git a/lldb/include/lldb/Target/Target.h b/lldb/include/lldb/Target/Target.h
index cc98258a179..38410430f18 100644
--- a/lldb/include/lldb/Target/Target.h
+++ b/lldb/include/lldb/Target/Target.h
@@ -96,6 +96,12 @@ public:
{
return m_max_strlen_length;
}
+
+ bool
+ GetBreakpointsConsultPlatformAvoidList ()
+ {
+ return m_breakpoints_use_platform_avoid;
+ }
protected:
@@ -113,6 +119,7 @@ protected:
PathMappingList m_source_map;
uint32_t m_max_children_display;
uint32_t m_max_strlen_length;
+ OptionValueBoolean m_breakpoints_use_platform_avoid;
};
@@ -482,6 +489,48 @@ public:
{
return m_images;
}
+
+
+ //------------------------------------------------------------------
+ /// Return whether this FileSpec corresponds to a module that should be considered for general searches.
+ ///
+ /// This API will be consulted by the SearchFilterForNonModuleSpecificSearches
+ /// and any module that returns \b true will not be searched. Note the
+ /// SearchFilterForNonModuleSpecificSearches is the search filter that
+ /// gets used in the CreateBreakpoint calls when no modules is provided.
+ ///
+ /// The target call at present just consults the Platform's call of the
+ /// same name.
+ ///
+ /// @param[in] module_sp
+ /// A shared pointer reference to the module that checked.
+ ///
+ /// @return \b true if the module should be excluded, \b false otherwise.
+ //------------------------------------------------------------------
+ const bool
+ ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_spec);
+
+ //------------------------------------------------------------------
+ /// Return whether this module should be considered for general searches.
+ ///
+ /// This API will be consulted by the SearchFilterForNonModuleSpecificSearches
+ /// and any module that returns \b true will not be searched. Note the
+ /// SearchFilterForNonModuleSpecificSearches is the search filter that
+ /// gets used in the CreateBreakpoint calls when no modules is provided.
+ ///
+ /// The target call at present just consults the Platform's call of the
+ /// same name.
+ ///
+ /// FIXME: When we get time we should add a way for the user to set modules that they
+ /// don't want searched, in addition to or instead of the platform ones.
+ ///
+ /// @param[in] module_sp
+ /// A shared pointer reference to the module that checked.
+ ///
+ /// @return \b true if the module should be excluded, \b false otherwise.
+ //------------------------------------------------------------------
+ const bool
+ ModuleIsExcludedForNonModuleSpecificSearches (const lldb::ModuleSP &module_sp);
ArchSpec &
GetArchitecture ()
diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp
index 1fdbefe8e59..d31ed8b5818 100644
--- a/lldb/source/Core/SearchFilter.cpp
+++ b/lldb/source/Core/SearchFilter.cpp
@@ -287,6 +287,29 @@ SearchFilter::DoFunctionIteration (Function *function, const SymbolContext &cont
}
//----------------------------------------------------------------------
+// SearchFilterForNonModuleSpecificSearches:
+// Selects a shared library matching a given file spec, consulting the targets "black list".
+//----------------------------------------------------------------------
+
+ bool
+ SearchFilterForNonModuleSpecificSearches::ModulePasses (const FileSpec &module_spec)
+ {
+ if (m_target_sp->ModuleIsExcludedForNonModuleSpecificSearches (module_spec))
+ return false;
+ else
+ return true;
+ }
+
+ bool
+ SearchFilterForNonModuleSpecificSearches::ModulePasses (const lldb::ModuleSP &module_sp)
+ {
+ if (m_target_sp->ModuleIsExcludedForNonModuleSpecificSearches (module_sp))
+ return false;
+ else
+ return true;
+ }
+
+//----------------------------------------------------------------------
// SearchFilterByModule:
// Selects a shared library matching a given file spec
//----------------------------------------------------------------------
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index 93be92353ef..24344306053 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -481,4 +481,16 @@ PlatformDarwin::GetGroupName (uint32_t gid)
return NULL;
}
-
+bool
+PlatformDarwin::ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp)
+{
+ ObjectFile *obj_file = module_sp->GetObjectFile();
+ if (!obj_file)
+ return false;
+
+ ObjectFile::Type obj_type = obj_file->GetType();
+ if (obj_type == ObjectFile::eTypeDynamicLinker)
+ return true;
+ else
+ return false;
+}
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
index 38804edad18..9b3e771193e 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.h
@@ -85,6 +85,9 @@ public:
lldb_private::Listener &listener,
lldb_private::Error &error);
+ virtual bool
+ ModuleIsExcludedForNonModuleSpecificSearches (lldb_private::Target &target, const lldb::ModuleSP &module_sp);
+
protected:
lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote darwin OS
diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 6a55c62194b..0213ac61485 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -591,4 +591,3 @@ Platform::DebugProcess (ProcessLaunchInfo &launch_info,
}
return process_sp;
}
-
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp
index dbfee315cbd..367bfc8d9c8 100644
--- a/lldb/source/Target/Target.cpp
+++ b/lldb/source/Target/Target.cpp
@@ -252,7 +252,7 @@ BreakpointSP
Target::CreateBreakpoint (Address &addr, bool internal)
{
TargetSP target_sp = this->GetSP();
- SearchFilterSP filter_sp(new SearchFilter (target_sp));
+ SearchFilterSP filter_sp(new SearchFilterForNonModuleSpecificSearches (target_sp));
BreakpointResolverSP resolver_sp (new BreakpointResolverAddress (NULL, addr));
return CreateBreakpoint (filter_sp, resolver_sp, internal);
}
@@ -295,7 +295,7 @@ Target::GetSearchFilterForModule (const FileSpec *containingModule)
else
{
if (m_search_filter_sp.get() == NULL)
- m_search_filter_sp.reset (new SearchFilter (target_sp));
+ m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -315,7 +315,7 @@ Target::GetSearchFilterForModuleList (const FileSpecList *containingModules)
else
{
if (m_search_filter_sp.get() == NULL)
- m_search_filter_sp.reset (new SearchFilter (target_sp));
+ m_search_filter_sp.reset (new SearchFilterForNonModuleSpecificSearches (target_sp));
filter_sp = m_search_filter_sp;
}
return filter_sp;
@@ -934,6 +934,50 @@ Target::ModulesDidUnload (ModuleList &module_list)
BroadcastEvent (eBroadcastBitModulesUnloaded, NULL);
}
+
+const bool
+Target::ModuleIsExcludedForNonModuleSpecificSearches (const FileSpec &module_spec)
+{
+
+ if (!m_breakpoints_use_platform_avoid)
+ return false;
+ else
+ {
+ ModuleList matchingModules;
+ const ArchSpec *arch_ptr = NULL;
+ const lldb_private::UUID *uuid_ptr= NULL;
+ const ConstString *object_name = NULL;
+ size_t num_modules = GetImages().FindModules(&module_spec, arch_ptr, uuid_ptr, object_name, matchingModules);
+
+ // If there is more than one module for this file spec, only return true if ALL the modules are on the
+ // black list.
+ if (num_modules > 0)
+ {
+ for (int i = 0; i < num_modules; i++)
+ {
+ if (!ModuleIsExcludedForNonModuleSpecificSearches (matchingModules.GetModuleAtIndex(i)))
+ return false;
+ }
+ return true;
+ }
+ else
+ return false;
+ }
+}
+
+const bool
+Target::ModuleIsExcludedForNonModuleSpecificSearches (const lldb::ModuleSP &module_sp)
+{
+ if (!m_breakpoints_use_platform_avoid)
+ return false;
+ else if (GetPlatform())
+ {
+ return GetPlatform()->ModuleIsExcludedForNonModuleSpecificSearches (*this, module_sp);
+ }
+ else
+ return false;
+}
+
size_t
Target::ReadMemoryFromFileCache (const Address& addr, void *dst, size_t dst_len, Error &error)
{
@@ -1935,6 +1979,7 @@ Target::SettingsController::CreateInstanceSettings (const char *instance_name)
#define TSC_SOURCE_MAP "source-map"
#define TSC_MAX_CHILDREN "max-children-count"
#define TSC_MAX_STRLENSUMMARY "max-string-summary-length"
+#define TSC_PLATFORM_AVOID "breakpoints-use-platform-avoid-list"
static const ConstString &
@@ -1986,6 +2031,14 @@ GetSettingNameForMaxStringSummaryLength ()
return g_const_string;
}
+static const ConstString &
+GetSettingNameForPlatformAvoid ()
+{
+ static ConstString g_const_string (TSC_PLATFORM_AVOID);
+ return g_const_string;
+}
+
+
bool
Target::SettingsController::SetGlobalVariable (const ConstString &var_name,
const char *index_value,
@@ -2039,7 +2092,8 @@ TargetInstanceSettings::TargetInstanceSettings
m_skip_prologue (true, true),
m_source_map (NULL, NULL),
m_max_children_display(256),
- m_max_strlen_length(1024)
+ m_max_strlen_length(1024),
+ m_breakpoints_use_platform_avoid (true, true)
{
// CopyInstanceSettings is a pure virtual function in InstanceSettings; it therefore cannot be called
// until the vtables for TargetInstanceSettings are properly set up, i.e. AFTER all the initializers.
@@ -2067,7 +2121,8 @@ TargetInstanceSettings::TargetInstanceSettings (const TargetInstanceSettings &rh
m_skip_prologue (rhs.m_skip_prologue),
m_source_map (rhs.m_source_map),
m_max_children_display(rhs.m_max_children_display),
- m_max_strlen_length(rhs.m_max_strlen_length)
+ m_max_strlen_length(rhs.m_max_strlen_length),
+ m_breakpoints_use_platform_avoid (rhs.m_breakpoints_use_platform_avoid)
{
if (m_instance_name != InstanceSettings::GetDefaultName())
{
@@ -2214,6 +2269,10 @@ TargetInstanceSettings::UpdateInstanceSettingsVariable (const ConstString &var_n
break;
}
}
+ else if (var_name == GetSettingNameForPlatformAvoid ())
+ {
+ err = UserSettingsController::UpdateBooleanOptionValue (value, op, m_breakpoints_use_platform_avoid);
+ }
}
void
@@ -2224,12 +2283,13 @@ TargetInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &ne
if (!new_settings_ptr)
return;
- m_expr_prefix_file = new_settings_ptr->m_expr_prefix_file;
- m_expr_prefix_contents_sp = new_settings_ptr->m_expr_prefix_contents_sp;
- m_prefer_dynamic_value = new_settings_ptr->m_prefer_dynamic_value;
- m_skip_prologue = new_settings_ptr->m_skip_prologue;
- m_max_children_display = new_settings_ptr->m_max_children_display;
- m_max_strlen_length = new_settings_ptr->m_max_strlen_length;
+ m_expr_prefix_file = new_settings_ptr->m_expr_prefix_file;
+ m_expr_prefix_contents_sp = new_settings_ptr->m_expr_prefix_contents_sp;
+ m_prefer_dynamic_value = new_settings_ptr->m_prefer_dynamic_value;
+ m_skip_prologue = new_settings_ptr->m_skip_prologue;
+ m_max_children_display = new_settings_ptr->m_max_children_display;
+ m_max_strlen_length = new_settings_ptr->m_max_strlen_length;
+ m_breakpoints_use_platform_avoid = new_settings_ptr->m_breakpoints_use_platform_avoid;
}
bool
@@ -2271,6 +2331,13 @@ TargetInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
count_str.Printf ("%d", m_max_strlen_length);
value.AppendString (count_str.GetData());
}
+ else if (var_name == GetSettingNameForPlatformAvoid())
+ {
+ if (m_breakpoints_use_platform_avoid)
+ value.AppendString ("true");
+ else
+ value.AppendString ("false");
+ }
else
{
if (err)
@@ -2326,5 +2393,6 @@ Target::SettingsController::instance_settings_table[] =
{ TSC_SOURCE_MAP , eSetVarTypeArray , NULL , NULL, false, false, "Source path remappings to use when locating source files from debug information." },
{ TSC_MAX_CHILDREN , eSetVarTypeInt , "256" , NULL, true, false, "Maximum number of children to expand in any level of depth." },
{ TSC_MAX_STRLENSUMMARY , eSetVarTypeInt , "1024" , NULL, true, false, "Maximum number of characters to show when using %s in summary strings." },
+ { TSC_PLATFORM_AVOID , eSetVarTypeBoolean, "true" , NULL, false, false, "Consult the platform module avoid list when setting non-module specific breakpoints." },
{ NULL , eSetVarTypeNone , NULL , NULL, false, false, NULL }
};
OpenPOWER on IntegriCloud