2010-06-09 00:52:24 +08:00
|
|
|
//===-- SymbolFileDWARF.h --------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2011-09-13 07:21:58 +08:00
|
|
|
#ifndef SymbolFileDWARF_SymbolFileDWARF_h_
|
|
|
|
#define SymbolFileDWARF_SymbolFileDWARF_h_
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// C Includes
|
|
|
|
// C++ Includes
|
|
|
|
#include <list>
|
|
|
|
#include <map>
|
2015-10-22 19:14:37 +08:00
|
|
|
#include <mutex>
|
2013-06-19 06:51:05 +08:00
|
|
|
#include <set>
|
2015-12-16 08:22:08 +08:00
|
|
|
#include <unordered_map>
|
2010-06-09 00:52:24 +08:00
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
// Other libraries and framework includes
|
|
|
|
#include "llvm/ADT/DenseMap.h"
|
2017-02-07 01:55:02 +08:00
|
|
|
#include "llvm/Support/Threading.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2017-02-15 03:06:07 +08:00
|
|
|
#include "lldb/Utility/Flags.h"
|
|
|
|
|
2015-01-15 10:59:20 +08:00
|
|
|
#include "lldb/Core/RangeMap.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/UniqueCStringMap.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/Core/dwarf.h"
|
2015-09-16 20:37:06 +08:00
|
|
|
#include "lldb/Expression/DWARFExpression.h"
|
2015-12-16 08:22:08 +08:00
|
|
|
#include "lldb/Symbol/DebugMacros.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/SymbolContext.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/Symbol/SymbolFile.h"
|
2017-02-03 05:39:50 +08:00
|
|
|
#include "lldb/Utility/ConstString.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "lldb/lldb-private.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
// Project includes
|
2013-10-25 04:43:47 +08:00
|
|
|
#include "DWARFDataExtractor.h"
|
2016-09-07 04:57:50 +08:00
|
|
|
#include "DWARFDefines.h"
|
2011-09-02 12:03:59 +08:00
|
|
|
#include "HashedNameToDIE.h"
|
2010-09-15 12:15:46 +08:00
|
|
|
#include "NameToDIE.h"
|
2011-02-10 03:06:17 +08:00
|
|
|
#include "UniqueDWARFASTType.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// Forward Declarations for this DWARF plugin
|
|
|
|
//----------------------------------------------------------------------
|
<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
2012-08-30 05:13:06 +08:00
|
|
|
class DebugMapModule;
|
2010-06-09 00:52:24 +08:00
|
|
|
class DWARFAbbreviationDeclaration;
|
|
|
|
class DWARFAbbreviationDeclarationSet;
|
2012-04-25 05:22:41 +08:00
|
|
|
class DWARFileUnit;
|
2010-06-09 00:52:24 +08:00
|
|
|
class DWARFDebugAbbrev;
|
|
|
|
class DWARFDebugAranges;
|
|
|
|
class DWARFDebugInfo;
|
|
|
|
class DWARFDebugInfoEntry;
|
|
|
|
class DWARFDebugLine;
|
|
|
|
class DWARFDebugPubnames;
|
|
|
|
class DWARFDebugRanges;
|
2012-04-25 05:22:41 +08:00
|
|
|
class DWARFDeclContext;
|
2010-06-09 00:52:24 +08:00
|
|
|
class DWARFDIECollection;
|
|
|
|
class DWARFFormValue;
|
2010-10-12 10:24:53 +08:00
|
|
|
class SymbolFileDWARFDebugMap;
|
2016-03-29 21:42:02 +08:00
|
|
|
class SymbolFileDWARFDwo;
|
2017-08-25 21:56:14 +08:00
|
|
|
class SymbolFileDWARFDwp;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
#define DIE_IS_BEING_PARSED ((lldb_private::Type *)1)
|
2015-08-15 04:02:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
class SymbolFileDWARF : public lldb_private::SymbolFile,
|
|
|
|
public lldb_private::UserID {
|
2010-06-09 00:52:24 +08:00
|
|
|
public:
|
2016-09-07 04:57:50 +08:00
|
|
|
friend class SymbolFileDWARFDebugMap;
|
|
|
|
friend class SymbolFileDWARFDwo;
|
|
|
|
friend class DebugMapModule;
|
|
|
|
friend struct DIERef;
|
|
|
|
friend class DWARFCompileUnit;
|
|
|
|
friend class DWARFDIE;
|
|
|
|
friend class DWARFASTParserClang;
|
|
|
|
friend class DWARFASTParserGo;
|
|
|
|
friend class DWARFASTParserJava;
|
|
|
|
friend class DWARFASTParserOCaml;
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Static Functions
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
static void Initialize();
|
|
|
|
|
|
|
|
static void Terminate();
|
|
|
|
|
|
|
|
static void DebuggerInitialize(lldb_private::Debugger &debugger);
|
|
|
|
|
|
|
|
static lldb_private::ConstString GetPluginNameStatic();
|
|
|
|
|
|
|
|
static const char *GetPluginDescriptionStatic();
|
|
|
|
|
|
|
|
static lldb_private::SymbolFile *
|
|
|
|
CreateInstance(lldb_private::ObjectFile *obj_file);
|
|
|
|
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Constructors and Destructors
|
|
|
|
//------------------------------------------------------------------
|
2015-08-28 09:01:03 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SymbolFileDWARF(lldb_private::ObjectFile *ofile);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
~SymbolFileDWARF() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t CalculateAbilities() override;
|
2015-07-30 06:18:16 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void InitializeObject() override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// Compile Unit function calls
|
|
|
|
//------------------------------------------------------------------
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t GetNumCompileUnits() override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::LanguageType
|
|
|
|
ParseCompileUnitLanguage(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t
|
|
|
|
ParseCompileUnitFunctions(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool
|
|
|
|
ParseCompileUnitLineTable(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool
|
|
|
|
ParseCompileUnitDebugMacros(const lldb_private::SymbolContext &sc) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool ParseCompileUnitSupportFiles(
|
|
|
|
const lldb_private::SymbolContext &sc,
|
|
|
|
lldb_private::FileSpecList &support_files) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool
|
|
|
|
ParseCompileUnitIsOptimized(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool ParseImportedModules(
|
|
|
|
const lldb_private::SymbolContext &sc,
|
|
|
|
std::vector<lldb_private::ConstString> &imported_modules) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t ParseFunctionBlocks(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t ParseTypes(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t
|
|
|
|
ParseVariablesForContext(const lldb_private::SymbolContext &sc) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::Type *ResolveTypeUID(lldb::user_id_t type_uid) override;
|
2016-07-06 07:01:20 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
bool CompleteType(lldb_private::CompilerType &compiler_type) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::Type *ResolveType(const DWARFDIE &die,
|
|
|
|
bool assert_not_being_parsed = true,
|
|
|
|
bool resolve_function_context = false);
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
SymbolFileDWARF *GetDWARFForUID(lldb::user_id_t uid);
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
DWARFDIE
|
|
|
|
GetDIEFromUID(lldb::user_id_t uid);
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::CompilerDecl GetDeclForUID(lldb::user_id_t uid) override;
|
2016-04-26 07:39:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::CompilerDeclContext
|
|
|
|
GetDeclContextForUID(lldb::user_id_t uid) override;
|
2016-04-26 07:39:19 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::CompilerDeclContext
|
|
|
|
GetDeclContextContainingUID(lldb::user_id_t uid) override;
|
2015-09-16 07:44:17 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void
|
|
|
|
ParseDeclsForContext(lldb_private::CompilerDeclContext decl_ctx) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t ResolveSymbolContext(const lldb_private::Address &so_addr,
|
|
|
|
uint32_t resolve_scope,
|
|
|
|
lldb_private::SymbolContext &sc) override;
|
2015-09-17 02:48:30 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t
|
|
|
|
ResolveSymbolContext(const lldb_private::FileSpec &file_spec, uint32_t line,
|
|
|
|
bool check_inlines, uint32_t resolve_scope,
|
|
|
|
lldb_private::SymbolContextList &sc_list) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t
|
|
|
|
FindGlobalVariables(const lldb_private::ConstString &name,
|
|
|
|
const lldb_private::CompilerDeclContext *parent_decl_ctx,
|
|
|
|
bool append, uint32_t max_matches,
|
|
|
|
lldb_private::VariableList &variables) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t FindGlobalVariables(const lldb_private::RegularExpression ®ex,
|
|
|
|
bool append, uint32_t max_matches,
|
|
|
|
lldb_private::VariableList &variables) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t
|
|
|
|
FindFunctions(const lldb_private::ConstString &name,
|
|
|
|
const lldb_private::CompilerDeclContext *parent_decl_ctx,
|
|
|
|
uint32_t name_type_mask, bool include_inlines, bool append,
|
|
|
|
lldb_private::SymbolContextList &sc_list) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t FindFunctions(const lldb_private::RegularExpression ®ex,
|
|
|
|
bool include_inlines, bool append,
|
|
|
|
lldb_private::SymbolContextList &sc_list) override;
|
2015-12-08 09:02:08 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
void GetMangledNamesForFunction(
|
|
|
|
const std::string &scope_qualified_name,
|
|
|
|
std::vector<lldb_private::ConstString> &mangled_names) override;
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t
|
|
|
|
FindTypes(const lldb_private::SymbolContext &sc,
|
|
|
|
const lldb_private::ConstString &name,
|
|
|
|
const lldb_private::CompilerDeclContext *parent_decl_ctx,
|
|
|
|
bool append, uint32_t max_matches,
|
|
|
|
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
|
|
|
lldb_private::TypeMap &types) override;
|
2013-06-19 06:51:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t FindTypes(const std::vector<lldb_private::CompilerContext> &context,
|
|
|
|
bool append, lldb_private::TypeMap &types) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::TypeList *GetTypeList() override;
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
|
|
|
|
uint32_t type_mask,
|
|
|
|
lldb_private::TypeList &type_list) override;
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::TypeSystem *
|
|
|
|
GetTypeSystemForLanguage(lldb::LanguageType language) override;
|
2011-09-30 11:20:47 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::CompilerDeclContext FindNamespace(
|
|
|
|
const lldb_private::SymbolContext &sc,
|
|
|
|
const lldb_private::ConstString &name,
|
|
|
|
const lldb_private::CompilerDeclContext *parent_decl_ctx) override;
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
|
2017-04-28 08:51:06 +08:00
|
|
|
void PreloadSymbols() override;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
//------------------------------------------------------------------
|
|
|
|
// PluginInterface protocol
|
|
|
|
//------------------------------------------------------------------
|
|
|
|
lldb_private::ConstString GetPluginName() override;
|
2015-08-15 04:02:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
uint32_t GetPluginVersion() override;
|
2015-08-15 04:02:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_abbrev_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_addr_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_aranges_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_frame_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_info_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_line_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_macro_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_loc_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_ranges_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_str_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_debug_str_offsets_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_apple_names_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_apple_types_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_apple_namespaces_data();
|
|
|
|
const lldb_private::DWARFDataExtractor &get_apple_objc_data();
|
2015-08-15 04:02:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
DWARFDebugAbbrev *DebugAbbrev();
|
2015-12-16 08:22:08 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const DWARFDebugAbbrev *DebugAbbrev() const;
|
2015-08-15 04:02:05 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
DWARFDebugInfo *DebugInfo();
|
2015-09-09 18:20:48 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const DWARFDebugInfo *DebugInfo() const;
|
2015-09-16 20:37:06 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
DWARFDebugRanges *DebugRanges();
|
2015-12-08 09:02:08 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const DWARFDebugRanges *DebugRanges() const;
|
When support for DWO files was added, there were two ways to pass lldb::user_id_t out to the rest of LLDB:
1 - DWARF in .o files with debug map in executable: we would place the compile unit index in the upper 32 bits of the 64 bit value and the lower 32 bits would be the DIE offset
2 - DWO: we would place the compile unit offset in the upper 32 bits of the 64 bit value and the lower 32 bits would be the DIE offset
There was a mixing and matching of this and it wasn't done consistently.
Major changes include:
The DIERef constructor that takes a lldb::user_id_t now requires a SymbolFileDWARF:
DIERef(lldb::user_id_t uid, SymbolFileDWARF *dwarf)
It is needed so that it can be decoded correctly. If it is DWARF in .o files with debug map in executable, then we get the right compile unit from the SymbolFileDWARFDebugMap, otherwise, we use the compile unit offset and DIE offset for DWO or normal DWARF.
The function:
lldb::user_id_t DIERef::GetUID() const;
Now becomes
lldb::user_id_t DIERef::GetUID(SymbolFileDWARF *dwarf) const;
Again, we need the DWARF file to encode it correctly.
This removes the need for "lldb::user_id_t SymbolFileDWARF::MakeUserID() const" and for bool SymbolFileDWARF::UserIDMatches (lldb::user_id_t uid) const". There were also many places were doing things inneficiently like:
1 - encode a dw_offset_t into a lldb::user_id_t
2 - call the public SymbolFile interface to resolve types using the lldb::user_id_t
3 - This would then decode the lldb::user_id_t into a DIERef, and then try to find that type.
There are many places that are now doing this more efficiently by storing DW_AT_type form values as DWARFFormValue objects and then making a DIERef from them and directly calling the underlying function to resolve the lldb_private::Type, lldb_private::CompilerType, lldb_private::CompilerDecl, lldb_private::CompilerDeclContext.
If there are any regressions in DWARF with DWO, we will need to fix any issues that arise since the original patch wasn't functional for the much more widely used DWARF in .o files with debug map.
<rdar://problem/25200976>
llvm-svn: 264909
2016-03-31 04:14:35 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
static bool SupportedVersion(uint16_t version);
|
|
|
|
|
|
|
|
DWARFDIE
|
|
|
|
GetDeclContextDIEContainingDIE(const DWARFDIE &die);
|
|
|
|
|
|
|
|
bool
|
|
|
|
HasForwardDeclForClangType(const lldb_private::CompilerType &compiler_type);
|
|
|
|
|
|
|
|
lldb_private::CompileUnit *
|
|
|
|
GetCompUnitForDWARFCompUnit(DWARFCompileUnit *dwarf_cu,
|
|
|
|
uint32_t cu_idx = UINT32_MAX);
|
|
|
|
|
2017-11-18 04:50:54 +08:00
|
|
|
virtual size_t GetObjCMethodDIEOffsets(lldb_private::ConstString class_name,
|
|
|
|
DIEArray &method_die_offsets);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
|
|
|
bool Supports_DW_AT_APPLE_objc_complete_type(DWARFCompileUnit *cu);
|
|
|
|
|
|
|
|
lldb_private::DebugMacrosSP ParseDebugMacros(lldb::offset_t *offset);
|
|
|
|
|
|
|
|
static DWARFDIE GetParentSymbolContextDIE(const DWARFDIE &die);
|
|
|
|
|
|
|
|
virtual lldb::CompUnitSP ParseCompileUnit(DWARFCompileUnit *dwarf_cu,
|
|
|
|
uint32_t cu_idx);
|
|
|
|
|
|
|
|
virtual lldb_private::DWARFExpression::LocationListFormat
|
|
|
|
GetLocationListFormat() const;
|
|
|
|
|
|
|
|
lldb::ModuleSP GetDWOModule(lldb_private::ConstString name);
|
|
|
|
|
2018-01-05 00:42:05 +08:00
|
|
|
typedef std::map<lldb_private::ConstString, lldb::ModuleSP>
|
|
|
|
ExternalTypeModuleMap;
|
|
|
|
|
|
|
|
/// Return the list of Clang modules imported by this SymbolFile.
|
|
|
|
const ExternalTypeModuleMap& getExternalTypeModules() const {
|
|
|
|
return m_external_type_modules;
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
virtual DWARFDIE GetDIE(const DIERef &die_ref);
|
|
|
|
|
|
|
|
virtual std::unique_ptr<SymbolFileDWARFDwo>
|
|
|
|
GetDwoSymbolFileForCompileUnit(DWARFCompileUnit &dwarf_cu,
|
|
|
|
const DWARFDebugInfoEntry &cu_die);
|
2016-03-29 21:42:02 +08:00
|
|
|
|
2017-11-18 04:50:54 +08:00
|
|
|
// For regular SymbolFileDWARF instances the method returns nullptr,
|
|
|
|
// for the instances of the subclass SymbolFileDWARFDwo
|
|
|
|
// the method returns a pointer to the base compile unit.
|
|
|
|
virtual DWARFCompileUnit *GetBaseCompileUnit();
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
protected:
|
2016-09-07 04:57:50 +08:00
|
|
|
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb_private::Type *>
|
|
|
|
DIEToTypePtr;
|
|
|
|
typedef llvm::DenseMap<const DWARFDebugInfoEntry *, lldb::VariableSP>
|
|
|
|
DIEToVariableSP;
|
|
|
|
typedef llvm::DenseMap<const DWARFDebugInfoEntry *,
|
|
|
|
lldb::opaque_compiler_type_t>
|
|
|
|
DIEToClangType;
|
|
|
|
typedef llvm::DenseMap<lldb::opaque_compiler_type_t, DIERef> ClangTypeToDIE;
|
|
|
|
|
|
|
|
struct DWARFDataSegment {
|
2017-02-07 01:55:02 +08:00
|
|
|
llvm::once_flag m_flag;
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::DWARFDataExtractor m_data;
|
|
|
|
};
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(SymbolFileDWARF);
|
2015-08-25 07:46:31 +08:00
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
const lldb_private::DWARFDataExtractor &
|
|
|
|
GetCachedSectionData(lldb::SectionType sect_type,
|
|
|
|
DWARFDataSegment &data_segment);
|
|
|
|
|
|
|
|
virtual void LoadSectionData(lldb::SectionType sect_type,
|
|
|
|
lldb_private::DWARFDataExtractor &data);
|
|
|
|
|
|
|
|
bool DeclContextMatchesThisSymbolFile(
|
|
|
|
const lldb_private::CompilerDeclContext *decl_ctx);
|
|
|
|
|
|
|
|
bool
|
|
|
|
DIEInDeclContext(const lldb_private::CompilerDeclContext *parent_decl_ctx,
|
|
|
|
const DWARFDIE &die);
|
|
|
|
|
|
|
|
virtual DWARFCompileUnit *
|
|
|
|
GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit);
|
|
|
|
|
|
|
|
DWARFCompileUnit *GetNextUnparsedDWARFCompileUnit(DWARFCompileUnit *prev_cu);
|
|
|
|
|
|
|
|
bool GetFunction(const DWARFDIE &die, lldb_private::SymbolContext &sc);
|
|
|
|
|
|
|
|
lldb_private::Function *
|
|
|
|
ParseCompileUnitFunction(const lldb_private::SymbolContext &sc,
|
|
|
|
const DWARFDIE &die);
|
|
|
|
|
|
|
|
size_t ParseFunctionBlocks(const lldb_private::SymbolContext &sc,
|
|
|
|
lldb_private::Block *parent_block,
|
|
|
|
const DWARFDIE &die,
|
|
|
|
lldb::addr_t subprogram_low_pc, uint32_t depth);
|
|
|
|
|
|
|
|
size_t ParseTypes(const lldb_private::SymbolContext &sc, const DWARFDIE &die,
|
|
|
|
bool parse_siblings, bool parse_children);
|
|
|
|
|
|
|
|
lldb::TypeSP ParseType(const lldb_private::SymbolContext &sc,
|
|
|
|
const DWARFDIE &die, bool *type_is_new);
|
|
|
|
|
|
|
|
lldb_private::Type *ResolveTypeUID(const DWARFDIE &die,
|
|
|
|
bool assert_not_being_parsed);
|
|
|
|
|
|
|
|
lldb_private::Type *ResolveTypeUID(const DIERef &die_ref);
|
|
|
|
|
|
|
|
lldb::VariableSP ParseVariableDIE(const lldb_private::SymbolContext &sc,
|
|
|
|
const DWARFDIE &die,
|
|
|
|
const lldb::addr_t func_low_pc);
|
|
|
|
|
|
|
|
size_t ParseVariables(const lldb_private::SymbolContext &sc,
|
|
|
|
const DWARFDIE &orig_die,
|
|
|
|
const lldb::addr_t func_low_pc, bool parse_siblings,
|
|
|
|
bool parse_children,
|
|
|
|
lldb_private::VariableList *cc_variable_list = NULL);
|
|
|
|
|
|
|
|
bool ClassOrStructIsVirtual(const DWARFDIE &die);
|
|
|
|
|
|
|
|
// Given a die_offset, figure out the symbol context representing that die.
|
|
|
|
bool ResolveFunction(const DIERef &die_ref, bool include_inlines,
|
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
bool ResolveFunction(const DWARFDIE &die, bool include_inlines,
|
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
void FindFunctions(const lldb_private::ConstString &name,
|
|
|
|
const NameToDIE &name_to_die, bool include_inlines,
|
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
void FindFunctions(const lldb_private::RegularExpression ®ex,
|
|
|
|
const NameToDIE &name_to_die, bool include_inlines,
|
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
void FindFunctions(const lldb_private::RegularExpression ®ex,
|
|
|
|
const DWARFMappedHash::MemoryTable &memory_table,
|
2015-08-25 07:46:31 +08:00
|
|
|
bool include_inlines,
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
virtual lldb::TypeSP
|
|
|
|
FindDefinitionTypeForDWARFDeclContext(const DWARFDeclContext &die_decl_ctx);
|
|
|
|
|
2017-11-18 04:50:54 +08:00
|
|
|
virtual lldb::TypeSP FindCompleteObjCDefinitionTypeForDIE(
|
2016-09-07 04:57:50 +08:00
|
|
|
const DWARFDIE &die, const lldb_private::ConstString &type_name,
|
|
|
|
bool must_be_implementation);
|
|
|
|
|
|
|
|
lldb_private::Symbol *
|
|
|
|
GetObjCClassSymbol(const lldb_private::ConstString &objc_class_name);
|
|
|
|
|
|
|
|
void ParseFunctions(const DIEArray &die_offsets, bool include_inlines,
|
|
|
|
lldb_private::SymbolContextList &sc_list);
|
|
|
|
|
|
|
|
lldb::TypeSP GetTypeForDIE(const DWARFDIE &die,
|
|
|
|
bool resolve_function_context = false);
|
|
|
|
|
|
|
|
void Index();
|
|
|
|
|
|
|
|
void DumpIndexes();
|
|
|
|
|
|
|
|
void SetDebugMapModule(const lldb::ModuleSP &module_sp) {
|
|
|
|
m_debug_map_module_wp = module_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
SymbolFileDWARFDebugMap *GetDebugMapSymfile();
|
|
|
|
|
|
|
|
DWARFDIE
|
|
|
|
FindBlockContainingSpecification(const DIERef &func_die_ref,
|
|
|
|
dw_offset_t spec_block_die_offset);
|
|
|
|
|
|
|
|
DWARFDIE
|
|
|
|
FindBlockContainingSpecification(const DWARFDIE &die,
|
|
|
|
dw_offset_t spec_block_die_offset);
|
|
|
|
|
|
|
|
virtual UniqueDWARFASTTypeMap &GetUniqueDWARFASTTypeMap();
|
|
|
|
|
|
|
|
bool DIEDeclContextsMatch(const DWARFDIE &die1, const DWARFDIE &die2);
|
|
|
|
|
|
|
|
bool ClassContainsSelector(const DWARFDIE &class_die,
|
|
|
|
const lldb_private::ConstString &selector);
|
|
|
|
|
|
|
|
bool FixupAddress(lldb_private::Address &addr);
|
|
|
|
|
|
|
|
typedef std::set<lldb_private::Type *> TypeSet;
|
|
|
|
|
|
|
|
void GetTypes(const DWARFDIE &die, dw_offset_t min_die_offset,
|
|
|
|
dw_offset_t max_die_offset, uint32_t type_mask,
|
|
|
|
TypeSet &type_set);
|
|
|
|
|
|
|
|
typedef lldb_private::RangeDataVector<lldb::addr_t, lldb::addr_t,
|
|
|
|
lldb_private::Variable *>
|
|
|
|
GlobalVariableMap;
|
|
|
|
|
|
|
|
GlobalVariableMap &GetGlobalAranges();
|
|
|
|
|
|
|
|
void UpdateExternalModuleListIfNeeded();
|
|
|
|
|
|
|
|
virtual DIEToTypePtr &GetDIEToType() { return m_die_to_type; }
|
|
|
|
|
|
|
|
virtual DIEToVariableSP &GetDIEToVariable() { return m_die_to_variable_sp; }
|
|
|
|
|
|
|
|
virtual DIEToClangType &GetForwardDeclDieToClangType() {
|
|
|
|
return m_forward_decl_die_to_clang_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual ClangTypeToDIE &GetForwardDeclClangTypeToDie() {
|
|
|
|
return m_forward_decl_clang_type_to_die;
|
|
|
|
}
|
|
|
|
|
2017-08-25 21:56:14 +08:00
|
|
|
SymbolFileDWARFDwp *GetDwpSymbolFile();
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb::ModuleWP m_debug_map_module_wp;
|
|
|
|
SymbolFileDWARFDebugMap *m_debug_map_symfile;
|
2017-08-25 21:56:14 +08:00
|
|
|
|
|
|
|
llvm::once_flag m_dwp_symfile_once_flag;
|
|
|
|
std::unique_ptr<SymbolFileDWARFDwp> m_dwp_symfile;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
lldb_private::DWARFDataExtractor m_dwarf_data;
|
|
|
|
|
|
|
|
DWARFDataSegment m_data_debug_abbrev;
|
|
|
|
DWARFDataSegment m_data_debug_addr;
|
|
|
|
DWARFDataSegment m_data_debug_aranges;
|
|
|
|
DWARFDataSegment m_data_debug_frame;
|
|
|
|
DWARFDataSegment m_data_debug_info;
|
|
|
|
DWARFDataSegment m_data_debug_line;
|
|
|
|
DWARFDataSegment m_data_debug_macro;
|
|
|
|
DWARFDataSegment m_data_debug_loc;
|
|
|
|
DWARFDataSegment m_data_debug_ranges;
|
|
|
|
DWARFDataSegment m_data_debug_str;
|
|
|
|
DWARFDataSegment m_data_debug_str_offsets;
|
|
|
|
DWARFDataSegment m_data_apple_names;
|
|
|
|
DWARFDataSegment m_data_apple_types;
|
|
|
|
DWARFDataSegment m_data_apple_namespaces;
|
|
|
|
DWARFDataSegment m_data_apple_objc;
|
|
|
|
|
|
|
|
// The unique pointer items below are generated on demand if and when someone
|
|
|
|
// accesses
|
|
|
|
// them through a non const version of this class.
|
|
|
|
std::unique_ptr<DWARFDebugAbbrev> m_abbr;
|
|
|
|
std::unique_ptr<DWARFDebugInfo> m_info;
|
|
|
|
std::unique_ptr<DWARFDebugLine> m_line;
|
|
|
|
std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_names_ap;
|
|
|
|
std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_types_ap;
|
|
|
|
std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_namespaces_ap;
|
|
|
|
std::unique_ptr<DWARFMappedHash::MemoryTable> m_apple_objc_ap;
|
|
|
|
std::unique_ptr<GlobalVariableMap> m_global_aranges_ap;
|
|
|
|
|
|
|
|
typedef std::unordered_map<lldb::offset_t, lldb_private::DebugMacrosSP>
|
|
|
|
DebugMacrosMap;
|
|
|
|
DebugMacrosMap m_debug_macros_map;
|
|
|
|
|
|
|
|
ExternalTypeModuleMap m_external_type_modules;
|
|
|
|
NameToDIE m_function_basename_index; // All concrete functions
|
|
|
|
NameToDIE m_function_fullname_index; // All concrete functions
|
|
|
|
NameToDIE m_function_method_index; // All inlined functions
|
|
|
|
NameToDIE
|
|
|
|
m_function_selector_index; // All method names for functions of classes
|
|
|
|
NameToDIE m_objc_class_selectors_index; // Given a class name, find all
|
|
|
|
// selectors for the class
|
|
|
|
NameToDIE m_global_index; // Global and static variables
|
|
|
|
NameToDIE m_type_index; // All type DIE offsets
|
|
|
|
NameToDIE m_namespace_index; // All type DIE offsets
|
|
|
|
bool m_indexed : 1, m_using_apple_tables : 1, m_fetched_external_modules : 1;
|
|
|
|
lldb_private::LazyBool m_supports_DW_AT_APPLE_objc_complete_type;
|
|
|
|
|
|
|
|
typedef std::shared_ptr<std::set<DIERef>> DIERefSetSP;
|
|
|
|
typedef std::unordered_map<std::string, DIERefSetSP> NameToOffsetMap;
|
|
|
|
NameToOffsetMap m_function_scope_qualified_name_map;
|
|
|
|
std::unique_ptr<DWARFDebugRanges> m_ranges;
|
|
|
|
UniqueDWARFASTTypeMap m_unique_ast_type_map;
|
|
|
|
DIEToTypePtr m_die_to_type;
|
|
|
|
DIEToVariableSP m_die_to_variable_sp;
|
|
|
|
DIEToClangType m_forward_decl_die_to_clang_type;
|
|
|
|
ClangTypeToDIE m_forward_decl_clang_type_to_die;
|
2010-06-09 00:52:24 +08:00
|
|
|
};
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
#endif // SymbolFileDWARF_SymbolFileDWARF_h_
|