diff options
author | Greg Clayton <gclayton@apple.com> | 2012-08-29 21:13:06 +0000 |
---|---|---|
committer | Greg Clayton <gclayton@apple.com> | 2012-08-29 21:13:06 +0000 |
commit | 1f7460716bcb2a0919124da96365e7deb4b4181e (patch) | |
tree | ba67de6446b4d9d1107b2a2739ddfa68f7607fb2 /lldb/source/Core | |
parent | 23793141a1ea05f443541f580ad061225fa47052 (diff) | |
download | bcm5719-llvm-1f7460716bcb2a0919124da96365e7deb4b4181e.tar.gz bcm5719-llvm-1f7460716bcb2a0919124da96365e7deb4b4181e.zip |
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
Diffstat (limited to 'lldb/source/Core')
-rw-r--r-- | lldb/source/Core/Address.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/AddressResolverFileLine.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Core/AddressResolverName.cpp | 4 | ||||
-rw-r--r-- | lldb/source/Core/ConstString.cpp | 12 | ||||
-rw-r--r-- | lldb/source/Core/Debugger.cpp | 5 | ||||
-rw-r--r-- | lldb/source/Core/Disassembler.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Core/FileLineResolver.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Core/Module.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Core/ModuleList.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Core/SearchFilter.cpp | 40 | ||||
-rw-r--r-- | lldb/source/Core/SourceManager.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Core/ValueObjectVariable.cpp | 1 |
13 files changed, 57 insertions, 19 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index d9ff36ecd40..2edd52f39b6 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -10,7 +10,9 @@ #include "lldb/Core/Address.h" #include "lldb/Core/Module.h" #include "lldb/Core/Section.h" +#include "lldb/Symbol/Block.h" #include "lldb/Symbol/ObjectFile.h" +#include "lldb/Symbol/Type.h" #include "lldb/Symbol/Variable.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" diff --git a/lldb/source/Core/AddressResolverFileLine.cpp b/lldb/source/Core/AddressResolverFileLine.cpp index 0da1feb51fc..9300f90dbc4 100644 --- a/lldb/source/Core/AddressResolverFileLine.cpp +++ b/lldb/source/Core/AddressResolverFileLine.cpp @@ -12,6 +12,8 @@ // Project includes #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" +#include "lldb/Symbol/CompileUnit.h" +#include "lldb/Symbol/SymbolContext.h" #include "lldb/lldb-private-log.h" using namespace lldb; diff --git a/lldb/source/Core/AddressResolverName.cpp b/lldb/source/Core/AddressResolverName.cpp index f1874202fec..3e7c373998b 100644 --- a/lldb/source/Core/AddressResolverName.cpp +++ b/lldb/source/Core/AddressResolverName.cpp @@ -11,8 +11,12 @@ // Project includes #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/StreamString.h" #include "lldb/Symbol/ClangNamespaceDecl.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/SymbolContext.h" +#include "lldb/Symbol/Symbol.h" #include "lldb/lldb-private-log.h" using namespace lldb; diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp index 720514bd52c..d82bc61fa91 100644 --- a/lldb/source/Core/ConstString.cpp +++ b/lldb/source/Core/ConstString.cpp @@ -100,6 +100,18 @@ public: } const char * + GetConstCStringWithStringRef (const llvm::StringRef &string_ref) + { + if (string_ref.data()) + { + Mutex::Locker locker (m_mutex); + StringPoolEntryType& entry = m_string_map.GetOrCreateValue (string_ref, (StringPoolValueType)NULL); + return entry.getKeyData(); + } + return NULL; + } + + const char * GetConstCStringAndSetMangledCounterPart (const char *demangled_cstr, const char *mangled_ccstr) { if (demangled_cstr) diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 23fbbadbace..57f63e8f454 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/DataVisualization.h" #include "lldb/Core/FormatManager.h" #include "lldb/Core/InputReader.h" +#include "lldb/Core/Module.h" #include "lldb/Core/RegisterValue.h" #include "lldb/Core/State.h" #include "lldb/Core/StreamAsynchronousIO.h" @@ -31,6 +32,10 @@ #include "lldb/Interpreter/CommandInterpreter.h" #include "lldb/Interpreter/OptionValueSInt64.h" #include "lldb/Interpreter/OptionValueString.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "lldb/Symbol/CompileUnit.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/TargetList.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 6b6b6eeeddc..124fc4ac194 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -29,6 +29,7 @@ #include "lldb/Interpreter/OptionValueString.h" #include "lldb/Interpreter/OptionValueUInt64.h" #include "lldb/Symbol/ClangNamespaceDecl.h" +#include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Core/FileLineResolver.cpp b/lldb/source/Core/FileLineResolver.cpp index 8d68df2929b..59a875cf68b 100644 --- a/lldb/source/Core/FileLineResolver.cpp +++ b/lldb/source/Core/FileLineResolver.cpp @@ -13,6 +13,7 @@ #include "lldb/lldb-private-log.h" #include "lldb/Core/Log.h" #include "lldb/Core/StreamString.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/LineTable.h" using namespace lldb; diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index b3fac25a7c4..781853088f1 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -12,11 +12,14 @@ #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Log.h" #include "lldb/Core/ModuleList.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/RegularExpression.h" +#include "lldb/Core/Section.h" #include "lldb/Core/StreamString.h" #include "lldb/Core/Timer.h" #include "lldb/Host/Host.h" #include "lldb/lldb-private-log.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/SymbolVendor.h" diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index 5507428c53e..657ee693457 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -15,6 +15,7 @@ // Project includes #include "lldb/Core/Log.h" #include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Host/Host.h" #include "lldb/Host/Symbols.h" #include "lldb/Symbol/ClangNamespaceDecl.h" diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index 9256899f196..60f7dbbe2a7 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -14,6 +14,8 @@ #include "lldb/lldb-private.h" #include "lldb/Core/SearchFilter.h" +#include "lldb/Core/Module.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Target/Target.h" using namespace lldb; @@ -368,26 +370,25 @@ SearchFilterByModule::ModulePasses (const ModuleSP &module_sp) bool SearchFilterByModule::ModulePasses (const FileSpec &spec) { - if (FileSpec::Compare(spec, m_module_spec, false) == 0) - return true; - else - return false; + // Do a full match only if "spec" has a directory + const bool full_match = spec.GetDirectory(); + return FileSpec::Equal(spec, m_module_spec, full_match); } bool -SearchFilterByModule::SymbolContextPasses -( - const SymbolContext &context, - lldb::SymbolContextItem scope - ) +SearchFilterByModule::SymbolContextPasses (const SymbolContext &sc, + lldb::SymbolContextItem scope) { - if (!(scope & eSymbolContextModule)) - return false; - - if (context.module_sp && FileSpec::Compare (context.module_sp->GetFileSpec(), m_module_spec, false) == 0) - return true; - else - return false; + if (scope & eSymbolContextModule) + { + if (sc.module_sp) + { + // Match the full path only if "m_module_spec" has a directory + const bool full_match = m_module_spec.GetDirectory(); + return FileSpec::Equal (sc.module_sp->GetFileSpec(), m_module_spec, full_match); + } + } + return false; } bool @@ -434,7 +435,8 @@ SearchFilterByModule::Search (Searcher &searcher) for (size_t i = 0; i < num_modules; i++) { Module* module = target_modules.GetModulePointerAtIndexUnlocked(i); - if (FileSpec::Compare (m_module_spec, module->GetFileSpec(), false) == 0) + const bool full_match = m_module_spec.GetDirectory(); + if (FileSpec::Equal (m_module_spec, module->GetFileSpec(), full_match)) { SymbolContext matchingContext(m_target_sp, module->shared_from_this()); Searcher::CallbackReturn shouldContinue; @@ -723,7 +725,7 @@ SearchFilterByModuleListAndCU::SymbolContextPasses return false; if (!(scope & eSymbolContextCompUnit)) return false; - if (context.comp_unit && m_cu_spec_list.FindFileIndex(0, static_cast<FileSpec>(context.comp_unit), false) == UINT32_MAX) + if (context.comp_unit && m_cu_spec_list.FindFileIndex(0, context.comp_unit, false) == UINT32_MAX) return false; return true; } @@ -745,7 +747,7 @@ SearchFilterByModuleListAndCU::CompUnitPasses (FileSpec &fileSpec) bool SearchFilterByModuleListAndCU::CompUnitPasses (CompileUnit &compUnit) { - return m_cu_spec_list.FindFileIndex(0, static_cast<FileSpec>(compUnit), false) != UINT32_MAX; + return m_cu_spec_list.FindFileIndex(0, compUnit, false) != UINT32_MAX; } void diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 849c8243e1a..a967b358cb7 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -15,8 +15,11 @@ // Project includes #include "lldb/Core/DataBuffer.h" #include "lldb/Core/Debugger.h" +#include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" #include "lldb/Symbol/ClangNamespaceDecl.h" +#include "lldb/Symbol/CompileUnit.h" +#include "lldb/Symbol/Function.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 8016bab3d2e..ed370e66c12 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -22,6 +22,7 @@ #include "lldb/Core/DataVisualization.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/StreamString.h" #include "lldb/Core/ValueObjectChild.h" #include "lldb/Core/ValueObjectConstResult.h" diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index d71ec97ce3c..20a4af078ee 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -18,6 +18,7 @@ #include "lldb/Core/ValueObjectList.h" #include "lldb/Core/Value.h" +#include "lldb/Symbol/Function.h" #include "lldb/Symbol/ObjectFile.h" #include "lldb/Symbol/SymbolContext.h" #include "lldb/Symbol/SymbolContextScope.h" |