the debug information individual Decls came from. We've had a metadata infrastructure for a while, which was intended to solve a problem we've since dealt with in a different way. (It was meant to keep track of which definition of an Objective-C class was the "true" definition, but we now find it by searching the symbols for the class symbol.) The metadata is attached to the ExternalASTSource, which means it has a one-to-one correspondence with AST contexts. I've repurposed the metadata infrastructure to hold the object file and DIE offset for the DWARF information corresponding to a Decl. There are methods in ClangASTContext that get and set this metadata, and the ClangASTImporter is capable of tracking down the metadata for Decls that have been copied out of the debug information into the parser's AST context without using any additional memory. To see the metadata, you just have to enable the expression log: - (lldb) log enable lldb expr - and watch the import messages. The high 32 bits of the metadata indicate the index of the object file in its containing DWARFDebugMap; I have also added a log which you can use to track that mapping: - (lldb) log enable dwarf map - This adds 64 bits per Decl, which in my testing hasn't turned out to be very much (debugging Clang produces around 6500 Decls in my tests). To track how much data is being consumed, I've also added a global variable g_TotalSizeOfMetadata which tracks the total number of Decls that have metadata in all active AST contexts. Right now this metadata is enormously useful for tracking down bugs in the debug info parser. In the future I also want to use this information to provide more intelligent error messages instead of printing empty source lines wherever Clang refers to the location where something is defined. llvm-svn: 154634
93 lines
2.3 KiB
C++
93 lines
2.3 KiB
C++
//===-- LogChannelDWARF.h --------------------------------------*- C++ -*-===//
|
|
//
|
|
// The LLVM Compiler Infrastructure
|
|
//
|
|
// This file is distributed under the University of Illinois Open Source
|
|
// License. See LICENSE.TXT for details.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef SymbolFileDWARF_LogChannelDWARF_h_
|
|
#define SymbolFileDWARF_LogChannelDWARF_h_
|
|
|
|
// C Includes
|
|
// C++ Includes
|
|
// Other libraries and framework includes
|
|
|
|
// Project includes
|
|
#include "lldb/Core/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)
|
|
#define DWARF_LOG_DEBUG_PUBTYPES (1u << 4)
|
|
#define DWARF_LOG_DEBUG_ARANGES (1u << 5)
|
|
#define DWARF_LOG_LOOKUPS (1u << 6)
|
|
#define DWARF_LOG_TYPE_COMPLETION (1u << 7)
|
|
#define DWARF_LOG_DEBUG_MAP (1u << 8)
|
|
#define DWARF_LOG_ALL (UINT32_MAX)
|
|
#define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO)
|
|
|
|
class LogChannelDWARF : public lldb_private::LogChannel
|
|
{
|
|
public:
|
|
LogChannelDWARF ();
|
|
|
|
virtual
|
|
~LogChannelDWARF ();
|
|
|
|
static void
|
|
Initialize();
|
|
|
|
static void
|
|
Terminate();
|
|
|
|
static const char *
|
|
GetPluginNameStatic();
|
|
|
|
static const char *
|
|
GetPluginDescriptionStatic();
|
|
|
|
static lldb_private::LogChannel *
|
|
CreateInstance ();
|
|
|
|
virtual const char *
|
|
GetPluginName();
|
|
|
|
virtual const char *
|
|
GetShortPluginName();
|
|
|
|
virtual uint32_t
|
|
GetPluginVersion();
|
|
|
|
virtual void
|
|
Disable (const char** categories, lldb_private::Stream *feedback_strm);
|
|
|
|
void
|
|
Delete ();
|
|
|
|
virtual 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); // The categories to enable within this logging stream, if empty, enable default set
|
|
|
|
virtual void
|
|
ListCategories (lldb_private::Stream *strm);
|
|
|
|
static lldb::LogSP
|
|
GetLog ();
|
|
|
|
static lldb::LogSP
|
|
GetLogIfAll (uint32_t mask);
|
|
|
|
static lldb::LogSP
|
|
GetLogIfAny (uint32_t mask);
|
|
|
|
static void
|
|
LogIf (uint32_t mask, const char *format, ...);
|
|
};
|
|
|
|
#endif // SymbolFileDWARF_LogChannelDWARF_h_
|