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/Target | |
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/Target')
-rw-r--r-- | lldb/source/Target/ObjCLanguageRuntime.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/Platform.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Target/Process.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Target/StackFrame.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/Target.cpp | 63 | ||||
-rw-r--r-- | lldb/source/Target/TargetList.cpp | 1 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanCallFunction.cpp | 2 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanStepOut.cpp | 3 | ||||
-rw-r--r-- | lldb/source/Target/ThreadPlanTracer.cpp | 1 |
9 files changed, 71 insertions, 6 deletions
diff --git a/lldb/source/Target/ObjCLanguageRuntime.cpp b/lldb/source/Target/ObjCLanguageRuntime.cpp index db51729ee99..c41db3c7eb5 100644 --- a/lldb/source/Target/ObjCLanguageRuntime.cpp +++ b/lldb/source/Target/ObjCLanguageRuntime.cpp @@ -9,10 +9,12 @@ #include "clang/AST/Type.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/ClangASTContext.h" #include "lldb/Symbol/Type.h" +#include "lldb/Symbol/TypeList.h" #include "lldb/Target/ObjCLanguageRuntime.h" #include "lldb/Target/Target.h" diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp index 3fcd9dfe174..666daaa651d 100644 --- a/lldb/source/Target/Platform.cpp +++ b/lldb/source/Target/Platform.cpp @@ -16,6 +16,7 @@ #include "lldb/Breakpoint/BreakpointIDList.h" #include "lldb/Core/Error.h" #include "lldb/Core/Log.h" +#include "lldb/Core/ModuleSpec.h" #include "lldb/Core/PluginManager.h" #include "lldb/Host/FileSpec.h" #include "lldb/Host/Host.h" diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 454cf3a51e6..b16a37de3d1 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -18,6 +18,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/InputReader.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/State.h" #include "lldb/Expression/ClangUserExpression.h" diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 6099ed2f890..614223d97ff 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -19,7 +19,10 @@ #include "lldb/Core/Value.h" #include "lldb/Core/ValueObjectVariable.h" #include "lldb/Core/ValueObjectConstResult.h" +#include "lldb/Symbol/CompileUnit.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Symbol.h" +#include "lldb/Symbol/SymbolContextScope.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/Target/Process.h" diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 289944fe6ff..2298a1fa3a0 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -22,6 +22,9 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" +#include "lldb/Core/ModuleSpec.h" +#include "lldb/Core/Section.h" #include "lldb/Core/StreamString.h" #include "lldb/Core/Timer.h" #include "lldb/Core/ValueObject.h" @@ -226,9 +229,9 @@ Target::GetBreakpointByID (break_id_t break_id) BreakpointSP Target::CreateSourceRegexBreakpoint (const FileSpecList *containingModules, - const FileSpecList *source_file_spec_list, - RegularExpression &source_regex, - bool internal) + const FileSpecList *source_file_spec_list, + RegularExpression &source_regex, + bool internal) { SearchFilterSP filter_sp(GetSearchFilterForModuleAndCUList (containingModules, source_file_spec_list)); BreakpointResolverSP resolver_sp(new BreakpointResolverFileRegex (NULL, source_regex)); @@ -240,13 +243,37 @@ BreakpointSP Target::CreateBreakpoint (const FileSpecList *containingModules, const FileSpec &file, uint32_t line_no, - bool check_inlines, + LazyBool check_inlines, LazyBool skip_prologue, bool internal) { SearchFilterSP filter_sp(GetSearchFilterForModuleList (containingModules)); - BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL, file, line_no, check_inlines, + if (check_inlines == eLazyBoolCalculate) + { + const InlineStrategy inline_strategy = GetInlineStrategy(); + switch (inline_strategy) + { + case eInlineBreakpointsNever: + check_inlines = eLazyBoolNo; + break; + + case eInlineBreakpointsHeaders: + if (file.IsSourceImplementationFile()) + check_inlines = eLazyBoolNo; + else + check_inlines = eLazyBoolYes; + break; + + case eInlineBreakpointsAlways: + check_inlines = eLazyBoolYes; + break; + } + } + BreakpointResolverSP resolver_sp(new BreakpointResolverFileLine (NULL, + file, + line_no, + check_inlines, skip_prologue == eLazyBoolCalculate ? GetSkipPrologue() : skip_prologue)); return CreateBreakpoint (filter_sp, resolver_sp, internal); } @@ -2092,6 +2119,15 @@ lldb_private::g_dynamic_value_types[] = { 0, NULL, NULL } }; +static OptionEnumValueElement +g_inline_breakpoint_enums[] = +{ + { eInlineBreakpointsNever, "never", "Never look for inline breakpoint locations (fastest). This setting should only be used if you know that no inlining occurs in your programs."}, + { eInlineBreakpointsHeaders, "headers", "Only check for inline breakpoint locations when setting breakpoints in header files, but not when setting breakpoint in implementation source files (default)."}, + { eInlineBreakpointsAlways, "always", "Always look for inline breakpoint locations when setting file and line breakpoints (slower but most accurate)."}, + { 0, NULL, NULL } +}; + static PropertyDefinition g_properties[] = { @@ -2117,6 +2153,13 @@ g_properties[] = { "error-path" , OptionValue::eTypeFileSpec , false, 0 , NULL, NULL, "The file/path to be used by the executable program for writing its standard error." }, { "disable-aslr" , OptionValue::eTypeBoolean , false, true , NULL, NULL, "Disable Address Space Layout Randomization (ASLR)" }, { "disable-stdio" , OptionValue::eTypeBoolean , false, false , NULL, NULL, "Disable stdin/stdout for process (e.g. for a GUI application)" }, + { "inline-breakpoint-strategy" , OptionValue::eTypeEnum , false, eInlineBreakpointsHeaders , NULL, g_inline_breakpoint_enums, "The strategy to use when settings breakpoints by file and line. " + "Breakpoint locations can end up being inlined by the compiler, so that a compile unit 'a.c' might contain an inlined function from another source file. " + "Usually this is limitted to breakpoint locations from inlined functions from header or other include files, or more accurately non-implementation source files. " + "Sometimes code might #include implementation files and cause inlined breakpoint locations in inlined implementation files. " + "Always checking for inlined breakpoint locations can be expensive (memory and time), so we try to minimize the " + "times we look for inlined locations. This setting allows you to control exactly which strategy is used when settings " + "file and line breakpoints." }, { NULL , OptionValue::eTypeInvalid , false, 0 , NULL, NULL, NULL } }; enum @@ -2138,7 +2181,8 @@ enum ePropertyOutputPath, ePropertyErrorPath, ePropertyDisableASLR, - ePropertyDisableSTDIO + ePropertyDisableSTDIO, + ePropertyInlineStrategy }; @@ -2314,6 +2358,13 @@ TargetProperties::SetDisableSTDIO (bool b) m_collection_sp->SetPropertyAtIndexAsBoolean (NULL, idx, b); } +InlineStrategy +TargetProperties::GetInlineStrategy () const +{ + const uint32_t idx = ePropertyInlineStrategy; + return (InlineStrategy)m_collection_sp->GetPropertyAtIndexAsEnumeration (NULL, idx, g_properties[idx].default_uint_value); +} + bool TargetProperties::GetRunArguments (Args &args) const { diff --git a/lldb/source/Target/TargetList.cpp b/lldb/source/Target/TargetList.cpp index 850179aa4fc..94f0d7e285c 100644 --- a/lldb/source/Target/TargetList.cpp +++ b/lldb/source/Target/TargetList.cpp @@ -14,6 +14,7 @@ #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Event.h" +#include "lldb/Core/Module.h" #include "lldb/Core/State.h" #include "lldb/Core/Timer.h" #include "lldb/Host/Host.h" diff --git a/lldb/source/Target/ThreadPlanCallFunction.cpp b/lldb/source/Target/ThreadPlanCallFunction.cpp index c7ee7996b0a..0491d34a26d 100644 --- a/lldb/source/Target/ThreadPlanCallFunction.cpp +++ b/lldb/source/Target/ThreadPlanCallFunction.cpp @@ -19,7 +19,9 @@ #include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/Address.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/Stream.h" +#include "lldb/Symbol/ObjectFile.h" #include "lldb/Target/LanguageRuntime.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index 44ede3ad700..4e628e7d0b0 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -18,6 +18,9 @@ #include "lldb/Core/Log.h" #include "lldb/Core/Value.h" #include "lldb/Core/ValueObjectConstResult.h" +#include "lldb/Symbol/Block.h" +#include "lldb/Symbol/Function.h" +#include "lldb/Symbol/Type.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" #include "lldb/Target/StopInfo.h" diff --git a/lldb/source/Target/ThreadPlanTracer.cpp b/lldb/source/Target/ThreadPlanTracer.cpp index 5ae17913f50..87e5e1964fb 100644 --- a/lldb/source/Target/ThreadPlanTracer.cpp +++ b/lldb/source/Target/ThreadPlanTracer.cpp @@ -19,6 +19,7 @@ #include "lldb/Core/Debugger.h" #include "lldb/Core/Disassembler.h" #include "lldb/Core/Log.h" +#include "lldb/Core/Module.h" #include "lldb/Core/State.h" #include "lldb/Core/Value.h" #include "lldb/Symbol/TypeList.h" |