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/Symbol/CompileUnit.cpp | |
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/Symbol/CompileUnit.cpp')
-rw-r--r-- | lldb/source/Symbol/CompileUnit.cpp | 37 |
1 files changed, 32 insertions, 5 deletions
diff --git a/lldb/source/Symbol/CompileUnit.cpp b/lldb/source/Symbol/CompileUnit.cpp index ac57d88a3ae..fbcf45b72fe 100644 --- a/lldb/source/Symbol/CompileUnit.cpp +++ b/lldb/source/Symbol/CompileUnit.cpp @@ -8,8 +8,9 @@ //===----------------------------------------------------------------------===// #include "lldb/Symbol/CompileUnit.h" -#include "lldb/Symbol/LineTable.h" #include "lldb/Core/Module.h" +#include "lldb/Core/Language.h" +#include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SymbolVendor.h" #include "lldb/Symbol/VariableList.h" @@ -20,14 +21,16 @@ CompileUnit::CompileUnit (const lldb::ModuleSP &module_sp, void *user_data, cons ModuleChild(module_sp), FileSpec (pathname, false), UserID(cu_sym_id), - Language (language), m_user_data (user_data), + m_language (language), m_flags (0), m_functions (), m_support_files (), m_line_table_ap (), m_variables() { + if (language != eLanguageTypeUnknown) + m_flags.Set(flagsParsedLanguage); assert(module_sp); } @@ -35,14 +38,16 @@ CompileUnit::CompileUnit (const lldb::ModuleSP &module_sp, void *user_data, cons ModuleChild(module_sp), FileSpec (fspec), UserID(cu_sym_id), - Language (language), m_user_data (user_data), + m_language (language), m_flags (0), m_functions (), m_support_files (), m_line_table_ap (), m_variables() { + if (language != eLanguageTypeUnknown) + m_flags.Set(flagsParsedLanguage); assert(module_sp); } @@ -80,7 +85,8 @@ CompileUnit::DumpSymbolContext(Stream *s) void CompileUnit::GetDescription(Stream *s, lldb::DescriptionLevel level) const { - *s << "id = " << (const UserID&)*this << ", file = \"" << (const FileSpec&)*this << "\", language = \"" << (const Language&)*this << '"'; + Language language(m_language); + *s << "id = " << (const UserID&)*this << ", file = \"" << (const FileSpec&)*this << "\", language = \"" << language << '"'; } @@ -208,6 +214,26 @@ CompileUnit::FindFunctionByUID (lldb::user_id_t func_uid) } +lldb::LanguageType +CompileUnit::GetLanguage() +{ + if (m_language == eLanguageTypeUnknown) + { + if (m_flags.IsClear(flagsParsedLanguage)) + { + m_flags.Set(flagsParsedLanguage); + SymbolVendor* symbol_vendor = GetModule()->GetSymbolVendor(); + if (symbol_vendor) + { + SymbolContext sc; + CalculateSymbolContext(&sc); + m_language = symbol_vendor->ParseCompileUnitLanguage(sc); + } + } + } + return m_language; +} + LineTable* CompileUnit::GetLineTable() { @@ -298,7 +324,8 @@ CompileUnit::ResolveSymbolContext // "file_spec" has an empty directory, then only compare the basenames // when finding file indexes std::vector<uint32_t> file_indexes; - bool file_spec_matches_cu_file_spec = FileSpec::Equal(file_spec, *this, !file_spec.GetDirectory().IsEmpty()); + const bool full_match = file_spec.GetDirectory(); + bool file_spec_matches_cu_file_spec = FileSpec::Equal(file_spec, *this, full_match); // If we are not looking for inlined functions and our file spec doesn't // match then we are done... |