summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2011-10-06 00:09:08 +0000
committerGreg Clayton <gclayton@apple.com>2011-10-06 00:09:08 +0000
commit21f2a4919ba26a41dc0d6f1801e135a09f16e2ad (patch)
tree1fb0d26c3e983944a9a2c99cf9635b201652823e
parent6e429a16fd81ae050d37b23d83d52aa508c29b21 (diff)
downloadbcm5719-llvm-21f2a4919ba26a41dc0d6f1801e135a09f16e2ad.tar.gz
bcm5719-llvm-21f2a4919ba26a41dc0d6f1801e135a09f16e2ad.zip
Added a new logging channel to the DWARF called "lookups":
(lldb) log enable dwarf lookups This allows us to see when lookups are being done on functions, addresses, and types by both name and regular expresssion. llvm-svn: 141259
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp7
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp3
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp7
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp9
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp24
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h5
-rw-r--r--lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp62
8 files changed, 94 insertions, 26 deletions
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
index 8abef30af75..a4281ace521 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -24,6 +24,7 @@
#include "NameToDIE.h"
#include "SymbolFileDWARF.h"
+using namespace lldb;
using namespace lldb_private;
using namespace std;
@@ -353,7 +354,7 @@ DWARFCompileUnit::GetFunctionAranges ()
if (m_func_aranges_ap.get() == NULL)
{
m_func_aranges_ap.reset (new DWARFDebugAranges());
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
if (log)
log->Printf ("DWARFCompileUnit::GetFunctionAranges() for \"%s/%s\" compile unit at 0x%8.8x",
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
index 01b6017b32a..974868cfccb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp
@@ -23,6 +23,7 @@
#include "DWARFDebugInfo.h"
#include "DWARFCompileUnit.h"
+using namespace lldb;
using namespace lldb_private;
//----------------------------------------------------------------------
@@ -261,12 +262,12 @@ DWARFDebugAranges::Sort (bool minimize, uint32_t n)
Timer scoped_timer(__PRETTY_FUNCTION__, "%s this = %p",
__PRETTY_FUNCTION__, this);
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
const size_t orig_arange_size = m_aranges.size();
if (log)
{
log->Printf ("DWARFDebugAranges::Sort(minimize = %u, n = %u) with %zu entries", minimize, n, orig_arange_size);
- Dump (log);
+ Dump (log.get());
}
// Size of one? If so, no sorting is needed
@@ -331,7 +332,7 @@ DWARFDebugAranges::Sort (bool minimize, uint32_t n)
size_t delta = orig_arange_size - m_aranges.size();
log->Printf ("DWARFDebugAranges::Sort() %zu entries after minimizing (%zu entries combined for %zu bytes saved)",
m_aranges.size(), delta, delta * sizeof(Range));
- Dump (log);
+ Dump (log.get());
}
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 8f7335376d4..4dfede9a797 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
@@ -24,6 +24,7 @@
#include "DWARFFormValue.h"
#include "LogChannelDWARF.h"
+using namespace lldb;
using namespace lldb_private;
using namespace std;
@@ -53,7 +54,7 @@ DWARFDebugInfo::GetCompileUnitAranges ()
{
if (m_cu_aranges_ap.get() == NULL && m_dwarf2Data)
{
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
m_cu_aranges_ap.reset (new DWARFDebugAranges());
const DataExtractor &debug_aranges_data = m_dwarf2Data->get_debug_aranges_data();
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
index 05688d4c19a..54f1bf86d9d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
@@ -19,6 +19,7 @@
#include "SymbolFileDWARF.h"
#include "LogChannelDWARF.h"
+using namespace lldb;
using namespace lldb_private;
using namespace std;
@@ -560,7 +561,7 @@ DWARFDebugLine::ParseStatementTable
void* userData
)
{
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_LINE);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_LINE));
Prologue::shared_ptr prologue(new Prologue());
@@ -580,11 +581,11 @@ DWARFDebugLine::ParseStatementTable
}
if (log)
- prologue->Dump (log);
+ prologue->Dump (log.get());
const dw_offset_t end_offset = debug_line_offset + prologue->total_length + sizeof(prologue->total_length);
- State state(prologue, log, callback, userData);
+ State state(prologue, log.get(), callback, userData);
while (*offset_ptr < end_offset)
{
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
index 2b3dc757bf3..8c2f46a48c7 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
@@ -20,6 +20,7 @@
#include "SymbolFileDWARF.h"
+using namespace lldb;
using namespace lldb_private;
DWARFDebugPubnames::DWARFDebugPubnames() :
@@ -33,7 +34,7 @@ DWARFDebugPubnames::Extract(const DataExtractor& data)
Timer scoped_timer (__PRETTY_FUNCTION__,
"DWARFDebugPubnames::Extract (byte_size = %zu)",
data.GetByteSize());
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
if (log)
log->Printf("DWARFDebugPubnames::Extract (byte_size = %zu)", data.GetByteSize());
@@ -53,7 +54,7 @@ DWARFDebugPubnames::Extract(const DataExtractor& data)
break;
}
if (log)
- Dump (log);
+ Dump (log.get());
return true;
}
return false;
@@ -67,7 +68,7 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data)
"DWARFDebugPubnames::GeneratePubnames (data = %p)",
dwarf2Data);
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
if (log)
log->Printf("DWARFDebugPubnames::GeneratePubnames (data = %p)", dwarf2Data);
@@ -207,7 +208,7 @@ DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF* dwarf2Data)
if (m_sets.empty())
return false;
if (log)
- Dump (log);
+ Dump (log.get());
return true;
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
index b87a8147892..3385905e46d 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.cpp
@@ -109,6 +109,7 @@ LogChannelDWARF::Disable (Args &categories, Stream *feedback_strm)
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, "default") == 0 ) flag_bits &= ~DWARF_LOG_DEFAULT;
else
{
@@ -151,6 +152,7 @@ LogChannelDWARF::Enable
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, "default") == 0 ) flag_bits |= DWARF_LOG_DEFAULT;
else
{
@@ -177,29 +179,29 @@ LogChannelDWARF::ListCategories (Stream *strm)
" info - log the parsing if .debug_info\n"
" line - log the parsing if .debug_line\n"
" pubnames - log the parsing if .debug_pubnames\n"
- " pubtypes - log the parsing if .debug_pubtypes\n\n",
+ " pubtypes - log the parsing if .debug_pubtypes\n"
+ " lookups - log any lookups that happen by name, regex, or address\n\n",
SymbolFileDWARF::GetPluginNameStatic());
}
-Log *
+LogSP
LogChannelDWARF::GetLog ()
{
if (g_log_channel)
- return g_log_channel->m_log_sp.get();
- else
- return NULL;
+ return g_log_channel->m_log_sp;
+
+ return LogSP();
}
-Log *
+LogSP
LogChannelDWARF::GetLogIfAll (uint32_t mask)
{
- Log *log = GetLog();
- if (log)
+ if (g_log_channel && g_log_channel->m_log_sp)
{
- if (log->GetMask().AllSet(mask))
- return log;
+ if (g_log_channel->m_log_sp->GetMask().AllSet(mask))
+ return g_log_channel->m_log_sp;
}
- return NULL;
+ return LogSP();
}
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
index 5ed8c2a7fb2..bb57663df79 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
@@ -23,6 +23,7 @@
#define DWARF_LOG_DEBUG_PUBNAMES (1u << 3)
#define DWARF_LOG_DEBUG_PUBTYPES (1u << 4)
#define DWARF_LOG_DEBUG_ARANGES (1u << 5)
+#define DWARF_LOG_LOOKUPS (1u << 6)
#define DWARF_LOG_ALL (UINT32_MAX)
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
@@ -73,10 +74,10 @@ public:
virtual void
ListCategories (lldb_private::Stream *strm);
- static lldb_private::Log *
+ static lldb::LogSP
GetLog ();
- static lldb_private::Log *
+ static lldb::LogSP
GetLogIfAll (uint32_t mask);
static void
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index a934eabc76f..e25acbb28f9 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -1943,6 +1943,15 @@ SymbolFileDWARF::Index ()
uint32_t
SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint32_t max_matches, VariableList& variables)
{
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindGlobalVariables (file=\"%s/%s\", name=\"%s\", append=%u, max_matches=%u, variables)",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ name.GetCString(), append, max_matches);
+ }
DWARFDebugInfo* info = DebugInfo();
if (info == NULL)
return 0;
@@ -2007,6 +2016,16 @@ SymbolFileDWARF::FindGlobalVariables (const ConstString &name, bool append, uint
uint32_t
SymbolFileDWARF::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables)
{
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindGlobalVariables (file=\"%s/%s\", regex=\"%s\", append=%u, max_matches=%u, variables)",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ regex.GetText(), append, max_matches);
+ }
+
DWARFDebugInfo* info = DebugInfo();
if (info == NULL)
return 0;
@@ -2267,6 +2286,16 @@ SymbolFileDWARF::FindFunctions (const ConstString &name,
"SymbolFileDWARF::FindFunctions (name = '%s')",
name.AsCString());
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindFunctions (file=\"%s/%s\", name=\"%s\", name_type_mask=0x%x, append=%u, sc_list)",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ name.GetCString(), name_type_mask, append);
+ }
+
// If we aren't appending the results to this list, then clear the list
if (!append)
sc_list.Clear();
@@ -2315,6 +2344,17 @@ SymbolFileDWARF::FindFunctions(const RegularExpression& regex, bool append, Symb
"SymbolFileDWARF::FindFunctions (regex = '%s')",
regex.GetText());
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindFunctions (file=\"%s/%s\", regex=\"%s\"append=%u, sc_list)",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ regex.GetText(), append);
+ }
+
+
// If we aren't appending the results to this list, then clear the list
if (!append)
sc_list.Clear();
@@ -2383,6 +2423,16 @@ SymbolFileDWARF::FindTypes(const SymbolContext& sc, const ConstString &name, boo
if (info == NULL)
return 0;
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindFunctions (file=\"%s/%s\", sc, name=\"%s\", append=%u, max_matches=%u, type_list)",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ name.GetCString(), append, max_matches);
+ }
+
// If we aren't appending the results to this list, then clear the list
if (!append)
types.Clear();
@@ -2447,6 +2497,16 @@ ClangNamespaceDecl
SymbolFileDWARF::FindNamespace (const SymbolContext& sc,
const ConstString &name)
{
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
+
+ if (log)
+ {
+ log->Printf ("SymbolFileDWARF::FindNamespace (file=\"%s/%s\", sc, name=\"%s\")",
+ m_obj_file->GetFileSpec().GetDirectory().GetCString(),
+ m_obj_file->GetFileSpec().GetFilename().GetCString(),
+ name.GetCString());
+ }
+
ClangNamespaceDecl namespace_decl;
DWARFDebugInfo* info = DebugInfo();
if (info)
@@ -3206,7 +3266,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
AccessType accessibility = eAccessNone;
if (die != NULL)
{
- Log *log = LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO);
+ LogSP log (LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_INFO));
if (log && dwarf_cu)
{
StreamString s;
OpenPOWER on IntegriCloud