Change over to using the definitions for mach-o types and defines to the

defines that are in "llvm/Support/MachO.h". This should allow ObjectFileMachO
and ObjectContainerUniversalMachO to be able to be cross compiled in Linux.

Also did some cleanup on the ASTType by renaming it to ClangASTType and
renaming the header file. Moved a lot of "AST * + opaque clang type *"
functionality from lldb_private::Type over into ClangASTType.

llvm-svn: 109046
This commit is contained in:
Greg Clayton 2010-07-21 22:12:05 +00:00
parent a57b97e7e7
commit e1a916a74d
32 changed files with 1769 additions and 1551 deletions

View File

@ -24,9 +24,13 @@ namespace clang
class Context;
}
class Action;
class ASTContext;
class ASTRecordLayout;
class AddrLabelExpr;
class AnalyzerOptions;
class BinaryOperator;
class CodeGenOptions;
class CodeGenerator;
class CompilerInstance;
class CXXBaseSpecifier;
@ -38,18 +42,23 @@ namespace clang
class CharacterLiteral;
class CompoundAssignOperator;
class Decl;
class DeclarationName;
class DeclaratorDecl;
class DeclContext;
class DeclRefExpr;
class DeclStmt;
class DependencyOutputOptions;
class Diagnostic;
class DiagnosticOptions;
class EnumDecl;
class Expr;
class ExtVectorElementExpr;
class FieldDecl;
class FloatingLiteral;
class FrontendOptions;
class FunctionDecl;
class GotoStmt;
class HeaderSearchOptions;
class IdentifierTable;
class IntegerLiteral;
class LabelStmt;
@ -72,6 +81,8 @@ namespace clang
class ParenExpr;
class ParmVarDecl;
class PredefinedExpr;
class PreprocessorOptions;
class PreprocessorOutputOptions;
class QualType;
class QualifiedNameType;
class RecordDecl;

View File

