aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/SymbolFile
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-16 16:04:10 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-16 16:04:10 +0000
commit74a628f776edb588bff8f8f5cc16eac947c9d631 (patch)
treedc32e010ac4902621e5a279bfeb48628f7f0e166 /source/Plugins/SymbolFile
parentafed7be32164a598f8172282c249af7266c48b46 (diff)
downloadsrc-74a628f776edb588bff8f8f5cc16eac947c9d631.tar.gz
src-74a628f776edb588bff8f8f5cc16eac947c9d631.zip
Vendor import of lldb trunk r300422:vendor/lldb/lldb-trunk-r300422
Notes
Notes: svn path=/vendor/lldb/dist/; revision=317027 svn path=/vendor/lldb/lldb-trunk-r300422/; revision=317028; tag=vendor/lldb/lldb-trunk-r300422
Diffstat (limited to 'source/Plugins/SymbolFile')
-rw-r--r--source/Plugins/SymbolFile/DWARF/CMakeLists.txt18
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp22
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h4
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp8
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp47
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp4
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h3
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp10
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp19
-rw-r--r--source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h2
-rw-r--r--source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp212
-rw-r--r--source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h47
-rw-r--r--source/Plugins/SymbolFile/DWARF/NameToDIE.cpp8
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp22
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h8
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp2
-rw-r--r--source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h1
-rw-r--r--source/Plugins/SymbolFile/PDB/CMakeLists.txt15
-rw-r--r--source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp118
-rw-r--r--source/Plugins/SymbolFile/PDB/SymbolFilePDB.h2
-rw-r--r--source/Plugins/SymbolFile/Symtab/CMakeLists.txt6
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp3
-rw-r--r--source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h1
36 files changed, 181 insertions, 433 deletions
diff --git a/source/Plugins/SymbolFile/DWARF/CMakeLists.txt b/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
index 5ce20cc0989c..fb468440f9e0 100644
--- a/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
+++ b/source/Plugins/SymbolFile/DWARF/CMakeLists.txt
@@ -1,4 +1,4 @@
-add_lldb_library(lldbPluginSymbolFileDWARF
+add_lldb_library(lldbPluginSymbolFileDWARF PLUGIN
DIERef.cpp
DWARFAbbreviationDeclaration.cpp
DWARFASTParserClang.cpp
@@ -32,4 +32,20 @@ add_lldb_library(lldbPluginSymbolFileDWARF
SymbolFileDWARFDwo.cpp
SymbolFileDWARFDebugMap.cpp
UniqueDWARFASTType.cpp
+
+ LINK_LIBS
+ clangAST
+ clangBasic
+ lldbCore
+ lldbExpression
+ lldbHost
+ lldbInterpreter
+ lldbSymbol
+ lldbTarget
+ lldbUtility
+ lldbPluginObjCLanguage
+ lldbPluginCPlusPlusLanguage
+ lldbPluginExpressionParserClang
+ LINK_COMPONENTS
+ Support
)
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index c064d61d71d4..e2902d5ef787 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -21,9 +21,7 @@
#include "UniqueDWARFASTType.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Core/Value.h"
#include "lldb/Host/Host.h"
#include "lldb/Interpreter/Args.h"
@@ -38,6 +36,8 @@
#include "lldb/Symbol/TypeMap.h"
#include "lldb/Target/Language.h"
#include "lldb/Utility/LLDBAssert.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/StreamString.h"
#include "clang/AST/DeclCXX.h"
#include "clang/AST/DeclObjC.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp b/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
index 0cf7ff2b938f..2e5be393dea2 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.cpp
@@ -2,14 +2,14 @@
#include "DWARFASTParserOCaml.h"
-#include "lldb/Core/Error.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Utility/Error.h"
+#include "lldb/Utility/Log.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 6d3ff8e35910..ef499a6d5615 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -10,15 +10,16 @@
#include "DWARFCompileUnit.h"
#include "Plugins/Language/ObjC/ObjCLanguage.h"
+#include "lldb/Core/DumpDataExtractor.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/Module.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/StringConvert.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
#include "DWARFDIECollection.h"
#include "DWARFDebugAbbrev.h"
@@ -256,16 +257,15 @@ size_t DWARFCompileUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
m_die_array.end());
exact_size_die_array.swap(m_die_array);
}
- Log *verbose_log(
- LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO | DWARF_LOG_VERBOSE));
- if (verbose_log) {
+ Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
+ if (log && log->GetVerbose()) {
StreamString strm;
Dump(&strm);
if (m_die_array.empty())
strm.Printf("error: no DIE for compile unit");
else
m_die_array[0].Dump(m_dwarf2Data, this, strm, UINT32_MAX);
- verbose_log->PutString(strm.GetString());
+ log->PutString(strm.GetString());
}
if (!m_dwo_symbol_file)
@@ -324,18 +324,14 @@ bool DWARFCompileUnit::Verify(Stream *s) const {
bool abbr_offset_OK =
m_dwarf2Data->get_debug_abbrev_data().ValidOffset(GetAbbrevOffset());
bool addr_size_OK = ((m_addr_size == 4) || (m_addr_size == 8));
- bool verbose = s->GetVerbose();
if (valid_offset && length_OK && version_OK && addr_size_OK &&
abbr_offset_OK) {
- if (verbose)
- s->Printf(" 0x%8.8x: OK\n", m_offset);
return true;
} else {
s->Printf(" 0x%8.8x: ", m_offset);
-
- m_dwarf2Data->get_debug_info_data().Dump(s, m_offset, lldb::eFormatHex, 1,
- Size(), 32, LLDB_INVALID_ADDRESS,
- 0, 0);
+ DumpDataExtractor(m_dwarf2Data->get_debug_info_data(), s, m_offset,
+ lldb::eFormatHex, 1, Size(), 32, LLDB_INVALID_ADDRESS, 0,
+ 0);
s->EOL();
if (valid_offset) {
if (!length_OK)
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
index 5fb63589591e..1e5bf619f798 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDIECollection.cpp
@@ -11,7 +11,7 @@
#include <algorithm>
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb_private;
using namespace std;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h b/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
index 62ddbe8ecd5a..46d09f1ca237 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
@@ -11,12 +11,12 @@
#define liblldb_DWARFDataExtractor_h_
// Other libraries and framework includes.
-#include "lldb/Core/DataExtractor.h"
#include "lldb/Core/dwarf.h"
+#include "lldb/Utility/DataExtractor.h"
namespace lldb_private {
-class DWARFDataExtractor : public lldb_private::DataExtractor {
+class DWARFDataExtractor : public DataExtractor {
public:
DWARFDataExtractor() : DataExtractor(), m_is_dwarf64(false) {}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
index fe6df913b762..d681925daeac 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugAbbrev.cpp
@@ -9,7 +9,7 @@
#include "DWARFDebugAbbrev.h"
#include "DWARFDataExtractor.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
index 06b46f0569eb..cecb69c8fb46 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp
@@ -10,7 +10,7 @@
#include "DWARFDebugArangeSet.h"
#include "SymbolFileDWARF.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
#include <assert.h>
using namespace lldb_private;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index 5e71e9dfcbb3..d571c512658e 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -14,9 +14,9 @@
#include <algorithm>
-#include "lldb/Core/Log.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/Timer.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/Stream.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugInfo.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 9dc656d79326..eff9850d435d 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -12,10 +12,10 @@
#include <algorithm>
#include <set>
-#include "lldb/Core/RegularExpression.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Host/PosixApi.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugAranges.h"
@@ -430,10 +430,6 @@ static dw_offset_t DumpCallback(SymbolFileDWARF *dwarf2Data,
} else {
// See if the DIE is in this compile unit?
if (cu && dumpInfo->die_offset < cu->GetNextCompileUnitOffset()) {
- // This DIE is in this compile unit!
- if (s->GetVerbose())
- cu->Dump(s); // Dump the compile unit for the DIE in verbose mode
-
return next_offset;
// // We found our compile unit that contains our DIE, just skip to
// dumping the requested DIE...
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
index a05a8886bb48..be4e18b12be0 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.h
@@ -15,7 +15,7 @@
#include "DWARFDIE.h"
#include "SymbolFileDWARF.h"
-#include "lldb/lldb-private.h"
+#include "lldb/Core/STLUtils.h"
#include "lldb/lldb-private.h"
typedef std::multimap<const char *, dw_offset_t, CStringCompareFunctionObject>
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index a824c4ac6afe..e00eda4f35c5 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -14,9 +14,9 @@
#include <algorithm>
#include "lldb/Core/Module.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/Stream.h"
#include "DWARFCompileUnit.h"
#include "DWARFDIECollection.h"
@@ -666,13 +666,9 @@ void DWARFDebugInfoEntry::DumpAttribute(
SymbolFileDWARF *dwarf2Data, const DWARFCompileUnit *cu,
const DWARFDataExtractor &debug_info_data, lldb::offset_t *offset_ptr,
Stream &s, dw_attr_t attr, dw_form_t form) {
- bool verbose = s.GetVerbose();
bool show_form = s.GetFlags().Test(DWARFDebugInfo::eDumpFlag_ShowForm);
- if (verbose)
- s.Offset(*offset_ptr);
- else
- s.Printf(" ");
+ s.Printf(" ");
s.Indent(DW_AT_value_to_name(attr));
if (show_form) {
@@ -694,35 +690,18 @@ void DWARFDebugInfoEntry::DumpAttribute(
s.PutCString("( ");
- // Always dump form value if verbose is enabled
- if (verbose) {
- form_value.Dump(s);
- }
-
// Check to see if we have any special attribute formatters
switch (attr) {
case DW_AT_stmt_list:
- if (verbose)
- s.PutCString(" ( ");
s.Printf("0x%8.8" PRIx64, form_value.Unsigned());
- if (verbose)
- s.PutCString(" )");
break;
case DW_AT_language:
- if (verbose)
- s.PutCString(" ( ");
s.PutCString(DW_LANG_value_to_name(form_value.Unsigned()));
- if (verbose)
- s.PutCString(" )");
break;
case DW_AT_encoding:
- if (verbose)
- s.PutCString(" ( ");
s.PutCString(DW_ATE_value_to_name(form_value.Unsigned()));
- if (verbose)
- s.PutCString(" )");
break;
case DW_AT_frame_base:
@@ -730,32 +709,20 @@ void DWARFDebugInfoEntry::DumpAttribute(
case DW_AT_data_member_location: {
const uint8_t *blockData = form_value.BlockData();
if (blockData) {
- if (!verbose)
- form_value.Dump(s);
-
// Location description is inlined in data in the form value
DWARFDataExtractor locationData(debug_info_data,
(*offset_ptr) - form_value.Unsigned(),
form_value.Unsigned());
- if (verbose)
- s.PutCString(" ( ");
DWARFExpression::PrintDWARFExpression(
s, locationData, DWARFCompileUnit::GetAddressByteSize(cu), 4, false);
- if (verbose)
- s.PutCString(" )");
} else {
// We have a location list offset as the value that is
// the offset into the .debug_loc section that describes
// the value over it's lifetime
uint64_t debug_loc_offset = form_value.Unsigned();
if (dwarf2Data) {
- if (!verbose)
- form_value.Dump(s);
DWARFExpression::PrintDWARFLocationList(
s, cu, dwarf2Data->get_debug_loc_data(), debug_loc_offset);
- } else {
- if (!verbose)
- form_value.Dump(s);
}
}
} break;
@@ -765,25 +732,17 @@ void DWARFDebugInfoEntry::DumpAttribute(
uint64_t abstract_die_offset = form_value.Reference();
form_value.Dump(s);
// *ostrm_ptr << HEX32 << abstract_die_offset << " ( ";
- if (verbose)
- s.PutCString(" ( ");
GetName(dwarf2Data, cu, abstract_die_offset, s);
- if (verbose)
- s.PutCString(" )");
} break;
case DW_AT_type: {
uint64_t type_die_offset = form_value.Reference();
- if (!verbose)
- form_value.Dump(s);
s.PutCString(" ( ");
AppendTypeName(dwarf2Data, cu, type_die_offset, s);
s.PutCString(" )");
} break;
case DW_AT_ranges: {
- if (!verbose)
- form_value.Dump(s);
lldb::offset_t ranges_offset = form_value.Unsigned();
dw_addr_t base_addr = cu ? cu->GetBaseAddress() : 0;
if (dwarf2Data)
@@ -792,8 +751,6 @@ void DWARFDebugInfoEntry::DumpAttribute(
} break;
default:
- if (!verbose)
- form_value.Dump(s);
break;
}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index bce21c44b73e..077675be2271 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -13,10 +13,10 @@
#include <assert.h>
#include "lldb/Core/FileSpecList.h"
-#include "lldb/Core/Log.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Timer.h"
#include "lldb/Host/Host.h"
+#include "lldb/Utility/Log.h"
#include "LogChannelDWARF.h"
#include "SymbolFileDWARF.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp
index d56463039a19..19074b8865ff 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfo.cpp
@@ -12,7 +12,7 @@
#include "DWARFDebugMacinfoEntry.h"
#include "SymbolFileDWARF.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb_private;
using namespace std;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp
index 45498590236f..f078fbd44f2f 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugMacinfoEntry.cpp
@@ -9,7 +9,7 @@
#include "DWARFDebugMacinfoEntry.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
using namespace lldb_private;
using namespace std;
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
index d4281bac79a1..81e27f2bc95e 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
@@ -9,8 +9,8 @@
#include "DWARFDebugPubnames.h"
-#include "lldb/Core/Stream.h"
#include "lldb/Core/Timer.h"
+#include "lldb/Utility/Stream.h"
#include "DWARFCompileUnit.h"
#include "DWARFDIECollection.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
index 4518d65811b5..21e2482783a1 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.cpp
@@ -9,8 +9,8 @@
#include "DWARFDebugPubnamesSet.h"
-#include "lldb/Core/Log.h"
-#include "lldb/Core/RegularExpression.h"
+#include "lldb/Utility/Log.h"
+#include "lldb/Utility/RegularExpression.h"
#include "SymbolFileDWARF.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h
index 9654ee3d6da7..6e7d3f38aa85 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h
@@ -11,6 +11,7 @@
#define SymbolFileDWARF_DWARFDebugPubnamesSet_h_
#include "SymbolFileDWARF.h"
+#include <map>
#include <string>
#include <vector>
#if __cplusplus >= 201103L || defined(_MSC_VER)
@@ -19,6 +20,8 @@
#include <ext/hash_map>
#endif
+#include "lldb/Core/STLUtils.h"
+
class DWARFDebugPubnamesSet {
public:
struct Header {
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
index ef3566855298..515c083fedb0 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -9,7 +9,7 @@
#include "DWARFDebugRanges.h"
#include "SymbolFileDWARF.h"
-#include "lldb/Core/Stream.h"
+#include "lldb/Utility/Stream.h"
#include <assert.h>
using namespace lldb_private;
@@ -82,7 +82,6 @@ void DWARFDebugRanges::Dump(Stream &s,
lldb::offset_t *offset_ptr,
dw_addr_t cu_base_addr) {
uint32_t addr_size = s.GetAddressByteSize();
- bool verbose = s.GetVerbose();
dw_addr_t base_addr = cu_base_addr;
while (
@@ -95,10 +94,6 @@ void DWARFDebugRanges::Dump(Stream &s,
begin = LLDB_INVALID_ADDRESS;
s.Indent();
- if (verbose) {
- s.AddressRange(begin, end, sizeof(dw_addr_t), " offsets = ");
- }
-
if (begin == 0 && end == 0) {
s.PutCString(" End");
break;
@@ -111,8 +106,7 @@ void DWARFDebugRanges::Dump(Stream &s,
dw_addr_t begin_addr = begin + base_addr;
dw_addr_t end_addr = end + base_addr;
- s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t),
- verbose ? " ==> addrs = " : NULL);
+ s.AddressRange(begin_addr, end_addr, sizeof(dw_addr_t), NULL);
}
}
}
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h b/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
index 0d0a5a317262..1f3c59768fdf 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -15,7 +15,7 @@
#include <string>
#include <vector>
// Other libraries and framework includes
-#include "lldb/Core/ConstString.h"
+#include "lldb/Utility/ConstString.h"
// Project includes
#include "DWARFDefines.h"
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp b/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
index c5260bb1cb1a..f0d66720c55c 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp
@@ -8,7 +8,7 @@
//===----------------------------------------------------------------------===//
#include "DWARFDefines.h"
-#include "lldb/Core/ConstString.h"
+#include "lldb/Utility/ConstString.h"
#include <cstdio>
#include <cstring>
#include <string>
diff --git a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
index 39c52a8a5e57..0853671ee874 100644
--- a/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
+++ b/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
@@ -9,8 +9,8 @@
#include <assert.h>
-#include "lldb/Core/Stream.h"
#include "lldb/Core/dwarf.h"
+#include "lldb/Utility/Stream.h"
#include "DWARFCompileUnit.h"
#include "DWARFFormValue.h"
@@ -406,8 +406,6 @@ void DWARFFormValue::Dump(Stream &s) const {
uint64_t uvalue = Unsigned();
bool cu_relative_offset = false;
- bool verbose = s.GetVerbose();
-
switch (m_form) {
case DW_FORM_addr:
s.Address(uvalue, sizeof(uint64_t));
@@ -476,8 +474,6 @@ void DWARFFormValue::Dump(Stream &s) const {
case DW_FORM_strp: {
const char *dbg_str = AsCString();
if (dbg_str) {
- if (verbose)
- s.Printf(" .debug_str[0x%8.8x] = ", (uint32_t)uvalue);
s.QuotedCString(dbg_str);
} else {
s.PutHex32(uvalue);
@@ -496,28 +492,18 @@ void DWARFFormValue::Dump(Stream &s) const {
}
case DW_FORM_ref1:
cu_relative_offset = true;
- if (verbose)
- s.Printf("cu + 0x%2.2x", (uint8_t)uvalue);
break;
case DW_FORM_ref2:
cu_relative_offset = true;
- if (verbose)
- s.Printf("cu + 0x%4.4x", (uint16_t)uvalue);
break;
case DW_FORM_ref4:
cu_relative_offset = true;
- if (verbose)
- s.Printf("cu + 0x%4.4x", (uint32_t)uvalue);
break;
case DW_FORM_ref8:
cu_relative_offset = true;
- if (verbose)
- s.Printf("cu + 0x%8.8" PRIx64, uvalue);
break;
case DW_FORM_ref_udata:
cu_relative_offset = true;
- if (verbose)
- s.Printf("cu + 0x%" PRIx64, uvalue);
break;
// All DW_FORM_indirect attributes should be resolved prior to calling this
@@ -535,9 +521,6 @@ void DWARFFormValue::Dump(Stream &s) const {
if (cu_relative_offset) {
assert(m_cu); // CU must be valid for DW_FORM_ref forms that are compile
// unit relative or we will get this wrong
- if (verbose)
- s.PutCString(" => ");
-
s.Printf("{0x%8.8" PRIx64 "}", uvalue + m_cu->GetOffset());
}
}
diff --git a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
index c1cb30b60045..959517529e52 100644
--- a/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
+++ b/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h
@@ -13,8 +13,8 @@
#include <vector>
#include "lldb/Core/MappedHash.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/dwarf.h"
+#include "lldb/Utility/RegularExpression.h"
#include "lldb/lldb-defines.h"
#include "DWARFDefines.h"
diff --git a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
index 1385e3dd28de..0b06713f9543 100644
--- a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
@@ -9,195 +9,35 @@
#include "LogChannelDWARF.h"
-#include "SymbolFileDWARF.h"
-#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/StreamFile.h"
-#include "lldb/Interpreter/Args.h"
-
-using namespace lldb;
using namespace lldb_private;
-// when the one and only logging channel is enabled, then this will be non NULL.
-static LogChannelDWARF *g_log_channel = NULL;
-
-LogChannelDWARF::LogChannelDWARF() : LogChannel() {}
-
-LogChannelDWARF::~LogChannelDWARF() {}
+static constexpr Log::Category g_categories[] = {
+ {{"aranges"},
+ {"log the parsing of .debug_aranges"},
+ DWARF_LOG_DEBUG_ARANGES},
+ {{"comp"},
+ {"log insertions of object files into DWARF debug maps"},
+ DWARF_LOG_TYPE_COMPLETION},
+ {{"info"}, {"log the parsing of .debug_info"}, DWARF_LOG_DEBUG_INFO},
+ {{"line"}, {"log the parsing of .debug_line"}, DWARF_LOG_DEBUG_LINE},
+ {{"lookups"},
+ {"log any lookups that happen by name, regex, or address"},
+ DWARF_LOG_LOOKUPS},
+ {{"map"},
+ {"log struct/unions/class type completions"},
+ DWARF_LOG_DEBUG_MAP},
+ {{"pubnames"},
+ {"log the parsing of .debug_pubnames"},
+ DWARF_LOG_DEBUG_PUBNAMES},
+ {{"pubtypes"},
+ {"log the parsing of .debug_pubtypes"},
+ DWARF_LOG_DEBUG_PUBTYPES},
+};
+
+Log::Channel LogChannelDWARF::g_channel(g_categories, DWARF_LOG_DEFAULT);
void LogChannelDWARF::Initialize() {
- PluginManager::RegisterPlugin(GetPluginNameStatic(),
- GetPluginDescriptionStatic(),
- LogChannelDWARF::CreateInstance);
-}
-
-void LogChannelDWARF::Terminate() {
- PluginManager::UnregisterPlugin(LogChannelDWARF::CreateInstance);
-}
-
-LogChannel *LogChannelDWARF::CreateInstance() { return new LogChannelDWARF(); }
-
-lldb_private::ConstString LogChannelDWARF::GetPluginNameStatic() {
- return SymbolFileDWARF::GetPluginNameStatic();
-}
-
-const char *LogChannelDWARF::GetPluginDescriptionStatic() {
- return "DWARF log channel for debugging plug-in issues.";
-}
-
-lldb_private::ConstString LogChannelDWARF::GetPluginName() {
- return GetPluginNameStatic();
+ Log::Register("dwarf", g_channel);
}
-uint32_t LogChannelDWARF::GetPluginVersion() { return 1; }
-
-void LogChannelDWARF::Delete() { g_log_channel = NULL; }
-
-void LogChannelDWARF::Disable(const char **categories, Stream *feedback_strm) {
- if (m_log_ap.get() == NULL)
- return;
-
- uint32_t flag_bits = m_log_ap->GetMask().Get();
- for (size_t i = 0; categories[i] != NULL; ++i) {
- const char *arg = categories[i];
-
- if (::strcasecmp(arg, "all") == 0)
- flag_bits &= ~DWARF_LOG_ALL;
- else if (::strcasecmp(arg, "info") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_INFO;
- else if (::strcasecmp(arg, "line") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_LINE;
- else if (::strcasecmp(arg, "pubnames") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_PUBNAMES;
- else if (::strcasecmp(arg, "pubtypes") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_PUBTYPES;
- else if (::strcasecmp(arg, "aranges") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_ARANGES;
- else if (::strcasecmp(arg, "lookups") == 0)
- flag_bits &= ~DWARF_LOG_LOOKUPS;
- else if (::strcasecmp(arg, "map") == 0)
- flag_bits &= ~DWARF_LOG_DEBUG_MAP;
- else if (::strcasecmp(arg, "default") == 0)
- flag_bits &= ~DWARF_LOG_DEFAULT;
- else if (::strcasecmp(arg, "verbose") == 0)
- flag_bits &= ~DWARF_LOG_VERBOSE;
- else if (::strncasecmp(arg, "comp", 4) == 0)
- flag_bits &= ~DWARF_LOG_TYPE_COMPLETION;
- else {
- feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
- ListCategories(feedback_strm);
- }
- }
-
- if (flag_bits == 0)
- Delete();
- else
- m_log_ap->GetMask().Reset(flag_bits);
-
- return;
-}
-
-bool LogChannelDWARF::Enable(
- StreamSP &log_stream_sp, uint32_t log_options,
- Stream *feedback_strm, // Feedback stream for argument errors etc
- const char **categories // The categories to enable within this logging
- // stream, if empty, enable default set
- ) {
- Delete();
-
- if (m_log_ap)
- m_log_ap->SetStream(log_stream_sp);
- else
- m_log_ap.reset(new Log(log_stream_sp));
-
- g_log_channel = this;
- uint32_t flag_bits = 0;
- bool got_unknown_category = false;
- for (size_t i = 0; categories[i] != NULL; ++i) {
- const char *arg = categories[i];
-
- if (::strcasecmp(arg, "all") == 0)
- flag_bits |= DWARF_LOG_ALL;
- else if (::strcasecmp(arg, "info") == 0)
- flag_bits |= DWARF_LOG_DEBUG_INFO;
- else if (::strcasecmp(arg, "line") == 0)
- flag_bits |= DWARF_LOG_DEBUG_LINE;
- else if (::strcasecmp(arg, "pubnames") == 0)
- flag_bits |= DWARF_LOG_DEBUG_PUBNAMES;
- else if (::strcasecmp(arg, "pubtypes") == 0)
- flag_bits |= DWARF_LOG_DEBUG_PUBTYPES;
- else if (::strcasecmp(arg, "aranges") == 0)
- flag_bits |= DWARF_LOG_DEBUG_ARANGES;
- else if (::strcasecmp(arg, "lookups") == 0)
- flag_bits |= DWARF_LOG_LOOKUPS;
- else if (::strcasecmp(arg, "map") == 0)
- flag_bits |= DWARF_LOG_DEBUG_MAP;
- else if (::strcasecmp(arg, "default") == 0)
- flag_bits |= DWARF_LOG_DEFAULT;
- else if (::strcasecmp(arg, "verbose") == 0)
- flag_bits |= DWARF_LOG_VERBOSE;
- else if (::strncasecmp(arg, "comp", 4) == 0)
- flag_bits |= DWARF_LOG_TYPE_COMPLETION;
- else {
- feedback_strm->Printf("error: unrecognized log category '%s'\n", arg);
- if (got_unknown_category == false) {
- got_unknown_category = true;
- ListCategories(feedback_strm);
- }
- }
- }
- if (flag_bits == 0)
- flag_bits = DWARF_LOG_DEFAULT;
- m_log_ap->GetMask().Reset(flag_bits);
- m_log_ap->GetOptions().Reset(log_options);
- return m_log_ap.get() != NULL;
-}
-
-void LogChannelDWARF::ListCategories(Stream *strm) {
- strm->Printf(
- "Logging categories for '%s':\n"
- " all - turn on all available logging categories\n"
- " info - log the parsing of .debug_info\n"
- " line - log the parsing of .debug_line\n"
- " pubnames - log the parsing of .debug_pubnames\n"
- " pubtypes - log the parsing of .debug_pubtypes\n"
- " aranges - log the parsing of .debug_aranges\n"
- " lookups - log any lookups that happen by name, regex, or address\n"
- " completion - log struct/unions/class type completions\n"
- " map - log insertions of object files into DWARF debug maps\n",
- SymbolFileDWARF::GetPluginNameStatic().GetCString());
-}
-
-Log *LogChannelDWARF::GetLog() {
- if (g_log_channel)
- return g_log_channel->m_log_ap.get();
-
- return NULL;
-}
-
-Log *LogChannelDWARF::GetLogIfAll(uint32_t mask) {
- if (g_log_channel && g_log_channel->m_log_ap.get()) {
- if (g_log_channel->m_log_ap->GetMask().AllSet(mask))
- return g_log_channel->m_log_ap.get();
- }
- return NULL;
-}
-
-Log *LogChannelDWARF::GetLogIfAny(uint32_t mask) {
- if (g_log_channel && g_log_channel->m_log_ap.get()) {
- if (g_log_channel->m_log_ap->GetMask().AnySet(mask))
- return g_log_channel->m_log_ap.get();
- }
- return NULL;
-}
-
-void LogChannelDWARF::LogIf(uint32_t mask, const char *format, ...) {
- if (g_log_channel) {
- Log *log = g_log_channel->m_log_ap.get();
- if (log && log->GetMask().AnySet(mask)) {
- va_list args;
- va_start(args, format);
- log->VAPrintf(format, args);
- va_end(args);
- }
- }
-}
+void LogChannelDWARF::Terminate() { Log::Unregister("dwarf"); }
diff --git a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 4802f858f3a1..0293fbd7c495 100644
--- a/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -14,9 +14,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Core/Log.h"
+#include "lldb/Utility/Log.h"
-#define DWARF_LOG_VERBOSE (1u << 0)
#define DWARF_LOG_DEBUG_INFO (1u << 1)
#define DWARF_LOG_DEBUG_LINE (1u << 2)
#define DWARF_LOG_DEBUG_PUBNAMES (1u << 3)
@@ -28,47 +27,17 @@
#define DWARF_LOG_ALL (UINT32_MAX)
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
-class LogChannelDWARF : public lldb_private::LogChannel {
-public:
- LogChannelDWARF();
-
- ~LogChannelDWARF() override;
+namespace lldb_private {
+class LogChannelDWARF {
+ static Log::Channel g_channel;
+public:
static void Initialize();
-
static void Terminate();
- static lldb_private::ConstString GetPluginNameStatic();
-
- static const char *GetPluginDescriptionStatic();
-
- static lldb_private::LogChannel *CreateInstance();
-
- lldb_private::ConstString GetPluginName() override;
-
- uint32_t GetPluginVersion() override;
-
- void Disable(const char **categories,
- lldb_private::Stream *feedback_strm) override;
-
- void Delete();
-
- bool Enable(lldb::StreamSP &log_stream_sp, uint32_t log_options,
- lldb_private::Stream
- *feedback_strm, // Feedback stream for argument errors etc
- const char **categories) override; // The categories to enable
- // within this logging stream,
- // if empty, enable default set
-
- void ListCategories(lldb_private::Stream *strm) override;
-
- static lldb_private::Log *GetLog();
-
- static lldb_private::Log *GetLogIfAll(uint32_t mask);
-
- static lldb_private::Log *GetLogIfAny(uint32_t mask);
-
- static void LogIf(uint32_t mask, const char *format, ...);
+ static Log *GetLogIfAll(uint32_t mask) { return g_channel.GetLogIfAll(mask); }
+ static Log *GetLogIfAny(uint32_t mask) { return g_channel.GetLogIfAny(mask); }
};
+}
#endif // SymbolFileDWARF_LogChannelDWARF_h_
diff --git a/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp b/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
index c3d90d171b79..f5f979caa38e 100644
--- a/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ b/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -8,11 +8,11 @@
//===----------------------------------------------------------------------===//
#include "NameToDIE.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/RegularExpression.h"
-#include "lldb/Core/Stream.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Utility/ConstString.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/Stream.h"
+#include "lldb/Utility/StreamString.h"
#include "DWARFCompileUnit.h"
#include "DWARFDebugInfo.h"
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index 5c44ee03b02c..856c371636d9 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -11,19 +11,20 @@
// Other libraries and framework includes
#include "llvm/Support/Casting.h"
+#include "llvm/Support/Threading.h"
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Scalar.h"
#include "lldb/Core/Section.h"
#include "lldb/Core/StreamFile.h"
-#include "lldb/Core/StreamString.h"
#include "lldb/Core/Timer.h"
#include "lldb/Core/Value.h"
+#include "lldb/Utility/RegularExpression.h"
+#include "lldb/Utility/StreamString.h"
#include "Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h"
@@ -71,6 +72,8 @@
#include "SymbolFileDWARFDebugMap.h"
#include "SymbolFileDWARFDwo.h"
+#include "llvm/Support/FileSystem.h"
+
#include <map>
#include <ctype.h>
@@ -190,7 +193,9 @@ static const char *resolveCompDir(const char *path_from_dwarf) {
if (!is_symlink)
return local_path;
- if (!local_path_spec.IsSymbolicLink())
+ namespace fs = llvm::sys::fs;
+ if (fs::get_file_type(local_path_spec.GetPath(), false) !=
+ fs::file_type::symlink_file)
return local_path;
FileSpec resolved_local_path_spec;
@@ -222,7 +227,7 @@ void SymbolFileDWARF::DebuggerInitialize(Debugger &debugger) {
void SymbolFileDWARF::Terminate() {
PluginManager::UnregisterPlugin(CreateInstance);
- LogChannelDWARF::Initialize();
+ LogChannelDWARF::Terminate();
}
lldb_private::ConstString SymbolFileDWARF::GetPluginNameStatic() {
@@ -553,8 +558,9 @@ uint32_t SymbolFileDWARF::CalculateAbilities() {
const DWARFDataExtractor &
SymbolFileDWARF::GetCachedSectionData(lldb::SectionType sect_type,
DWARFDataSegment &data_segment) {
- std::call_once(data_segment.m_flag, &SymbolFileDWARF::LoadSectionData, this,
- sect_type, std::ref(data_segment.m_data));
+ llvm::call_once(data_segment.m_flag, [this, sect_type, &data_segment] {
+ this->LoadSectionData(sect_type, std::ref(data_segment.m_data));
+ });
return data_segment.m_data;
}
@@ -1935,7 +1941,7 @@ void SymbolFileDWARF::Index() {
std::vector<NameToDIE> namespace_index(num_compile_units);
std::vector<bool> clear_cu_dies(num_compile_units, false);
- auto parser_fn = [this, debug_info, &function_basename_index,
+ auto parser_fn = [debug_info, &function_basename_index,
&function_fullname_index, &function_method_index,
&function_selector_index, &objc_class_selectors_index,
&global_index, &type_index,
@@ -1951,7 +1957,7 @@ void SymbolFileDWARF::Index() {
return cu_idx;
};
- auto extract_fn = [this, debug_info, num_compile_units](uint32_t cu_idx) {
+ auto extract_fn = [debug_info](uint32_t cu_idx) {
DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx);
if (dwarf_cu) {
// dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 52937697500f..14b29fa44fa3 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -21,9 +21,10 @@
// Other libraries and framework includes
#include "llvm/ADT/DenseMap.h"
+#include "llvm/Support/Threading.h"
+
+#include "lldb/Utility/Flags.h"
-#include "lldb/Core/ConstString.h"
-#include "lldb/Core/Flags.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Core/dwarf.h"
@@ -31,6 +32,7 @@
#include "lldb/Symbol/DebugMacros.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Utility/ConstString.h"
#include "lldb/lldb-private.h"
// Project includes
@@ -305,7 +307,7 @@ protected:
typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> ClangTypeToDIE;
struct DWARFDataSegment {
- std::once_flag m_flag;
+ llvm::once_flag m_flag;
lldb_private::DWARFDataExtractor m_data;
};
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
index 16bb578e99c2..45519663f71f 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp
@@ -19,9 +19,9 @@
#include "lldb/Core/ModuleList.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/RangeMap.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Section.h"
#include "lldb/Host/FileSystem.h"
+#include "lldb/Utility/RegularExpression.h"
//#define DEBUG_OSO_DMAP // DO NOT CHECKIN WITH THIS NOT COMMENTED OUT
#if defined(DEBUG_OSO_DMAP)
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
index 109da631d771..dcca4268b6eb 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h
@@ -11,6 +11,7 @@
#define SymbolFileDWARF_SymbolFileDWARFDebugMap_h_
#include <bitset>
+#include <map>
#include <vector>
#include "lldb/Core/RangeMap.h"
diff --git a/source/Plugins/SymbolFile/PDB/CMakeLists.txt b/source/Plugins/SymbolFile/PDB/CMakeLists.txt
index 55aaadaf191b..871f382298d6 100644
--- a/source/Plugins/SymbolFile/PDB/CMakeLists.txt
+++ b/source/Plugins/SymbolFile/PDB/CMakeLists.txt
@@ -1,7 +1,14 @@
-set(LLVM_LINK_COMPONENTS
- DebugInfoPDB)
-
-add_lldb_library(lldbPluginSymbolFilePDB
+add_lldb_library(lldbPluginSymbolFilePDB PLUGIN
PDBASTParser.cpp
SymbolFilePDB.cpp
+
+ LINK_LIBS
+ clangAST
+ clangLex
+ lldbCore
+ lldbSymbol
+ lldbUtility
+ LINK_COMPONENTS
+ DebugInfoPDB
+ Support
)
diff --git a/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp b/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
index cd99493c239a..5e713224fcf8 100644
--- a/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
+++ b/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp
@@ -125,9 +125,8 @@ uint32_t SymbolFilePDB::GetNumCompileUnits() {
m_cached_compile_unit_count = compilands->getChildCount();
// The linker can inject an additional "dummy" compilation unit into the
- // PDB.
- // Ignore this special compile unit for our purposes, if it is there. It is
- // always the last one.
+ // PDB. Ignore this special compile unit for our purposes, if it is there.
+ // It is always the last one.
auto last_cu = compilands->getChildAtIndex(m_cached_compile_unit_count - 1);
std::string name = last_cu->getName();
if (name == "* Linker *")
@@ -187,12 +186,10 @@ bool SymbolFilePDB::ParseCompileUnitSupportFiles(
return false;
// In theory this is unnecessary work for us, because all of this information
- // is easily
- // (and quickly) accessible from DebugInfoPDB, so caching it a second time
- // seems like a waste.
- // Unfortunately, there's no good way around this short of a moderate
- // refactor, since SymbolVendor
- // depends on being able to cache this list.
+ // is easily (and quickly) accessible from DebugInfoPDB, so caching it a
+ // second time seems like a waste. Unfortunately, there's no good way around
+ // this short of a moderate refactor since SymbolVendor depends on being able
+ // to cache this list.
auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(
sc.comp_unit->GetID());
if (!cu)
@@ -269,9 +266,8 @@ lldb_private::CompilerDecl SymbolFilePDB::GetDeclForUID(lldb::user_id_t uid) {
lldb_private::CompilerDeclContext
SymbolFilePDB::GetDeclContextForUID(lldb::user_id_t uid) {
// PDB always uses the translation unit decl context for everything. We can
- // improve this later
- // but it's not easy because PDB doesn't provide a high enough level of type
- // fidelity in this area.
+ // improve this later but it's not easy because PDB doesn't provide a high
+ // enough level of type fidelity in this area.
return *m_tu_decl_ctx_up;
}
@@ -295,30 +291,25 @@ uint32_t SymbolFilePDB::ResolveSymbolContext(
uint32_t resolve_scope, lldb_private::SymbolContextList &sc_list) {
if (resolve_scope & lldb::eSymbolContextCompUnit) {
// Locate all compilation units with line numbers referencing the specified
- // file. For example, if
- // `file_spec` is <vector>, then this should return all source files and
- // header files that reference
- // <vector>, either directly or indirectly.
+ // file. For example, if `file_spec` is <vector>, then this should return
+ // all source files and header files that reference <vector>, either
+ // directly or indirectly.
auto compilands = m_session_up->findCompilandsForSourceFile(
file_spec.GetPath(), PDB_NameSearchFlags::NS_CaseInsensitive);
- // For each one, either find get its previously parsed data, or parse it
- // afresh and add it to
- // the symbol context list.
+ // For each one, either find its previously parsed data or parse it afresh
+ // and add it to the symbol context list.
while (auto compiland = compilands->getNext()) {
// If we're not checking inlines, then don't add line information for this
- // file unless the FileSpec
- // matches.
+ // file unless the FileSpec matches.
if (!check_inlines) {
// `getSourceFileName` returns the basename of the original source file
- // used to generate this compiland.
- // It does not return the full path. Currently the only way to get that
- // is to do a basename lookup to
- // get the IPDBSourceFile, but this is ambiguous in the case of two
- // source files with the same name
- // contributing to the same compiland. This is a moderately extreme
- // edge case, so we consider this ok
- // for now, although we need to find a long term solution.
+ // used to generate this compiland. It does not return the full path.
+ // Currently the only way to get that is to do a basename lookup to get
+ // the IPDBSourceFile, but this is ambiguous in the case of two source
+ // files with the same name contributing to the same compiland. This is
+ // a moderately extreme edge case, so we consider this OK for now,
+ // although we need to find a long-term solution.
std::string source_file = compiland->getSourceFileName();
auto pdb_file = m_session_up->findOneSourceFile(
compiland.get(), source_file,
@@ -336,8 +327,7 @@ uint32_t SymbolFilePDB::ResolveSymbolContext(
sc_list.Append(sc);
// If we were asked to resolve line entries, add all entries to the line
- // table that match the requested
- // line (or all lines if `line` == 0)
+ // table that match the requested line (or all lines if `line` == 0).
if (resolve_scope & lldb::eSymbolContextLineEntry)
ParseCompileUnitLineTable(sc, line);
}
@@ -396,9 +386,8 @@ uint32_t SymbolFilePDB::FindTypes(
std::string name_str = name.AsCString();
// If this might be a regex, we have to return EVERY symbol and process them
- // one by one, which is going
- // to destroy performance on large PDB files. So try really hard not to use a
- // regex match.
+ // one by one, which is going to destroy performance on large PDB files. So
+ // try really hard not to use a regex match.
if (name_str.find_first_of("[]?*.-+\\") != std::string::npos)
FindTypesByRegex(name_str, max_matches, types);
else
@@ -410,14 +399,11 @@ void SymbolFilePDB::FindTypesByRegex(const std::string &regex,
uint32_t max_matches,
lldb_private::TypeMap &types) {
// When searching by regex, we need to go out of our way to limit the search
- // space as much as possible, since
- // the way this is implemented is by searching EVERYTHING in the PDB and
- // manually doing a regex compare. PDB
- // library isn't optimized for regex searches or searches across multiple
- // symbol types at the same time, so the
+ // space as much as possible since this searches EVERYTHING in the PDB,
+ // manually doing regex comparisons. PDB library isn't optimized for regex
+ // searches or searches across multiple symbol types at the same time, so the
// best we can do is to search enums, then typedefs, then classes one by one,
- // and do a regex compare against all
- // of them.
+ // and do a regex comparison against each of them.
PDB_SymType tags_to_search[] = {PDB_SymType::Enum, PDB_SymType::Typedef,
PDB_SymType::UDT};
auto global = m_session_up->getGlobalScope();
@@ -442,9 +428,8 @@ void SymbolFilePDB::FindTypesByRegex(const std::string &regex,
else if (auto class_type = llvm::dyn_cast<PDBSymbolTypeUDT>(result.get()))
type_name = class_type->getName();
else {
- // We're only looking for types that have names. Skip symbols, as well
- // as
- // unnamed types such as arrays, pointers, etc.
+ // We're looking only for types that have names. Skip symbols, as well
+ // as unnamed types such as arrays, pointers, etc.
continue;
}
@@ -484,7 +469,7 @@ void SymbolFilePDB::FindTypesByName(const std::string &name,
case PDB_SymType::Typedef:
break;
default:
- // We're only looking for types that have names. Skip symbols, as well as
+ // We're looking only for types that have names. Skip symbols, as well as
// unnamed types such as arrays, pointers, etc.
continue;
}
@@ -553,14 +538,12 @@ lldb::CompUnitSP SymbolFilePDB::ParseCompileUnitForSymIndex(uint32_t id) {
auto cu = m_session_up->getConcreteSymbolById<PDBSymbolCompiland>(id);
// `getSourceFileName` returns the basename of the original source file used
- // to generate this compiland. It does
- // not return the full path. Currently the only way to get that is to do a
- // basename lookup to get the
+ // to generate this compiland. It does not return the full path. Currently
+ // the only way to get that is to do a basename lookup to get the
// IPDBSourceFile, but this is ambiguous in the case of two source files with
- // the same name contributing to the
- // same compiland. This is a moderately extreme edge case, so we consider this
- // ok for now, although we need to find
- // a long term solution.
+ // the same name contributing to the same compiland. This is a moderately
+ // extreme edge case, so we consider this OK for now, although we need to find
+ // a long-term solution.
auto file =
m_session_up->findOneSourceFile(cu.get(), cu->getSourceFileName(),
PDB_NameSearchFlags::NS_CaseInsensitive);
@@ -589,12 +572,9 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(
sc.comp_unit->GetID());
// LineEntry needs the *index* of the file into the list of support files
- // returned by
- // ParseCompileUnitSupportFiles. But the underlying SDK gives us a globally
- // unique
- // idenfitifier in the namespace of the PDB. So, we have to do a mapping so
- // that we
- // can hand out indices.
+ // returned by ParseCompileUnitSupportFiles. But the underlying SDK gives us
+ // a globally unique idenfitifier in the namespace of the PDB. So, we have to
+ // do a mapping so that we can hand out indices.
llvm::DenseMap<uint32_t, uint32_t> index_map;
BuildSupportFileIdToSupportFileIndexMap(*cu, index_map);
auto line_table = llvm::make_unique<LineTable>(sc.comp_unit);
@@ -604,8 +584,7 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(
auto files = m_session_up->getSourceFilesForCompiland(*cu);
// For each source and header file, create a LineSequence for contributions to
- // the cu
- // from that file, and add the sequence.
+ // the cu from that file, and add the sequence.
while (auto file = files->getNext()) {
std::unique_ptr<LineSequence> sequence(
line_table->CreateLineSequenceContainer());
@@ -628,13 +607,12 @@ bool SymbolFilePDB::ParseCompileUnitLineTable(
uint32_t source_idx = index_map[source_id];
// There was a gap between the current entry and the previous entry if the
- // addresses don't perfectly line
- // up.
+ // addresses don't perfectly line up.
bool is_gap = (i > 0) && (prev_addr + prev_length < addr);
// Before inserting the current entry, insert a terminal entry at the end
- // of the previous entry's address
- // range if the current entry resulted in a gap from the previous entry.
+ // of the previous entry's address range if the current entry resulted in
+ // a gap from the previous entry.
if (is_gap && ShouldAddLine(match_line, prev_line, prev_length)) {
line_table->AppendLineEntryToSequence(
sequence.get(), prev_addr + prev_length, prev_line, 0,
@@ -684,14 +662,10 @@ void SymbolFilePDB::BuildSupportFileIdToSupportFileIndexMap(
const PDBSymbolCompiland &cu,
llvm::DenseMap<uint32_t, uint32_t> &index_map) const {
// This is a hack, but we need to convert the source id into an index into the
- // support
- // files array. We don't want to do path comparisons to avoid basename / full
- // path
- // issues that may or may not even be a problem, so we use the globally unique
- // source
- // file identifiers. Ideally we could use the global identifiers everywhere,
- // but LineEntry
- // currently assumes indices.
+ // support files array. We don't want to do path comparisons to avoid
+ // basename / full path issues that may or may not even be a problem, so we
+ // use the globally unique source file identifiers. Ideally we could use the
+ // global identifiers everywhere, but LineEntry currently assumes indices.
auto source_files = m_session_up->getSourceFilesForCompiland(cu);
int index = 0;
diff --git a/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h b/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
index 2e5918328ff0..efd2cb081dca 100644
--- a/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
+++ b/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h
@@ -10,8 +10,8 @@
#ifndef lldb_Plugins_SymbolFile_PDB_SymbolFilePDB_h_
#define lldb_Plugins_SymbolFile_PDB_SymbolFilePDB_h_
-#include "lldb/Core/UserID.h"
#include "lldb/Symbol/SymbolFile.h"
+#include "lldb/Utility/UserID.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/DebugInfo/PDB/IPDBSession.h"
diff --git a/source/Plugins/SymbolFile/Symtab/CMakeLists.txt b/source/Plugins/SymbolFile/Symtab/CMakeLists.txt
index 20e406b08ab2..a2e19bd283f1 100644
--- a/source/Plugins/SymbolFile/Symtab/CMakeLists.txt
+++ b/source/Plugins/SymbolFile/Symtab/CMakeLists.txt
@@ -1,3 +1,7 @@
-add_lldb_library(lldbPluginSymbolFileSymtab
+add_lldb_library(lldbPluginSymbolFileSymtab PLUGIN
SymbolFileSymtab.cpp
+
+ LINK_LIBS
+ lldbCore
+ lldbSymbol
)
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
index 39073991c32c..094e48cf00e1 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp
@@ -10,16 +10,15 @@
#include "SymbolFileSymtab.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/PluginManager.h"
-#include "lldb/Core/RegularExpression.h"
#include "lldb/Core/Timer.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/Function.h"
#include "lldb/Symbol/ObjectFile.h"
-#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Symbol.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/TypeList.h"
+#include "lldb/Utility/RegularExpression.h"
using namespace lldb;
using namespace lldb_private;
diff --git a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
index 1945af9a337e..d1887a707ea6 100644
--- a/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
+++ b/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h
@@ -12,6 +12,7 @@
// C Includes
// C++ Includes
+#include <map>
#include <vector>
// Other libraries and framework includes