aboutsummaryrefslogtreecommitdiffstats
path: root/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime
diff options
context:
space:
mode:
Diffstat (limited to 'source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime')
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp133
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h8
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp23
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp12
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp162
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp62
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp49
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h32
-rw-r--r--source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp25
9 files changed, 243 insertions, 263 deletions
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
index 18f2a1829a41..1f27a4f0b3ed 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp
@@ -38,12 +38,13 @@ public:
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
if (log) {
- log->Printf("AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
- "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
- current_id,
- static_cast<void *>(&decl_ctx->getParentASTContext()),
- name.getAsString().c_str(), decl_ctx->getDeclKindName(),
- static_cast<const void *>(decl_ctx));
+ LLDB_LOGF(log,
+ "AppleObjCExternalASTSource::FindExternalVisibleDeclsByName[%"
+ "u] on (ASTContext*)%p Looking for %s in (%sDecl*)%p",
+ current_id,
+ static_cast<void *>(&decl_ctx->getParentASTContext()),
+ name.getAsString().c_str(), decl_ctx->getDeclKindName(),
+ static_cast<const void *>(decl_ctx));
}
do {
@@ -77,19 +78,20 @@ public:
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
if (log) {
- log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
- "(ASTContext*)%p Completing (TagDecl*)%p named %s",
- current_id, static_cast<void *>(&tag_decl->getASTContext()),
- static_cast<void *>(tag_decl),
- tag_decl->getName().str().c_str());
-
- log->Printf(" AOEAS::CT[%u] Before:", current_id);
+ LLDB_LOGF(log,
+ "AppleObjCExternalASTSource::CompleteType[%u] on "
+ "(ASTContext*)%p Completing (TagDecl*)%p named %s",
+ current_id, static_cast<void *>(&tag_decl->getASTContext()),
+ static_cast<void *>(tag_decl),
+ tag_decl->getName().str().c_str());
+
+ LLDB_LOGF(log, " AOEAS::CT[%u] Before:", current_id);
ASTDumper dumper((clang::Decl *)tag_decl);
dumper.ToLog(log, " [CT] ");
}
if (log) {
- log->Printf(" AOEAS::CT[%u] After:", current_id);
+ LLDB_LOGF(log, " AOEAS::CT[%u] After:", current_id);
ASTDumper dumper((clang::Decl *)tag_decl);
dumper.ToLog(log, " [CT] ");
}
@@ -104,14 +106,15 @@ public:
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
if (log) {
- log->Printf("AppleObjCExternalASTSource::CompleteType[%u] on "
- "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
- current_id,
- static_cast<void *>(&interface_decl->getASTContext()),
- static_cast<void *>(interface_decl),
- interface_decl->getName().str().c_str());
-
- log->Printf(" AOEAS::CT[%u] Before:", current_id);
+ LLDB_LOGF(log,
+ "AppleObjCExternalASTSource::CompleteType[%u] on "
+ "(ASTContext*)%p Completing (ObjCInterfaceDecl*)%p named %s",
+ current_id,
+ static_cast<void *>(&interface_decl->getASTContext()),
+ static_cast<void *>(interface_decl),
+ interface_decl->getName().str().c_str());
+
+ LLDB_LOGF(log, " AOEAS::CT[%u] Before:", current_id);
ASTDumper dumper((clang::Decl *)interface_decl);
dumper.ToLog(log, " [CT] ");
}
@@ -119,7 +122,7 @@ public:
m_decl_vendor.FinishDecl(interface_decl);
if (log) {
- log->Printf(" [CT] After:");
+ LLDB_LOGF(log, " [CT] After:");
ASTDumper dumper((clang::Decl *)interface_decl);
dumper.ToLog(log, " [CT] ");
}
@@ -148,12 +151,13 @@ private:
};
AppleObjCDeclVendor::AppleObjCDeclVendor(ObjCLanguageRuntime &runtime)
- : DeclVendor(), m_runtime(runtime), m_ast_ctx(runtime.GetProcess()
- ->GetTarget()
- .GetArchitecture()
- .GetTriple()
- .getTriple()
- .c_str()),
+ : ClangDeclVendor(eAppleObjCDeclVendor), m_runtime(runtime),
+ m_ast_ctx(runtime.GetProcess()
+ ->GetTarget()
+ .GetArchitecture()
+ .GetTriple()
+ .getTriple()
+ .c_str()),
m_type_realizer_sp(m_runtime.GetEncodingToType()) {
m_external_source = new AppleObjCExternalASTSource(*this);
llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> external_source_owning_ptr(
@@ -462,8 +466,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
clang::ObjCMethodDecl *method_decl =
method_type.BuildMethod(interface_decl, name, true, m_type_realizer_sp);
- if (log)
- log->Printf("[ AOTV::FD] Instance method [%s] [%s]", name, types);
+ LLDB_LOGF(log, "[ AOTV::FD] Instance method [%s] [%s]", name, types);
if (method_decl)
interface_decl->addDecl(method_decl);
@@ -481,8 +484,7 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
clang::ObjCMethodDecl *method_decl = method_type.BuildMethod(
interface_decl, name, false, m_type_realizer_sp);
- if (log)
- log->Printf("[ AOTV::FD] Class method [%s] [%s]", name, types);
+ LLDB_LOGF(log, "[ AOTV::FD] Class method [%s] [%s]", name, types);
if (method_decl)
interface_decl->addDecl(method_decl);
@@ -498,10 +500,9 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
const bool for_expression = false;
- if (log)
- log->Printf(
- "[ AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64, name,
- type, offset_ptr);
+ LLDB_LOGF(log,
+ "[ AOTV::FD] Instance variable [%s] [%s], offset at %" PRIx64,
+ name, type, offset_ptr);
CompilerType ivar_type = m_runtime.GetEncodingToType()->RealizeType(
m_ast_ctx, type, for_expression);
@@ -527,9 +528,10 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
if (log) {
ASTDumper method_dumper((clang::Decl *)interface_decl);
- log->Printf("[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
- "interface for %s",
- descriptor->GetClassName().AsCString());
+ LLDB_LOGF(log,
+ "[AppleObjCDeclVendor::FinishDecl] Finishing Objective-C "
+ "interface for %s",
+ descriptor->GetClassName().AsCString());
}
if (!descriptor->Describe(superclass_func, instance_method_func,
@@ -539,7 +541,8 @@ bool AppleObjCDeclVendor::FinishDecl(clang::ObjCInterfaceDecl *interface_decl) {
if (log) {
ASTDumper method_dumper((clang::Decl *)interface_decl);
- log->Printf(
+ LLDB_LOGF(
+ log,
"[AppleObjCDeclVendor::FinishDecl] Finished Objective-C interface");
method_dumper.ToLog(log, " [AOTV::FD] ");
@@ -558,10 +561,9 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
Log *log(GetLogIfAllCategoriesSet(
LIBLLDB_LOG_EXPRESSIONS)); // FIXME - a more appropriate log channel?
- if (log)
- log->Printf("AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
- current_id, (const char *)name.AsCString(),
- append ? "true" : "false", max_matches);
+ LLDB_LOGF(log, "AppleObjCDeclVendor::FindDecls [%u] ('%s', %s, %u, )",
+ current_id, (const char *)name.AsCString(),
+ append ? "true" : "false", max_matches);
if (!append)
decls.clear();
@@ -595,24 +597,25 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
if (metadata)
isa_value = metadata->GetISAPtr();
- log->Printf("AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
- ") in the ASTContext",
- current_id, dumper.GetCString(), isa_value);
+ LLDB_LOGF(log,
+ "AOCTV::FT [%u] Found %s (isa 0x%" PRIx64
+ ") in the ASTContext",
+ current_id, dumper.GetCString(), isa_value);
}
decls.push_back(result_iface_decl);
ret++;
break;
} else {
- if (log)
- log->Printf("AOCTV::FT [%u] There's something in the ASTContext, but "
- "it's not something we know about",
- current_id);
+ LLDB_LOGF(log,
+ "AOCTV::FT [%u] There's something in the ASTContext, but "
+ "it's not something we know about",
+ current_id);
break;
}
} else if (log) {
- log->Printf("AOCTV::FT [%u] Couldn't find %s in the ASTContext",
- current_id, name.AsCString());
+ LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find %s in the ASTContext",
+ current_id, name.AsCString());
}
// It's not. If it exists, we have to put it into our ASTContext.
@@ -620,8 +623,7 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
ObjCLanguageRuntime::ObjCISA isa = m_runtime.GetISA(name);
if (!isa) {
- if (log)
- log->Printf("AOCTV::FT [%u] Couldn't find the isa", current_id);
+ LLDB_LOGF(log, "AOCTV::FT [%u] Couldn't find the isa", current_id);
break;
}
@@ -629,10 +631,10 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
clang::ObjCInterfaceDecl *iface_decl = GetDeclForISA(isa);
if (!iface_decl) {
- if (log)
- log->Printf("AOCTV::FT [%u] Couldn't get the Objective-C interface for "
- "isa 0x%" PRIx64,
- current_id, (uint64_t)isa);
+ LLDB_LOGF(log,
+ "AOCTV::FT [%u] Couldn't get the Objective-C interface for "
+ "isa 0x%" PRIx64,
+ current_id, (uint64_t)isa);
break;
}
@@ -641,8 +643,8 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
clang::QualType new_iface_type =
ast_ctx->getObjCInterfaceType(iface_decl);
ASTDumper dumper(new_iface_type);
- log->Printf("AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")", current_id,
- dumper.GetCString(), (uint64_t)isa);
+ LLDB_LOGF(log, "AOCTV::FT [%u] Created %s (isa 0x%" PRIx64 ")",
+ current_id, dumper.GetCString(), (uint64_t)isa);
}
decls.push_back(iface_decl);
@@ -655,8 +657,7 @@ AppleObjCDeclVendor::FindDecls(ConstString name, bool append,
clang::ExternalASTMerger::ImporterSource
AppleObjCDeclVendor::GetImporterSource() {
- return {*m_ast_ctx.getASTContext(),
- *m_ast_ctx.getFileManager(),
- m_ast_ctx.GetOriginMap()
- };
+ return clang::ExternalASTMerger::ImporterSource(*m_ast_ctx.getASTContext(),
+ *m_ast_ctx.getFileManager(),
+ m_ast_ctx.GetOriginMap());
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
index 77b30b7fde79..99ca4b748709 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h
@@ -10,19 +10,23 @@
#define liblldb_AppleObjCDeclVendor_h_
#include "lldb/Symbol/ClangASTContext.h"
-#include "lldb/Symbol/DeclVendor.h"
#include "lldb/lldb-private.h"
+#include "Plugins/ExpressionParser/Clang/ClangDeclVendor.h"
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
namespace lldb_private {
class AppleObjCExternalASTSource;
-class AppleObjCDeclVendor : public DeclVendor {
+class AppleObjCDeclVendor : public ClangDeclVendor {
public:
AppleObjCDeclVendor(ObjCLanguageRuntime &runtime);
+ static bool classof(const DeclVendor *vendor) {
+ return vendor->GetKind() == eAppleObjCDeclVendor;
+ }
+
uint32_t FindDecls(ConstString name, bool append, uint32_t max_matches,
std::vector<clang::NamedDecl *> &decls) override;
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index 52ed3628520f..8ca9ad7b843a 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -223,11 +223,14 @@ Address *AppleObjCRuntime::GetPrintForDebuggerAddr() {
SymbolContextList contexts;
SymbolContext context;
- if ((!modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
- eSymbolTypeCode, contexts)) &&
- (!modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
- eSymbolTypeCode, contexts)))
- return nullptr;
+ modules.FindSymbolsWithNameAndType(ConstString("_NSPrintForDebugger"),
+ eSymbolTypeCode, contexts);
+ if (contexts.IsEmpty()) {
+ modules.FindSymbolsWithNameAndType(ConstString("_CFPrintForDebugger"),
+ eSymbolTypeCode, contexts);
+ if (contexts.IsEmpty())
+ return nullptr;
+ }
contexts.GetContextAtIndex(0, context);
@@ -444,10 +447,12 @@ bool AppleObjCRuntime::CalculateHasNewLiteralsAndIndexing() {
SymbolContextList sc_list;
- return target.GetImages().FindSymbolsWithNameAndType(
- s_method_signature, eSymbolTypeCode, sc_list) ||
- target.GetImages().FindSymbolsWithNameAndType(
- s_arclite_method_signature, eSymbolTypeCode, sc_list);
+ target.GetImages().FindSymbolsWithNameAndType(s_method_signature,
+ eSymbolTypeCode, sc_list);
+ if (sc_list.IsEmpty())
+ target.GetImages().FindSymbolsWithNameAndType(s_arclite_method_signature,
+ eSymbolTypeCode, sc_list);
+ return !sc_list.IsEmpty();
}
lldb::SearchFilterSP AppleObjCRuntime::CreateExceptionSearchFilter() {
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index c8884fd5c9b9..88bfe2ce0203 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -395,10 +395,11 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
new ClassDescriptorV1(isa, process_sp));
if (log && log->GetVerbose())
- log->Printf("AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
- " from _objc_debug_class_hash to "
- "isa->descriptor cache",
- isa);
+ LLDB_LOGF(log,
+ "AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
+ " from _objc_debug_class_hash to "
+ "isa->descriptor cache",
+ isa);
AddClass(isa, descriptor_sp);
}
@@ -417,7 +418,8 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
new ClassDescriptorV1(isa, process_sp));
if (log && log->GetVerbose())
- log->Printf(
+ LLDB_LOGF(
+ log,
"AppleObjCRuntimeV1 added (ObjCISA)0x%" PRIx64
" from _objc_debug_class_hash to isa->descriptor "
"cache",
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 635eaff637bc..9bdbef393e39 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -582,9 +582,9 @@ protected:
case 0:
break;
case 1: {
- regex_up.reset(new RegularExpression());
- if (!regex_up->Compile(llvm::StringRef::withNullAsEmpty(
- command.GetArgumentAtIndex(0)))) {
+ regex_up.reset(new RegularExpression(
+ llvm::StringRef::withNullAsEmpty(command.GetArgumentAtIndex(0))));
+ if (!regex_up->IsValid()) {
result.AppendError(
"invalid argument - please provide a valid regular expression");
result.SetStatus(lldb::eReturnStatusFailed);
@@ -1209,11 +1209,11 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
objc_class_sp = GetClassDescriptorFromISA(isa);
if (isa && !objc_class_sp) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_PROCESS));
- if (log)
- log->Printf("0x%" PRIx64
- ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
- "not in class descriptor cache 0x%" PRIx64,
- isa_pointer, isa);
+ LLDB_LOGF(log,
+ "0x%" PRIx64
+ ": AppleObjCRuntimeV2::GetClassDescriptor() ISA was "
+ "not in class descriptor cache 0x%" PRIx64,
+ isa_pointer, isa);
}
}
}
@@ -1317,8 +1317,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
// Read the total number of classes from the hash table
const uint32_t num_classes = hash_table.GetCount();
if (num_classes == 0) {
- if (log)
- log->Printf("No dynamic classes found in gdb_objc_realized_classes.");
+ LLDB_LOGF(log, "No dynamic classes found in gdb_objc_realized_classes.");
return DescriptorMapUpdateResult::Success(0);
}
@@ -1337,17 +1336,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
g_get_dynamic_class_info_body, eLanguageTypeObjC,
g_get_dynamic_class_info_name, error));
if (error.Fail()) {
- if (log)
- log->Printf(
- "Failed to get Utility Function for implementation lookup: %s",
- error.AsCString());
+ LLDB_LOGF(log,
+ "Failed to get Utility Function for implementation lookup: %s",
+ error.AsCString());
m_get_class_info_code.reset();
} else {
diagnostics.Clear();
if (!m_get_class_info_code->Install(diagnostics, exe_ctx)) {
if (log) {
- log->Printf("Failed to install implementation lookup");
+ LLDB_LOGF(log, "Failed to install implementation lookup");
diagnostics.Dump(log);
}
m_get_class_info_code.reset();
@@ -1372,17 +1370,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
clang_uint32_t_type, arguments, thread_sp, error);
if (error.Fail()) {
- if (log)
- log->Printf(
- "Failed to make function caller for implementation lookup: %s.",
- error.AsCString());
+ LLDB_LOGF(log,
+ "Failed to make function caller for implementation lookup: %s.",
+ error.AsCString());
return DescriptorMapUpdateResult::Fail();
}
} else {
get_class_info_function = m_get_class_info_code->GetFunctionCaller();
if (!get_class_info_function) {
if (log) {
- log->Printf("Failed to get implementation lookup function caller.");
+ LLDB_LOGF(log, "Failed to get implementation lookup function caller.");
diagnostics.Dump(log);
}
@@ -1399,10 +1396,10 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
if (class_infos_addr == LLDB_INVALID_ADDRESS) {
- if (log)
- log->Printf("unable to allocate %" PRIu32
- " bytes in process for shared cache read",
- class_infos_byte_size);
+ LLDB_LOGF(log,
+ "unable to allocate %" PRIu32
+ " bytes in process for shared cache read",
+ class_infos_byte_size);
return DescriptorMapUpdateResult::Fail();
}
@@ -1451,8 +1448,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
if (results == eExpressionCompleted) {
// The result is the number of ClassInfo structures that were filled in
num_class_infos = return_value.GetScalar().ULong();
- if (log)
- log->Printf("Discovered %u ObjC classes\n", num_class_infos);
+ LLDB_LOGF(log, "Discovered %u ObjC classes\n", num_class_infos);
if (num_class_infos > 0) {
// Read the ClassInfo structures
DataBufferHeap buffer(num_class_infos * class_info_byte_size, 0);
@@ -1468,13 +1464,13 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
success = true;
} else {
if (log) {
- log->Printf("Error evaluating our find class name function.");
+ LLDB_LOGF(log, "Error evaluating our find class name function.");
diagnostics.Dump(log);
}
}
} else {
if (log) {
- log->Printf("Error writing function arguments.");
+ LLDB_LOGF(log, "Error writing function arguments.");
diagnostics.Dump(log);
}
}
@@ -1507,17 +1503,18 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
if (isa == 0) {
if (should_log)
- log->Printf(
- "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
+ LLDB_LOGF(
+ log, "AppleObjCRuntimeV2 found NULL isa, ignoring this class info");
continue;
}
// Check if we already know about this ISA, if we do, the info will never
// change, so we can just skip it.
if (ISAIsCached(isa)) {
if (should_log)
- log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
- ", ignoring this class info",
- isa);
+ LLDB_LOGF(log,
+ "AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
+ ", ignoring this class info",
+ isa);
offset += 4;
} else {
// Read the 32 bit hash for the class name
@@ -1536,15 +1533,16 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
AddClass(isa, descriptor_sp, descriptor_sp->GetClassName().AsCString(nullptr));
num_parsed++;
if (should_log)
- log->Printf("AppleObjCRuntimeV2 added isa=0x%" PRIx64
- ", hash=0x%8.8x, name=%s",
- isa, name_hash,
- descriptor_sp->GetClassName().AsCString("<unknown>"));
+ LLDB_LOGF(log,
+ "AppleObjCRuntimeV2 added isa=0x%" PRIx64
+ ", hash=0x%8.8x, name=%s",
+ isa, name_hash,
+ descriptor_sp->GetClassName().AsCString("<unknown>"));
}
}
if (should_log)
- log->Printf("AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
- num_parsed);
+ LLDB_LOGF(log, "AppleObjCRuntimeV2 parsed %" PRIu32 " class infos",
+ num_parsed);
return num_parsed;
}
@@ -1603,7 +1601,7 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
// use that in our jitted expression. Else fall back to the old
// class_getName.
static ConstString g_class_getName_symbol_name("class_getName");
- static ConstString g_class_getNameRaw_symbol_name("class_getNameRaw");
+ static ConstString g_class_getNameRaw_symbol_name("objc_debug_class_getNameRaw");
ConstString class_name_getter_function_name = g_class_getName_symbol_name;
ObjCLanguageRuntime *objc_runtime = ObjCLanguageRuntime::Get(*process);
@@ -1646,17 +1644,16 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
shared_class_expression.c_str(), eLanguageTypeObjC,
g_get_shared_cache_class_info_name, error));
if (error.Fail()) {
- if (log)
- log->Printf(
- "Failed to get Utility function for implementation lookup: %s.",
- error.AsCString());
+ LLDB_LOGF(log,
+ "Failed to get Utility function for implementation lookup: %s.",
+ error.AsCString());
m_get_shared_cache_class_info_code.reset();
} else {
diagnostics.Clear();
if (!m_get_shared_cache_class_info_code->Install(diagnostics, exe_ctx)) {
if (log) {
- log->Printf("Failed to install implementation lookup.");
+ LLDB_LOGF(log, "Failed to install implementation lookup.");
diagnostics.Dump(log);
}
m_get_shared_cache_class_info_code.reset();
@@ -1703,10 +1700,10 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
class_infos_byte_size, ePermissionsReadable | ePermissionsWritable, err);
if (class_infos_addr == LLDB_INVALID_ADDRESS) {
- if (log)
- log->Printf("unable to allocate %" PRIu32
- " bytes in process for shared cache read",
- class_infos_byte_size);
+ LLDB_LOGF(log,
+ "unable to allocate %" PRIu32
+ " bytes in process for shared cache read",
+ class_infos_byte_size);
return DescriptorMapUpdateResult::Fail();
}
@@ -1757,9 +1754,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
if (results == eExpressionCompleted) {
// The result is the number of ClassInfo structures that were filled in
num_class_infos = return_value.GetScalar().ULong();
- if (log)
- log->Printf("Discovered %u ObjC classes in shared cache\n",
- num_class_infos);
+ LLDB_LOGF(log, "Discovered %u ObjC classes in shared cache\n",
+ num_class_infos);
assert(num_class_infos <= num_classes);
if (num_class_infos > 0) {
if (num_class_infos > num_classes) {
@@ -1786,13 +1782,13 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
}
} else {
if (log) {
- log->Printf("Error evaluating our find class name function.");
+ LLDB_LOGF(log, "Error evaluating our find class name function.");
diagnostics.Dump(log);
}
}
} else {
if (log) {
- log->Printf("Error writing function arguments.");
+ LLDB_LOGF(log, "Error writing function arguments.");
diagnostics.Dump(log);
}
}
@@ -1827,9 +1823,10 @@ bool AppleObjCRuntimeV2::UpdateISAToDescriptorMapFromMemory(
new ClassDescriptorV2(*this, elt.second, elt.first.AsCString()));
if (log && log->GetVerbose())
- log->Printf("AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
- " (%s) from dynamic table to isa->descriptor cache",
- elt.second, elt.first.AsCString());
+ LLDB_LOGF(log,
+ "AppleObjCRuntimeV2 added (ObjCISA)0x%" PRIx64
+ " (%s) from dynamic table to isa->descriptor cache",
+ elt.second, elt.first.AsCString());
AddClass(elt.second, descriptor_sp, elt.first.AsCString());
}
@@ -1912,14 +1909,14 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
DescriptorMapUpdateResult shared_cache_update_result =
UpdateISAToDescriptorMapSharedCache();
- if (log)
- log->Printf("attempted to read objc class data - results: "
- "[dynamic_update]: ran: %s, count: %" PRIu32
- " [shared_cache_update]: ran: %s, count: %" PRIu32,
- dynamic_update_result.m_update_ran ? "yes" : "no",
- dynamic_update_result.m_num_found,
- shared_cache_update_result.m_update_ran ? "yes" : "no",
- shared_cache_update_result.m_num_found);
+ LLDB_LOGF(log,
+ "attempted to read objc class data - results: "
+ "[dynamic_update]: ran: %s, count: %" PRIu32
+ " [shared_cache_update]: ran: %s, count: %" PRIu32,
+ dynamic_update_result.m_update_ran ? "yes" : "no",
+ dynamic_update_result.m_num_found,
+ shared_cache_update_result.m_update_ran ? "yes" : "no",
+ shared_cache_update_result.m_num_found);
// warn if:
// - we could not run either expression
@@ -2032,8 +2029,8 @@ lldb::addr_t AppleObjCRuntimeV2::LookupRuntimeSymbol(ConstString name) {
if (name_cstr) {
llvm::StringRef name_strref(name_cstr);
- static const llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
- static const llvm::StringRef class_prefix("OBJC_CLASS_$_");
+ llvm::StringRef ivar_prefix("OBJC_IVAR_$_");
+ llvm::StringRef class_prefix("OBJC_CLASS_$_");
if (name_strref.startswith(ivar_prefix)) {
llvm::StringRef ivar_skipped_prefix =
@@ -2516,8 +2513,7 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
ObjCISA isa, ObjCISA &ret_isa) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES));
- if (log)
- log->Printf("AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
+ LLDB_LOGF(log, "AOCRT::NPI Evalulate(isa = 0x%" PRIx64 ")", (uint64_t)isa);
if ((isa & ~m_objc_debug_isa_class_mask) == 0)
return false;
@@ -2543,10 +2539,10 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
// read the count again, and update the cache if the count has been
// updated.
if (index > m_indexed_isa_cache.size()) {
- if (log)
- log->Printf("AOCRT::NPI (index = %" PRIu64
- ") exceeds cache (size = %" PRIu64 ")",
- (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
+ LLDB_LOGF(log,
+ "AOCRT::NPI (index = %" PRIu64
+ ") exceeds cache (size = %" PRIu64 ")",
+ (uint64_t)index, (uint64_t)m_indexed_isa_cache.size());
Process *process(m_runtime.GetProcess());
@@ -2561,9 +2557,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
if (error.Fail())
return false;
- if (log)
- log->Printf("AOCRT::NPI (new class count = %" PRIu64 ")",
- (uint64_t)objc_indexed_classes_count);
+ LLDB_LOGF(log, "AOCRT::NPI (new class count = %" PRIu64 ")",
+ (uint64_t)objc_indexed_classes_count);
if (objc_indexed_classes_count > m_indexed_isa_cache.size()) {
// Read the class entries we don't have. We should just read all of
@@ -2581,9 +2576,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
if (error.Fail() || bytes_read != buffer.GetByteSize())
return false;
- if (log)
- log->Printf("AOCRT::NPI (read new classes count = %" PRIu64 ")",
- (uint64_t)num_new_classes);
+ LLDB_LOGF(log, "AOCRT::NPI (read new classes count = %" PRIu64 ")",
+ (uint64_t)num_new_classes);
// Append the new entries to the existing cache.
DataExtractor data(buffer.GetBytes(), buffer.GetByteSize(),
@@ -2600,9 +2594,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
if (index > m_indexed_isa_cache.size())
return false;
- if (log)
- log->Printf("AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
- (uint64_t)m_indexed_isa_cache[index]);
+ LLDB_LOGF(log, "AOCRT::NPI Evalulate(ret_isa = 0x%" PRIx64 ")",
+ (uint64_t)m_indexed_isa_cache[index]);
ret_isa = m_indexed_isa_cache[index];
return (ret_isa != 0); // this is a pointer so 0 is not a valid value
@@ -2647,8 +2640,9 @@ bool AppleObjCRuntimeV2::GetCFBooleanValuesIfNeeded() {
std::function<lldb::addr_t(ConstString)> get_symbol =
[this](ConstString sym) -> lldb::addr_t {
SymbolContextList sc_list;
- if (GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType(
- sym, lldb::eSymbolTypeData, sc_list) == 1) {
+ GetProcess()->GetTarget().GetImages().FindSymbolsWithNameAndType(
+ sym, lldb::eSymbolTypeData, sc_list);
+ if (sc_list.GetSize() == 1) {
SymbolContext sc;
sc_list.GetContextAtIndex(0, sc);
if (sc.symbol)
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index b3eb09caa86d..379ef3dca86c 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -543,7 +543,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(
Status error;
DataExtractor data;
error = argument_values.GetValueAtIndex(0)->GetValueAsData(&exe_ctx, data,
- 0, nullptr);
+ nullptr);
lldb::offset_t offset = 0;
lldb::addr_t region_addr = data.GetPointer(&offset);
@@ -593,7 +593,7 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions(
if (log) {
StreamString s;
m_regions.back().Dump(s);
- log->Printf("Read vtable region: \n%s", s.GetData());
+ LLDB_LOGF(log, "Read vtable region: \n%s", s.GetData());
}
next_region = m_regions.back().GetNextRegionAddr();
@@ -704,7 +704,7 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
// step through any method dispatches. Warn to that effect and get out of
// here.
if (process_sp->CanJIT()) {
- process_sp->GetTarget().GetDebugger().GetErrorFile()->Printf(
+ process_sp->GetTarget().GetDebugger().GetErrorStream().Printf(
"Could not find implementation lookup function \"%s\""
" step in through ObjC method dispatch will not work.\n",
get_impl_name.AsCString());
@@ -779,25 +779,24 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
m_lookup_implementation_function_code, eLanguageTypeObjC,
g_lookup_implementation_function_name, error));
if (error.Fail()) {
- if (log)
- log->Printf(
- "Failed to get Utility Function for implementation lookup: %s.",
- error.AsCString());
+ LLDB_LOGF(
+ log,
+ "Failed to get Utility Function for implementation lookup: %s.",
+ error.AsCString());
m_impl_code.reset();
return args_addr;
}
if (!m_impl_code->Install(diagnostics, exe_ctx)) {
if (log) {
- log->Printf("Failed to install implementation lookup.");
+ LLDB_LOGF(log, "Failed to install implementation lookup.");
diagnostics.Dump(log);
}
m_impl_code.reset();
return args_addr;
}
} else {
- if (log)
- log->Printf("No method lookup implementation code.");
+ LLDB_LOGF(log, "No method lookup implementation code.");
return LLDB_INVALID_ADDRESS;
}
@@ -811,10 +810,9 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
impl_function_caller = m_impl_code->MakeFunctionCaller(
clang_void_ptr_type, dispatch_values, thread_sp, error);
if (error.Fail()) {
- if (log)
- log->Printf(
- "Error getting function caller for dispatch lookup: \"%s\".",
- error.AsCString());
+ LLDB_LOGF(log,
+ "Error getting function caller for dispatch lookup: \"%s\".",
+ error.AsCString());
return args_addr;
}
} else {
@@ -833,7 +831,7 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
if (!impl_function_caller->WriteFunctionArguments(
exe_ctx, args_addr, dispatch_values, diagnostics)) {
if (log) {
- log->Printf("Error writing function arguments.");
+ LLDB_LOGF(log, "Error writing function arguments.");
diagnostics.Dump(log);
}
return args_addr;
@@ -934,9 +932,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
lldb::addr_t obj_addr =
argument_values.GetValueAtIndex(obj_index)->GetScalar().ULongLong();
if (obj_addr == 0x0) {
- if (log)
- log->Printf(
- "Asked to step to dispatch to nil object, returning empty plan.");
+ LLDB_LOGF(
+ log,
+ "Asked to step to dispatch to nil object, returning empty plan.");
return ret_plan_sp;
}
@@ -976,13 +974,11 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (super_value.GetScalar().IsValid())
isa_addr = super_value.GetScalar().ULongLong();
else {
- if (log)
- log->Printf("Failed to extract the super class value from the "
- "class in objc_super.");
+ LLDB_LOGF(log, "Failed to extract the super class value from the "
+ "class in objc_super.");
}
} else {
- if (log)
- log->Printf("Failed to extract the class value from objc_super.");
+ LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
}
} else {
// In the objc_msgSendSuper case, we don't get the object
@@ -998,8 +994,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (super_value.GetScalar().IsValid()) {
isa_addr = super_value.GetScalar().ULongLong();
} else {
- if (log)
- log->Printf("Failed to extract the class value from objc_super.");
+ LLDB_LOGF(log, "Failed to extract the class value from objc_super.");
}
}
} else {
@@ -1022,8 +1017,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (isa_value.GetScalar().IsValid()) {
isa_addr = isa_value.GetScalar().ULongLong();
} else {
- if (log)
- log->Printf("Failed to extract the isa value from object.");
+ LLDB_LOGF(log, "Failed to extract the isa value from object.");
}
}
@@ -1033,9 +1027,10 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (isa_addr != LLDB_INVALID_ADDRESS) {
if (log) {
- log->Printf("Resolving call for class - 0x%" PRIx64
- " and selector - 0x%" PRIx64,
- isa_addr, sel_addr);
+ LLDB_LOGF(log,
+ "Resolving call for class - 0x%" PRIx64
+ " and selector - 0x%" PRIx64,
+ isa_addr, sel_addr);
}
ObjCLanguageRuntime *objc_runtime =
ObjCLanguageRuntime::Get(*thread.GetProcess());
@@ -1047,9 +1042,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (impl_addr != LLDB_INVALID_ADDRESS) {
// Yup, it was in the cache, so we can run to that address directly.
- if (log)
- log->Printf("Found implementation address in cache: 0x%" PRIx64,
- impl_addr);
+ LLDB_LOGF(log, "Found implementation address in cache: 0x%" PRIx64,
+ impl_addr);
ret_plan_sp = std::make_shared<ThreadPlanRunToAddress>(thread, impl_addr,
stop_others);
@@ -1137,7 +1131,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (log) {
StreamString s;
ret_plan_sp->GetDescription(&s, eDescriptionLevelFull);
- log->Printf("Using ObjC step plan: %s.\n", s.GetData());
+ LLDB_LOGF(log, "Using ObjC step plan: %s.\n", s.GetData());
}
}
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 26654e9212b9..6402e80d6f98 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -18,7 +18,6 @@
#include <vector>
using namespace lldb_private;
-using namespace lldb_utility;
AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
ObjCLanguageRuntime &runtime)
@@ -32,16 +31,14 @@ AppleObjCTypeEncodingParser::AppleObjCTypeEncodingParser(
.c_str()));
}
-std::string
-AppleObjCTypeEncodingParser::ReadStructName(lldb_utility::StringLexer &type) {
+std::string AppleObjCTypeEncodingParser::ReadStructName(StringLexer &type) {
StreamString buffer;
while (type.HasAtLeast(1) && type.Peek() != '=')
buffer.Printf("%c", type.Next());
return buffer.GetString();
}
-std::string
-AppleObjCTypeEncodingParser::ReadQuotedString(lldb_utility::StringLexer &type) {
+std::string AppleObjCTypeEncodingParser::ReadQuotedString(StringLexer &type) {
StreamString buffer;
while (type.HasAtLeast(1) && type.Peek() != '"')
buffer.Printf("%c", type.Next());
@@ -51,8 +48,7 @@ AppleObjCTypeEncodingParser::ReadQuotedString(lldb_utility::StringLexer &type) {
return buffer.GetString();
}
-uint32_t
-AppleObjCTypeEncodingParser::ReadNumber(lldb_utility::StringLexer &type) {
+uint32_t AppleObjCTypeEncodingParser::ReadNumber(StringLexer &type) {
uint32_t total = 0;
while (type.HasAtLeast(1) && isdigit(type.Peek()))
total = 10 * total + (type.Next() - '0');
@@ -68,7 +64,7 @@ AppleObjCTypeEncodingParser::StructElement::StructElement()
AppleObjCTypeEncodingParser::StructElement
AppleObjCTypeEncodingParser::ReadStructElement(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StringLexer &type,
bool for_expression) {
StructElement retval;
if (type.NextIf('"'))
@@ -81,25 +77,21 @@ AppleObjCTypeEncodingParser::ReadStructElement(clang::ASTContext &ast_ctx,
return retval;
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildStruct(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildStruct(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
return BuildAggregate(ast_ctx, type, for_expression, '{', '}',
clang::TTK_Struct);
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildUnion(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildUnion(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
return BuildAggregate(ast_ctx, type, for_expression, '(', ')',
clang::TTK_Union);
}
clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
- clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
- bool for_expression, char opener, char closer, uint32_t kind) {
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression,
+ char opener, char closer, uint32_t kind) {
if (!type.NextIf(opener))
return clang::QualType();
std::string name(ReadStructName(type));
@@ -149,8 +141,9 @@ clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
}
ClangASTContext::AddFieldToRecordType(
union_type, element.name.c_str(),
- CompilerType(&ast_ctx, element.type), lldb::eAccessPublic,
- element.bitfield);
+ CompilerType(ClangASTContext::GetASTContext(&ast_ctx),
+ element.type.getAsOpaquePtr()),
+ lldb::eAccessPublic, element.bitfield);
++count;
}
ClangASTContext::CompleteTagDeclarationDefinition(union_type);
@@ -158,10 +151,8 @@ clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
return ClangUtil::GetQualType(union_type);
}
-clang::QualType
-AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
- bool for_expression) {
+clang::QualType AppleObjCTypeEncodingParser::BuildArray(
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
if (!type.NextIf('['))
return clang::QualType();
uint32_t size = ReadNumber(type);
@@ -172,7 +163,9 @@ AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
if (!lldb_ctx)
return clang::QualType();
CompilerType array_type(lldb_ctx->CreateArrayType(
- CompilerType(&ast_ctx, element_type), size, false));
+ CompilerType(ClangASTContext::GetASTContext(&ast_ctx),
+ element_type.getAsOpaquePtr()),
+ size, false));
return ClangUtil::GetQualType(array_type);
}
@@ -182,8 +175,7 @@ AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
// consume but ignore the type info and always return an 'id'; if anything,
// dynamic typing will resolve things for us anyway
clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
- clang::ASTContext &ast_ctx, lldb_utility::StringLexer &type,
- bool for_expression) {
+ clang::ASTContext &ast_ctx, StringLexer &type, bool for_expression) {
if (!type.NextIf('@'))
return clang::QualType();
@@ -375,7 +367,8 @@ CompilerType AppleObjCTypeEncodingParser::RealizeType(
if (name && name[0]) {
StringLexer lexer(name);
clang::QualType qual_type = BuildType(ast_ctx, lexer, for_expression);
- return CompilerType(&ast_ctx, qual_type);
+ return CompilerType(ClangASTContext::GetASTContext(&ast_ctx),
+ qual_type.getAsOpaquePtr());
}
return CompilerType();
}
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
index e576e8f283f2..590bc4ba9eae 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h
@@ -15,12 +15,8 @@
#include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h"
-namespace lldb_utility {
-class StringLexer;
-}
-
namespace lldb_private {
-
+class StringLexer;
class AppleObjCTypeEncodingParser : public ObjCLanguageRuntime::EncodingToType {
public:
AppleObjCTypeEncodingParser(ObjCLanguageRuntime &runtime);
@@ -39,41 +35,35 @@ private:
~StructElement() = default;
};
- clang::QualType BuildType(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildType(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression,
uint32_t *bitfield_bit_size = nullptr);
- clang::QualType BuildStruct(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildStruct(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- clang::QualType BuildAggregate(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildAggregate(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression, char opener, char closer,
uint32_t kind);
- clang::QualType BuildUnion(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildUnion(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- clang::QualType BuildArray(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ clang::QualType BuildArray(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
- std::string ReadStructName(lldb_utility::StringLexer &type);
+ std::string ReadStructName(StringLexer &type);
- StructElement ReadStructElement(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StructElement ReadStructElement(clang::ASTContext &ast_ctx, StringLexer &type,
bool for_expression);
clang::QualType BuildObjCObjectPointerType(clang::ASTContext &ast_ctx,
- lldb_utility::StringLexer &type,
+ StringLexer &type,
bool for_expression);
- uint32_t ReadNumber(lldb_utility::StringLexer &type);
+ uint32_t ReadNumber(StringLexer &type);
- std::string ReadQuotedString(lldb_utility::StringLexer &type);
+ std::string ReadQuotedString(StringLexer &type);
ObjCLanguageRuntime &m_runtime;
};
diff --git a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
index d18435c9c6db..af630eee7265 100644
--- a/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -141,17 +141,15 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
target_so_addr.SetOpcodeLoadAddress(target_addr, exc_ctx.GetTargetPtr());
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
if (target_addr == 0) {
- if (log)
- log->Printf("Got target implementation of 0x0, stopping.");
+ LLDB_LOGF(log, "Got target implementation of 0x0, stopping.");
SetPlanComplete();
return true;
}
if (m_trampoline_handler->AddrIsMsgForward(target_addr)) {
- if (log)
- log->Printf(
- "Implementation lookup returned msgForward function: 0x%" PRIx64
- ", stopping.",
- target_addr);
+ LLDB_LOGF(log,
+ "Implementation lookup returned msgForward function: 0x%" PRIx64
+ ", stopping.",
+ target_addr);
SymbolContext sc = m_thread.GetStackFrameAtIndex(0)->GetSymbolContext(
eSymbolContextEverything);
@@ -167,18 +165,17 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
return false;
}
- if (log)
- log->Printf("Running to ObjC method implementation: 0x%" PRIx64,
- target_addr);
+ LLDB_LOGF(log, "Running to ObjC method implementation: 0x%" PRIx64,
+ target_addr);
ObjCLanguageRuntime *objc_runtime =
ObjCLanguageRuntime::Get(*GetThread().GetProcess());
assert(objc_runtime != nullptr);
objc_runtime->AddToMethodCache(m_isa_addr, m_sel_addr, target_addr);
- if (log)
- log->Printf("Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
- "} = addr=0x%" PRIx64 " to cache.",
- m_isa_addr, m_sel_addr, target_addr);
+ LLDB_LOGF(log,
+ "Adding {isa-addr=0x%" PRIx64 ", sel-addr=0x%" PRIx64
+ "} = addr=0x%" PRIx64 " to cache.",
+ m_isa_addr, m_sel_addr, target_addr);
// Extract the target address from the value: