forked from OSchip/llvm-project
Cleaned up a unused member variable in Debugger.
Added the start of Host specific launch services, though it currently isn't hookup up to anything. We want to be able to launch a process and use the native launch services to launch an app like it would be launched by the user double clicking on the app. We also eventually want to be able to run a command line app in a newly spawned terminal to avoid terminal sharing. Fixed an issue with the new DWARF forward type declaration stuff. A crasher was found that was happening when trying to properly expand the forward declarations. llvm-svn: 115213
This commit is contained in:
parent
86103ea237
commit
4957bf69e5
|
@ -333,7 +333,6 @@ protected:
|
|||
|
||||
std::stack<lldb::InputReaderSP> m_input_readers;
|
||||
std::string m_input_reader_data;
|
||||
bool m_use_external_editor; // FIXME: Convert this to a set/show variable on the debugger.
|
||||
|
||||
private:
|
||||
|
||||
|
|
|
@ -268,8 +268,11 @@ public:
|
|||
static ArchSpec
|
||||
GetArchSpecForExistingProcess (const char *process_name);
|
||||
|
||||
static lldb::pid_t
|
||||
LaunchApplication (const FileSpec &file_spec);
|
||||
|
||||
static bool
|
||||
OpenFileInExternalEditor (FileSpec &file_spec, uint32_t line_no);
|
||||
OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no);
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -23,27 +23,29 @@ class Type : public UserID
|
|||
public:
|
||||
typedef enum
|
||||
{
|
||||
eTypeInvalid,
|
||||
eIsTypeWithUID, ///< This type is the type whose UID is m_encoding_uid
|
||||
eIsConstTypeWithUID, ///< This type is the type whose UID is m_encoding_uid with the const qualifier added
|
||||
eIsRestrictTypeWithUID, ///< This type is the type whose UID is m_encoding_uid with the restrict qualifier added
|
||||
eIsVolatileTypeWithUID, ///< This type is the type whose UID is m_encoding_uid with the volatile qualifier added
|
||||
eTypedefToTypeWithUID, ///< This type is pointer to a type whose UID is m_encoding_uid
|
||||
ePointerToTypeWithUID, ///< This type is pointer to a type whose UID is m_encoding_uid
|
||||
eLValueReferenceToTypeWithUID, ///< This type is L value reference to a type whose UID is m_encoding_uid
|
||||
eRValueReferenceToTypeWithUID, ///< This type is R value reference to a type whose UID is m_encoding_uid
|
||||
eTypeUIDSynthetic
|
||||
} EncodingUIDType;
|
||||
eEncodingInvalid,
|
||||
eEncodingIsUID, ///< This type is the type whose UID is m_encoding_uid
|
||||
eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid with the const qualifier added
|
||||
eEncodingIsRestrictUID, ///< This type is the type whose UID is m_encoding_uid with the restrict qualifier added
|
||||
eEncodingIsVolatileUID, ///< This type is the type whose UID is m_encoding_uid with the volatile qualifier added
|
||||
eEncodingIsTypedefUID, ///< This type is pointer to a type whose UID is m_encoding_uid
|
||||
eEncodingIsPointerUID, ///< This type is pointer to a type whose UID is m_encoding_uid
|
||||
eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type whose UID is m_encoding_uid
|
||||
eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type whose UID is m_encoding_uid
|
||||
eEncodingIsSyntheticUID,
|
||||
eEncodingIsTypePtr ///< m_encoding_data is a "lldb_private::Type *"
|
||||
} EncodingDataType;
|
||||
|
||||
Type (lldb::user_id_t uid,
|
||||
SymbolFile* symbol_file,
|
||||
const ConstString &name,
|
||||
uint64_t byte_size,
|
||||
uint32_t byte_size,
|
||||
SymbolContextScope *context,
|
||||
lldb::user_id_t encoding_uid,
|
||||
EncodingUIDType encoding_type,
|
||||
uintptr_t encoding_uid,
|
||||
EncodingDataType encoding_type,
|
||||
const Declaration& decl,
|
||||
lldb::clang_type_t clang_qual_type);
|
||||
lldb::clang_type_t clang_qual_type,
|
||||
bool is_forward_decl);
|
||||
|
||||
// This makes an invalid type. Used for functions that return a Type when they
|
||||
// get an error.
|
||||
|
@ -91,7 +93,7 @@ public:
|
|||
bool
|
||||
IsValidType ()
|
||||
{
|
||||
return m_encoding_uid_type != eTypeInvalid;
|
||||
return m_encoding_data_type != eEncodingInvalid;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -196,14 +198,22 @@ public:
|
|||
|
||||
protected:
|
||||
ConstString m_name;
|
||||
uint64_t m_byte_size;
|
||||
SymbolFile *m_symbol_file;
|
||||
SymbolContextScope *m_context; // The symbol context in which this type is defined
|
||||
lldb::user_id_t m_encoding_uid;
|
||||
EncodingUIDType m_encoding_uid_type;
|
||||
uint64_t m_byte_size;
|
||||
EncodingDataType m_encoding_data_type;
|
||||
uintptr_t m_encoding_data;
|
||||
Declaration m_decl;
|
||||
lldb::clang_type_t m_clang_qual_type;
|
||||
bool m_is_forward_decl;
|
||||
|
||||
Type *
|
||||
GetEncodingType ()
|
||||
{
|
||||
if (m_encoding_data_type == eEncodingIsTypePtr)
|
||||
return (Type *)m_encoding_data;
|
||||
return NULL;
|
||||
}
|
||||
bool ResolveClangType(bool forward_decl_is_ok = false);
|
||||
};
|
||||
|
||||
|
|
|
@ -2431,6 +2431,7 @@
|
|||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "lldb" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
en,
|
||||
|
|
|
@ -155,8 +155,7 @@ Debugger::Debugger () :
|
|||
m_command_interpreter_ap (new CommandInterpreter (*this, eScriptLanguageDefault, false)),
|
||||
m_exe_ctx (),
|
||||
m_input_readers (),
|
||||
m_input_reader_data (),
|
||||
m_use_external_editor(false)
|
||||
m_input_reader_data ()
|
||||
{
|
||||
m_command_interpreter_ap->Initialize ();
|
||||
}
|
||||
|
|
|
@ -12,11 +12,13 @@
|
|||
#include "lldb/Core/Log.h"
|
||||
|
||||
#include "cfcpp/CFCBundle.h"
|
||||
#include "cfcpp/CFCMutableDictionary.h"
|
||||
#include "cfcpp/CFCReleaser.h"
|
||||
#include "cfcpp/CFCString.h"
|
||||
|
||||
#include <objc/objc-auto.h>
|
||||
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
#include <Carbon/Carbon.h>
|
||||
#include <Foundation/Foundation.h>
|
||||
|
||||
|
@ -112,8 +114,44 @@ Host::ResolveExecutableInBundle (FileSpec *file)
|
|||
return false;
|
||||
}
|
||||
|
||||
lldb::pid_t
|
||||
Host::LaunchApplication (const FileSpec &app_file_spec)
|
||||
{
|
||||
char app_path[PATH_MAX];
|
||||
app_file_spec.GetPath(app_path, sizeof(app_path));
|
||||
|
||||
LSApplicationParameters app_params;
|
||||
::bzero (&app_params, sizeof (app_params));
|
||||
app_params.flags = kLSLaunchDefaults |
|
||||
kLSLaunchDontAddToRecents |
|
||||
kLSLaunchDontSwitch |
|
||||
kLSLaunchNewInstance;// | 0x00001000;
|
||||
|
||||
FSRef app_fsref;
|
||||
CFCString app_cfstr (app_path, kCFStringEncodingUTF8);
|
||||
|
||||
OSStatus error = ::FSPathMakeRef ((const UInt8 *)app_path, &app_fsref, false);
|
||||
|
||||
// If we found the app, then store away the name so we don't have to re-look it up.
|
||||
if (error != noErr)
|
||||
return LLDB_INVALID_PROCESS_ID;
|
||||
|
||||
app_params.application = &app_fsref;
|
||||
|
||||
ProcessSerialNumber psn;
|
||||
|
||||
error = ::LSOpenApplication (&app_params, &psn);
|
||||
|
||||
if (error != noErr)
|
||||
return LLDB_INVALID_PROCESS_ID;
|
||||
|
||||
::pid_t pid = LLDB_INVALID_PROCESS_ID;
|
||||
error = ::GetProcessPID(&psn, &pid);
|
||||
return pid;
|
||||
}
|
||||
|
||||
bool
|
||||
Host::OpenFileInExternalEditor (FileSpec &file_spec, uint32_t line_no)
|
||||
Host::OpenFileInExternalEditor (const FileSpec &file_spec, uint32_t line_no)
|
||||
{
|
||||
// We attach this to an 'odoc' event to specify a particular selection
|
||||
typedef struct {
|
||||
|
|
|
@ -366,6 +366,7 @@ ProcessGDBRemote::WillLaunchOrAttach ()
|
|||
return error;
|
||||
}
|
||||
|
||||
//#define LAUNCH_WITH_LAUNCH_SERVICES 1
|
||||
//----------------------------------------------------------------------
|
||||
// Process Control
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -381,10 +382,18 @@ ProcessGDBRemote::DoLaunch
|
|||
const char *stderr_path
|
||||
)
|
||||
{
|
||||
Error error;
|
||||
#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
|
||||
FileSpec app_file_spec (argv[0]);
|
||||
pid_t pid = Host::LaunchApplication (app_file_spec);
|
||||
if (pid != LLDB_INVALID_PROCESS_ID)
|
||||
error = DoAttachToProcessWithID (pid);
|
||||
else
|
||||
error.SetErrorString("failed");
|
||||
#else
|
||||
// ::LogSetBitMask (GDBR_LOG_DEFAULT);
|
||||
// ::LogSetOptions (LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_TIMESTAMP | LLDB_LOG_OPTION_PREPEND_PROC_AND_THREAD);
|
||||
// ::LogSetLogFile ("/dev/stdout");
|
||||
Error error;
|
||||
|
||||
ObjectFile * object_file = module->GetObjectFile();
|
||||
if (object_file)
|
||||
|
@ -497,9 +506,9 @@ ProcessGDBRemote::DoLaunch
|
|||
SetID(LLDB_INVALID_PROCESS_ID);
|
||||
error.SetErrorStringWithFormat("Failed to get object file from '%s' for arch %s.\n", module->GetFileSpec().GetFilename().AsCString(), module->GetArchitecture().AsCString());
|
||||
}
|
||||
|
||||
// Return the process ID we have
|
||||
#endif
|
||||
return error;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -621,9 +630,13 @@ ProcessGDBRemote::DidLaunchOrAttach ()
|
|||
void
|
||||
ProcessGDBRemote::DidLaunch ()
|
||||
{
|
||||
#if defined (LAUNCH_WITH_LAUNCH_SERVICES)
|
||||
DidAttach ();
|
||||
#else
|
||||
DidLaunchOrAttach ();
|
||||
if (m_dynamic_loader_ap.get())
|
||||
m_dynamic_loader_ap->DidLaunch();
|
||||
#endif
|
||||
}
|
||||
|
||||
Error
|
||||
|
|
|
@ -2444,7 +2444,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
DWARFDebugInfoEntry::Attributes attributes;
|
||||
const char *type_name_cstr = NULL;
|
||||
ConstString type_name_dbstr;
|
||||
Type::EncodingUIDType encoding_uid_type = Type::eIsTypeWithUID;
|
||||
Type::EncodingDataType encoding_data_type = Type::eEncodingIsUID;
|
||||
clang_type_t clang_type = NULL;
|
||||
|
||||
TypeList* type_list = m_obj_file->GetModule()->GetTypeList();
|
||||
|
@ -2508,37 +2508,37 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
case DW_TAG_pointer_type:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::ePointerToTypeWithUID;
|
||||
encoding_data_type = Type::eEncodingIsPointerUID;
|
||||
break;
|
||||
|
||||
case DW_TAG_reference_type:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::eLValueReferenceToTypeWithUID;
|
||||
encoding_data_type = Type::eEncodingIsLValueReferenceUID;
|
||||
break;
|
||||
|
||||
case DW_TAG_typedef:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::eTypedefToTypeWithUID;
|
||||
encoding_data_type = Type::eEncodingIsTypedefUID;
|
||||
break;
|
||||
|
||||
case DW_TAG_const_type:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::eIsConstTypeWithUID; //ClangASTContext::AddConstModifier (clang_type);
|
||||
encoding_data_type = Type::eEncodingIsConstUID; //ClangASTContext::AddConstModifier (clang_type);
|
||||
break;
|
||||
|
||||
case DW_TAG_restrict_type:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::eIsRestrictTypeWithUID; //ClangASTContext::AddRestrictModifier (clang_type);
|
||||
encoding_data_type = Type::eEncodingIsRestrictUID; //ClangASTContext::AddRestrictModifier (clang_type);
|
||||
break;
|
||||
|
||||
case DW_TAG_volatile_type:
|
||||
// The encoding_uid will be embedded into the
|
||||
// Type object and will be looked up when the Type::GetClangType()
|
||||
encoding_uid_type = Type::eIsVolatileTypeWithUID; //ClangASTContext::AddVolatileModifier (clang_type);
|
||||
encoding_data_type = Type::eEncodingIsVolatileUID; //ClangASTContext::AddVolatileModifier (clang_type);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -2563,7 +2563,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
}
|
||||
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, encoding_uid_type, &decl, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, encoding_data_type, &decl, clang_type, clang_type == NULL));
|
||||
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
|
||||
|
@ -2679,21 +2679,27 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
// parameters in any class methods need it for the clang
|
||||
// types for function prototypes.
|
||||
m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, true));
|
||||
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
|
||||
// Leave this as a forward declaration until we need
|
||||
// to know the details of the type. lldb_private::Type
|
||||
// will automatically call the SymbolFile virtual function
|
||||
// "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
|
||||
// When the definition needs to be defined.
|
||||
if (clang_type_was_created)
|
||||
if (die->HasChildren() == false)
|
||||
{
|
||||
// No children for this struct/union/class, lets finish it
|
||||
type_list->GetClangASTContext().StartTagDeclarationDefinition (clang_type);
|
||||
type_list->GetClangASTContext().CompleteTagDeclarationDefinition (clang_type);
|
||||
}
|
||||
else if (clang_type_was_created)
|
||||
{
|
||||
// Leave this as a forward declaration until we need
|
||||
// to know the details of the type. lldb_private::Type
|
||||
// will automatically call the SymbolFile virtual function
|
||||
// "SymbolFileDWARF::ResolveClangOpaqueTypeDefinition(Type *)"
|
||||
// When the definition needs to be defined.
|
||||
m_forward_decl_die_to_clang_type[die] = clang_type;
|
||||
m_forward_decl_clang_type_to_die[clang_type] = die;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -2760,7 +2766,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
}
|
||||
|
||||
m_die_to_decl_ctx[die] = ClangASTContext::GetDeclContextForType (clang_type);
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, Type::eIsTypeWithUID, &decl, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, encoding_uid, Type::eEncodingIsUID, &decl, clang_type, true));
|
||||
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
|
||||
|
@ -2972,7 +2978,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
type_list->GetClangASTContext().SetFunctionParameters (function_decl, &function_param_decls.front(), function_param_decls.size());
|
||||
}
|
||||
}
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, 0, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, 0, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, false));
|
||||
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
assert(type_sp.get());
|
||||
|
@ -3057,7 +3063,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
array_element_bit_stride = array_element_bit_stride * num_elements;
|
||||
}
|
||||
ConstString empty_name;
|
||||
type_sp.reset( new Type(die->GetOffset(), this, empty_name, array_element_bit_stride / 8, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, empty_name, array_element_bit_stride / 8, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, &decl, clang_type, false));
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
}
|
||||
}
|
||||
|
@ -3099,7 +3105,7 @@ SymbolFileDWARF::ParseType (const SymbolContext& sc, DWARFCompileUnit* dwarf_cu,
|
|||
|
||||
size_t byte_size = ClangASTType::GetClangTypeBitWidth (type_list->GetClangASTContext().getASTContext(), clang_type) / 8;
|
||||
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, NULL, clang_type));
|
||||
type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, byte_size, NULL, LLDB_INVALID_UID, Type::eEncodingIsUID, NULL, clang_type, false));
|
||||
m_die_to_type[die] = type_sp.get();
|
||||
}
|
||||
|
||||
|
|
|
@ -414,7 +414,7 @@ Function::GetReturnType ()
|
|||
// Null out everything below the CompUnit 'cause we don't actually know these.
|
||||
|
||||
size_t bit_size = ClangASTType::GetClangTypeBitWidth ((GetType()->GetClangASTContext().getASTContext()), fun_return_qualtype.getAsOpaquePtr());
|
||||
Type return_type (0, GetType()->GetSymbolFile(), fun_return_name, bit_size, sc.comp_unit, 0, Type::eTypeUIDSynthetic, Declaration(), fun_return_qualtype.getAsOpaquePtr());
|
||||
Type return_type (0, GetType()->GetSymbolFile(), fun_return_name, bit_size, sc.comp_unit, 0, Type::eEncodingIsSyntheticUID, Declaration(), fun_return_qualtype.getAsOpaquePtr(), false);
|
||||
return return_type;
|
||||
}
|
||||
|
||||
|
@ -455,7 +455,7 @@ Function::GetArgumentTypeAtIndex (size_t idx)
|
|||
// Null out everything below the CompUnit 'cause we don't actually know these.
|
||||
|
||||
size_t bit_size = ClangASTType::GetClangTypeBitWidth ((GetType()->GetClangASTContext().getASTContext()), arg_qualtype.getAsOpaquePtr());
|
||||
Type arg_type (0, GetType()->GetSymbolFile(), arg_return_name, bit_size, sc.comp_unit, 0, Type::eTypeUIDSynthetic, Declaration(), arg_qualtype.getAsOpaquePtr());
|
||||
Type arg_type (0, GetType()->GetSymbolFile(), arg_return_name, bit_size, sc.comp_unit, 0, Type::eEncodingIsSyntheticUID, Declaration(), arg_qualtype.getAsOpaquePtr(), false);
|
||||
return arg_type;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,22 +33,24 @@ lldb_private::Type::Type
|
|||
lldb::user_id_t uid,
|
||||
SymbolFile* symbol_file,
|
||||
const ConstString &name,
|
||||
uint64_t byte_size,
|
||||
uint32_t byte_size,
|
||||
SymbolContextScope *context,
|
||||
lldb::user_id_t encoding_uid,
|
||||
EncodingUIDType encoding_uid_type,
|
||||
uintptr_t encoding_data,
|
||||
EncodingDataType encoding_data_type,
|
||||
const Declaration& decl,
|
||||
clang_type_t clang_type
|
||||
clang_type_t clang_type,
|
||||
bool is_forward_decl
|
||||
) :
|
||||
UserID (uid),
|
||||
m_name (name),
|
||||
m_byte_size (byte_size),
|
||||
m_symbol_file (symbol_file),
|
||||
m_context (context),
|
||||
m_encoding_uid (encoding_uid),
|
||||
m_encoding_uid_type (encoding_uid_type),
|
||||
m_byte_size (byte_size),
|
||||
m_encoding_data_type (encoding_data_type),
|
||||
m_encoding_data (encoding_data),
|
||||
m_decl (decl),
|
||||
m_clang_qual_type (clang_type)
|
||||
m_clang_qual_type (clang_type),
|
||||
m_is_forward_decl (is_forward_decl)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -58,10 +60,11 @@ lldb_private::Type::Type () :
|
|||
m_byte_size (0),
|
||||
m_symbol_file (NULL),
|
||||
m_context (),
|
||||
m_encoding_uid (0),
|
||||
m_encoding_uid_type (eTypeInvalid),
|
||||
m_encoding_data (0),
|
||||
m_encoding_data_type (eEncodingInvalid),
|
||||
m_decl (),
|
||||
m_clang_qual_type (NULL)
|
||||
m_clang_qual_type (NULL),
|
||||
m_is_forward_decl (false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -76,7 +79,7 @@ lldb_private::Type::operator= (const Type& rhs)
|
|||
m_byte_size = rhs.m_byte_size;
|
||||
m_symbol_file = rhs.m_symbol_file;
|
||||
m_context = rhs.m_context;
|
||||
m_encoding_uid = rhs.m_encoding_uid;
|
||||
m_encoding_data = rhs.m_encoding_data;
|
||||
m_decl = rhs.m_decl;
|
||||
m_clang_qual_type = rhs.m_clang_qual_type;
|
||||
}
|
||||
|
@ -105,19 +108,21 @@ lldb_private::Type::GetDescription (Stream *s, lldb::DescriptionLevel level, boo
|
|||
ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_qual_type, s);
|
||||
*s << '"';
|
||||
}
|
||||
else if (m_encoding_uid != LLDB_INVALID_UID)
|
||||
else if (m_encoding_data != LLDB_INVALID_UID)
|
||||
{
|
||||
s->Printf(", type_uid = 0x%8.8x", m_encoding_uid);
|
||||
switch (m_encoding_uid_type)
|
||||
s->Printf(", type_uid = 0x%8.8x", m_encoding_data);
|
||||
switch (m_encoding_data_type)
|
||||
{
|
||||
case eIsTypeWithUID: s->PutCString(" (unresolved type)"); break;
|
||||
case eIsConstTypeWithUID: s->PutCString(" (unresolved const type)"); break;
|
||||
case eIsRestrictTypeWithUID: s->PutCString(" (unresolved restrict type)"); break;
|
||||
case eIsVolatileTypeWithUID: s->PutCString(" (unresolved volatile type)"); break;
|
||||
case eTypedefToTypeWithUID: s->PutCString(" (unresolved typedef)"); break;
|
||||
case ePointerToTypeWithUID: s->PutCString(" (unresolved pointer)"); break;
|
||||
case eLValueReferenceToTypeWithUID: s->PutCString(" (unresolved L value reference)"); break;
|
||||
case eRValueReferenceToTypeWithUID: s->PutCString(" (unresolved R value reference)"); break;
|
||||
case eEncodingIsUID: s->PutCString(" (unresolved type)"); break;
|
||||
case eEncodingIsConstUID: s->PutCString(" (unresolved const type)"); break;
|
||||
case eEncodingIsRestrictUID: s->PutCString(" (unresolved restrict type)"); break;
|
||||
case eEncodingIsVolatileUID: s->PutCString(" (unresolved volatile type)"); break;
|
||||
case eEncodingIsTypedefUID: s->PutCString(" (unresolved typedef)"); break;
|
||||
case eEncodingIsPointerUID: s->PutCString(" (unresolved pointer)"); break;
|
||||
case eEncodingIsLValueReferenceUID: s->PutCString(" (unresolved L value reference)"); break;
|
||||
case eEncodingIsRValueReferenceUID: s->PutCString(" (unresolved R value reference)"); break;
|
||||
case eEncodingIsSyntheticUID: s->PutCString(" (synthetic type)"); break;
|
||||
case eEncodingIsTypePtr: s->PutCString(" (Type *)"); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -151,19 +156,21 @@ lldb_private::Type::Dump (Stream *s, bool show_context)
|
|||
|
||||
ClangASTType::DumpTypeDescription (GetClangAST(), m_clang_qual_type, s);
|
||||
}
|
||||
else if (m_encoding_uid != LLDB_INVALID_UID)
|
||||
else if (m_encoding_data != LLDB_INVALID_UID)
|
||||
{
|
||||
*s << ", type_uid = " << m_encoding_uid;
|
||||
switch (m_encoding_uid_type)
|
||||
*s << ", type_data = " << (uint64_t)m_encoding_data;
|
||||
switch (m_encoding_data_type)
|
||||
{
|
||||
case eIsTypeWithUID: s->PutCString(" (unresolved type)"); break;
|
||||
case eIsConstTypeWithUID: s->PutCString(" (unresolved const type)"); break;
|
||||
case eIsRestrictTypeWithUID: s->PutCString(" (unresolved restrict type)"); break;
|
||||
case eIsVolatileTypeWithUID: s->PutCString(" (unresolved volatile type)"); break;
|
||||
case eTypedefToTypeWithUID: s->PutCString(" (unresolved typedef)"); break;
|
||||
case ePointerToTypeWithUID: s->PutCString(" (unresolved pointer)"); break;
|
||||
case eLValueReferenceToTypeWithUID: s->PutCString(" (unresolved L value reference)"); break;
|
||||
case eRValueReferenceToTypeWithUID: s->PutCString(" (unresolved R value reference)"); break;
|
||||
case eEncodingIsUID: s->PutCString(" (unresolved type)"); break;
|
||||
case eEncodingIsConstUID: s->PutCString(" (unresolved const type)"); break;
|
||||
case eEncodingIsRestrictUID: s->PutCString(" (unresolved restrict type)"); break;
|
||||
case eEncodingIsVolatileUID: s->PutCString(" (unresolved volatile type)"); break;
|
||||
case eEncodingIsTypedefUID: s->PutCString(" (unresolved typedef)"); break;
|
||||
case eEncodingIsPointerUID: s->PutCString(" (unresolved pointer)"); break;
|
||||
case eEncodingIsLValueReferenceUID: s->PutCString(" (unresolved L value reference)"); break;
|
||||
case eEncodingIsRValueReferenceUID: s->PutCString(" (unresolved R value reference)"); break;
|
||||
case eEncodingIsSyntheticUID: s->PutCString(" (synthetic type)"); break;
|
||||
case eEncodingIsTypePtr: s->PutCString(" (Type *)"); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -241,16 +248,16 @@ lldb_private::Type::GetByteSize()
|
|||
{
|
||||
if (m_byte_size == 0)
|
||||
{
|
||||
switch (m_encoding_uid_type)
|
||||
switch (m_encoding_data_type)
|
||||
{
|
||||
case eIsTypeWithUID:
|
||||
case eIsConstTypeWithUID:
|
||||
case eIsRestrictTypeWithUID:
|
||||
case eIsVolatileTypeWithUID:
|
||||
case eTypedefToTypeWithUID:
|
||||
if (m_encoding_uid != LLDB_INVALID_UID)
|
||||
case eEncodingIsUID:
|
||||
case eEncodingIsConstUID:
|
||||
case eEncodingIsRestrictUID:
|
||||
case eEncodingIsVolatileUID:
|
||||
case eEncodingIsTypedefUID:
|
||||
if (m_encoding_data != LLDB_INVALID_UID)
|
||||
{
|
||||
Type *encoding_type = m_symbol_file->ResolveTypeUID (m_encoding_uid);
|
||||
Type *encoding_type = m_symbol_file->ResolveTypeUID (m_encoding_data);
|
||||
if (encoding_type)
|
||||
m_byte_size = encoding_type->GetByteSize();
|
||||
}
|
||||
|
@ -262,9 +269,9 @@ lldb_private::Type::GetByteSize()
|
|||
break;
|
||||
|
||||
// If we are a pointer or reference, then this is just a pointer size;
|
||||
case ePointerToTypeWithUID:
|
||||
case eLValueReferenceToTypeWithUID:
|
||||
case eRValueReferenceToTypeWithUID:
|
||||
case eEncodingIsPointerUID:
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_byte_size = GetTypeList()->GetClangASTContext().GetPointerBitSize() / 8;
|
||||
break;
|
||||
}
|
||||
|
@ -400,113 +407,132 @@ lldb_private::Type::GetDeclaration () const
|
|||
bool
|
||||
lldb_private::Type::ResolveClangType (bool forward_decl_is_ok)
|
||||
{
|
||||
// static int g_depth = 0;
|
||||
// g_depth++;
|
||||
// printf ("%.*sType::ResolveClangType (forward = %i) uid = 0x%8.8x, name = %s\n", g_depth, "", forward_decl_is_ok, m_uid, m_name.AsCString());
|
||||
Type *encoding_type = NULL;
|
||||
if (m_clang_qual_type == NULL)
|
||||
{
|
||||
TypeList *type_list = GetTypeList();
|
||||
if (m_encoding_uid != LLDB_INVALID_UID)
|
||||
if (m_encoding_data != LLDB_INVALID_UID)
|
||||
{
|
||||
Type *encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_uid);
|
||||
encoding_type = m_symbol_file->ResolveTypeUID(m_encoding_data);
|
||||
if (encoding_type)
|
||||
{
|
||||
|
||||
switch (m_encoding_uid_type)
|
||||
switch (m_encoding_data_type)
|
||||
{
|
||||
case eIsTypeWithUID:
|
||||
case eEncodingIsUID:
|
||||
m_clang_qual_type = encoding_type->GetClangType();
|
||||
break;
|
||||
|
||||
case eIsConstTypeWithUID:
|
||||
m_clang_qual_type = ClangASTContext::AddConstModifier (encoding_type->GetClangType(forward_decl_is_ok));
|
||||
case eEncodingIsConstUID:
|
||||
m_clang_qual_type = ClangASTContext::AddConstModifier (encoding_type->GetClangType(true));
|
||||
break;
|
||||
|
||||
case eIsRestrictTypeWithUID:
|
||||
m_clang_qual_type = ClangASTContext::AddRestrictModifier (encoding_type->GetClangType(forward_decl_is_ok));
|
||||
case eEncodingIsRestrictUID:
|
||||
m_clang_qual_type = ClangASTContext::AddRestrictModifier (encoding_type->GetClangType(true));
|
||||
break;
|
||||
|
||||
case eIsVolatileTypeWithUID:
|
||||
m_clang_qual_type = ClangASTContext::AddVolatileModifier (encoding_type->GetClangType(forward_decl_is_ok));
|
||||
case eEncodingIsVolatileUID:
|
||||
m_clang_qual_type = ClangASTContext::AddVolatileModifier (encoding_type->GetClangType(true));
|
||||
break;
|
||||
|
||||
case eTypedefToTypeWithUID:
|
||||
m_clang_qual_type = type_list->CreateClangTypedefType (this, encoding_type, forward_decl_is_ok);
|
||||
case eEncodingIsTypedefUID:
|
||||
m_clang_qual_type = type_list->CreateClangTypedefType (this, encoding_type, true);
|
||||
// Clear the name so it can get fully qualified in case the
|
||||
// typedef is in a namespace.
|
||||
m_name.Clear();
|
||||
break;
|
||||
|
||||
case ePointerToTypeWithUID:
|
||||
m_clang_qual_type = type_list->CreateClangPointerType (encoding_type, forward_decl_is_ok);
|
||||
case eEncodingIsPointerUID:
|
||||
m_clang_qual_type = type_list->CreateClangPointerType (encoding_type, true);
|
||||
break;
|
||||
|
||||
case eLValueReferenceToTypeWithUID:
|
||||
m_clang_qual_type = type_list->CreateClangLValueReferenceType (encoding_type, forward_decl_is_ok);
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
m_clang_qual_type = type_list->CreateClangLValueReferenceType (encoding_type, true);
|
||||
break;
|
||||
|
||||
case eRValueReferenceToTypeWithUID:
|
||||
m_clang_qual_type = type_list->CreateClangRValueReferenceType (encoding_type, forward_decl_is_ok);
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_clang_qual_type = type_list->CreateClangRValueReferenceType (encoding_type, true);
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(!"Unhandled encoding_uid_type.");
|
||||
assert(!"Unhandled encoding_data_type.");
|
||||
break;
|
||||
}
|
||||
|
||||
if (encoding_type)
|
||||
{
|
||||
m_encoding_data_type = eEncodingIsTypePtr;
|
||||
m_encoding_data = (uintptr_t)encoding_type;
|
||||
}
|
||||
}
|
||||
// Return here since we won't need to check if this is a forward
|
||||
// declaration below since we already obeyed this above.
|
||||
return m_clang_qual_type != NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
// We have no encoding type, return void?
|
||||
clang_type_t void_clang_type = type_list->GetClangASTContext().GetBuiltInType_void();
|
||||
switch (m_encoding_uid_type)
|
||||
switch (m_encoding_data_type)
|
||||
{
|
||||
case eIsTypeWithUID:
|
||||
case eEncodingIsUID:
|
||||
m_clang_qual_type = void_clang_type;
|
||||
break;
|
||||
|
||||
case eIsConstTypeWithUID:
|
||||
case eEncodingIsConstUID:
|
||||
m_clang_qual_type = ClangASTContext::AddConstModifier (void_clang_type);
|
||||
break;
|
||||
|
||||
case eIsRestrictTypeWithUID:
|
||||
case eEncodingIsRestrictUID:
|
||||
m_clang_qual_type = ClangASTContext::AddRestrictModifier (void_clang_type);
|
||||
break;
|
||||
|
||||
case eIsVolatileTypeWithUID:
|
||||
case eEncodingIsVolatileUID:
|
||||
m_clang_qual_type = ClangASTContext::AddVolatileModifier (void_clang_type);
|
||||
break;
|
||||
|
||||
case eTypedefToTypeWithUID:
|
||||
case eEncodingIsTypedefUID:
|
||||
m_clang_qual_type = type_list->GetClangASTContext().CreateTypedefType (m_name.AsCString(), void_clang_type, NULL);
|
||||
break;
|
||||
|
||||
case ePointerToTypeWithUID:
|
||||
case eEncodingIsPointerUID:
|
||||
m_clang_qual_type = type_list->GetClangASTContext().CreatePointerType (void_clang_type);
|
||||
break;
|
||||
|
||||
case eLValueReferenceToTypeWithUID:
|
||||
case eEncodingIsLValueReferenceUID:
|
||||
m_clang_qual_type = type_list->GetClangASTContext().CreateLValueReferenceType (void_clang_type);
|
||||
break;
|
||||
|
||||
case eRValueReferenceToTypeWithUID:
|
||||
case eEncodingIsRValueReferenceUID:
|
||||
m_clang_qual_type = type_list->GetClangASTContext().CreateRValueReferenceType (void_clang_type);
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(!"Unhandled encoding_uid_type.");
|
||||
assert(!"Unhandled encoding_data_type.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if we have a forward reference to a class/struct/union/enum?
|
||||
if (!forward_decl_is_ok && !ClangASTType::IsDefined (m_clang_qual_type))
|
||||
if (m_is_forward_decl && m_clang_qual_type && !forward_decl_is_ok)
|
||||
{
|
||||
// We have a forward declaration, we need to resolve it to a complete
|
||||
// definition.
|
||||
m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_qual_type);
|
||||
m_is_forward_decl = false;
|
||||
if (!ClangASTType::IsDefined (m_clang_qual_type))
|
||||
{
|
||||
// We have a forward declaration, we need to resolve it to a complete
|
||||
// definition.
|
||||
m_symbol_file->ResolveClangOpaqueTypeDefinition (m_clang_qual_type);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (encoding_type == NULL)
|
||||
encoding_type = GetEncodingType ();
|
||||
if (encoding_type != NULL)
|
||||
encoding_type->ResolveClangType (forward_decl_is_ok);
|
||||
}
|
||||
}
|
||||
// if (g_depth > 0)
|
||||
// --g_depth;
|
||||
return m_clang_qual_type != NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -369,6 +369,7 @@
|
|||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB914E08733D8E0010E9CD /* Build configuration list for PBXProject "debugserver" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
|
|
Loading…
Reference in New Issue