summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2012-08-29 21:13:06 +0000
committerGreg Clayton <gclayton@apple.com>2012-08-29 21:13:06 +0000
commit1f7460716bcb2a0919124da96365e7deb4b4181e (patch)
treeba67de6446b4d9d1107b2a2739ddfa68f7607fb2 /lldb/source/Host
parent23793141a1ea05f443541f580ad061225fa47052 (diff)
downloadbcm5719-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/Host')
-rw-r--r--lldb/source/Host/common/FileSpec.cpp41
-rw-r--r--lldb/source/Host/macosx/Symbols.cpp1
2 files changed, 33 insertions, 9 deletions
diff --git a/lldb/source/Host/common/FileSpec.cpp b/lldb/source/Host/common/FileSpec.cpp
index 2a6e339a322..0faa274a47f 100644
--- a/lldb/source/Host/common/FileSpec.cpp
+++ b/lldb/source/Host/common/FileSpec.cpp
@@ -28,6 +28,7 @@
#include "lldb/Host/FileSpec.h"
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/DataBufferMemoryMap.h"
+#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Stream.h"
#include "lldb/Host/Host.h"
#include "lldb/Utility/CleanUp.h"
@@ -702,15 +703,14 @@ FileSpec::GetPath(char *path, size_t path_max_len) const
ConstString
FileSpec::GetFileNameExtension () const
{
- const char *filename = m_filename.GetCString();
- if (filename == NULL)
- return ConstString();
-
- const char* dot_pos = strrchr(filename, '.');
- if (dot_pos == NULL)
- return ConstString();
-
- return ConstString(dot_pos+1);
+ if (m_filename)
+ {
+ const char *filename = m_filename.GetCString();
+ const char* dot_pos = strrchr(filename, '.');
+ if (dot_pos && dot_pos[1] != '\0')
+ return ConstString(dot_pos+1);
+ }
+ return ConstString();
}
ConstString
@@ -944,3 +944,26 @@ FileSpec::EnumerateDirectory
return eEnumerateDirectoryResultNext;
}
+//------------------------------------------------------------------
+/// Returns true if the filespec represents an implementation source
+/// file (files with a ".c", ".cpp", ".m", ".mm" (many more)
+/// extension).
+///
+/// @return
+/// \b true if the filespec represents an implementation source
+/// file, \b false otherwise.
+//------------------------------------------------------------------
+bool
+FileSpec::IsSourceImplementationFile () const
+{
+ ConstString extension (GetFileNameExtension());
+ if (extension)
+ {
+ static RegularExpression g_source_file_regex ("^(c|m|mm|cpp|c\\+\\+|cxx|cc|cp|s|asm|f|f77|f90|f95|f03|for|ftn|fpp|ada|adb|ads)$",
+ REG_EXTENDED | REG_ICASE);
+ return g_source_file_regex.Execute (extension.GetCString());
+ }
+ return false;
+}
+
+
diff --git a/lldb/source/Host/macosx/Symbols.cpp b/lldb/source/Host/macosx/Symbols.cpp
index 9274decda0e..eb7341d6dad 100644
--- a/lldb/source/Host/macosx/Symbols.cpp
+++ b/lldb/source/Host/macosx/Symbols.cpp
@@ -22,6 +22,7 @@
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/Module.h"
+#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/UUID.h"
OpenPOWER on IntegriCloud