@ -21,13 +21,7 @@
// Project includes
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/Value.h"
#include "lldb/Symbol/ASTType.h"
namespace clang {
class DeclarationName;
class DeclContext;
class QualType;
}
#include "lldb/Symbol/ClangASTType.h"
namespace llvm {
class Value;
@ -35,6 +29,33 @@ namespace llvm {
namespace lldb_private {
//----------------------------------------------------------------------
// For cases in which there are multiple classes of types that are not
// interchangeable, to allow static type checking.
//----------------------------------------------------------------------
template <unsigned int C> class TaggedClangASTType : public ClangASTType
{
public:
TaggedClangASTType (void *type, clang::ASTContext *ast_context) :
ClangASTType(type, ast_context) { }
TaggedClangASTType (const TaggedClangASTType<C> &tw) :
ClangASTType(tw) { }
TaggedClangASTType () :
ClangASTType() { }
~TaggedClangASTType() { }
const TaggedClangASTType<C> &
operator= (const TaggedClangASTType<C> &tw)
{
ClangASTType::operator= (tw);
return *this;
}
};
class Error;
class Function;
class NameSearchContext;
@ -83,8 +104,8 @@ public:
void GetDecls (NameSearchContext &context,
const char *name);
private:
typedef TaggedASTType<0> TypeFromParser;
typedef TaggedASTType<1> TypeFromUser;
typedef TaggedClangASTType<0> TypeFromParser;
typedef TaggedClangASTType<1> TypeFromUser;
struct Tuple
{

View File

@ -26,11 +26,6 @@
// Right now, this is just a toy. It calls a set function, with fixed
// values.
namespace clang
{
class ASTRecordLayout;
}
namespace lldb_private
{

View File

@ -11,10 +11,7 @@
#define liblldb_ClangResultSynthesizer_h_
#include "clang/Sema/SemaConsumer.h"
namespace clang {
class Action;
}
#include "lldb/Core/ClangForward.h"
namespace lldb_private {

View File

@ -1,113 +0,0 @@
//===-- ASTType.h -----------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_ASTType_h_
#define liblldb_ASTType_h_
namespace clang
{
class ASTContext;
}
namespace lldb_private
{
class ASTTypeBase
{
protected:
ASTTypeBase (void *type, clang::ASTContext *ast_context) :
m_type(type),
m_ast_context(ast_context)
{
}
ASTTypeBase (const ASTTypeBase &tw) :
m_type(tw.m_type),
m_ast_context(tw.m_ast_context)
{
}
ASTTypeBase () :
m_type(0),
m_ast_context(0)
{
}
~ASTTypeBase();
ASTTypeBase &operator= (const ASTTypeBase &atb)
{
m_type = atb.m_type;
m_ast_context = atb.m_ast_context;
return *this;
}
public:
void *GetType() const
{
return m_type;
}
clang::ASTContext *GetASTContext() const
{
return m_ast_context;
}
private:
void *m_type;
clang::ASTContext *m_ast_context;
};
class ASTType : public ASTTypeBase
{
public:
ASTType (void *type, clang::ASTContext *ast_context) :
ASTTypeBase(type, ast_context) { }
ASTType (const ASTType &at) :
ASTTypeBase(at) { }
ASTType () :
ASTTypeBase() { }
~ASTType();
ASTType &operator= (const ASTType &at)
{
ASTTypeBase::operator= (at);
return *this;
}
};
// For cases in which there are multiple classes of types that are not
// interchangeable, to allow static type checking.
template <unsigned int C> class TaggedASTType : public ASTTypeBase
{
public:
TaggedASTType (void *type, clang::ASTContext *ast_context) :
ASTTypeBase(type, ast_context) { }
TaggedASTType (const TaggedASTType<C> &tw) :
ASTTypeBase(tw) { }
TaggedASTType () :
ASTTypeBase() { }
~TaggedASTType() { }
TaggedASTType<C> &operator= (const TaggedASTType<C> &tw)
{
ASTTypeBase::operator= (tw);
return *this;
}
};
}
#endif

View File

@ -21,7 +21,7 @@
// Project includes
#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Symbol/ASTType.h"
#include "lldb/Symbol/ClangASTType.h"
namespace lldb_private {

View File

@ -0,0 +1,219 @@
//===-- ClangASTType.h ------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef liblldb_ClangASTType_h_
#define liblldb_ClangASTType_h_
#include "lldb/lldb-include.h"
#include "lldb/Core/ClangForward.h"
namespace lldb_private {
//----------------------------------------------------------------------
// A class that can carry around a clang ASTContext and a opaque clang
// QualType. A clang::QualType can be easily reconstructed from an
// opaque clang type and often the ASTContext is needed when doing
// various type related tasks, so this class allows both items to travel
// in a single very lightweight class that can be used. There are many
// static equivalents of the member functions that allow the ASTContext
// and the opaque clang QualType to be specified for ease of use and
// to avoid code duplication.
//----------------------------------------------------------------------
class ClangASTType
{
protected:
ClangASTType (void *type, clang::ASTContext *ast_context) :
m_type (type),
m_ast (ast_context)
{
}
ClangASTType (const ClangASTType &tw) :
m_type (tw.m_type),
m_ast (tw.m_ast)
{
}
ClangASTType () :
m_type (0),
m_ast (0)
{
}
~ClangASTType();
const ClangASTType &
operator= (const ClangASTType &atb)
{
m_type = atb.m_type;
m_ast = atb.m_ast;
return *this;
}
public:
void *
GetOpaqueQualType() const
{
return m_type;
}
clang::ASTContext *
GetASTContext() const
{
return m_ast;
}
ConstString
GetClangTypeName ();
static ConstString
GetClangTypeName (void *clang_type);
void
DumpValue (ExecutionContext *exe_ctx,
Stream *s,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset,
bool show_types,
bool show_summary,
bool verbose,
uint32_t depth);
static void
DumpValue (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
ExecutionContext *exe_ctx,
Stream *s,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset,
bool show_types,
bool show_summary,
bool verbose,
uint32_t depth);
bool
DumpTypeValue (Stream *s,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset);
static bool
DumpTypeValue (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
Stream *s,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset);
void
DumpSummary (ExecutionContext *exe_ctx,
Stream *s,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size);
static void
DumpSummary (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
ExecutionContext *exe_ctx,
Stream *s,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size);
lldb::Encoding
GetEncoding (uint32_t &count);
static lldb::Encoding
GetEncoding (void *opaque_clang_qual_type, uint32_t &count);
lldb::Format
GetFormat ();
static lldb::Format
GetFormat (void *opaque_clang_qual_type);
bool
GetValueAsScalar (const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
Scalar &value);
static bool
GetValueAsScalar (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
Scalar &value);
bool
SetValueFromScalar (const Scalar &value,
Stream &strm);
static bool
SetValueFromScalar (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
const Scalar &value,
Stream &strm);
bool
ReadFromMemory (ExecutionContext *exe_ctx,
lldb::addr_t addr,
lldb::AddressType address_type,
DataExtractor &data);
static bool
ReadFromMemory (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
ExecutionContext *exe_ctx,
lldb::addr_t addr,
lldb::AddressType address_type,
DataExtractor &data);
bool
WriteToMemory (ExecutionContext *exe_ctx,
lldb::addr_t addr,
lldb::AddressType address_type,
StreamString &new_value);
static bool
WriteToMemory (clang::ASTContext *ast_context,
void *opaque_clang_qual_type,
ExecutionContext *exe_ctx,
lldb::addr_t addr,
lldb::AddressType address_type,
StreamString &new_value);
private:
void *m_type;
clang::ASTContext *m_ast;
};
} // namespace lldb_private
#endif // #ifndef liblldb_ClangASTType_h_

View File

@ -103,35 +103,6 @@ public:
return m_name;
}
static ConstString
GetClangTypeName (void *clang_qual_type);
static void
DumpValue(ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
void *clang_qual_type,
Stream *s,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset,
bool show_types,
bool show_summary,
bool verbose,
uint32_t depth);
static void
DumpSummary (ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
void *clang_qual_type,
Stream *s,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size);
void
DumpValue(ExecutionContext *exe_ctx,
Stream *s,
@ -151,31 +122,6 @@ public:
bool show_summary,
bool verbose);
static bool
DumpTypeValue ( Stream *s,
clang::ASTContext *ast_context,
void *clang_qual_type,
lldb::Format format,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset);
static bool
GetValueAsScalar (clang::ASTContext *ast_context,
void *clang_qual_type,
const DataExtractor &data,
uint32_t data_offset,
size_t data_byte_size,
Scalar &value);
static bool
SetValueFromScalar (clang::ASTContext *ast_context,
void *clang_qual_type,
const Scalar &value,
Stream &strm);
bool
ReadFromMemory (ExecutionContext *exe_ctx,
lldb::addr_t address,
@ -188,23 +134,6 @@ public:
lldb::AddressType address_type,
DataExtractor &data);
static bool
ReadFromMemory (ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
void *clang_qual_type,
lldb::addr_t addr,
lldb::AddressType address_type,
DataExtractor &data);
static bool
WriteToMemory (ExecutionContext *exe_ctx,
clang::ASTContext *ast_context,
void *clang_qual_type,
lldb::addr_t addr,
lldb::AddressType address_type,
StreamString &new_value);
bool
GetIsDeclaration() const;
@ -223,9 +152,6 @@ public:
lldb::Encoding
GetEncoding (uint32_t &count);
static lldb::Encoding
GetEncoding (void *clang_qual_type, uint32_t &count);
SymbolContextScope *
GetSymbolContextScope()
{
@ -265,12 +191,6 @@ public:
static int
Compare(const Type &a, const Type &b);
static lldb::Format
GetFormat (void *clang_qual_type);
static int
DumpClangTypeName(Stream *s, void *clang_qual_type);
protected:
ConstString m_name;
uint64_t m_byte_size;

View File

@ -335,8 +335,8 @@
49D7072911B5AD11001AD875 /* ClangASTSource.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49D7072811B5AD11001AD875 /* ClangASTSource.cpp */; settings = {COMPILER_FLAGS = "-fno-rtti"; }; };
49DA743011DE6A5A006AEF7E /* IRToDWARF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49DA742F11DE6A5A006AEF7E /* IRToDWARF.cpp */; };
49DA743511DE6BB2006AEF7E /* IRToDWARF.h in Headers */ = {isa = PBXBuildFile; fileRef = 49DA743411DE6BB2006AEF7E /* IRToDWARF.h */; };
49E45FAA11F660DC008F7B28 /* ASTType.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E45FA911F660DC008F7B28 /* ASTType.h */; };
49E45FAF11F660FE008F7B28 /* ASTType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /* ASTType.cpp */; };
49E45FAA11F660DC008F7B28 /* ClangASTType.h in Headers */ = {isa = PBXBuildFile; fileRef = 49E45FA911F660DC008F7B28 /* ClangASTType.h */; };
49E45FAF11F660FE008F7B28 /* ClangASTType.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */; };
49F1A74611B3388F003ED505 /* ClangExpressionDeclMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */; };
49F1A74A11B338AE003ED505 /* ClangExpressionDeclMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 49F1A74911B338AE003ED505 /* ClangExpressionDeclMap.h */; };
4C08CDE811C81EF8001610A8 /* ThreadSpec.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4C08CDE711C81EF8001610A8 /* ThreadSpec.cpp */; };
@ -912,8 +912,8 @@
49D7072811B5AD11001AD875 /* ClangASTSource.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTSource.cpp; path = source/Expression/ClangASTSource.cpp; sourceTree = "<group>"; };
49DA742F11DE6A5A006AEF7E /* IRToDWARF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = IRToDWARF.cpp; path = source/Expression/IRToDWARF.cpp; sourceTree = "<group>"; };
49DA743411DE6BB2006AEF7E /* IRToDWARF.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IRToDWARF.h; path = include/lldb/Expression/IRToDWARF.h; sourceTree = "<group>"; };
49E45FA911F660DC008F7B28 /* ASTType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ASTType.h; path = include/lldb/Symbol/ASTType.h; sourceTree = "<group>"; };
49E45FAD11F660FE008F7B28 /* ASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ASTType.cpp; path = source/Symbol/ASTType.cpp; sourceTree = "<group>"; };
49E45FA911F660DC008F7B28 /* ClangASTType.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ClangASTType.h; path = include/lldb/Symbol/ClangASTType.h; sourceTree = "<group>"; };
49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangASTType.cpp; path = source/Symbol/ClangASTType.cpp; sourceTree = "<group>"; };
49EC3E98118F90AC00B1265E /* ThreadPlanCallFunction.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadPlanCallFunction.cpp; path = source/Target/ThreadPlanCallFunction.cpp; sourceTree = "<group>"; };
49EC3E9C118F90D400B1265E /* ThreadPlanCallFunction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadPlanCallFunction.h; path = include/lldb/Target/ThreadPlanCallFunction.h; sourceTree = "<group>"; };
49F1A74511B3388F003ED505 /* ClangExpressionDeclMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ClangExpressionDeclMap.cpp; path = source/Expression/ClangExpressionDeclMap.cpp; sourceTree = "<group>"; };
@ -1669,12 +1669,12 @@
isa = PBXGroup;
children = (
AF94005711C03F6500085DB9 /* SymbolVendor.cpp */,
49E45FA911F660DC008F7B28 /* ASTType.h */,
49E45FAD11F660FE008F7B28 /* ASTType.cpp */,
26BC7C5510F1B6E900F91463 /* Block.h */,
26BC7F1310F1B8EC00F91463 /* Block.cpp */,
26BC7C5610F1B6E900F91463 /* ClangASTContext.h */,
26BC7F1410F1B8EC00F91463 /* ClangASTContext.cpp */,
49E45FA911F660DC008F7B28 /* ClangASTType.h */,
49E45FAD11F660FE008F7B28 /* ClangASTType.cpp */,
26BC7C5710F1B6E900F91463 /* CompileUnit.h */,
26BC7F1510F1B8EC00F91463 /* CompileUnit.cpp */,
26BC7C5810F1B6E900F91463 /* Declaration.h */,
@ -2201,7 +2201,7 @@
49307AB211DEA4F20081F992 /* IRForTarget.h in Headers */,
4C5DBBC911E3FEC60035160F /* CommandObjectCommands.h in Headers */,
26D27CA011ED3A4E0024D721 /* ELFHeader.h in Headers */,
49E45FAA11F660DC008F7B28 /* ASTType.h in Headers */,
49E45FAA11F660DC008F7B28 /* ClangASTType.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -2655,7 +2655,7 @@
49307AAE11DEA4D90081F992 /* IRForTarget.cpp in Sources */,
4C5DBBC811E3FEC60035160F /* CommandObjectCommands.cpp in Sources */,
26D27C9F11ED3A4E0024D721 /* ELFHeader.cpp in Sources */,
49E45FAF11F660FE008F7B28 /* ASTType.cpp in Sources */,
49E45FAF11F660FE008F7B28 /* ClangASTType.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

View File

@ -12,8 +12,10 @@
// C Includes
// C++ Includes
// Other libraries and framework includes
#include "llvm/ADT/StringRef.h"
// Project includes
#include "lldb/Interpreter/Args.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Core/Value.h"
#include "lldb/Core/InputReader.h"
#include "lldb/Expression/ClangExpression.h"
@ -21,15 +23,15 @@
#include "lldb/Expression/ClangExpressionVariable.h"
#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Host/Host.h"
#include "lldb/Core/Debugger.h"
#include "lldb/Interpreter/Args.h"
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/StackFrame.h"
#include "lldb/Target/Target.h"
#include "llvm/ADT/StringRef.h"
using namespace lldb;
using namespace lldb_private;
@ -402,22 +404,26 @@ CommandObjectExpression::EvaluateExpression (const char *expr, bool bare, Stream
if (clang_type)
{
if (m_options.show_types)
Type::DumpClangTypeName (&output_stream, clang_type);
{
ConstString type_name(ClangASTType::GetClangTypeName (clang_type));
if (type_name)
output_stream.Printf("(%s) ", type_name.AsCString("<invalid>"));
}
Type::DumpValue (&m_exe_ctx, // The execution context for memory and variable access
ast_context, // The ASTContext that the clang type belongs to
clang_type, // The opaque clang type we want to dump that value of
&output_stream, // Stream to dump to
format, // Format to use when dumping
data, // A buffer containing the bytes for the clang type
0, // Byte offset within "data" where value is
data.GetByteSize (), // Size in bytes of the value we are dumping
0, // Bitfield bit size
0, // Bitfield bit offset
m_options.show_types, // Show types?
m_options.show_summary, // Show summary?
m_options.debug, // Debug logging output?
UINT32_MAX); // Depth to dump in case this is an aggregate type
ClangASTType::DumpValue (ast_context, // The ASTContext that the clang type belongs to
clang_type, // The opaque clang type we want to dump that value of
&m_exe_ctx, // The execution context for memory and variable access
&output_stream, // Stream to dump to
format, // Format to use when dumping
data, // A buffer containing the bytes for the clang type
0, // Byte offset within "data" where value is
data.GetByteSize (), // Size in bytes of the value we are dumping
0, // Bitfield bit size
0, // Bitfield bit offset
m_options.show_types, // Show types?
m_options.show_summary, // Show summary?
m_options.debug, // Debug logging output?
UINT32_MAX); // Depth to dump in case this is an aggregate type
}
else
{

View File

@ -23,6 +23,7 @@
#include "lldb/Interpreter/CommandInterpreter.h"
#include "lldb/Interpreter/CommandReturnObject.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
@ -386,12 +387,12 @@ public:
Scalar scalar;
if (!Type::GetValueAsScalar (valobj->GetClangAST(),
valobj->GetOpaqueClangQualType(),
valobj->GetDataExtractor(),
0,
valobj->GetByteSize(),
scalar))
if (!ClangASTType::GetValueAsScalar (valobj->GetClangAST(),
valobj->GetOpaqueClangQualType(),
valobj->GetDataExtractor(),
0,
valobj->GetByteSize(),
scalar))
return;
ConstString po_output;

View File

@ -17,6 +17,7 @@
#include "lldb/Core/DataBufferHeap.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Stream.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
@ -472,7 +473,7 @@ Value::GetValueDefaultFormat ()
break;
case eContextTypeOpaqueClangQualType:
return Type::GetFormat (m_context);
return ClangASTType::GetFormat (m_context);
case eContextTypeDCRegisterInfo:
if (GetRegisterInfo())
@ -692,9 +693,9 @@ Value::ResolveValue(ExecutionContext *exe_ctx, clang::ASTContext *ast_context)
lldb::AddressType address_type = m_value_type == eValueTypeLoadAddress ? eAddressTypeLoad : eAddressTypeHost;
lldb::addr_t addr = m_value.ULongLong(LLDB_INVALID_ADDRESS);
DataExtractor data;
if (Type::ReadFromMemory (exe_ctx, ast_context, opaque_clang_qual_type, addr, address_type, data))
if (ClangASTType::ReadFromMemory (ast_context, opaque_clang_qual_type, exe_ctx, addr, address_type, data))
{
if (Type::GetValueAsScalar (ast_context, opaque_clang_qual_type, data, 0, data.GetByteSize(), scalar))
if (ClangASTType::GetValueAsScalar (ast_context, opaque_clang_qual_type, data, 0, data.GetByteSize(), scalar))
{
m_value = scalar;
m_value_type = eValueTypeScalar;

View File

@ -20,6 +20,7 @@
#include "lldb/Core/ValueObjectChild.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Type.h"
@ -488,16 +489,16 @@ ValueObject::GetValueAsCString (ExecutionContextScope *exe_scope)
if (clang_type)
{
StreamString sstr;
lldb::Format format = Type::GetFormat(clang_type);
if (Type::DumpTypeValue(&sstr,
GetClangAST(), // The clang AST
clang_type, // The clang type to display
format, // Format to display this type with
m_data, // Data to extract from
0, // Byte offset into "m_data"
GetByteSize(), // Byte size of item in "m_data"
GetBitfieldBitSize(), // Bitfield bit size
GetBitfieldBitOffset())) // Bitfield bit offset
lldb::Format format = ClangASTType::GetFormat(clang_type);
if (ClangASTType::DumpTypeValue(GetClangAST(), // The clang AST
clang_type, // The clang type to display
&sstr,
format, // Format to display this type with
m_data, // Data to extract from
0, // Byte offset into "m_data"
GetByteSize(), // Byte size of item in "m_data"
GetBitfieldBitSize(), // Bitfield bit size
GetBitfieldBitOffset())) // Bitfield bit offset
m_value_str.swap(sstr.GetString());
else
m_value_str.clear();
@ -537,7 +538,7 @@ ValueObject::SetValueFromCString (ExecutionContextScope *exe_scope, const char *
return false;
uint32_t count = 0;
lldb::Encoding encoding = Type::GetEncoding (GetOpaqueClangQualType(), count);
lldb::Encoding encoding = ClangASTType::GetEncoding (GetOpaqueClangQualType(), count);
char *end = NULL;
const size_t byte_size = GetByteSize();

View File

@ -12,6 +12,7 @@
#include "lldb/Core/Module.h"
#include "lldb/Core/ValueObjectList.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Symbol/SymbolContext.h"
#include "lldb/Symbol/Type.h"
@ -103,7 +104,7 @@ ValueObjectChild::GetTypeName()
{
if (m_type_name.IsEmpty())
{
m_type_name = Type::GetClangTypeName (GetOpaqueClangQualType());
m_type_name = ClangASTType::GetClangTypeName (GetOpaqueClangQualType());
if (m_type_name)
{
if (m_bitfield_bit_size > 0)

View File

@ -15,6 +15,7 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/Module.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Target/ExecutionContext.h"
@ -250,7 +251,7 @@ ConstString
ValueObjectRegister::GetTypeName()
{
if (m_type_name.IsEmpty())
m_type_name = Type::GetClangTypeName (GetOpaqueClangQualType());
m_type_name = ClangASTType::GetClangTypeName (GetOpaqueClangQualType());
return m_type_name;
}

View File

@ -55,6 +55,7 @@
// Project includes
#include "lldb/Core/Log.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Expression/ClangExpression.h"
#include "lldb/Expression/ClangASTSource.h"
#include "lldb/Expression/ClangResultSynthesizer.h"
@ -74,23 +75,6 @@ using namespace lldb_private;
using namespace clang;
using namespace llvm;
namespace clang {
class AnalyzerOptions;
class CodeGenOptions;
class DependencyOutputOptions;
class DiagnosticOptions;
class FrontendOptions;
class HeaderSearchOptions;
class LangOptions;
class PreprocessorOptions;
class PreprocessorOutputOptions;
class TargetInfo;
class TargetOptions;
} // end namespace clang
//===----------------------------------------------------------------------===//
// Utility Methods

View File

@ -292,10 +292,11 @@ ClangExpressionDeclMap::DoMaterialize (bool dematerialize,
TypeFromUser copied_type(ClangASTContext::CopyType(context,
iter->m_parser_type.GetASTContext(),
iter->m_parser_type.GetType()),
iter->m_parser_type.GetOpaqueQualType()),
context);
result_value->SetContext(Value::eContextTypeOpaqueClangQualType, copied_type.GetType());
result_value->SetContext(Value::eContextTypeOpaqueClangQualType,
copied_type.GetOpaqueQualType());
}
continue;
@ -329,7 +330,10 @@ ClangExpressionDeclMap::DoMaterializeOneVariable(bool dematerialize,
return false;
}
log->Printf("%s %s with type %p", (dematerialize ? "Dematerializing" : "Materializing"), name, type.GetType());
log->Printf("%s %s with type %p",
(dematerialize ? "Dematerializing" : "Materializing"),
name,
type.GetOpaqueQualType());
std::auto_ptr<lldb_private::Value> location_value(GetVariableValue(exe_ctx,
var,
@ -345,7 +349,8 @@ ClangExpressionDeclMap::DoMaterializeOneVariable(bool dematerialize,
{
lldb::addr_t value_addr = location_value->GetScalar().ULongLong();
size_t bit_size = ClangASTContext::GetTypeBitSize(type.GetASTContext(), type.GetType());
size_t bit_size = ClangASTContext::GetTypeBitSize (type.GetASTContext(),
type.GetOpaqueQualType());
size_t byte_size = bit_size % 8 ? ((bit_size + 8) / 8) : (bit_size / 8);
DataBufferHeap data;
@ -488,7 +493,9 @@ ClangExpressionDeclMap::FindVariableInScope(const SymbolContext &sym_ctx,
if (type->GetASTContext() == var->GetType()->GetClangAST())
{
if (!ClangASTContext::AreTypesSame(type->GetASTContext(), type->GetType(), var->GetType()->GetOpaqueClangQualType()))
if (!ClangASTContext::AreTypesSame(type->GetASTContext(),
type->GetOpaqueQualType(),
var->GetType()->GetOpaqueClangQualType()))
return NULL;
}
else
@ -657,7 +664,7 @@ ClangExpressionDeclMap::AddOneVariable(NameSearchContext &context,
&ut,
&pt);
NamedDecl *var_decl = context.AddVarDecl(pt.GetType());
NamedDecl *var_decl = context.AddVarDecl(pt.GetOpaqueQualType());
Tuple tuple;

View File

@ -24,6 +24,7 @@
#include "lldb/lldb-private-log.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/Type.h"
@ -2273,10 +2274,10 @@ DWARFExpression::Evaluate
}
else
{
if (!Type::SetValueFromScalar(ast_context,
clang_type,
tmp.ResolveValue(exe_ctx, ast_context),
new_value))
if (!ClangASTType::SetValueFromScalar (ast_context,
clang_type,
tmp.ResolveValue(exe_ctx, ast_context),
new_value))
{
if (error_ptr)
error_ptr->SetErrorStringWithFormat ("Couldn't extract a value from an integral type.\n");
@ -2292,12 +2293,12 @@ DWARFExpression::Evaluate
{
lldb::AddressType address_type = (value_type == Value::eValueTypeLoadAddress ? eAddressTypeLoad : eAddressTypeHost);
lldb::addr_t addr = stack.back().GetScalar().ULongLong(LLDB_INVALID_ADDRESS);
if (!Type::WriteToMemory (exe_ctx,
ast_context,
clang_type,
addr,
address_type,
new_value))
if (!ClangASTType::WriteToMemory (ast_context,
clang_type,
exe_ctx,
addr,
address_type,
new_value))
{
if (error_ptr)
error_ptr->SetErrorStringWithFormat ("Failed to write value to memory at 0x%llx.\n", addr);

View File

@ -11,8 +11,7 @@
// C Includes
#include <dirent.h>
#include <mach-o/loader.h>
#include <mach-o/fat.h>
#include "llvm/Support/MachO.h"
// C++ Includes
// Other libraries and framework includes
@ -29,6 +28,7 @@
using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;
extern "C" {
@ -49,8 +49,8 @@ SkinnyMachOFileContainsArchAndUUID
const uint32_t magic
)
{
assert(magic == MH_CIGAM || magic == MH_MAGIC || magic == MH_CIGAM_64 || magic == MH_MAGIC_64);
if (magic == MH_MAGIC || magic == MH_MAGIC_64)
assert(magic == HeaderMagic32 || magic == HeaderMagic32Swapped || magic == HeaderMagic64 || magic == HeaderMagic64Swapped);
if (magic == HeaderMagic32 || magic == HeaderMagic64)
data.SetByteOrder (eByteOrderHost);
else if (eByteOrderHost == eByteOrderBig)
data.SetByteOrder (eByteOrderLittle);
@ -80,11 +80,11 @@ SkinnyMachOFileContainsArchAndUUID
if (uuid == NULL)
return true;
if (magic == MH_CIGAM_64 || magic == MH_MAGIC_64)
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
data_offset += 4; // Skip reserved field for in mach_header_64
// Make sure we have enough data for all the load commands
if (magic == MH_CIGAM_64 || magic == MH_MAGIC_64)
if (magic == HeaderMagic64Swapped || magic == HeaderMagic64)
{
if (data.GetByteSize() < sizeof(struct mach_header_64) + sizeofcmds)
{
@ -106,7 +106,7 @@ SkinnyMachOFileContainsArchAndUUID
const uint32_t cmd_offset = data_offset; // Save this data_offset in case parsing of the segment goes awry!
uint32_t cmd = data.GetU32(&data_offset);
uint32_t cmd_size = data.GetU32(&data_offset);
if (cmd == LC_UUID)
if (cmd == LoadCommandUUID)
{
UUID file_uuid (data.GetData(&data_offset, 16), 16);
return file_uuid == *uuid;
@ -128,7 +128,7 @@ UniversalMachOFileContainsArchAndUUID
const uint32_t magic
)
{
assert(magic == FAT_CIGAM || magic == FAT_MAGIC);
assert(magic == UniversalMagic || magic == UniversalMagicSwapped);
// Universal mach-o files always have their headers encoded as BIG endian
data.SetByteOrder(eByteOrderBig);
@ -167,10 +167,10 @@ UniversalMachOFileContainsArchAndUUID
switch (arch_magic)
{
case MH_CIGAM: // 32 bit mach-o file
case MH_MAGIC: // 32 bit mach-o file
case MH_CIGAM_64: // 64 bit mach-o file
case MH_MAGIC_64: // 64 bit mach-o file
case HeaderMagic32:
case HeaderMagic32Swapped:
case HeaderMagic64:
case HeaderMagic64Swapped:
if (SkinnyMachOFileContainsArchAndUUID (file_spec, arch, uuid, file_offset + arch_offset, arch_data, arch_data_offset, arch_magic))
return true;
break;
@ -201,15 +201,15 @@ FileAtPathContainsArchAndUUID
switch (magic)
{
// 32 bit mach-o file
case MH_CIGAM:
case MH_MAGIC:
case MH_CIGAM_64:
case MH_MAGIC_64:
case HeaderMagic32:
case HeaderMagic32Swapped:
case HeaderMagic64:
case HeaderMagic64Swapped:
return SkinnyMachOFileContainsArchAndUUID (file_spec, arch, uuid, file_offset, data, data_offset, magic);
// fat mach-o file
case FAT_CIGAM:
case FAT_MAGIC:
case UniversalMagic:
case UniversalMagicSwapped:
return UniversalMachOFileContainsArchAndUUID (file_spec, arch, uuid, file_offset, data, data_offset, magic);
default:

View File

@ -34,7 +34,7 @@
using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;
/// FIXME - The ObjC Runtime trampoline handler doesn't really belong here.
/// I am putting it here so I can invoke it in the Trampoline code here, but
@ -191,7 +191,7 @@ DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(lldb::
DataExtractor data; // Load command data
if (ReadMachHeader (addr, &m_dyld.header, &data))
{
if (m_dyld.header.filetype == MH_DYLINKER)
if (m_dyld.header.filetype == HeaderFileTypeDynamicLinkEditor)
{
m_dyld.address = addr;
ModuleSP dyld_module_sp;
@ -670,15 +670,15 @@ DynamicLoaderMacOSXDYLD::UpdateAllImageInfos()
// Returns true if we succeed, false if we fail for any reason.
//----------------------------------------------------------------------
bool
DynamicLoaderMacOSXDYLD::ReadMachHeader (lldb::addr_t addr, struct mach_header *header, DataExtractor *load_command_data)
DynamicLoaderMacOSXDYLD::ReadMachHeader (lldb::addr_t addr, mach_header *header, DataExtractor *load_command_data)
{
DataBufferHeap header_bytes(sizeof(struct mach_header), 0);
DataBufferHeap header_bytes(sizeof(mach_header), 0);
Error error;
size_t bytes_read = m_process->ReadMemory (addr,
header_bytes.GetBytes(),
header_bytes.GetByteSize(),
error);
if (bytes_read == sizeof(struct mach_header))
if (bytes_read == sizeof(mach_header))
{
uint32_t offset = 0;
::memset (header, 0, sizeof(header));
@ -690,16 +690,16 @@ DynamicLoaderMacOSXDYLD::ReadMachHeader (lldb::addr_t addr, struct mach_header *
data.SetByteOrder(DynamicLoaderMacOSXDYLD::GetByteOrderFromMagic(header->magic));
switch (header->magic)
{
case MH_MAGIC:
case MH_CIGAM:
case llvm::MachO::HeaderMagic32:
case llvm::MachO::HeaderMagic32Swapped:
data.SetAddressByteSize(4);
load_cmd_addr += sizeof(struct mach_header);
load_cmd_addr += sizeof(mach_header);
break;
case MH_MAGIC_64:
case MH_CIGAM_64:
case llvm::MachO::HeaderMagic64:
case llvm::MachO::HeaderMagic64Swapped:
data.SetAddressByteSize(8);
load_cmd_addr += sizeof(struct mach_header_64);
load_cmd_addr += sizeof(mach_header_64);
break;
default:
@ -707,7 +707,7 @@ DynamicLoaderMacOSXDYLD::ReadMachHeader (lldb::addr_t addr, struct mach_header *
}
// Read the rest of dyld's mach header
if (data.GetU32(&offset, &header->cputype, (sizeof(struct mach_header)/sizeof(uint32_t)) - 1))
if (data.GetU32(&offset, &header->cputype, (sizeof(mach_header)/sizeof(uint32_t)) - 1))
{
if (load_command_data == NULL)
return true; // We were able to read the mach_header and weren't asked to read the load command bytes
@ -752,15 +752,15 @@ DynamicLoaderMacOSXDYLD::ParseLoadCommands (const DataExtractor& data, struct DY
// Clear out any load command specific data from DYLIB_INFO since
// we are about to read it.
if (data.ValidOffsetForDataOfSize (offset, sizeof(struct load_command)))
if (data.ValidOffsetForDataOfSize (offset, sizeof(load_command)))
{
struct load_command load_cmd;
load_command load_cmd;
uint32_t load_cmd_offset = offset;
load_cmd.cmd = data.GetU32 (&offset);
load_cmd.cmdsize = data.GetU32 (&offset);
switch (load_cmd.cmd)
{
case LC_SEGMENT:
case LoadCommandSegment32:
{
segment.name.SetTrimmedCStringWithLength ((const char *)data.GetData(&offset, 16), 16);
segment.addr = data.GetU32 (&offset);
@ -769,7 +769,7 @@ DynamicLoaderMacOSXDYLD::ParseLoadCommands (const DataExtractor& data, struct DY
}
break;
case LC_SEGMENT_64:
case LoadCommandSegment64:
{
segment.name.SetTrimmedCStringWithLength ((const char *)data.GetData(&offset, 16), 16);
segment.addr = data.GetU64 (&offset);
@ -778,7 +778,7 @@ DynamicLoaderMacOSXDYLD::ParseLoadCommands (const DataExtractor& data, struct DY
}
break;
case LC_ID_DYLINKER:
case LoadCommandDynamicLinkerIdent:
if (lc_id_dylinker)
{
uint32_t name_offset = load_cmd_offset + data.GetU32 (&offset);
@ -787,7 +787,7 @@ DynamicLoaderMacOSXDYLD::ParseLoadCommands (const DataExtractor& data, struct DY
}
break;
case LC_UUID:
case LoadCommandUUID:
dylib_info.uuid.SetBytes(data.GetData (&offset, 16));
break;
@ -820,7 +820,7 @@ DynamicLoaderMacOSXDYLD::UpdateAllImageInfosHeaderAndLoadCommands()
ParseLoadCommands (data, m_dyld_image_infos[i], NULL);
if (m_dyld_image_infos[i].header.filetype == MH_EXECUTE)
if (m_dyld_image_infos[i].header.filetype == HeaderFileTypeExecutable)
exe_idx = i;
}
}

View File

@ -11,19 +11,20 @@
#define liblldb_DynamicLoaderMacOSXDYLD_h_
// C Includes
#include <mach-o/loader.h>
// C++ Includes
#include <map>
#include <vector>
#include <string>
// Other libraries and framework includes
#include "llvm/Support/MachO.h"
#include "lldb/Target/DynamicLoader.h"
#include "lldb/Core/FileSpec.h"
#include "lldb/Core/UUID.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Process.h"
#include "ObjCTrampolineHandler.h"
class DynamicLoaderMacOSXDYLD : public lldb_private::DynamicLoader
@ -144,12 +145,12 @@ protected:
{
switch (m_dyld.header.magic)
{
case MH_MAGIC:
case MH_CIGAM:
case llvm::MachO::HeaderMagic32:
case llvm::MachO::HeaderMagic32Swapped:
return 4;
case MH_MAGIC_64:
case MH_CIGAM_64:
case llvm::MachO::HeaderMagic64:
case llvm::MachO::HeaderMagic64Swapped:
return 8;
default:
@ -163,12 +164,12 @@ protected:
{
switch (magic)
{
case MH_MAGIC:
case MH_MAGIC_64:
case llvm::MachO::HeaderMagic32:
case llvm::MachO::HeaderMagic64:
return lldb::eByteOrderHost;
case MH_CIGAM:
case MH_CIGAM_64:
case llvm::MachO::HeaderMagic32Swapped:
case llvm::MachO::HeaderMagic64Swapped:
if (lldb::eByteOrderHost == lldb::eByteOrderBig)
return lldb::eByteOrderLittle;
else
@ -182,7 +183,7 @@ protected:
bool
ReadMachHeader (lldb::addr_t addr,
struct mach_header *header,
llvm::MachO::mach_header *header,
lldb_private::DataExtractor *load_command_data);
class Segment
{
@ -218,7 +219,7 @@ protected:
lldb::addr_t mod_date; // Modification date for this dylib
lldb_private::FileSpec file_spec; // Resolved path for this dylib
lldb_private::UUID uuid; // UUID for this dylib if it has one, else all zeros
struct mach_header header; // The mach header for this image
llvm::MachO::mach_header header; // The mach header for this image
std::vector<Segment> segments; // All segment vmaddr and vmsize pairs for this executable (from memory of inferior)
DYLDImageInfo() :

View File

@ -16,7 +16,7 @@
using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;
void
ObjectContainerUniversalMachO::Initialize()
@ -75,7 +75,7 @@ ObjectContainerUniversalMachO::MagicBytesMatch (DataBufferSP& dataSP)
DataExtractor data(dataSP, eByteOrderHost, 4);
uint32_t offset = 0;
uint32_t magic = data.GetU32(&offset);
return magic == FAT_MAGIC || magic == FAT_CIGAM;
return magic == UniversalMagic || magic == UniversalMagicSwapped;
}
ObjectContainerUniversalMachO::ObjectContainerUniversalMachO
@ -108,20 +108,20 @@ ObjectContainerUniversalMachO::ParseHeader ()
m_data.SetByteOrder (eByteOrderBig);
m_header.magic = m_data.GetU32(&offset);
if (m_header.magic == FAT_MAGIC)
if (m_header.magic == UniversalMagic)
{
m_data.SetAddressByteSize(4);
m_header.nfat_arch = m_data.GetU32(&offset);
const size_t nfat_arch_size = sizeof(fat_arch_t) * m_header.nfat_arch;
const size_t nfat_arch_size = sizeof(fat_arch) * m_header.nfat_arch;
// See if the current data we have is enough for all of the fat headers?
if (!m_data.ValidOffsetForDataOfSize(offset, nfat_arch_size))
{
// The fat headers are larger than the number of bytes we have been
// given when this class was constructed. We will read the exact number
// of bytes that we need.
DataBufferSP data_sp(m_file.ReadFileContents(m_offset, nfat_arch_size + sizeof(fat_header_t)));
DataBufferSP data_sp(m_file.ReadFileContents(m_offset, nfat_arch_size + sizeof(fat_header)));
m_data.SetData (data_sp);
}
@ -130,10 +130,10 @@ ObjectContainerUniversalMachO::ParseHeader ()
uint32_t arch_idx = 0;
for (arch_idx = 0; arch_idx < m_header.nfat_arch; ++arch_idx)
{
if (m_data.ValidOffsetForDataOfSize(offset, sizeof(fat_arch_t)))
if (m_data.ValidOffsetForDataOfSize(offset, sizeof(fat_arch)))
{
fat_arch_t arch;
if (m_data.GetU32(&offset, &arch, sizeof(fat_arch_t)/sizeof(uint32_t)))
fat_arch arch;
if (m_data.GetU32(&offset, &arch, sizeof(fat_arch)/sizeof(uint32_t)))
{
m_fat_archs.push_back(arch);
}

View File

@ -10,11 +10,11 @@
#ifndef liblldb_ObjectContainerUniversalMachO_h_
#define liblldb_ObjectContainerUniversalMachO_h_
#include <mach-o/fat.h>
#include "lldb/Symbol/ObjectContainer.h"
#include "lldb/Core/FileSpec.h"
#include "llvm/Support/MachO.h"
class ObjectContainerUniversalMachO :
public lldb_private::ObjectContainer
{
@ -94,10 +94,8 @@ public:
protected:
typedef struct fat_header fat_header_t;
typedef struct fat_arch fat_arch_t;
fat_header_t m_header;
std::vector<fat_arch_t> m_fat_archs;
llvm::MachO::fat_header m_header;
std::vector<llvm::MachO::fat_arch> m_fat_archs;
};
#endif // liblldb_ObjectContainerUniversalMachO_h_

View File

@ -9,9 +9,6 @@
#include "ObjectFileMachO.h"
#include <mach-o/nlist.h>
#include <mach-o/stab.h>
#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/DataBuffer.h"
#include "lldb/Core/FileSpec.h"
@ -25,18 +22,10 @@
#include "lldb/Core/UUID.h"
#include "lldb/Symbol/ObjectFile.h"
#ifndef S_DTRACE_DOF
// section contains DTrace Object Format
#define S_DTRACE_DOF 0xf
#endif
#ifndef S_LAZY_DYLIB_SYMBOL_POINTERS
// section with only lazy symbol pointers to lazy loaded dylibs
#define S_LAZY_DYLIB_SYMBOL_POINTERS 0x10
#endif
using namespace lldb;
using namespace lldb_private;
using namespace llvm::MachO;
void
@ -85,12 +74,12 @@ MachHeaderSizeFromMagic(uint32_t magic)
{
switch (magic)
{
case MH_MAGIC:
case MH_CIGAM:
case HeaderMagic32:
case HeaderMagic32Swapped:
return sizeof(struct mach_header);
case MH_MAGIC_64:
case MH_CIGAM_64:
case HeaderMagic64:
case HeaderMagic64Swapped:
return sizeof(struct mach_header_64);
break;
@ -139,25 +128,25 @@ ObjectFileMachO::ParseHeader ()
m_header.magic = m_data.GetU32(&offset);
switch (m_header.magic)
{
case MH_MAGIC:
case HeaderMagic32:
m_data.SetByteOrder (eByteOrderHost);
m_data.SetAddressByteSize(4);
can_parse = true;
break;
case MH_MAGIC_64:
case HeaderMagic64:
m_data.SetByteOrder (eByteOrderHost);
m_data.SetAddressByteSize(8);
can_parse = true;
break;
case MH_CIGAM:
case HeaderMagic32Swapped:
m_data.SetByteOrder(eByteOrderHost == eByteOrderBig ? eByteOrderLittle : eByteOrderBig);
m_data.SetAddressByteSize(4);
can_parse = true;
break;
case MH_CIGAM_64:
case HeaderMagic64Swapped:
m_data.SetByteOrder(eByteOrderHost == eByteOrderBig ? eByteOrderLittle : eByteOrderBig);
m_data.SetAddressByteSize(8);
can_parse = true;
@ -245,7 +234,7 @@ ObjectFileMachO::ParseSections ()
if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
break;
if (load_cmd.cmd == LC_SEGMENT || load_cmd.cmd == LC_SEGMENT_64)
if (load_cmd.cmd == LoadCommandSegment32 || load_cmd.cmd == LoadCommandSegment64)
{
if (m_data.GetU8(&offset, (uint8_t*)load_cmd.segname, 16))
{
@ -282,13 +271,13 @@ ObjectFileMachO::ParseSections ()
struct section_64 sect64;
::bzero (&sect64, sizeof(sect64));
// Push a section into our mach sections for the section at
// index zero (NO_SECT)
// index zero (NListSectionNoSection)
m_mach_sections.push_back(sect64);
uint32_t segment_sect_idx;
const lldb::user_id_t first_segment_sectID = sectID + 1;
const uint32_t num_u32s = load_cmd.cmd == LC_SEGMENT ? 7 : 8;
const uint32_t num_u32s = load_cmd.cmd == LoadCommandSegment32 ? 7 : 8;
for (segment_sect_idx=0; segment_sect_idx<load_cmd.nsects; ++segment_sect_idx)
{
if (m_data.GetU8(&offset, (uint8_t*)sect64.sectname, sizeof(sect64.sectname)) == NULL)
@ -375,7 +364,7 @@ ObjectFileMachO::ParseSections ()
}
assert (segment_sp.get());
uint32_t mach_sect_type = sect64.flags & SECTION_TYPE;
uint32_t mach_sect_type = sect64.flags & SectionFlagMaskSectionType;
static ConstString g_sect_name_objc_data ("__objc_data");
static ConstString g_sect_name_objc_msgrefs ("__objc_msgrefs");
static ConstString g_sect_name_objc_selrefs ("__objc_selrefs");
@ -412,26 +401,23 @@ ObjectFileMachO::ParseSections ()
switch (mach_sect_type)
{
// TODO: categorize sections by other flags for regular sections
case S_REGULAR:
sect_type = eSectionTypeOther;
break;
case S_ZEROFILL: sect_type = eSectionTypeZeroFill; break;
case S_CSTRING_LITERALS: sect_type = eSectionTypeDataCString; break; // section with only literal C strings
case S_4BYTE_LITERALS: sect_type = eSectionTypeData4; break; // section with only 4 byte literals
case S_8BYTE_LITERALS: sect_type = eSectionTypeData8; break; // section with only 8 byte literals
case S_LITERAL_POINTERS: sect_type = eSectionTypeDataPointers; break; // section with only pointers to literals
case S_NON_LAZY_SYMBOL_POINTERS: sect_type = eSectionTypeDataPointers; break; // section with only non-lazy symbol pointers
case S_LAZY_SYMBOL_POINTERS: sect_type = eSectionTypeDataPointers; break; // section with only lazy symbol pointers
case S_SYMBOL_STUBS: sect_type = eSectionTypeCode; break; // section with only symbol stubs, byte size of stub in the reserved2 field
case S_MOD_INIT_FUNC_POINTERS: sect_type = eSectionTypeDataPointers; break; // section with only function pointers for initialization
case S_MOD_TERM_FUNC_POINTERS: sect_type = eSectionTypeDataPointers; break; // section with only function pointers for termination
case S_COALESCED: sect_type = eSectionTypeOther; break;
case S_GB_ZEROFILL: sect_type = eSectionTypeZeroFill; break;
case S_INTERPOSING: sect_type = eSectionTypeCode; break; // section with only pairs of function pointers for interposing
case S_16BYTE_LITERALS: sect_type = eSectionTypeData16; break; // section with only 16 byte literals
case S_DTRACE_DOF: sect_type = eSectionTypeDebug; break;
case S_LAZY_DYLIB_SYMBOL_POINTERS: sect_type = eSectionTypeDataPointers; break;
case SectionTypeRegular: sect_type = eSectionTypeOther; break;
case SectionTypeZeroFill: sect_type = eSectionTypeZeroFill; break;
case SectionTypeCStringLiterals: sect_type = eSectionTypeDataCString; break; // section with only literal C strings
case SectionType4ByteLiterals: sect_type = eSectionTypeData4; break; // section with only 4 byte literals
case SectionType8ByteLiterals: sect_type = eSectionTypeData8; break; // section with only 8 byte literals
case SectionTypeLiteralPointers: sect_type = eSectionTypeDataPointers; break; // section with only pointers to literals
case SectionTypeNonLazySymbolPointers: sect_type = eSectionTypeDataPointers; break; // section with only non-lazy symbol pointers
case SectionTypeLazySymbolPointers: sect_type = eSectionTypeDataPointers; break; // section with only lazy symbol pointers
case SectionTypeSymbolStubs: sect_type = eSectionTypeCode; break; // section with only symbol stubs, byte size of stub in the reserved2 field
case SectionTypeModuleInitFunctionPointers: sect_type = eSectionTypeDataPointers; break; // section with only function pointers for initialization
case SectionTypeModuleTermFunctionPointers: sect_type = eSectionTypeDataPointers; break; // section with only function pointers for termination
case SectionTypeCoalesced: sect_type = eSectionTypeOther; break;
case SectionTypeZeroFillLarge: sect_type = eSectionTypeZeroFill; break;
case SectionTypeInterposing: sect_type = eSectionTypeCode; break; // section with only pairs of function pointers for interposing
case SectionType16ByteLiterals: sect_type = eSectionTypeData16; break; // section with only 16 byte literals
case SectionTypeDTraceObjectFormat: sect_type = eSectionTypeDebug; break;
case SectionTypeLazyDylibSymbolPointers: sect_type = eSectionTypeDataPointers; break;
default: break;
}
}
@ -454,7 +440,7 @@ ObjectFileMachO::ParseSections ()
segment_name.Clear();
}
}
if (m_header.filetype == MH_DSYM)
if (m_header.filetype == HeaderFileTypeDSYM)
{
if (first_segment_sectID <= sectID)
{
@ -482,7 +468,7 @@ ObjectFileMachO::ParseSections ()
}
}
}
else if (load_cmd.cmd == LC_DYSYMTAB)
else if (load_cmd.cmd == LoadCommandDynamicSymtabInfo)
{
m_dysymtab.cmd = load_cmd.cmd;
m_dysymtab.cmdsize = load_cmd.cmdsize;
@ -569,7 +555,7 @@ ObjectFileMachO::ParseSymtab (bool minimize)
if (m_data.GetU32(&offset, &symtab_load_command, 2) == NULL)
break;
// Watch for the symbol table load command
if (symtab_load_command.cmd == LC_SYMTAB)
if (symtab_load_command.cmd == LoadCommandSymtab)
{
// Read in the rest of the symtab load command
if (m_data.GetU32(&offset, &symtab_load_command.symoff, 4)) // fill in symoff, nsyms, stroff, strsize fields
@ -602,7 +588,7 @@ ObjectFileMachO::ParseSymtab (bool minimize)
else
eh_frame_section_sp = section_list->FindSectionByName (g_section_name_eh_frame);
uint8_t TEXT_eh_frame_sectID = eh_frame_section_sp.get() ? eh_frame_section_sp->GetID() : NO_SECT;
uint8_t TEXT_eh_frame_sectID = eh_frame_section_sp.get() ? eh_frame_section_sp->GetID() : NListSectionNoSection;
//uint32_t symtab_offset = 0;
const uint8_t* nlist_data = symtab_data_sp->GetBytes();
assert (symtab_data_sp->GetByteSize()/nlist_size >= symtab_load_command.nsyms);
@ -635,7 +621,7 @@ ObjectFileMachO::ParseSymtab (bool minimize)
if (bit_width_32)
{
struct nlist* nlist32_ptr = (struct nlist*)(nlist_data + (nlist_idx * nlist_size));
nlist.n_un.n_strx = nlist32_ptr->n_un.n_strx;
nlist.n_strx = nlist32_ptr->n_strx;
nlist.n_type = nlist32_ptr->n_type;
nlist.n_sect = nlist32_ptr->n_sect;
nlist.n_desc = nlist32_ptr->n_desc;
@ -647,12 +633,12 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
SymbolType type = eSymbolTypeInvalid;
const char* symbol_name = &strtab_data[nlist.n_un.n_strx];
const char* symbol_name = &strtab_data[nlist.n_strx];
if (symbol_name[0] == '\0')
symbol_name = NULL;
Section* symbol_section = NULL;
bool add_nlist = true;
bool is_debug = ((nlist.n_type & N_STAB) != 0);
bool is_debug = ((nlist.n_type & NlistMaskStab) != 0);
assert (sym_idx < num_syms);
@ -662,18 +648,21 @@ ObjectFileMachO::ParseSymtab (bool minimize)
{
switch (nlist.n_type)
{
case N_GSYM: // global symbol: name,,NO_SECT,type,0
case StabGlobalSymbol:
// N_GSYM -- global symbol: name,,NO_SECT,type,0
// Sometimes the N_GSYM value contains the address.
if (nlist.n_value != 0)
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
type = eSymbolTypeGlobal;
break;
case N_FNAME: // procedure name (f77 kludge): name,,NO_SECT,0,0
case StabFunctionName:
// N_FNAME -- procedure name (f77 kludge): name,,NO_SECT,0,0
type = eSymbolTypeFunction;
break;
case N_FUN: // procedure: name,,n_sect,linenumber,address
case StabFunction:
// N_FUN -- procedure: name,,n_sect,linenumber,address
if (symbol_name)
{
type = eSymbolTypeFunction;
@ -701,17 +690,20 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
break;
case N_STSYM: // static symbol: name,,n_sect,type,address
case StabStaticSymbol:
// N_STSYM -- static symbol: name,,n_sect,type,address
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
type = eSymbolTypeStatic;
break;
case N_LCSYM: // .lcomm symbol: name,,n_sect,type,address
case StabLocalCommon:
// N_LCSYM -- .lcomm symbol: name,,n_sect,type,address
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
type = eSymbolTypeCommonBlock;
break;
case N_BNSYM:
case StabBeginSymbol:
// N_BNSYM
// We use the current number of symbols in the symbol table in lieu of
// using nlist_idx in case we ever start trimming entries out
if (minimize)
@ -727,7 +719,8 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
break;
case N_ENSYM:
case StabEndSymbol:
// N_ENSYM
// Set the size of the N_BNSYM to the terminating index of this N_ENSYM
// so that we can always skip the entire symbol if we need to navigate
// more quickly at the source level when parsing STABS
@ -750,24 +743,29 @@ ObjectFileMachO::ParseSymtab (bool minimize)
break;
case N_OPT: // emitted with gcc2_compiled and in gcc source
case StabSourceFileOptions:
// N_OPT - emitted with gcc2_compiled and in gcc source
type = eSymbolTypeCompiler;
break;
case N_RSYM: // register sym: name,,NO_SECT,type,register
case StabRegisterSymbol:
// N_RSYM - register sym: name,,NO_SECT,type,register
type = eSymbolTypeVariable;
break;
case N_SLINE: // src line: 0,,n_sect,linenumber,address
case StabSourceLine:
// N_SLINE - src line: 0,,n_sect,linenumber,address
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
type = eSymbolTypeLineEntry;
break;
case N_SSYM: // structure elt: name,,NO_SECT,type,struct_offset
case StabStructureType:
// N_SSYM - structure elt: name,,NO_SECT,type,struct_offset
type = eSymbolTypeVariableType;
break;
case N_SO:
case StabSourceFileName:
// N_SO - source file name
type = eSymbolTypeSourceFile;
if (symbol_name == NULL)
{
@ -802,25 +800,29 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
break;
case N_OSO: // object file name: name,,0,0,st_mtime
case StabObjectFileName:
// N_OSO - object file name: name,,0,0,st_mtime
type = eSymbolTypeObjectFile;
break;
case N_LSYM: // local sym: name,,NO_SECT,type,offset
case StabLocalSymbol:
// N_LSYM - local sym: name,,NO_SECT,type,offset
type = eSymbolTypeLocal;
break;
//----------------------------------------------------------------------
// INCL scopes
//----------------------------------------------------------------------
case N_BINCL: // include file beginning: name,,NO_SECT,0,sum
case StabBeginIncludeFileName:
// N_BINCL - include file beginning: name,,NO_SECT,0,sum
// We use the current number of symbols in the symbol table in lieu of
// using nlist_idx in case we ever start trimming entries out
N_INCL_indexes.push_back(sym_idx);
type = eSymbolTypeScopeBegin;
break;
case N_EINCL: // include file end: name,,NO_SECT,0,0
case StabEndIncludeFile:
// N_EINCL - include file end: name,,NO_SECT,0,0
// Set the size of the N_BINCL to the terminating index of this N_EINCL
// so that we can always skip the entire symbol if we need to navigate
// more quickly at the source level when parsing STABS
@ -834,27 +836,33 @@ ObjectFileMachO::ParseSymtab (bool minimize)
type = eSymbolTypeScopeEnd;
break;
case N_SOL: // #included file name: name,,n_sect,0,address
case StabIncludeFileName:
// N_SOL - #included file name: name,,n_sect,0,address
type = eSymbolTypeHeaderFile;
break;
case N_PARAMS: // compiler parameters: name,,NO_SECT,0,0
case StabCompilerParameters:
// N_PARAMS - compiler parameters: name,,NO_SECT,0,0
type = eSymbolTypeCompiler;
break;
case N_VERSION: // compiler version: name,,NO_SECT,0,0
case StabCompilerVersion:
// N_VERSION - compiler version: name,,NO_SECT,0,0
type = eSymbolTypeCompiler;
break;
case N_OLEVEL: // compiler -O level: name,,NO_SECT,0,0
case StabCompilerOptLevel:
// N_OLEVEL - compiler -O level: name,,NO_SECT,0,0
type = eSymbolTypeCompiler;
break;
case N_PSYM: // parameter: name,,NO_SECT,type,offset
case StabParameter:
// N_PSYM - parameter: name,,NO_SECT,type,offset
type = eSymbolTypeVariable;
break;
case N_ENTRY: // alternate entry: name,,n_sect,linenumber,address
case StabAlternateEntry:
// N_ENTRY - alternate entry: name,,n_sect,linenumber,address
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
type = eSymbolTypeLineEntry;
break;
@ -862,7 +870,8 @@ ObjectFileMachO::ParseSymtab (bool minimize)
//----------------------------------------------------------------------
// Left and Right Braces
//----------------------------------------------------------------------
case N_LBRAC: // left bracket: 0,,NO_SECT,nesting level,address
case StabLeftBracket:
// N_LBRAC - left bracket: 0,,NO_SECT,nesting level,address
// We use the current number of symbols in the symbol table in lieu of
// using nlist_idx in case we ever start trimming entries out
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
@ -870,7 +879,8 @@ ObjectFileMachO::ParseSymtab (bool minimize)
type = eSymbolTypeScopeBegin;
break;
case N_RBRAC: // right bracket: 0,,NO_SECT,nesting level,address
case StabRightBracket:
// N_RBRAC - right bracket: 0,,NO_SECT,nesting level,address
// Set the size of the N_LBRAC to the terminating index of this N_RBRAC
// so that we can always skip the entire symbol if we need to navigate
// more quickly at the source level when parsing STABS
@ -885,25 +895,29 @@ ObjectFileMachO::ParseSymtab (bool minimize)
type = eSymbolTypeScopeEnd;
break;
case N_EXCL: // deleted include file: name,,NO_SECT,0,sum
case StabDeletedIncludeFile:
// N_EXCL - deleted include file: name,,NO_SECT,0,sum
type = eSymbolTypeHeaderFile;
break;
//----------------------------------------------------------------------
// COMM scopes
//----------------------------------------------------------------------
case N_BCOMM: // begin common: name,,NO_SECT,0,0
case StabBeginCommon:
// N_BCOMM - begin common: name,,NO_SECT,0,0
// We use the current number of symbols in the symbol table in lieu of
// using nlist_idx in case we ever start trimming entries out
type = eSymbolTypeScopeBegin;
N_COMM_indexes.push_back(sym_idx);
break;
case N_ECOML: // end common (local name): 0,,n_sect,0,address
case StabEndCommonLocal:
// N_ECOML - end common (local name): 0,,n_sect,0,address
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
// Fall through
case N_ECOMM: // end common: name,,n_sect,0,0
case StabEndCommon:
// N_ECOMM - end common: name,,n_sect,0,0
// Set the size of the N_BCOMM to the terminating index of this N_ECOMM/N_ECOML
// so that we can always skip the entire symbol if we need to navigate
// more quickly at the source level when parsing STABS
@ -917,7 +931,8 @@ ObjectFileMachO::ParseSymtab (bool minimize)
type = eSymbolTypeScopeEnd;
break;
case N_LENG: // second stab entry with length information
case StabLength:
// N_LENG - second stab entry with length information
type = eSymbolTypeAdditional;
break;
@ -926,9 +941,9 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
else
{
//uint8_t n_pext = N_PEXT & nlist.n_type;
uint8_t n_type = N_TYPE & nlist.n_type;
sym[sym_idx].SetExternal((N_EXT & nlist.n_type) != 0);
//uint8_t n_pext = NlistMaskPrivateExternal & nlist.n_type;
uint8_t n_type = NlistMaskType & nlist.n_type;
sym[sym_idx].SetExternal((NlistMaskExternal & nlist.n_type) != 0);
if (symbol_name && ::strstr (symbol_name, ".objc") == symbol_name)
{
@ -938,17 +953,17 @@ ObjectFileMachO::ParseSymtab (bool minimize)
{
switch (n_type)
{
case N_INDR: // Fall through
case N_PBUD: // Fall through
case N_UNDF:
case NListTypeIndirect: // N_INDR - Fall through
case NListTypePreboundUndefined:// N_PBUD - Fall through
case NListTypeUndefined: // N_UNDF
type = eSymbolTypeExtern;
break;
case N_ABS:
case NListTypeAbsolute: // N_ABS
type = eSymbolTypeAbsolute;
break;
case N_SECT:
case NListTypeSection: // N_SECT
symbol_section = section_info.GetSection (nlist.n_sect, nlist.n_value);
assert(symbol_section != NULL);
@ -958,27 +973,27 @@ ObjectFileMachO::ParseSymtab (bool minimize)
}
else
{
uint32_t section_type = symbol_section->GetAllFlagBits() & SECTION_TYPE;
uint32_t section_type = symbol_section->GetAllFlagBits() & SectionFlagMaskSectionType;
switch (section_type)
{
case S_REGULAR: break; // regular section
//case S_ZEROFILL: type = eSymbolTypeData; break; // zero fill on demand section
case S_CSTRING_LITERALS: type = eSymbolTypeData; break; // section with only literal C strings
case S_4BYTE_LITERALS: type = eSymbolTypeData; break; // section with only 4 byte literals
case S_8BYTE_LITERALS: type = eSymbolTypeData; break; // section with only 8 byte literals
case S_LITERAL_POINTERS: type = eSymbolTypeTrampoline; break; // section with only pointers to literals
case S_NON_LAZY_SYMBOL_POINTERS: type = eSymbolTypeTrampoline; break; // section with only non-lazy symbol pointers
case S_LAZY_SYMBOL_POINTERS: type = eSymbolTypeTrampoline; break; // section with only lazy symbol pointers
case S_SYMBOL_STUBS: type = eSymbolTypeTrampoline; break; // section with only symbol stubs, byte size of stub in the reserved2 field
case S_MOD_INIT_FUNC_POINTERS: type = eSymbolTypeCode; break; // section with only function pointers for initialization
case S_MOD_TERM_FUNC_POINTERS: type = eSymbolTypeCode; break; // section with only function pointers for termination
//case S_COALESCED: type = eSymbolType; break; // section contains symbols that are to be coalesced
//case S_GB_ZEROFILL: type = eSymbolTypeData; break; // zero fill on demand section (that can be larger than 4 gigabytes)
case S_INTERPOSING: type = eSymbolTypeTrampoline; break; // section with only pairs of function pointers for interposing
case S_16BYTE_LITERALS: type = eSymbolTypeData; break; // section with only 16 byte literals
case S_DTRACE_DOF: type = eSymbolTypeInstrumentation; break;
case S_LAZY_DYLIB_SYMBOL_POINTERS: type = eSymbolTypeTrampoline; break;
case SectionTypeRegular: break; // regular section
//case SectionTypeZeroFill: type = eSymbolTypeData; break; // zero fill on demand section
case SectionTypeCStringLiterals: type = eSymbolTypeData; break; // section with only literal C strings
case SectionType4ByteLiterals: type = eSymbolTypeData; break; // section with only 4 byte literals
case SectionType8ByteLiterals: type = eSymbolTypeData; break; // section with only 8 byte literals
case SectionTypeLiteralPointers: type = eSymbolTypeTrampoline; break; // section with only pointers to literals
case SectionTypeNonLazySymbolPointers: type = eSymbolTypeTrampoline; break; // section with only non-lazy symbol pointers
case SectionTypeLazySymbolPointers: type = eSymbolTypeTrampoline; break; // section with only lazy symbol pointers
case SectionTypeSymbolStubs: type = eSymbolTypeTrampoline; break; // section with only symbol stubs, byte size of stub in the reserved2 field
case SectionTypeModuleInitFunctionPointers: type = eSymbolTypeCode; break; // section with only function pointers for initialization
case SectionTypeModuleTermFunctionPointers: type = eSymbolTypeCode; break; // section with only function pointers for termination
//case SectionTypeCoalesced: type = eSymbolType; break; // section contains symbols that are to be coalesced
//case SectionTypeZeroFillLarge: type = eSymbolTypeData; break; // zero fill on demand section (that can be larger than 4 gigabytes)
case SectionTypeInterposing: type = eSymbolTypeTrampoline; break; // section with only pairs of function pointers for interposing
case SectionType16ByteLiterals: type = eSymbolTypeData; break; // section with only 16 byte literals
case SectionTypeDTraceObjectFormat: type = eSymbolTypeInstrumentation; break;
case SectionTypeLazyDylibSymbolPointers: type = eSymbolTypeTrampoline; break;
default: break;
}
@ -987,7 +1002,9 @@ ObjectFileMachO::ParseSymtab (bool minimize)
const char *symbol_sect_name = symbol_section->GetName().AsCString();
if (symbol_section->IsDescendant (text_section_sp.get()))
{
if (symbol_section->IsClear(S_ATTR_PURE_INSTRUCTIONS | S_ATTR_SELF_MODIFYING_CODE | S_ATTR_SOME_INSTRUCTIONS))
if (symbol_section->IsClear(SectionAttrUserPureInstructions |
SectionAttrUserSelfModifyingCode |
SectionAttrSytemSomeInstructions))
type = eSymbolTypeData;
else
type = eSymbolTypeCode;
@ -1097,7 +1114,7 @@ ObjectFileMachO::ParseSymtab (bool minimize)
for (uint32_t sect_idx = 1; sect_idx < m_mach_sections.size(); ++sect_idx)
{
if ((m_mach_sections[sect_idx].flags & SECTION_TYPE) == S_SYMBOL_STUBS)
if ((m_mach_sections[sect_idx].flags & SectionFlagMaskSectionType) == SectionTypeSymbolStubs)
{
uint32_t symbol_stub_byte_size = m_mach_sections[sect_idx].reserved2;
if (symbol_stub_byte_size == 0)
@ -1177,7 +1194,7 @@ ObjectFileMachO::Dump (Stream *s)
lldb_private::Mutex::Locker locker(m_mutex);
s->Printf("%.*p: ", (int)sizeof(void*) * 2, this);
s->Indent();
if (m_header.magic == MH_MAGIC_64 || m_header.magic == MH_CIGAM_64)
if (m_header.magic == HeaderMagic64 || m_header.magic == HeaderMagic64Swapped)
s->PutCString("ObjectFileMachO64");
else
s->PutCString("ObjectFileMachO32");
@ -1207,7 +1224,7 @@ ObjectFileMachO::GetUUID (UUID* uuid)
if (m_data.GetU32(&offset, &load_cmd, 2) == NULL)
break;
if (load_cmd.cmd == LC_UUID)
if (load_cmd.cmd == LoadCommandUUID)
{
const uint8_t *uuid_bytes = m_data.PeekData(offset, 16);
if (uuid_bytes)
@ -1239,11 +1256,11 @@ ObjectFileMachO::GetDependentModules (FileSpecList& files)
switch (load_cmd.cmd)
{
case LC_LOAD_DYLIB:
case LC_LOAD_WEAK_DYLIB:
case LC_REEXPORT_DYLIB:
case LC_LOAD_DYLINKER:
case LC_LOADFVMLIB:
case LoadCommandDylibLoad:
case LoadCommandDylibLoadWeak:
case LoadCommandDylibReexport:
case LoadCommandDynamicLinkerLoad:
case LoadCommandFixedVMShlibLoad:
{
uint32_t name_offset = cmd_offset + m_data.GetU32(&offset);
const char *path = m_data.PeekCStr(name_offset);

View File

@ -10,7 +10,8 @@
#ifndef liblldb_ObjectFileMachO_h_
#define liblldb_ObjectFileMachO_h_
#include <mach-o/loader.h>
#include "llvm/Support/MachO.h"
#include "lldb/Core/FileSpec.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Symbol/ObjectFile.h"
@ -112,13 +113,13 @@ public:
protected:
mutable lldb_private::Mutex m_mutex;
struct mach_header m_header;
llvm::MachO::mach_header m_header;
mutable std::auto_ptr<lldb_private::SectionList> m_sections_ap;
mutable std::auto_ptr<lldb_private::Symtab> m_symtab_ap;
struct dysymtab_command m_dysymtab;
std::vector<struct segment_command_64> m_mach_segments;
std::vector<struct section_64> m_mach_sections;
llvm::MachO::dysymtab_command m_dysymtab;
std::vector<llvm::MachO::segment_command_64> m_mach_segments;
std::vector<llvm::MachO::section_64> m_mach_sections;
size_t
ParseSections ();

View File

@ -9,15 +9,9 @@
// C Includes
#include <errno.h>
#include <mach/mach.h>
#include <mach-o/dyld.h>
#include <spawn.h>
#include <sys/fcntl.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
#include <sys/sysctl.h>
#include <unistd.h>
// C++ Includes
#include <algorithm>

View File

@ -9,8 +9,6 @@
#include "SymbolVendorMacOSX.h"
#include <mach/machine.h> // DebugSymbols needs this on Leopard...
#include <AvailabilityMacros.h>
#include "lldb/Core/Module.h"

View File

@ -1,20 +0,0 @@
//===-- ASTType.cpp ---------------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "lldb/Symbol/ASTType.h"
using namespace lldb_private;
ASTTypeBase::~ASTTypeBase()
{
}
ASTType::~ASTType()
{
}

View File

@ -316,11 +316,11 @@ ClangASTContext::getSelectorTable()
return m_selector_table_ap.get();
}
SourceManager *
clang::SourceManager *
ClangASTContext::getSourceManager()
{
if (m_source_manager_ap.get() == NULL)
m_source_manager_ap.reset(new SourceManager(*getDiagnostic()));
m_source_manager_ap.reset(new clang::SourceManager(*getDiagnostic()));
return m_source_manager_ap.get();
}
@ -758,7 +758,7 @@ ClangASTContext::AddFieldToRecordType (void * record_clang_type, const char *nam
QualType record_qual_type(QualType::getFromOpaquePtr(record_clang_type));
Type *clang_type = record_qual_type.getTypePtr();
clang::Type *clang_type = record_qual_type.getTypePtr();
if (clang_type)
{
const RecordType *record_type = dyn_cast<RecordType>(clang_type);
@ -863,7 +863,7 @@ ClangASTContext::SetDefaultAccessForRecordFields (void *clang_qual_type, int def
if (clang_qual_type)
{
QualType qual_type(QualType::getFromOpaquePtr(clang_qual_type));
Type *clang_type = qual_type.getTypePtr();
clang::Type *clang_type = qual_type.getTypePtr();
if (clang_type)
{
RecordType *record_type = dyn_cast<RecordType>(clang_type);
@ -913,7 +913,7 @@ ClangASTContext::SetBaseClassesForClassType (void *class_clang_type, CXXBaseSpec
{
if (class_clang_type)
{
Type *clang_type = QualType::getFromOpaquePtr(class_clang_type).getTypePtr();
clang::Type *clang_type = QualType::getFromOpaquePtr(class_clang_type).getTypePtr();
if (clang_type)
{
RecordType *record_type = dyn_cast<RecordType>(clang_type);
@ -948,15 +948,15 @@ ClangASTContext::IsAggregateType (void *clang_type)
switch (qual_type->getTypeClass())
{
case Type::IncompleteArray:
case Type::VariableArray:
case Type::ConstantArray:
case Type::ExtVector:
case Type::Vector:
case Type::Record:
case clang::Type::IncompleteArray:
case clang::Type::VariableArray:
case clang::Type::ConstantArray:
case clang::Type::ExtVector:
case clang::Type::Vector:
case clang::Type::Record:
return true;
case Type::Typedef:
case clang::Type::Typedef:
return ClangASTContext::IsAggregateType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr());
default:
@ -976,7 +976,7 @@ ClangASTContext::GetNumChildren (void *clang_qual_type, bool omit_empty_base_cla
QualType qual_type(QualType::getFromOpaquePtr(clang_qual_type));
switch (qual_type->getTypeClass())
{
case Type::Record:
case clang::Type::Record:
{
const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
const RecordDecl *record_decl = record_type->getDecl();
@ -1017,11 +1017,11 @@ ClangASTContext::GetNumChildren (void *clang_qual_type, bool omit_empty_base_cla
}
break;
case Type::ConstantArray:
case clang::Type::ConstantArray:
num_children = cast<ConstantArrayType>(qual_type.getTypePtr())->getSize().getLimitedValue();
break;
case Type::Pointer:
case clang::Type::Pointer:
{
PointerType *pointer_type = cast<PointerType>(qual_type.getTypePtr());
QualType pointee_type = pointer_type->getPointeeType();
@ -1034,7 +1034,7 @@ ClangASTContext::GetNumChildren (void *clang_qual_type, bool omit_empty_base_cla
}
break;
case Type::Typedef:
case clang::Type::Typedef:
num_children = ClangASTContext::GetNumChildren (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), omit_empty_base_classes);
break;
@ -1103,7 +1103,7 @@ ClangASTContext::GetChildClangTypeAtIndex
QualType parent_qual_type(QualType::getFromOpaquePtr(parent_clang_type));
switch (parent_qual_type->getTypeClass())
{
case Type::Record:
case clang::Type::Record:
{
const RecordType *record_type = cast<RecordType>(parent_qual_type.getTypePtr());
const RecordDecl *record_decl = record_type->getDecl();
@ -1190,7 +1190,7 @@ ClangASTContext::GetChildClangTypeAtIndex
}
break;
case Type::ConstantArray:
case clang::Type::ConstantArray:
{
const ConstantArrayType *array = cast<ConstantArrayType>(parent_qual_type.getTypePtr());
const uint64_t element_count = array->getSize().getLimitedValue();
@ -1211,7 +1211,7 @@ ClangASTContext::GetChildClangTypeAtIndex
}
break;
case Type::Pointer:
case clang::Type::Pointer:
{
PointerType *pointer_type = cast<PointerType>(parent_qual_type.getTypePtr());
QualType pointee_type = pointer_type->getPointeeType();
@ -1251,7 +1251,7 @@ ClangASTContext::GetChildClangTypeAtIndex
}
break;
case Type::Typedef:
case clang::Type::Typedef:
return GetChildClangTypeAtIndex (ast_context,
parent_name,
cast<TypedefType>(parent_qual_type)->LookThroughTypedefs().getAsOpaquePtr(),
@ -1461,7 +1461,7 @@ ClangASTContext::GetIndexOfChildMemberWithName
QualType qual_type(QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::Record:
case clang::Type::Record:
{
const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
const RecordDecl *record_decl = record_type->getDecl();
@ -1548,7 +1548,7 @@ ClangASTContext::GetIndexOfChildMemberWithName
}
break;
case Type::ConstantArray:
case clang::Type::ConstantArray:
{
// const ConstantArrayType *array = cast<ConstantArrayType>(parent_qual_type.getTypePtr());
// const uint64_t element_count = array->getSize().getLimitedValue();
@ -1569,7 +1569,7 @@ ClangASTContext::GetIndexOfChildMemberWithName
}
break;
// case Type::MemberPointerType:
// case clang::Type::MemberPointerType:
// {
// MemberPointerType *mem_ptr_type = cast<MemberPointerType>(qual_type.getTypePtr());
// QualType pointee_type = mem_ptr_type->getPointeeType();
@ -1583,8 +1583,8 @@ ClangASTContext::GetIndexOfChildMemberWithName
// }
// break;
//
case Type::LValueReference:
case Type::RValueReference:
case clang::Type::LValueReference:
case clang::Type::RValueReference:
{
ReferenceType *reference_type = cast<ReferenceType>(qual_type.getTypePtr());
QualType pointee_type = reference_type->getPointeeType();
@ -1600,7 +1600,7 @@ ClangASTContext::GetIndexOfChildMemberWithName
}
break;
case Type::Pointer:
case clang::Type::Pointer:
{
PointerType *pointer_type = cast<PointerType>(qual_type.getTypePtr());
QualType pointee_type = pointer_type->getPointeeType();
@ -1634,7 +1634,7 @@ ClangASTContext::GetIndexOfChildMemberWithName
}
break;
case Type::Typedef:
case clang::Type::Typedef:
return GetIndexOfChildMemberWithName (ast_context,
cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(),
name,
@ -1667,7 +1667,7 @@ ClangASTContext::GetIndexOfChildWithName
QualType qual_type(QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::Record:
case clang::Type::Record:
{
const RecordType *record_type = cast<RecordType>(qual_type.getTypePtr());
const RecordDecl *record_decl = record_type->getDecl();
@ -1709,7 +1709,7 @@ ClangASTContext::GetIndexOfChildWithName
}
break;
case Type::ConstantArray:
case clang::Type::ConstantArray:
{
// const ConstantArrayType *array = cast<ConstantArrayType>(parent_qual_type.getTypePtr());
// const uint64_t element_count = array->getSize().getLimitedValue();
@ -1730,7 +1730,7 @@ ClangASTContext::GetIndexOfChildWithName
}
break;
// case Type::MemberPointerType:
// case clang::Type::MemberPointerType:
// {
// MemberPointerType *mem_ptr_type = cast<MemberPointerType>(qual_type.getTypePtr());
// QualType pointee_type = mem_ptr_type->getPointeeType();
@ -1744,8 +1744,8 @@ ClangASTContext::GetIndexOfChildWithName
// }
// break;
//
case Type::LValueReference:
case Type::RValueReference:
case clang::Type::LValueReference:
case clang::Type::RValueReference:
{
ReferenceType *reference_type = cast<ReferenceType>(qual_type.getTypePtr());
QualType pointee_type = reference_type->getPointeeType();
@ -1760,7 +1760,7 @@ ClangASTContext::GetIndexOfChildWithName
}
break;
case Type::Pointer:
case clang::Type::Pointer:
{
PointerType *pointer_type = cast<PointerType>(qual_type.getTypePtr());
QualType pointee_type = pointer_type->getPointeeType();
@ -1793,7 +1793,7 @@ ClangASTContext::GetIndexOfChildWithName
}
break;
case Type::Typedef:
case clang::Type::Typedef:
return GetIndexOfChildWithName (ast_context,
cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(),
name,
@ -1814,7 +1814,7 @@ ClangASTContext::SetTagTypeKind (void *tag_clang_type, int kind)
if (tag_clang_type)
{
QualType tag_qual_type(QualType::getFromOpaquePtr(tag_clang_type));
Type *clang_type = tag_qual_type.getTypePtr();
clang::Type *clang_type = tag_qual_type.getTypePtr();
if (clang_type)
{
TagType *tag_type = dyn_cast<TagType>(clang_type);
@ -1844,34 +1844,34 @@ ClangASTContext::GetDeclContextForType (void *clang_type)
QualType qual_type(QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::FunctionNoProto: break;
case Type::FunctionProto: break;
case Type::IncompleteArray: break;
case Type::VariableArray: break;
case Type::ConstantArray: break;
case Type::ExtVector: break;
case Type::Vector: break;
case Type::Builtin: break;
case Type::ObjCObjectPointer: break;
case Type::BlockPointer: break;
case Type::Pointer: break;
case Type::LValueReference: break;
case Type::RValueReference: break;
case Type::MemberPointer: break;
case Type::Complex: break;
case Type::ObjCInterface: break;
case Type::Record:
case clang::Type::FunctionNoProto: break;
case clang::Type::FunctionProto: break;
case clang::Type::IncompleteArray: break;
case clang::Type::VariableArray: break;
case clang::Type::ConstantArray: break;
case clang::Type::ExtVector: break;
case clang::Type::Vector: break;
case clang::Type::Builtin: break;
case clang::Type::ObjCObjectPointer: break;
case clang::Type::BlockPointer: break;
case clang::Type::Pointer: break;
case clang::Type::LValueReference: break;
case clang::Type::RValueReference: break;
case clang::Type::MemberPointer: break;
case clang::Type::Complex: break;
case clang::Type::ObjCInterface: break;
case clang::Type::Record:
return cast<RecordType>(qual_type)->getDecl();
case Type::Enum:
case clang::Type::Enum:
return cast<EnumType>(qual_type)->getDecl();
case Type::Typedef:
case clang::Type::Typedef:
return ClangASTContext::GetDeclContextForType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr());
case Type::TypeOfExpr: break;
case Type::TypeOf: break;
case Type::Decltype: break;
//case Type::QualifiedName: break;
case Type::TemplateSpecialization: break;
case clang::Type::TypeOfExpr: break;
case clang::Type::TypeOf: break;
case clang::Type::Decltype: break;
//case clang::Type::QualifiedName: break;
case clang::Type::TemplateSpecialization: break;
}
// No DeclContext in this type...
return NULL;
@ -2006,7 +2006,7 @@ ClangASTContext::StartTagDeclarationDefinition (void *clang_type)
if (clang_type)
{
QualType qual_type (QualType::getFromOpaquePtr(clang_type));
Type *t = qual_type.getTypePtr();
clang::Type *t = qual_type.getTypePtr();
if (t)
{
TagType *tag_type = dyn_cast<TagType>(t);
@ -2030,7 +2030,7 @@ ClangASTContext::CompleteTagDeclarationDefinition (void *clang_type)
if (clang_type)
{
QualType qual_type (QualType::getFromOpaquePtr(clang_type));
Type *t = qual_type.getTypePtr();
clang::Type *t = qual_type.getTypePtr();
if (t)
{
TagType *tag_type = dyn_cast<TagType>(t);
@ -2091,7 +2091,7 @@ ClangASTContext::AddEnumerationValueToEnumerationType
assert (identifier_table != NULL);
QualType enum_qual_type (QualType::getFromOpaquePtr(enum_clang_type));
Type *clang_type = enum_qual_type.getTypePtr();
clang::Type *clang_type = enum_qual_type.getTypePtr();
if (clang_type)
{
const EnumType *enum_type = dyn_cast<EnumType>(clang_type);
@ -2171,31 +2171,31 @@ ClangASTContext::IsPointerOrReferenceType (void *clang_type, void **target_type)
QualType qual_type (QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::ObjCObjectPointer:
case clang::Type::ObjCObjectPointer:
if (target_type)
*target_type = cast<ObjCObjectPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::BlockPointer:
case clang::Type::BlockPointer:
if (target_type)
*target_type = cast<BlockPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::Pointer:
case clang::Type::Pointer:
if (target_type)
*target_type = cast<PointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::MemberPointer:
case clang::Type::MemberPointer:
if (target_type)
*target_type = cast<MemberPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::LValueReference:
case clang::Type::LValueReference:
if (target_type)
*target_type = cast<LValueReferenceType>(qual_type)->desugar().getAsOpaquePtr();
return true;
case Type::RValueReference:
case clang::Type::RValueReference:
if (target_type)
*target_type = cast<LValueReferenceType>(qual_type)->desugar().getAsOpaquePtr();
return true;
case Type::Typedef:
case clang::Type::Typedef:
return ClangASTContext::IsPointerOrReferenceType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr());
default:
break;
@ -2247,23 +2247,23 @@ ClangASTContext::IsPointerType (void *clang_type, void **target_type)
QualType qual_type (QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::ObjCObjectPointer:
case clang::Type::ObjCObjectPointer:
if (target_type)
*target_type = cast<ObjCObjectPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::BlockPointer:
case clang::Type::BlockPointer:
if (target_type)
*target_type = cast<BlockPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::Pointer:
case clang::Type::Pointer:
if (target_type)
*target_type = cast<PointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::MemberPointer:
case clang::Type::MemberPointer:
if (target_type)
*target_type = cast<MemberPointerType>(qual_type)->getPointeeType().getAsOpaquePtr();
return true;
case Type::Typedef:
case clang::Type::Typedef:
return ClangASTContext::IsPointerOrReferenceType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), target_type);
default:
break;
@ -2320,11 +2320,11 @@ ClangASTContext::IsCStringType (void *clang_type, uint32_t &length)
QualType qual_type (QualType::getFromOpaquePtr(clang_type));
switch (qual_type->getTypeClass())
{
case Type::ConstantArray:
case clang::Type::ConstantArray:
{
ConstantArrayType *array = cast<ConstantArrayType>(qual_type.getTypePtr());
QualType element_qual_type = array->getElementType();
Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr();
clang::Type *canonical_type = element_qual_type->getCanonicalTypeInternal().getTypePtr();
if (canonical_type && canonical_type->isCharType())
{
// We know the size of the array and it could be a C string
@ -2335,13 +2335,13 @@ ClangASTContext::IsCStringType (void *clang_type, uint32_t &length)
}
break;
case Type::Pointer:
case clang::Type::Pointer:
{
PointerType *pointer_type = cast<PointerType>(qual_type.getTypePtr());
Type *pointee_type_ptr = pointer_type->getPointeeType().getTypePtr();
clang::Type *pointee_type_ptr = pointer_type->getPointeeType().getTypePtr();
if (pointee_type_ptr)
{
Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr();
clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr();
length = 0; // No length info, read until a NULL terminator is received
if (canonical_type_ptr)
return canonical_type_ptr->isCharType();
@ -2351,17 +2351,17 @@ ClangASTContext::IsCStringType (void *clang_type, uint32_t &length)
}
break;
case Type::Typedef:
case clang::Type::Typedef:
return ClangASTContext::IsCStringType (cast<TypedefType>(qual_type)->LookThroughTypedefs().getAsOpaquePtr(), length);
case Type::LValueReference:
case Type::RValueReference:
case clang::Type::LValueReference:
case clang::Type::RValueReference:
{
ReferenceType *reference_type = cast<ReferenceType>(qual_type.getTypePtr());
Type *pointee_type_ptr = reference_type->getPointeeType().getTypePtr();
clang::Type *pointee_type_ptr = reference_type->getPointeeType().getTypePtr();
if (pointee_type_ptr)
{
Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr();
clang::Type *canonical_type_ptr = pointee_type_ptr->getCanonicalTypeInternal().getTypePtr();
length = 0; // No length info, read until a NULL terminator is received
if (canonical_type_ptr)
return canonical_type_ptr->isCharType();
@ -2385,24 +2385,24 @@ ClangASTContext::IsArrayType (void * clang_type, void **member_type, uint64_t *s
switch (qual_type->getTypeClass())
{
case Type::ConstantArray:
case clang::Type::ConstantArray:
if (member_type)
*member_type = cast<ConstantArrayType>(qual_type)->getElementType().getAsOpaquePtr();
if (size)
*size = cast<ConstantArrayType>(qual_type)->getSize().getLimitedValue(ULONG_LONG_MAX);
return true;
case Type::IncompleteArray:
case clang::Type::IncompleteArray:
if (member_type)
*member_type = cast<IncompleteArrayType>(qual_type)->getElementType().getAsOpaquePtr();
if (size)
*size = 0;
return true;
case Type::VariableArray:
case clang::Type::VariableArray:
if (member_type)
*member_type = cast<VariableArrayType>(qual_type)->getElementType().getAsOpaquePtr();
if (size)
*size = 0;
case Type::DependentSizedArray:
case clang::Type::DependentSizedArray:
if (member_type)
*member_type = cast<DependentSizedArrayType>(qual_type)->getElementType().getAsOpaquePtr();
if (size)

File diff suppressed because it is too large Load Diff

View File

@ -10,10 +10,11 @@
#include "lldb/Symbol/Function.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/Section.h"
#include "lldb/Symbol/ClangASTType.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "lldb/Symbol/CompileUnit.h"
#include "lldb/Symbol/LineTable.h"
#include "lldb/Symbol/SymbolVendor.h"
#include "lldb/Symbol/ClangASTContext.h"
#include "clang/AST/Type.h"
#include "clang/AST/CanonicalType.h"
@ -339,7 +340,7 @@ Function::GetReturnType ()
clang::FunctionType *function_type = dyn_cast<clang::FunctionType> (clang_type);
clang::QualType fun_return_qualtype = function_type->getResultType();
const ConstString fun_return_name(Type::GetClangTypeName(fun_return_qualtype.getAsOpaquePtr()));
const ConstString fun_return_name(ClangASTType::GetClangTypeName(fun_return_qualtype.getAsOpaquePtr()));
SymbolContext sc;
CalculateSymbolContext (&sc);
@ -381,7 +382,7 @@ Function::GetArgumentTypeAtIndex (size_t idx)
return Type();
clang::QualType arg_qualtype = (function_proto_type->arg_type_begin())[idx];
const ConstString arg_return_name(Type::GetClangTypeName(arg_qualtype.getAsOpaquePtr()));
const ConstString arg_return_name(ClangASTType::GetClangTypeName(arg_qualtype.getAsOpaquePtr()));
SymbolContext sc;
CalculateSymbolContext (&sc);
// Null out everything below the CompUnit 'cause we don't actually know these.

File diff suppressed because it is too large Load Diff