Author: gclayton Date: Fri Jun 3 12:59:26 2016 New Revision: 271696 URL: http://llvm.org/viewvc/llvm-project?rev=271696&view=rev Log: Add support in debug LLDB builds (if LLDB_CONFIGURATION_DEBUG is defined) where we can set an environment variable named LLDB_DWARF_DONT_COMPLETE_TYPENAMES that can contain one or more typenames separated by ';' characters. This will cause us to not complete any types whose names match and can help us to try and reproduce issues we see in bugs.
So you can launch LLDB with the environment variable: % LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz lldb Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp?rev=271696&r1=271695&r2=271696&view=diff ============================================================================== --- lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Fri Jun 3 12:59:26 2016 @@ -7,6 +7,8 @@ // //===----------------------------------------------------------------------===// +#include <stdlib.h> + #include "DWARFASTParserClang.h" #include "DWARFCompileUnit.h" #include "DWARFDebugInfo.h" @@ -2120,6 +2122,44 @@ DWARFASTParserClang::CompleteTypeFromDWA if (!die) return false; +#if defined LLDB_CONFIGURATION_DEBUG + //---------------------------------------------------------------------- + // For debugging purposes, the LLDB_DWARF_DONT_COMPLETE_TYPENAMES + // environment variable can be set with one or more typenames separated + // by ';' characters. This will cause this function to not complete any + // types whose names match. + // + // Examples of setting this environment variable: + // + // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo + // LLDB_DWARF_DONT_COMPLETE_TYPENAMES=Foo;Bar;Baz + //---------------------------------------------------------------------- + const char *dont_complete_typenames_cstr = getenv("LLDB_DWARF_DONT_COMPLETE_TYPENAMES"); + if (dont_complete_typenames_cstr && dont_complete_typenames_cstr[0]) + { + const char *die_name = die.GetName(); + if (die_name && die_name[0]) + { + const char *match = strstr(dont_complete_typenames_cstr, die_name); + if (match) + { + size_t die_name_length = strlen(die_name); + while (match) + { + const char separator_char = ';'; + const char next_char = match[die_name_length]; + if (next_char == '\0' || next_char == separator_char) + { + if (match == dont_complete_typenames_cstr || match[-1] == separator_char) + return false; + } + match = strstr(match+1, die_name); + } + } + } + } +#endif + const dw_tag_t tag = die.Tag(); Log *log = nullptr; // (LogChannelDWARF::GetLogIfAny(DWARF_LOG_DEBUG_INFO|DWARF_LOG_TYPE_COMPLETION)); _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits