summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/LanguageRuntime
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Plugins/LanguageRuntime')
-rw-r--r--lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp69
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp3
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp32
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp10
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp124
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp545
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp54
-rw-r--r--lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp14
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp34
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp197
-rw-r--r--lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp68
11 files changed, 544 insertions, 606 deletions
diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
index 04789e5db23..fc661bbbf2c 100644
--- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp
@@ -93,8 +93,8 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
TypeList class_types;
uint32_t num_matches = 0;
- // First look in the module that the vtable symbol came from
- // and look for a single exact match.
+ // First look in the module that the vtable symbol came from and
+ // look for a single exact match.
llvm::DenseSet<SymbolFile *> searched_symbol_files;
if (sc.module_sp) {
num_matches = sc.module_sp->FindTypes(
@@ -102,9 +102,8 @@ TypeAndOrName ItaniumABILanguageRuntime::GetTypeInfoFromVTableAddress(
searched_symbol_files, class_types);
}
- // If we didn't find a symbol, then move on to the entire
- // module list in the target and get as many unique matches
- // as possible
+ // If we didn't find a symbol, then move on to the entire module
+ // list in the target and get as many unique matches as possible
if (num_matches == 0) {
num_matches = target.GetImages().FindTypes(
sc, ConstString(lookup_name), exact_match, UINT32_MAX,
@@ -192,15 +191,12 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
TypeAndOrName &class_type_or_name, Address &dynamic_address,
Value::ValueType &value_type) {
// For Itanium, if the type has a vtable pointer in the object, it will be at
- // offset 0
- // in the object. That will point to the "address point" within the vtable
- // (not the beginning of the
- // vtable.) We can then look up the symbol containing this "address point"
- // and that symbol's name
- // demangled will contain the full class name.
- // The second pointer above the "address point" is the "offset_to_top". We'll
- // use that to get the
- // start of the value object which holds the dynamic type.
+ // offset 0 in the object. That will point to the "address point" within the
+ // vtable (not the beginning of the vtable.) We can then look up the symbol
+ // containing this "address point" and that symbol's name demangled will
+ // contain the full class name. The second pointer above the "address point"
+ // is the "offset_to_top". We'll use that to get the start of the value
+ // object which holds the dynamic type.
//
class_type_or_name.Clear();
@@ -235,17 +231,15 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
if (class_type_or_name) {
TypeSP type_sp = class_type_or_name.GetTypeSP();
- // There can only be one type with a given name,
- // so we've just found duplicate definitions, and this
- // one will do as well as any other.
- // We don't consider something to have a dynamic type if
- // it is the same as the static type. So compare against
- // the value we were handed.
+ // There can only be one type with a given name, so we've just found
+ // duplicate definitions, and this one will do as well as any other. We
+ // don't consider something to have a dynamic type if it is the same as
+ // the static type. So compare against the value we were handed.
if (type_sp) {
if (ClangASTContext::AreTypesSame(in_value.GetCompilerType(),
type_sp->GetForwardCompilerType())) {
- // The dynamic type we found was the same type,
- // so we don't have a dynamic type here...
+ // The dynamic type we found was the same type, so we don't have a
+ // dynamic type here...
return false;
}
@@ -262,8 +256,8 @@ bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress(
if (offset_to_top == INT64_MIN)
return false;
- // So the dynamic type is a value that starts at offset_to_top
- // above the original address.
+ // So the dynamic type is a value that starts at offset_to_top above
+ // the original address.
lldb::addr_t dynamic_addr = original_ptr + offset_to_top;
if (!process->GetTarget().GetSectionLoadList().ResolveLoadAddress(
dynamic_addr, dynamic_address)) {
@@ -285,10 +279,9 @@ TypeAndOrName ItaniumABILanguageRuntime::FixUpDynamicType(
TypeAndOrName ret(type_and_or_name);
if (type_and_or_name.HasType()) {
// The type will always be the type of the dynamic object. If our parent's
- // type was a pointer,
- // then our type should be a pointer to the type of the dynamic object. If
- // a reference, then the original type
- // should be okay...
+ // type was a pointer, then our type should be a pointer to the type of the
+ // dynamic object. If a reference, then the original type should be
+ // okay...
CompilerType orig_type = type_and_or_name.GetCompilerType();
CompilerType corrected_type = orig_type;
if (static_type_flags.AllSet(eTypeIsPointer))
@@ -373,8 +366,8 @@ protected:
// the actual Mangled class should be strict about this, but on the
// command line if you're copying mangled names out of 'nm' on Darwin,
- // they will come out with an extra underscore - be willing to strip
- // this on behalf of the user. This is the moral equivalent of the -_/-n
+ // they will come out with an extra underscore - be willing to strip this
+ // on behalf of the user. This is the moral equivalent of the -_/-n
// options to c++filt
auto name = entry.ref;
if (name.startswith("__Z"))
@@ -453,13 +446,12 @@ BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(
BreakpointResolverSP ItaniumABILanguageRuntime::CreateExceptionResolver(
Breakpoint *bkpt, bool catch_bp, bool throw_bp, bool for_expressions) {
// One complication here is that most users DON'T want to stop at
- // __cxa_allocate_expression, but until we can do
- // anything better with predicting unwinding the expression parser does. So
- // we have two forms of the exception
- // breakpoints, one for expressions that leaves out __cxa_allocate_exception,
- // and one that includes it.
- // The SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint
- // in the runtime the former.
+ // __cxa_allocate_expression, but until we can do anything better with
+ // predicting unwinding the expression parser does. So we have two forms of
+ // the exception breakpoints, one for expressions that leaves out
+ // __cxa_allocate_exception, and one that includes it. The
+ // SetExceptionBreakpoints does the latter, the CreateExceptionBreakpoint in
+ // the runtime the former.
static const char *g_catch_name = "__cxa_begin_catch";
static const char *g_throw_name1 = "__cxa_throw";
static const char *g_throw_name2 = "__cxa_rethrow";
@@ -522,8 +514,7 @@ void ItaniumABILanguageRuntime::SetExceptionBreakpoints() {
const bool for_expressions = true;
// For the exception breakpoints set by the Expression parser, we'll be a
- // little more aggressive and
- // stop at exception allocation as well.
+ // little more aggressive and stop at exception allocation as well.
if (m_cxx_exception_bp_sp) {
m_cxx_exception_bp_sp->SetEnabled(true);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
index ecb0b64f234..edb29e735ca 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -378,8 +378,7 @@ bool ClassDescriptorV2::Describe(
AppleObjCRuntime::ClassDescriptorSP metaclass(GetMetaclass());
// We don't care about the metaclass's superclass, or its class methods.
- // Its instance methods are
- // our class methods.
+ // Its instance methods are our class methods.
if (metaclass) {
metaclass->Describe(
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
index eacc98a0719..5516cf90122 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp
@@ -54,23 +54,20 @@ bool AppleObjCRuntime::GetObjectDescription(Stream &str, ValueObject &valobj) {
CompilerType compiler_type(valobj.GetCompilerType());
bool is_signed;
// ObjC objects can only be pointers (or numbers that actually represents
- // pointers
- // but haven't been typecast, because reasons..)
+ // pointers but haven't been typecast, because reasons..)
if (!compiler_type.IsIntegerType(is_signed) && !compiler_type.IsPointerType())
return false;
- // Make the argument list: we pass one arg, the address of our pointer, to the
- // print function.
+ // Make the argument list: we pass one arg, the address of our pointer, to
+ // the print function.
Value val;
if (!valobj.ResolveValue(val.GetScalar()))
return false;
// Value Objects may not have a process in their ExecutionContextRef. But we
- // need to have one
- // in the ref we pass down to eventually call description. Get it from the
- // target if it isn't
- // present.
+ // need to have one in the ref we pass down to eventually call description.
+ // Get it from the target if it isn't present.
ExecutionContext exe_ctx;
if (valobj.GetProcessSP()) {
exe_ctx = ExecutionContext(valobj.GetExecutionContextRef());
@@ -257,10 +254,9 @@ AppleObjCRuntime::FixUpDynamicType(const TypeAndOrName &type_and_or_name,
TypeAndOrName ret(type_and_or_name);
if (type_and_or_name.HasType()) {
// The type will always be the type of the dynamic object. If our parent's
- // type was a pointer,
- // then our type should be a pointer to the type of the dynamic object. If
- // a reference, then the original type
- // should be okay...
+ // type was a pointer, then our type should be a pointer to the type of the
+ // dynamic object. If a reference, then the original type should be
+ // okay...
CompilerType orig_type = type_and_or_name.GetCompilerType();
CompilerType corrected_type = orig_type;
if (static_type_flags.AllSet(eTypeIsPointer))
@@ -325,8 +321,8 @@ bool AppleObjCRuntime::IsModuleObjCLibrary(const ModuleSP &module_sp) {
bool AppleObjCRuntime::ReadObjCLibrary(const ModuleSP &module_sp) {
// Maybe check here and if we have a handler already, and the UUID of this
- // module is the same as the one in the
- // current module, then we don't have to reread it?
+ // module is the same as the one in the current module, then we don't have to
+ // reread it?
m_objc_trampoline_handler_ap.reset(
new AppleObjCTrampolineHandler(m_process->shared_from_this(), module_sp));
if (m_objc_trampoline_handler_ap.get() != NULL) {
@@ -365,11 +361,9 @@ AppleObjCRuntime::GetObjCVersion(Process *process, ModuleSP &objc_module_sp) {
for (size_t i = 0; i < num_images; i++) {
ModuleSP module_sp = target_modules.GetModuleAtIndexUnlocked(i);
// One tricky bit here is that we might get called as part of the initial
- // module loading, but
- // before all the pre-run libraries get winnowed from the module list. So
- // there might actually
- // be an old and incorrect ObjC library sitting around in the list, and we
- // don't want to look at that.
+ // module loading, but before all the pre-run libraries get winnowed from
+ // the module list. So there might actually be an old and incorrect ObjC
+ // library sitting around in the list, and we don't want to look at that.
// That's why we call IsLoadedInTarget.
if (AppleIsModuleObjCLibrary(module_sp) &&
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
index 9cac499c0ff..270e83642ac 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp
@@ -42,8 +42,7 @@ AppleObjCRuntimeV1::AppleObjCRuntimeV1(Process *process)
m_isa_hash_table_ptr(LLDB_INVALID_ADDRESS) {}
// for V1 runtime we just try to return a class name as that is the minimum
-// level of support
-// required for the data formatters to work
+// level of support required for the data formatters to work
bool AppleObjCRuntimeV1::GetDynamicTypeAndAddress(
ValueObject &in_value, lldb::DynamicValueType use_dynamic,
TypeAndOrName &class_type_or_name, Address &address,
@@ -383,8 +382,8 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
ObjCISA isa;
if (bucket_isa_count == 1) {
- // When we only have one entry in the bucket, the bucket data is
- // the "isa"
+ // When we only have one entry in the bucket, the bucket data
+ // is the "isa"
isa = bucket_data;
if (isa) {
if (!ISAIsCached(isa)) {
@@ -402,8 +401,7 @@ void AppleObjCRuntimeV1::UpdateISAToDescriptorMapIfNeeded() {
}
} else {
// When we have more than one entry in the bucket, the bucket
- // data is a pointer
- // to an array of "isa" values
+ // data is a pointer to an array of "isa" values
addr_t isa_addr = bucket_data;
for (uint32_t isa_idx = 0; isa_idx < bucket_isa_count;
++isa_idx, isa_addr += addr_size) {
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
index 3742fc1e1ca..4605effcd19 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
@@ -77,8 +77,7 @@ static constexpr std::chrono::seconds g_utility_function_timeout(2);
static const char *g_get_dynamic_class_info_name =
"__lldb_apple_objc_v2_get_dynamic_class_info";
// Testing using the new C++11 raw string literals. If this breaks GCC then we
-// will
-// need to revert to the code above...
+// will need to revert to the code above...
static const char *g_get_dynamic_class_info_body = R"(
extern "C"
@@ -162,8 +161,7 @@ __lldb_apple_objc_v2_get_dynamic_class_info (void *gdb_objc_realized_classes_ptr
static const char *g_get_shared_cache_class_info_name =
"__lldb_apple_objc_v2_get_shared_cache_class_info";
// Testing using the new C++11 raw string literals. If this breaks GCC then we
-// will
-// need to revert to the code above...
+// will need to revert to the code above...
static const char *g_get_shared_cache_class_info_body = R"(
extern "C"
@@ -407,10 +405,9 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
assert(m_process != NULL);
// The Runtime is attached to a particular process, you shouldn't pass in a
- // value from another process.
- // Note, however, the process might be NULL (e.g. if the value was made with
- // SBTarget::EvaluateExpression...)
- // in which case it is sufficient if the target's match:
+ // value from another process. Note, however, the process might be NULL (e.g.
+ // if the value was made with SBTarget::EvaluateExpression...) in which case
+ // it is sufficient if the target's match:
Process *process = in_value.GetProcessSP().get();
if (process)
@@ -423,8 +420,8 @@ bool AppleObjCRuntimeV2::GetDynamicTypeAndAddress(
// Make sure we can have a dynamic value before starting...
if (CouldHaveDynamicValue(in_value)) {
- // First job, pull out the address at 0 offset from the object That will be
- // the ISA pointer.
+ // First job, pull out the address at 0 offset from the object That will
+ // be the ISA pointer.
ClassDescriptorSP objc_class_sp(GetNonKVOClassDescriptor(in_value));
if (objc_class_sp) {
const addr_t object_ptr = in_value.GetPointerValue();
@@ -871,8 +868,8 @@ size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type,
const char *class_name = parent_ast_type.GetConstTypeName().AsCString();
if (class_name && class_name[0] && ivar_name && ivar_name[0]) {
//----------------------------------------------------------------------
- // Make the objective C V2 mangled name for the ivar offset from the
- // class name and ivar name
+ // Make the objective C V2 mangled name for the ivar offset from the class
+ // name and ivar name
//----------------------------------------------------------------------
std::string buffer("OBJC_IVAR_$_");
buffer.append(class_name);
@@ -881,8 +878,8 @@ size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type,
ConstString ivar_const_str(buffer.c_str());
//----------------------------------------------------------------------
- // Try to get the ivar offset address from the symbol table first using
- // the name we created above
+ // Try to get the ivar offset address from the symbol table first using the
+ // name we created above
//----------------------------------------------------------------------
SymbolContextList sc_list;
Target &target = m_process->GetTarget();
@@ -915,11 +912,9 @@ size_t AppleObjCRuntimeV2::GetByteOffsetForIvar(CompilerType &parent_ast_type,
}
// tagged pointers are special not-a-real-pointer values that contain both type
-// and value information
-// this routine attempts to check with as little computational effort as
-// possible whether something
-// could possibly be a tagged pointer - false positives are possible but false
-// negatives shouldn't
+// and value information this routine attempts to check with as little
+// computational effort as possible whether something could possibly be a
+// tagged pointer - false positives are possible but false negatives shouldn't
bool AppleObjCRuntimeV2::IsTaggedPointer(addr_t ptr) {
if (!m_tagged_pointer_vendor_ap)
return false;
@@ -951,11 +946,11 @@ public:
Status err;
// This currently holds true for all platforms we support, but we might
- // need to change this to use get the actually byte size of "unsigned"
- // from the target AST...
+ // need to change this to use get the actually byte size of "unsigned" from
+ // the target AST...
const uint32_t unsigned_byte_size = sizeof(uint32_t);
- // Skip the prototype as we don't need it (const struct +NXMapTablePrototype
- // *prototype)
+ // Skip the prototype as we don't need it (const struct
+ // +NXMapTablePrototype *prototype)
bool success = true;
if (load_addr == LLDB_INVALID_ADDRESS)
@@ -989,8 +984,8 @@ public:
return success;
}
- // const_iterator mimics NXMapState and its code comes from NXInitMapState and
- // NXNextMapState.
+ // const_iterator mimics NXMapState and its code comes from NXInitMapState
+ // and NXNextMapState.
typedef std::pair<ConstString, ObjCLanguageRuntime::ObjCISA> element;
friend class const_iterator;
@@ -1133,8 +1128,8 @@ bool AppleObjCRuntimeV2::HashTableSignature::NeedsUpdate(
return false; // Failed to parse the header, no need to update anything
}
- // Check with out current signature and return true if the count,
- // number of buckets or the hash table address changes.
+ // Check with out current signature and return true if the count, number of
+ // buckets or the hash table address changes.
if (m_count == hash_table.GetCount() &&
m_num_buckets == hash_table.GetBucketCount() &&
m_buckets_ptr == hash_table.GetBucketDataPointer()) {
@@ -1168,9 +1163,9 @@ AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) {
}
return nullptr;
}
- // if we get an invalid VO (which might still happen when playing around
- // with pointers returned by the expression parser, don't consider this
- // a valid ObjC object)
+ // if we get an invalid VO (which might still happen when playing around with
+ // pointers returned by the expression parser, don't consider this a valid
+ // ObjC object)
if (valobj.GetCompilerType().IsValid()) {
addr_t isa_pointer = valobj.GetPointerValue();
@@ -1360,8 +1355,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapDynamic(
arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
- // Only dump the runtime classes from the expression evaluation if the
- // log is verbose:
+ // Only dump the runtime classes from the expression evaluation if the log is
+ // verbose:
Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES);
bool dump_log = type_log && type_log->GetVerbose();
@@ -1455,8 +1450,8 @@ uint32_t AppleObjCRuntimeV2::ParseClassInfoArray(const DataExtractor &data,
"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.
+ // 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 (log)
log->Printf("AppleObjCRuntimeV2 found cached isa=0x%" PRIx64
@@ -1607,8 +1602,8 @@ AppleObjCRuntimeV2::UpdateISAToDescriptorMapSharedCache() {
arguments.GetValueAtIndex(0)->GetScalar() = objc_opt_ptr;
arguments.GetValueAtIndex(1)->GetScalar() = class_infos_addr;
arguments.GetValueAtIndex(2)->GetScalar() = class_infos_byte_size;
- // Only dump the runtime classes from the expression evaluation if the
- // log is verbose:
+ // Only dump the runtime classes from the expression evaluation if the log is
+ // verbose:
Log *type_log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES);
bool dump_log = type_log && type_log->GetVerbose();
@@ -1788,21 +1783,17 @@ void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
DescriptorMapUpdateResult dynamic_update_result =
UpdateISAToDescriptorMapDynamic(hash_table);
- // Now get the objc classes that are baked into the Objective C runtime
- // in the shared cache, but only once per process as this data never
- // changes
+ // Now get the objc classes that are baked into the Objective C runtime in
+ // the shared cache, but only once per process as this data never changes
if (!m_loaded_objc_opt) {
// it is legitimately possible for the shared cache to be empty - in that
- // case, the dynamic hash table
- // will contain all the class information we need; the situation we're
- // trying to detect is one where
- // we aren't seeing class information from the runtime - in order to
- // detect that vs. just the shared cache
- // being empty or sparsely populated, we set an arbitrary (very low)
- // threshold for the number of classes
- // that we want to see in a "good" scenario - anything below that is
- // suspicious (Foundation alone has thousands
- // of classes)
+ // case, the dynamic hash table will contain all the class information we
+ // need; the situation we're trying to detect is one where we aren't
+ // seeing class information from the runtime - in order to detect that
+ // vs. just the shared cache being empty or sparsely populated, we set an
+ // arbitrary (very low) threshold for the number of classes that we want
+ // to see in a "good" scenario - anything below that is suspicious
+ // (Foundation alone has thousands of classes)
const uint32_t num_classes_to_warn_at = 500;
DescriptorMapUpdateResult shared_cache_update_result =
@@ -2089,8 +2080,8 @@ AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance(
if (error.Fail())
return new TaggedPointerVendorLegacy(runtime);
- // try to detect the "extended tagged pointer" variables - if any are missing,
- // use the non-extended vendor
+ // try to detect the "extended tagged pointer" variables - if any are
+ // missing, use the non-extended vendor
do {
auto objc_debug_taggedpointer_ext_mask = ExtractRuntimeGlobalSymbol(
process, ConstString("objc_debug_taggedpointer_ext_mask"),
@@ -2143,8 +2134,8 @@ AppleObjCRuntimeV2::TaggedPointerVendorV2::CreateInstance(
objc_debug_taggedpointer_classes, objc_debug_taggedpointer_ext_classes);
} while (false);
- // we might want to have some rules to outlaw these values (e.g if the table's
- // address is zero)
+ // we might want to have some rules to outlaw these values (e.g if the
+ // table's address is zero)
return new TaggedPointerVendorRuntimeAssisted(
runtime, objc_debug_taggedpointer_mask,
@@ -2414,11 +2405,10 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
if ((isa & ~m_objc_debug_isa_class_mask) == 0)
return false;
- // If all of the indexed ISA variables are set, then its possible that
- // this ISA is indexed, and we should first try to get its value using
- // the index.
- // Note, we check these varaibles first as the ObjC runtime will set at
- // least one of their values to 0 if they aren't needed.
+ // If all of the indexed ISA variables are set, then its possible that this
+ // ISA is indexed, and we should first try to get its value using the index.
+ // Note, we check these varaibles first as the ObjC runtime will set at least
+ // one of their values to 0 if they aren't needed.
if (m_objc_debug_indexed_isa_magic_mask &&
m_objc_debug_indexed_isa_magic_value &&
m_objc_debug_indexed_isa_index_mask &&
@@ -2431,10 +2421,10 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
// Magic bits are correct, so try extract the index.
uintptr_t index = (isa & m_objc_debug_indexed_isa_index_mask) >>
m_objc_debug_indexed_isa_index_shift;
- // If the index is out of bounds of the length of the array then
- // check if the array has been updated. If that is the case then
- // we should try read the count again, and update the cache if the
- // count has been updated.
+ // If the index is out of bounds of the length of the array then check if
+ // the array has been updated. If that is the case then we should try
+ // 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
@@ -2459,9 +2449,9 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
(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 them instead of just the one we need as then
- // we can cache those we may need later.
+ // Read the class entries we don't have. We should just read all of
+ // them instead of just the one we need as then we can cache those we
+ // may need later.
auto num_new_classes =
objc_indexed_classes_count - m_indexed_isa_cache.size();
const uint32_t addr_size = process->GetAddressByteSize();
@@ -2504,8 +2494,8 @@ bool AppleObjCRuntimeV2::NonPointerISACache::EvaluateNonPointerISA(
return false;
}
- // Definately not an indexed ISA, so try to use a mask to extract
- // the pointer from the ISA.
+ // Definately not an indexed ISA, so try to use a mask to extract the pointer
+ // from the ISA.
if ((isa & m_objc_debug_isa_magic_mask) == m_objc_debug_isa_magic_value) {
ret_isa = isa & m_objc_debug_isa_class_mask;
return (ret_isa != 0); // this is a pointer so 0 is not a valid value
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
index a6e9c0c16f1..c75fa71ba13 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp
@@ -49,227 +49,237 @@ const char *AppleObjCTrampolineHandler::g_lookup_implementation_function_name =
const char *AppleObjCTrampolineHandler::
g_lookup_implementation_with_stret_function_code =
" \n\
-extern \"C\" \n\
-{ \n\
- extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\
- extern void *class_getMethodImplementation_stret(void *objc_class, void *sel); \n\
- extern void * object_getClass (id object); \n\
- extern void * sel_getUid(char *name); \n\
- extern int printf(const char *format, ...); \n\
-} \n\
-extern \"C\" void * __lldb_objc_find_implementation_for_selector (void *object, \n\
- void *sel, \n\
- int is_stret, \n\
- int is_super, \n\
- int is_super2, \n\
- int is_fixup, \n\
- int is_fixed, \n\
- int debug) \n\
-{ \n\
- struct __lldb_imp_return_struct \n\
- { \n\
- void *class_addr; \n\
- void *sel_addr; \n\
- void *impl_addr; \n\
- }; \n\
- \n\
- struct __lldb_objc_class { \n\
- void *isa; \n\
- void *super_ptr; \n\
- }; \n\
- struct __lldb_objc_super { \n\
- void *reciever; \n\
- struct __lldb_objc_class *class_ptr; \n\
- }; \n\
- struct __lldb_msg_ref { \n\
- void *dont_know; \n\
- void *sel; \n\
- }; \n\
- \n\
- struct __lldb_imp_return_struct return_struct; \n\
- \n\
- if (debug) \n\
- printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \" \n\
- \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\
- object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed); \n\
- if (is_super) \n\
- { \n\
- if (is_super2) \n\
- { \n\
- return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr; \n\
- } \n\
- else \n\
- { \n\
- return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr; \n\
- } \n\
- } \n\
- else \n\
- { \n\
- // This code seems a little funny, but has its reasons... \n\
- // The call to [object class] is here because if this is a class, and has not been called into \n\
- // yet, we need to do something to force the class to initialize itself. \n\
- // Then the call to object_getClass will actually return the correct class, either the class \n\
- // if object is a class instance, or the meta-class if it is a class pointer. \n\
- void *class_ptr = (void *) [(id) object class]; \n\
- return_struct.class_addr = (id) object_getClass((id) object); \n\
- if (debug) \n\
- { \n\
- if (class_ptr == object) \n\
- { \n\
- printf (\"Found a class object, need to use the meta class %p -> %p\\n\", \n\
- class_ptr, return_struct.class_addr); \n\
- } \n\
- else \n\
- { \n\
- printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\
- class_ptr, return_struct.class_addr); \n\
- } \n\
- } \n\
- } \n\
- \n\
- if (is_fixup) \n\
- { \n\
- if (is_fixed) \n\
- { \n\
- return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\
- } \n\
- else \n\
- { \n\
- char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\
- return_struct.sel_addr = sel_getUid (sel_name); \n\
- if (debug) \n\
- printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\", \n\
- return_struct.sel_addr, sel_name); \n\
- } \n\
- } \n\
- else \n\
- { \n\
- return_struct.sel_addr = sel; \n\
- } \n\
- \n\
- if (is_stret) \n\
- { \n\
- return_struct.impl_addr = class_getMethodImplementation_stret (return_struct.class_addr, \n\
- return_struct.sel_addr); \n\
- } \n\
- else \n\
- { \n\
- return_struct.impl_addr = class_getMethodImplementation (return_struct.class_addr, \n\
- return_struct.sel_addr); \n\
- } \n\
- if (debug) \n\
- printf (\"\\n*** Returning implementation: %p.\\n\", return_struct.impl_addr); \n\
- \n\
- return return_struct.impl_addr; \n\
-} \n\
+extern \"C\" \n\
+{ \n\
+ extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\
+ extern void *class_getMethodImplementation_stret(void *objc_class, \n\
+ void *sel); \n\
+ extern void * object_getClass (id object); \n\
+ extern void * sel_getUid(char *name); \n\
+ extern int printf(const char *format, ...); \n\
+} \n\
+extern \"C\" void * __lldb_objc_find_implementation_for_selector ( \n\
+ void *object, \n\
+ void *sel, \n\
+ int is_stret, \n\
+ int is_super, \n\
+ int is_super2, \n\
+ int is_fixup, \n\
+ int is_fixed, \n\
+ int debug) \n\
+{ \n\
+ struct __lldb_imp_return_struct \n\
+ { \n\
+ void *class_addr; \n\
+ void *sel_addr; \n\
+ void *impl_addr; \n\
+ }; \n\
+ \n\
+ struct __lldb_objc_class { \n\
+ void *isa; \n\
+ void *super_ptr; \n\
+ }; \n\
+ struct __lldb_objc_super { \n\
+ void *reciever; \n\
+ struct __lldb_objc_class *class_ptr; \n\
+ }; \n\
+ struct __lldb_msg_ref { \n\
+ void *dont_know; \n\
+ void *sel; \n\
+ }; \n\
+ \n\
+ struct __lldb_imp_return_struct return_struct; \n\
+ \n\
+ if (debug) \n\
+ printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \"\n\
+ \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\
+ object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed);\n\
+ if (is_super) \n\
+ { \n\
+ if (is_super2) \n\
+ { \n\
+ return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr;\n\
+ } \n\
+ else \n\
+ { \n\
+ return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr;\n\
+ } \n\
+ } \n\
+ else \n\
+ { \n\
+ // This code seems a little funny, but has its reasons... \n\
+ \n\
+ // The call to [object class] is here because if this is a \n\
+ // class, and has not been called into yet, we need to do \n\
+ // something to force the class to initialize itself. \n\
+ // Then the call to object_getClass will actually return the \n\
+ // correct class, either the class if object is a class \n\
+ // instance, or the meta-class if it is a class pointer. \n\
+ void *class_ptr = (void *) [(id) object class]; \n\
+ return_struct.class_addr = (id) object_getClass((id) object); \n\
+ if (debug) \n\
+ { \n\
+ if (class_ptr == object) \n\
+ { \n\
+ printf (\"Found a class object, need to use the meta class %p -> %p\\n\",\n\
+ class_ptr, return_struct.class_addr); \n\
+ } \n\
+ else \n\
+ { \n\
+ printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\
+ class_ptr, return_struct.class_addr); \n\
+ } \n\
+ } \n\
+ } \n\
+ \n\
+ if (is_fixup) \n\
+ { \n\
+ if (is_fixed) \n\
+ { \n\
+ return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\
+ } \n\
+ else \n\
+ { \n\
+ char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\
+ return_struct.sel_addr = sel_getUid (sel_name); \n\
+ if (debug) \n\
+ printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\",\n\
+ return_struct.sel_addr, sel_name); \n\
+ } \n\
+ } \n\
+ else \n\
+ { \n\
+ return_struct.sel_addr = sel; \n\
+ } \n\
+ \n\
+ if (is_stret) \n\
+ { \n\
+ return_struct.impl_addr = \n\
+ class_getMethodImplementation_stret (return_struct.class_addr, \n\
+ return_struct.sel_addr); \n\
+ } \n\
+ else \n\
+ { \n\
+ return_struct.impl_addr = \n\
+ class_getMethodImplementation (return_struct.class_addr, \n\
+ return_struct.sel_addr); \n\
+ } \n\
+ if (debug) \n\
+ printf (\"\\n*** Returning implementation: %p.\\n\", \n\
+ return_struct.impl_addr); \n\
+ \n\
+ return return_struct.impl_addr; \n\
+} \n\
";
const char *
AppleObjCTrampolineHandler::g_lookup_implementation_no_stret_function_code =
" \n\
-extern \"C\" \n\
-{ \n\
- extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\
- extern void * object_getClass (id object); \n\
- extern void * sel_getUid(char *name); \n\
- extern int printf(const char *format, ...); \n\
-} \n\
+extern \"C\" \n\
+{ \n\
+ extern void *class_getMethodImplementation(void *objc_class, void *sel); \n\
+ extern void * object_getClass (id object); \n\
+ extern void * sel_getUid(char *name); \n\
+ extern int printf(const char *format, ...); \n\
+} \n\
extern \"C\" void * __lldb_objc_find_implementation_for_selector (void *object, \n\
- void *sel, \n\
- int is_stret, \n\
- int is_super, \n\
- int is_super2, \n\
- int is_fixup, \n\
- int is_fixed, \n\
- int debug) \n\
-{ \n\
- struct __lldb_imp_return_struct \n\
- { \n\
- void *class_addr; \n\
- void *sel_addr; \n\
- void *impl_addr; \n\
- }; \n\
- \n\
- struct __lldb_objc_class { \n\
- void *isa; \n\
- void *super_ptr; \n\
- }; \n\
- struct __lldb_objc_super { \n\
- void *reciever; \n\
- struct __lldb_objc_class *class_ptr; \n\
- }; \n\
- struct __lldb_msg_ref { \n\
- void *dont_know; \n\
- void *sel; \n\
- }; \n\
- \n\
- struct __lldb_imp_return_struct return_struct; \n\
- \n\
- if (debug) \n\
+ void *sel, \n\
+ int is_stret, \n\
+ int is_super, \n\
+ int is_super2, \n\
+ int is_fixup, \n\
+ int is_fixed, \n\
+ int debug) \n\
+{ \n\
+ struct __lldb_imp_return_struct \n\
+ { \n\
+ void *class_addr; \n\
+ void *sel_addr; \n\
+ void *impl_addr; \n\
+ }; \n\
+ \n\
+ struct __lldb_objc_class { \n\
+ void *isa; \n\
+ void *super_ptr; \n\
+ }; \n\
+ struct __lldb_objc_super { \n\
+ void *reciever; \n\
+ struct __lldb_objc_class *class_ptr; \n\
+ }; \n\
+ struct __lldb_msg_ref { \n\
+ void *dont_know; \n\
+ void *sel; \n\
+ }; \n\
+ \n\
+ struct __lldb_imp_return_struct return_struct; \n\
+ \n\
+ if (debug) \n\
printf (\"\\n*** Called with obj: 0x%p sel: 0x%p is_stret: %d is_super: %d, \" \n\
- \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\
+ \"is_super2: %d, is_fixup: %d, is_fixed: %d\\n\", \n\
object, sel, is_stret, is_super, is_super2, is_fixup, is_fixed); \n\
- if (is_super) \n\
- { \n\
- if (is_super2) \n\
- { \n\
+ if (is_super) \n\
+ { \n\
+ if (is_super2) \n\
+ { \n\
return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr->super_ptr; \n\
- } \n\
- else \n\
- { \n\
+ } \n\
+ else \n\
+ { \n\
return_struct.class_addr = ((__lldb_objc_super *) object)->class_ptr; \n\
- } \n\
- } \n\
- else \n\
- { \n\
- // This code seems a little funny, but has its reasons... \n\
+ } \n\
+ } \n\
+ else \n\
+ { \n\
+ // This code seems a little funny, but has its reasons... \n\
// The call to [object class] is here because if this is a class, and has not been called into \n\
// yet, we need to do something to force the class to initialize itself. \n\
// Then the call to object_getClass will actually return the correct class, either the class \n\
// if object is a class instance, or the meta-class if it is a class pointer. \n\
- void *class_ptr = (void *) [(id) object class]; \n\
- return_struct.class_addr = (id) object_getClass((id) object); \n\
- if (debug) \n\
- { \n\
- if (class_ptr == object) \n\
- { \n\
+ void *class_ptr = (void *) [(id) object class]; \n\
+ return_struct.class_addr = (id) object_getClass((id) object); \n\
+ if (debug) \n\
+ { \n\
+ if (class_ptr == object) \n\
+ { \n\
printf (\"Found a class object, need to return the meta class %p -> %p\\n\", \n\
- class_ptr, return_struct.class_addr); \n\
- } \n\
- else \n\
- { \n\
+ class_ptr, return_struct.class_addr); \n\
+ } \n\
+ else \n\
+ { \n\
printf (\"[object class] returned: %p object_getClass: %p.\\n\", \n\
- class_ptr, return_struct.class_addr); \n\
- } \n\
- } \n\
- } \n\
- \n\
- if (is_fixup) \n\
- { \n\
- if (is_fixed) \n\
- { \n\
- return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\
- } \n\
- else \n\
- { \n\
- char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\
- return_struct.sel_addr = sel_getUid (sel_name); \n\
- if (debug) \n\
- printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\", \n\
- return_struct.sel_addr, sel_name); \n\
- } \n\
- } \n\
- else \n\
- { \n\
- return_struct.sel_addr = sel; \n\
- } \n\
- \n\
- return_struct.impl_addr = class_getMethodImplementation (return_struct.class_addr, \n\
- return_struct.sel_addr); \n\
- if (debug) \n\
- printf (\"\\n*** Returning implementation: 0x%p.\\n\", return_struct.impl_addr); \n\
- \n\
- return return_struct.impl_addr; \n\
-} \n\
+ class_ptr, return_struct.class_addr); \n\
+ } \n\
+ } \n\
+ } \n\
+ \n\
+ if (is_fixup) \n\
+ { \n\
+ if (is_fixed) \n\
+ { \n\
+ return_struct.sel_addr = ((__lldb_msg_ref *) sel)->sel; \n\
+ } \n\
+ else \n\
+ { \n\
+ char *sel_name = (char *) ((__lldb_msg_ref *) sel)->sel; \n\
+ return_struct.sel_addr = sel_getUid (sel_name); \n\
+ if (debug) \n\
+ printf (\"\\n*** Got fixed up selector: %p for name %s.\\n\",\n\
+ return_struct.sel_addr, sel_name); \n\
+ } \n\
+ } \n\
+ else \n\
+ { \n\
+ return_struct.sel_addr = sel; \n\
+ } \n\
+ \n\
+ return_struct.impl_addr = \n\
+ class_getMethodImplementation (return_struct.class_addr, \n\
+ return_struct.sel_addr); \n\
+ if (debug) \n\
+ printf (\"\\n*** Returning implementation: 0x%p.\\n\", \n\
+ return_struct.impl_addr); \n\
+ \n\
+ return return_struct.impl_addr; \n\
+} \n\
";
AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion(
@@ -328,12 +338,11 @@ void AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion() {
// uint32_t offset
// uint32_t flags
//
- // Where offset is either 0 - in which case it is unused, or
- // it is the offset of the vtable code from the beginning of the descriptor
- // record.
- // Below, we'll convert that into an absolute code address, since I don't want
- // to have
- // to compute it over and over.
+ // Where offset is either 0 - in which case it is unused, or it is
+ // the offset of the vtable code from the beginning of the
+ // descriptor record. Below, we'll convert that into an absolute
+ // code address, since I don't want to have to compute it over and
+ // over.
// Ingest the whole descriptor array:
const lldb::addr_t desc_ptr = m_header_addr + header_size;
@@ -370,10 +379,9 @@ void AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion() {
offset = start_offset + descriptor_size;
}
- // Finally, a little bird told me that all the vtable code blocks are the same
- // size.
- // Let's compute the blocks and if they are all the same add the size to the
- // code end address:
+ // Finally, a little bird told me that all the vtable code blocks
+ // are the same size. Let's compute the blocks and if they are all
+ // the same add the size to the code end address:
lldb::addr_t code_size = 0;
bool all_the_same = true;
for (size_t i = 0; i < num_descriptors - 1; i++) {
@@ -548,9 +556,8 @@ bool AppleObjCTrampolineHandler::AppleObjCVTables::RefreshTrampolines(
}
bool AppleObjCTrampolineHandler::AppleObjCVTables::ReadRegions() {
- // The no argument version reads the start region from the value of the
- // gdb_regions_header, and
- // gets started from there.
+ // The no argument version reads the start region from the value of
+ // the gdb_regions_header, and gets started from there.
m_regions.clear();
if (!InitializeVTableSymbols())
@@ -718,13 +725,12 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
g_lookup_implementation_with_stret_function_code;
}
- // Look up the addresses for the objc dispatch functions and cache them. For
- // now I'm inspecting the symbol
- // names dynamically to figure out how to dispatch to them. If it becomes
- // more complicated than this we can
- // turn the g_dispatch_functions char * array into a template table, and
- // populate the DispatchFunction map
- // from there.
+ // Look up the addresses for the objc dispatch functions and cache
+ // them. For now I'm inspecting the symbol names dynamically to
+ // figure out how to dispatch to them. If it becomes more
+ // complicated than this we can turn the g_dispatch_functions char *
+ // array into a template table, and populate the DispatchFunction
+ // map from there.
for (size_t i = 0; i != llvm::array_lengthof(g_dispatch_functions); i++) {
ConstString name_const_str(g_dispatch_functions[i].name);
@@ -732,11 +738,11 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler(
m_objc_module_sp->FindFirstSymbolWithNameAndType(name_const_str,
eSymbolTypeCode);
if (msgSend_symbol && msgSend_symbol->ValueIsAddress()) {
- // FixMe: Make g_dispatch_functions static table of DispatchFunctions, and
- // have the map be address->index.
- // Problem is we also need to lookup the dispatch function. For now we
- // could have a side table of stret & non-stret
- // dispatch functions. If that's as complex as it gets, we're fine.
+ // FIXME: Make g_dispatch_functions static table of
+ // DispatchFunctions, and have the map be address->index.
+ // Problem is we also need to lookup the dispatch function. For
+ // now we could have a side table of stret & non-stret dispatch
+ // functions. If that's as complex as it gets, we're fine.
lldb::addr_t sym_addr =
msgSend_symbol->GetAddressRef().GetOpcodeLoadAddress(target);
@@ -820,11 +826,11 @@ AppleObjCTrampolineHandler::SetupDispatchFunction(Thread &thread,
diagnostics.Clear();
- // Now write down the argument values for this particular call. This looks
- // like it might be a race condition
- // if other threads were calling into here, but actually it isn't because we
- // allocate a new args structure for
- // this call by passing args_addr = LLDB_INVALID_ADDRESS...
+ // Now write down the argument values for this particular call.
+ // This looks like it might be a race condition if other threads
+ // were calling into here, but actually it isn't because we allocate
+ // a new args structure for this call by passing args_addr =
+ // LLDB_INVALID_ADDRESS...
if (!impl_function_caller->WriteFunctionArguments(
exe_ctx, args_addr, dispatch_values, diagnostics)) {
@@ -847,9 +853,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
DispatchFunction this_dispatch;
bool found_it = false;
- // First step is to look and see if we are in one of the known ObjC dispatch
- // functions. We've already compiled
- // a table of same, so consult it.
+ // First step is to look and see if we are in one of the known ObjC
+ // dispatch functions. We've already compiled a table of same, so
+ // consult it.
MsgsendMap::iterator pos;
pos = m_msgSend_map.find(curr_pc);
@@ -879,8 +885,8 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
if (found_it) {
Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_STEP));
- // We are decoding a method dispatch.
- // First job is to pull the arguments out:
+ // We are decoding a method dispatch. First job is to pull the
+ // arguments out:
lldb::StackFrameSP thread_cur_frame = thread.GetStackFrameAtIndex(0);
@@ -906,10 +912,10 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
int obj_index;
int sel_index;
- // If this is a struct return dispatch, then the first argument is the
- // return struct pointer, and the object is the second, and the selector is
- // the third.
- // Otherwise the object is the first and the selector the second.
+ // If this is a struct return dispatch, then the first argument is
+ // the return struct pointer, and the object is the second, and
+ // the selector is the third. Otherwise the object is the first
+ // and the selector the second.
if (this_dispatch.stret_return) {
obj_index = 1;
sel_index = 2;
@@ -938,29 +944,26 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
ExecutionContext exe_ctx(thread.shared_from_this());
Process *process = exe_ctx.GetProcessPtr();
- // isa_addr will store the class pointer that the method is being dispatched
- // to - so either the class
- // directly or the super class if this is one of the objc_msgSendSuper
- // flavors. That's mostly used to
- // look up the class/selector pair in our cache.
+ // isa_addr will store the class pointer that the method is being
+ // dispatched to - so either the class directly or the super class
+ // if this is one of the objc_msgSendSuper flavors. That's mostly
+ // used to look up the class/selector pair in our cache.
lldb::addr_t isa_addr = LLDB_INVALID_ADDRESS;
lldb::addr_t sel_addr =
argument_values.GetValueAtIndex(sel_index)->GetScalar().ULongLong();
- // Figure out the class this is being dispatched to and see if we've already
- // cached this method call,
- // If so we can push a run-to-address plan directly. Otherwise we have to
- // figure out where
- // the implementation lives.
+ // Figure out the class this is being dispatched to and see if
+ // we've already cached this method call, If so we can push a
+ // run-to-address plan directly. Otherwise we have to figure out
+ // where the implementation lives.
if (this_dispatch.is_super) {
if (this_dispatch.is_super2) {
- // In the objc_msgSendSuper2 case, we don't get the object directly, we
- // get a structure containing
- // the object and the class to which the super message is being sent.
- // So we need to dig the super
- // out of the class and use that.
+ // In the objc_msgSendSuper2 case, we don't get the object
+ // directly, we get a structure containing the object and the
+ // class to which the super message is being sent. So we need
+ // to dig the super out of the class and use that.
Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
super_value.GetScalar() += process->GetAddressByteSize();
@@ -984,11 +987,11 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
log->Printf("Failed to extract the class value from objc_super.");
}
} else {
- // In the objc_msgSendSuper case, we don't get the object directly, we
- // get a two element structure containing
- // the object and the super class to which the super message is being
- // sent. So the class we want is
- // the second element of this structure.
+ // In the objc_msgSendSuper case, we don't get the object
+ // directly, we get a two element structure containing the
+ // object and the super class to which the super message is
+ // being sent. So the class we want is the second element of
+ // this structure.
Value super_value(*(argument_values.GetValueAtIndex(obj_index)));
super_value.GetScalar() += process->GetAddressByteSize();
@@ -1009,9 +1012,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
// making the object value a load address value and resolving it will get
// the pointer sized data pointed to by that value...
- // Note, it isn't a fatal error not to be able to get the address from the
- // object, since this might
- // be a "tagged pointer" which isn't a real object, but rather some word
+ // Note, it isn't a fatal error not to be able to get the
+ // address from the object, since this might be a "tagged
+ // pointer" which isn't a real object, but rather some word
// length encoded dingus.
Value isa_value(*(argument_values.GetValueAtIndex(obj_index)));
@@ -1126,9 +1129,9 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan(Thread &thread,
flag_value.GetScalar() = 0; // FIXME - Set to 0 when debugging is done.
dispatch_values.PushValue(flag_value);
- // The step through code might have to fill in the cache, so it is not
- // safe to run only one thread.
- // So we override the stop_others value passed in to us here:
+ // The step through code might have to fill in the cache, so it
+ // is not safe to run only one thread. So we override the
+ // stop_others value passed in to us here:
const bool trampoline_stop_others = false;
ret_plan_sp.reset(new AppleThreadPlanStepThroughObjCTrampoline(
thread, this, dispatch_values, isa_addr, sel_addr,
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
index 316115b0dcb..9bb1a4e0ee4 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp
@@ -105,10 +105,9 @@ clang::QualType AppleObjCTypeEncodingParser::BuildAggregate(
return clang::QualType();
std::string name(ReadStructName(type));
- // We do not handle templated classes/structs at the moment.
- // If the name has a < in it, we are going to abandon this.
- // We're still obliged to parse it, so we just set a flag that
- // means "Don't actually build anything."
+ // We do not handle templated classes/structs at the moment. If the name has
+ // a < in it, we are going to abandon this. We're still obliged to parse it,
+ // so we just set a flag that means "Don't actually build anything."
const bool is_templated = name.find('<') != std::string::npos;
@@ -180,11 +179,9 @@ AppleObjCTypeEncodingParser::BuildArray(clang::ASTContext &ast_ctx,
// the runtime can emit these in the form of @"SomeType", giving more specifics
// this would be interesting for expression parser interop, but since we
-// actually try
-// to avoid exposing the ivar info to the expression evaluator, consume but
-// ignore the type info
-// and always return an 'id'; if anything, dynamic typing will resolve things
-// for us anyway
+// actually try to avoid exposing the ivar info to the expression evaluator,
+// 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) {
@@ -197,24 +194,21 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
// We have to be careful here. We're used to seeing
// @"NSString"
// but in records it is possible that the string following an @ is the name
- // of the next field and @ means "id".
- // This is the case if anything unquoted except for "}", the end of the
- // type, or another name follows the quoted string.
+ // of the next field and @ means "id". This is the case if anything
+ // unquoted except for "}", the end of the type, or another name follows
+ // the quoted string.
//
// E.g.
// - @"NSString"@ means "id, followed by a field named NSString of type id"
- // - @"NSString"} means "a pointer to NSString and the end of the struct"
- // - @"NSString""nextField" means "a pointer to NSString and a field named
- // nextField"
- // - @"NSString" followed by the end of the string means "a pointer to
- // NSString"
+ // - @"NSString"} means "a pointer to NSString and the end of the struct" -
+ // @"NSString""nextField" means "a pointer to NSString and a field named
+ // nextField" - @"NSString" followed by the end of the string means "a
+ // pointer to NSString"
//
// As a result, the rule is: If we see @ followed by a quoted string, we
- // peek.
- // - If we see }, ), ], the end of the string, or a quote ("), the quoted
- // string is a class name.
- // - If we see anything else, the quoted string is a field name and we push
- // it back onto type.
+ // peek. - If we see }, ), ], the end of the string, or a quote ("), the
+ // quoted string is a class name. - If we see anything else, the quoted
+ // string is a field name and we push it back onto type.
name = ReadQuotedString(type);
@@ -260,9 +254,8 @@ clang::QualType AppleObjCTypeEncodingParser::BuildObjCObjectPointerType(
decl_vendor->FindDecls(ConstString(name), append, max_matches, decls);
// The user can forward-declare something that has no definition. The runtime
-// doesn't prohibit this at all.
-// This is a rare and very weird case. We keep this assert in debug builds so
-// we catch other weird cases.
+// doesn't prohibit this at all. This is a rare and very weird case. We keep
+// this assert in debug builds so we catch other weird cases.
#ifdef LLDB_CONFIGURATION_DEBUG
assert(num_types);
#else
@@ -315,8 +308,8 @@ AppleObjCTypeEncodingParser::BuildType(clang::ASTContext &ast_ctx,
// if (!lldb_ctx)
// return clang::QualType();
// return lldb_ctx->GetIntTypeFromBitSize(32, true).GetQualType();
- // which uses one of the constants if one is available, but we don't think all
- // this work is necessary.
+ // which uses one of the constants if one is available, but we don't think
+ // all this work is necessary.
case 'q':
return ast_ctx.LongLongTy;
case 'C':
@@ -364,11 +357,10 @@ AppleObjCTypeEncodingParser::BuildType(clang::ASTContext &ast_ctx,
case '^': {
if (!for_expression && type.NextIf('?')) {
// if we are not supporting the concept of unknownAny, but what is being
- // created here is an unknownAny*, then
- // we can just get away with a void*
+ // created here is an unknownAny*, then we can just get away with a void*
// this is theoretically wrong (in the same sense as 'theoretically
- // nothing exists') but is way better than outright failure
- // in many practical cases
+ // nothing exists') but is way better than outright failure in many
+ // practical cases
return ast_ctx.VoidPtrTy;
} else {
clang::QualType target_type = BuildType(ast_ctx, type, for_expression);
diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
index a295d1b4ce7..75b67073942 100644
--- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp
@@ -52,8 +52,8 @@ AppleThreadPlanStepThroughObjCTrampoline::
void AppleThreadPlanStepThroughObjCTrampoline::DidPush() {
// Setting up the memory space for the called function text might require
- // allocations,
- // i.e. a nested function call. This needs to be done as a PreResumeAction.
+ // allocations, i.e. a nested function call. This needs to be done as a
+ // PreResumeAction.
m_thread.GetProcess()->AddPreResumeAction(PreResumeInitializeFunctionCaller,
(void *)this);
}
@@ -110,8 +110,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::DoPlanExplainsStop(
Event *event_ptr) {
// If we get asked to explain the stop it will be because something went
// wrong (like the implementation for selector function crashed... We're
- // going
- // to figure out what to do about that, so we do explain the stop.
+ // going to figure out what to do about that, so we do explain the stop.
return true;
}
@@ -135,8 +134,7 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
}
// Second stage, if all went well with the function calling, then fetch the
- // target address, and
- // queue up a "run to that address" plan.
+ // target address, and queue up a "run to that address" plan.
if (!m_run_to_sp) {
Value target_addr_value;
ExecutionContext exc_ctx;
@@ -201,8 +199,8 @@ bool AppleThreadPlanStepThroughObjCTrampoline::ShouldStop(Event *event_ptr) {
return false;
}
-// The base class MischiefManaged does some cleanup - so you have to call it
-// in your MischiefManaged derived class.
+// The base class MischiefManaged does some cleanup - so you have to call it in
+// your MischiefManaged derived class.
bool AppleThreadPlanStepThroughObjCTrampoline::MischiefManaged() {
if (IsPlanComplete())
return true;
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
index 654ac9abfca..cbbc35f1c08 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp
@@ -38,14 +38,12 @@ using namespace lldb_renderscript;
// [``slang``](https://android.googlesource.com/platform/frameworks/compile/slang),
// the compiler frontend for RenderScript embeds an ARM specific triple in IR
-// that is shipped in the app, after
-// generating IR that has some assumptions that an ARM device is the target.
-// As the IR is then compiled on a device of unknown (at time the IR was
-// generated at least) architecture,
-// when calling RenderScript API function as part of debugger expressions, we
-// have to perform a fixup pass that
-// removes those assumptions right before the module is sent to be generated by
-// the llvm backend.
+// that is shipped in the app, after generating IR that has some assumptions
+// that an ARM device is the target. As the IR is then compiled on a device of
+// unknown (at time the IR was generated at least) architecture, when calling
+// RenderScript API function as part of debugger expressions, we have to
+// perform a fixup pass that removes those assumptions right before the module
+// is sent to be generated by the llvm backend.
namespace {
bool registerRSDefaultTargetOpts(clang::TargetOptions &proto,
@@ -107,10 +105,9 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
case llvm::Triple::ArchType::x86:
changed_module |= fixupX86FunctionCalls(module);
// For some reason this triple gets totally missed by the backend, and must
- // be set manually.
- // There a reference in bcc/Main.cpp about auto feature-detection being
- // removed from LLVM3.5, but I can't
- // see that discussion anywhere public.
+ // be set manually. There a reference in bcc/Main.cpp about auto feature-
+ // detection being removed from LLVM3.5, but I can't see that discussion
+ // anywhere public.
real_triple = "i686--linux-android";
break;
case llvm::Triple::ArchType::x86_64:
@@ -118,12 +115,12 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
break;
case llvm::Triple::ArchType::mipsel:
case llvm::Triple::ArchType::mips64el:
- // No actual IR fixup pass is needed on MIPS, but the datalayout
- // and targetmachine do need to be explicitly set.
+ // No actual IR fixup pass is needed on MIPS, but the datalayout and
+ // targetmachine do need to be explicitly set.
- // bcc explicitly compiles MIPS code to use the static relocation
- // model due to an issue with relocations in mclinker.
- // see libbcc/support/CompilerConfig.cpp for details
+ // bcc explicitly compiles MIPS code to use the static relocation model due
+ // to an issue with relocations in mclinker. see
+ // libbcc/support/CompilerConfig.cpp for details
reloc_model = llvm::Reloc::Static;
changed_module = true;
break;
@@ -146,8 +143,7 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {
assert(target_machine &&
"failed to identify RenderScriptRuntime target machine");
// We've been using a triple and datalayout of some ARM variant all along,
- // so
- // we need to let the backend know that this is no longer the case.
+ // so we need to let the backend know that this is no longer the case.
if (log) {
log->Printf("%s - Changing RS target triple to '%s'", __FUNCTION__,
real_triple.str().c_str());
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
index a9707fae072..4ab1510d2c7 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp
@@ -312,7 +312,8 @@ bool GetArgsMipsel(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {
Status err;
- // find offset to arguments on the stack (+16 to skip over a0-a3 shadow space)
+ // find offset to arguments on the stack (+16 to skip over a0-a3 shadow
+ // space)
uint64_t sp = ctx.reg_ctx->GetSP() + 16;
for (size_t i = 0; i < num_args; ++i) {
@@ -447,12 +448,11 @@ bool IsRenderScriptScriptModule(ModuleSP module) {
}
bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) {
- // takes an argument of the form 'num[,num][,num]'.
- // Where 'coord_s' is a comma separated 1,2 or 3-dimensional coordinate
- // with the whitespace trimmed.
- // Missing coordinates are defaulted to zero.
- // If parsing of any elements fails the contents of &coord are undefined
- // and `false` is returned, `true` otherwise
+ // takes an argument of the form 'num[,num][,num]'. Where 'coord_s' is a
+ // comma separated 1,2 or 3-dimensional coordinate with the whitespace
+ // trimmed. Missing coordinates are defaulted to zero. If parsing of any
+ // elements fails the contents of &coord are undefined and `false` is
+ // returned, `true` otherwise
RegularExpression regex;
RegularExpression::Match regex_match(3);
@@ -633,8 +633,9 @@ struct RenderScriptRuntime::AllocationDetails {
// subelements, there may be more than one instance of the ElementHeader
// struct. With this first instance being the root element, and the other
// instances being the root's descendants. To identify which instances are an
- // ElementHeader's children, each struct is immediately followed by a sequence
- // of consecutive offsets to the start of its child structs. These offsets are
+ // ElementHeader's children, each struct is immediately followed by a
+ // sequence of consecutive offsets to the start of its child structs. These
+ // offsets are
// 4 bytes in size, and the 0 offset signifies no more children.
struct FileHeader {
uint8_t ident[4]; // ASCII 'RSAD' identifying the file
@@ -653,8 +654,8 @@ struct RenderScriptRuntime::AllocationDetails {
// Monotonically increasing from 1
static uint32_t ID;
- // Maps Allocation DataType enum and vector size to printable strings
- // using mapping from RenderScript numerical types summary documentation
+ // Maps Allocation DataType enum and vector size to printable strings using
+ // mapping from RenderScript numerical types summary documentation
static const char *RsDataTypeToString[][4];
// Maps Allocation DataKind enum to printable strings
@@ -844,11 +845,10 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,
lldb_private::SymbolContext &context,
Address *, bool) {
// We need to have access to the list of reductions currently parsed, as
- // reduce names don't actually exist as
- // symbols in a module. They are only identifiable by parsing the .rs.info
- // packet, or finding the expand symbol. We
- // therefore need access to the list of parsed rs modules to properly resolve
- // reduction names.
+ // reduce names don't actually exist as symbols in a module. They are only
+ // identifiable by parsing the .rs.info packet, or finding the expand symbol.
+ // We therefore need access to the list of parsed rs modules to properly
+ // resolve reduction names.
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS));
ModuleSP module = context.module_sp;
@@ -967,8 +967,8 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(
log->Printf("%s: Placed %sbreakpoint on %s", __FUNCTION__,
new_bp ? "new " : "", k.m_name.AsCString());
- // exit after placing the first breakpoint if we do not intend to stop
- // on all kernels making up this script group
+ // exit after placing the first breakpoint if we do not intend to stop on
+ // all kernels making up this script group
if (!m_stop_on_all)
break;
}
@@ -1684,8 +1684,8 @@ void RenderScriptRuntime::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) {
const ModuleSP module = rsmodule_sp->m_module;
const FileSpec &file = module->GetPlatformFileSpec();
- // Iterate over all of the scripts that we currently know of.
- // Note: We cant push or pop to m_scripts here or it may invalidate rs_script.
+ // Iterate over all of the scripts that we currently know of. Note: We cant
+ // push or pop to m_scripts here or it may invalidate rs_script.
for (const auto &rs_script : m_scripts) {
// Extract the expected .so file path for this script.
std::string shared_lib;
@@ -1825,9 +1825,9 @@ const char *JITTemplate(ExpressionStrings e) {
// rsaTypeGetNativeData(Context*, Type*, void* typeData, size) Pack the
// data in the following way mHal.state.dimX; mHal.state.dimY;
- // mHal.state.dimZ; mHal.state.lodCount; mHal.state.faces; mElement; into
- // typeData Need to specify 32 or 64 bit for uint_t since this differs
- // between devices
+ // mHal.state.dimZ; mHal.state.lodCount; mHal.state.faces; mElement;
+ // into typeData Need to specify 32 or 64 bit for uint_t since this
+ // differs between devices
JIT_TEMPLATE_CONTEXT
"uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(ctxt"
", 0x%" PRIx64 ", data, 6); data[0]", // eExprTypeDimX
@@ -1882,10 +1882,10 @@ const char *JITTemplate(ExpressionStrings e) {
}
} // end of the anonymous namespace
-// JITs the RS runtime for the internal data pointer of an allocation. Is passed
-// x,y,z coordinates for the pointer to a specific element. Then sets the
-// data_ptr member in Allocation with the result. Returns true on success, false
-// otherwise
+// JITs the RS runtime for the internal data pointer of an allocation. Is
+// passed x,y,z coordinates for the pointer to a specific element. Then sets
+// the data_ptr member in Allocation with the result. Returns true on success,
+// false otherwise
bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc,
StackFrame *frame_ptr, uint32_t x,
uint32_t y, uint32_t z) {
@@ -1961,8 +1961,8 @@ bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc,
}
// JITs the RS runtime for information about the dimensions and type of an
-// allocation Then sets dimension and element_ptr members in Allocation with the
-// result. Returns true on success, false otherwise
+// allocation Then sets dimension and element_ptr members in Allocation with
+// the result. Returns true on success, false otherwise
bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,
StackFrame *frame_ptr) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
@@ -2245,9 +2245,8 @@ bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc,
}
// JITs the RS runtime for information about the stride between rows in the
-// allocation. This is done to detect padding, since allocated memory is 16-byte
-// aligned.
-// Returns true on success, false otherwise
+// allocation. This is done to detect padding, since allocated memory is
+// 16-byte aligned. Returns true on success, false otherwise
bool RenderScriptRuntime::JITAllocationStride(AllocationDetails *alloc,
StackFrame *frame_ptr) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
@@ -2313,9 +2312,8 @@ bool RenderScriptRuntime::RefreshAllocation(AllocationDetails *alloc,
}
// Function attempts to set the type_name member of the paramaterised Element
-// object.
-// This string should be the name of the struct type the Element represents.
-// We need this string for pretty printing the Element to users.
+// object. This string should be the name of the struct type the Element
+// represents. We need this string for pretty printing the Element to users.
void RenderScriptRuntime::FindStructTypeName(Element &elem,
StackFrame *frame_ptr) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
@@ -2333,9 +2331,8 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,
RegularExpression(llvm::StringRef(".")), true, UINT32_MAX, var_list);
// Iterate over all the global variables looking for one with a matching type
- // to the Element.
- // We make the assumption a match exists since there needs to be a global
- // variable to reflect the struct type back into java host code.
+ // to the Element. We make the assumption a match exists since there needs to
+ // be a global variable to reflect the struct type back into java host code.
for (uint32_t i = 0; i < var_list.GetSize(); ++i) {
const VariableSP var_sp(var_list.GetVariableAtIndex(i));
if (!var_sp)
@@ -2347,15 +2344,14 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,
// Find the number of variable fields.
// If it has no fields, or more fields than our Element, then it can't be
- // the struct we're looking for.
- // Don't check for equality since RS can add extra struct members for
- // padding.
+ // the struct we're looking for. Don't check for equality since RS can add
+ // extra struct members for padding.
size_t num_children = valobj_sp->GetNumChildren();
if (num_children > elem.children.size() || num_children == 0)
continue;
- // Iterate over children looking for members with matching field names.
- // If all the field names match, this is likely the struct we want.
+ // Iterate over children looking for members with matching field names. If
+ // all the field names match, this is likely the struct we want.
// TODO: This could be made more robust by also checking children data
// sizes, or array size
bool found = true;
@@ -2404,8 +2400,8 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,
}
// Function sets the datum_size member of Element. Representing the size of a
-// single instance including padding.
-// Assumes the relevant allocation information has already been jitted.
+// single instance including padding. Assumes the relevant allocation
+// information has already been jitted.
void RenderScriptRuntime::SetElementSize(Element &elem) {
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
const Element::DataType type = *elem.type.get();
@@ -2446,9 +2442,9 @@ void RenderScriptRuntime::SetElementSize(Element &elem) {
data_size + padding);
}
-// Given an allocation, this function copies the allocation contents from device
-// into a buffer on the heap.
-// Returning a shared pointer to the buffer containing the data.
+// Given an allocation, this function copies the allocation contents from
+// device into a buffer on the heap. Returning a shared pointer to the buffer
+// containing the data.
std::shared_ptr<uint8_t>
RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,
StackFrame *frame_ptr) {
@@ -2496,9 +2492,8 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,
return buffer;
}
-// Function copies data from a binary file into an allocation.
-// There is a header at the start of the file, FileHeader, before the data
-// content itself.
+// Function copies data from a binary file into an allocation. There is a
+// header at the start of the file, FileHeader, before the data content itself.
// Information from this header is used to display warnings to the user about
// incompatibilities
bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
@@ -2630,7 +2625,8 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
// Calculate size of allocation data in file
size_t size = data_sp->GetByteSize() - file_header->hdr_size;
- // Check if the target allocation and file both have the same total data size.
+ // Check if the target allocation and file both have the same total data
+ // size.
const uint32_t alloc_size = *alloc->size.get();
if (alloc_size != size) {
strm.Printf("Warning: Mismatched allocation sizes - file 0x%" PRIx64
@@ -2660,15 +2656,15 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,
// Function takes as parameters a byte buffer, which will eventually be written
// to file as the element header, an offset into that buffer, and an Element
-// that will be saved into the buffer at the parametrised offset.
-// Return value is the new offset after writing the element into the buffer.
-// Elements are saved to the file as the ElementHeader struct followed by
-// offsets to the structs of all the element's children.
+// that will be saved into the buffer at the parametrised offset. Return value
+// is the new offset after writing the element into the buffer. Elements are
+// saved to the file as the ElementHeader struct followed by offsets to the
+// structs of all the element's children.
size_t RenderScriptRuntime::PopulateElementHeaders(
const std::shared_ptr<uint8_t> header_buffer, size_t offset,
const Element &elem) {
- // File struct for an element header with all the relevant details copied from
- // elem. We assume members are valid already.
+ // File struct for an element header with all the relevant details copied
+ // from elem. We assume members are valid already.
AllocationDetails::ElementHeader elem_header;
elem_header.type = *elem.type.get();
elem_header.kind = *elem.type_kind.get();
@@ -2678,9 +2674,8 @@ size_t RenderScriptRuntime::PopulateElementHeaders(
elem.array_size.isValid() ? *elem.array_size.get() : 0;
const size_t elem_header_size = sizeof(AllocationDetails::ElementHeader);
- // Copy struct into buffer and advance offset
- // We assume that header_buffer has been checked for nullptr before this
- // method is called
+ // Copy struct into buffer and advance offset We assume that header_buffer
+ // has been checked for nullptr before this method is called
memcpy(header_buffer.get() + offset, &elem_header, elem_header_size);
offset += elem_header_size;
@@ -2721,8 +2716,8 @@ size_t RenderScriptRuntime::CalculateElementHeaderSize(const Element &elem) {
return size;
}
-// Function copies allocation contents into a binary file. This file can then be
-// loaded later into a different allocation. There is a header, FileHeader,
+// Function copies allocation contents into a binary file. This file can then
+// be loaded later into a different allocation. There is a header, FileHeader,
// before the allocation data containing meta-data.
bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,
const char *path,
@@ -2852,8 +2847,8 @@ bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) {
if (module_sp) {
for (const auto &rs_module : m_rsmodules) {
if (rs_module->m_module == module_sp) {
- // Check if the user has enabled automatically breaking on
- // all RS kernels.
+ // Check if the user has enabled automatically breaking on all RS
+ // kernels.
if (m_breakAllKernels)
BreakOnModuleKernels(rs_module);
@@ -2975,11 +2970,10 @@ bool RSModuleDescriptor::ParseExportReduceCount(llvm::StringRef *lines,
size_t n_lines) {
// The list of reduction kernels in the `.rs.info` symbol is of the form
// "signature - accumulatordatasize - reduction_name - initializer_name -
- // accumulator_name - combiner_name -
- // outconverter_name - halter_name"
- // Where a function is not explicitly named by the user, or is not generated
- // by the compiler, it is named "." so the
- // dash separated list should always be 8 items long
+ // accumulator_name - combiner_name - outconverter_name - halter_name" Where
+ // a function is not explicitly named by the user, or is not generated by the
+ // compiler, it is named "." so the dash separated list should always be 8
+ // items long
Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE);
// Skip the exportReduceCount line
++lines;
@@ -3069,8 +3063,7 @@ bool RSModuleDescriptor::ParseExportVarCount(llvm::StringRef *lines,
}
// The .rs.info symbol in renderscript modules contains a string which needs to
-// be parsed.
-// The string is basic and is parsed on a line by line basis.
+// be parsed. The string is basic and is parsed on a line by line basis.
bool RSModuleDescriptor::ParseRSInfo() {
assert(m_module);
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));
@@ -3137,8 +3130,8 @@ bool RSModuleDescriptor::ParseRSInfo() {
const auto handler = rs_info_handler(key);
if (handler == -1)
continue;
- // getAsInteger returns `true` on an error condition - we're only interested
- // in numeric fields at the moment
+ // getAsInteger returns `true` on an error condition - we're only
+ // interested in numeric fields at the moment
uint64_t n_lines;
if (val.getAsInteger(10, n_lines)) {
LLDB_LOGV(log, "Failed to parse non-numeric '.rs.info' section {0}",
@@ -3213,9 +3206,8 @@ void RenderScriptRuntime::DumpContexts(Stream &strm) const {
std::map<addr_t, uint64_t> contextReferences;
- // Iterate over all of the currently discovered scripts.
- // Note: We cant push or pop from m_scripts inside this loop or it may
- // invalidate script.
+ // Iterate over all of the currently discovered scripts. Note: We cant push
+ // or pop from m_scripts inside this loop or it may invalidate script.
for (const auto &script : m_scripts) {
if (!script->context.isValid())
continue;
@@ -3393,15 +3385,15 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,
if ((type == Element::RS_TYPE_NONE) &&
(alloc->element.children.size() > 0) &&
(alloc->element.type_name != Element::GetFallbackStructName())) {
- // Here we are dumping an Element of struct type.
- // This is done using expression evaluation with the name of the
- // struct type and pointer to element.
- // Don't print the name of the resulting expression, since this will
- // be '$[0-9]+'
+ // Here we are dumping an Element of struct type. This is done using
+ // expression evaluation with the name of the struct type and pointer
+ // to element. Don't print the name of the resulting expression,
+ // since this will be '$[0-9]+'
DumpValueObjectOptions expr_options;
expr_options.SetHideName(true);
- // Setup expression as derefrencing a pointer cast to element address.
+ // Setup expression as derefrencing a pointer cast to element
+ // address.
char expr_char_buffer[jit_max_expr_size];
int written =
snprintf(expr_char_buffer, jit_max_expr_size, "*(%s*) 0x%" PRIx64,
@@ -3435,9 +3427,9 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,
return true;
}
-// Function recalculates all our cached information about allocations by jitting
-// the RS runtime regarding each allocation we know about. Returns true if all
-// allocations could be recomputed, false otherwise.
+// Function recalculates all our cached information about allocations by
+// jitting the RS runtime regarding each allocation we know about. Returns true
+// if all allocations could be recomputed, false otherwise.
bool RenderScriptRuntime::RecomputeAllAllocations(Stream &strm,
StackFrame *frame_ptr) {
bool success = true;
@@ -3601,8 +3593,8 @@ void RenderScriptRuntime::SetBreakAllKernels(bool do_break, TargetSP target) {
}
}
-// Given the name of a kernel this function creates a breakpoint using our
-// own breakpoint resolver, and returns the Breakpoint shared pointer.
+// Given the name of a kernel this function creates a breakpoint using our own
+// breakpoint resolver, and returns the Breakpoint shared pointer.
BreakpointSP
RenderScriptRuntime::CreateKernelBreakpoint(const ConstString &name) {
Log *log(
@@ -3743,8 +3735,8 @@ bool RenderScriptRuntime::GetKernelCoordinate(RSCoordinate &coord,
log->Printf("%s - Found .expand function '%s'", __FUNCTION__,
func_name.GetCString());
- // Get values for variables in .expand frame that tell us the current kernel
- // invocation
+ // Get values for variables in .expand frame that tell us the current
+ // kernel invocation
uint64_t x, y, z;
bool found = GetFrameVarAsUnsigned(frame_sp, x_expr, x) &&
GetFrameVarAsUnsigned(frame_sp, y_expr, y) &&
@@ -3765,12 +3757,11 @@ bool RenderScriptRuntime::GetKernelCoordinate(RSCoordinate &coord,
// Callback when a kernel breakpoint hits and we're looking for a specific
// coordinate. Baton parameter contains a pointer to the target coordinate we
-// want to break on.
-// Function then checks the .expand frame for the current coordinate and breaks
-// to user if it matches.
-// Parameter 'break_id' is the id of the Breakpoint which made the callback.
-// Parameter 'break_loc_id' is the id for the BreakpointLocation which was hit,
-// a single logical breakpoint can have multiple addresses.
+// want to break on. Function then checks the .expand frame for the current
+// coordinate and breaks to user if it matches. Parameter 'break_id' is the id
+// of the Breakpoint which made the callback. Parameter 'break_loc_id' is the
+// id for the BreakpointLocation which was hit, a single logical breakpoint can
+// have multiple addresses.
bool RenderScriptRuntime::KernelBreakpointHit(void *baton,
StoppointCallbackContext *ctx,
user_id_t break_id,
@@ -3845,12 +3836,10 @@ void RenderScriptRuntime::SetConditional(BreakpointSP bp, Stream &messages,
m_conditional_breaks[bp->GetID()] = std::unique_ptr<RSCoordinate>(baton);
}
-// Tries to set a breakpoint on the start of a kernel, resolved using the kernel
-// name. Argument 'coords', represents a three dimensional coordinate which can
-// be
-// used to specify a single kernel instance to break on. If this is set then we
-// add a callback
-// to the breakpoint.
+// Tries to set a breakpoint on the start of a kernel, resolved using the
+// kernel name. Argument 'coords', represents a three dimensional coordinate
+// which can be used to specify a single kernel instance to break on. If this
+// is set then we add a callback to the breakpoint.
bool RenderScriptRuntime::PlaceBreakpointOnKernel(TargetSP target,
Stream &messages,
const char *name,
@@ -4270,8 +4259,8 @@ public:
};
// Matching a comma separated list of known words is fairly
- // straightforward with PCRE, but we're
- // using ERE, so we end up with a little ugliness...
+ // straightforward with PCRE, but we're using ERE, so we end up with a
+ // little ugliness...
RegularExpression::Match match(/* max_matches */ 5);
RegularExpression match_type_list(
llvm::StringRef("^([[:alpha:]]+)(,[[:alpha:]]+){0,4}$"));
diff --git a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
index 439d372fade..1e75126621c 100644
--- a/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
+++ b/lldb/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp
@@ -46,18 +46,15 @@ bool isRSAPICall(llvm::Module &module, llvm::CallInst *call_inst) {
bool isRSLargeReturnCall(llvm::Module &module, llvm::CallInst *call_inst) {
// i686 and x86_64 returns for large vectors in the RenderScript API are not
- // handled as normal
- // register pairs, but as a hidden sret type. This is not reflected in the
- // debug info or mangled
- // symbol name, and the android ABI for x86 and x86_64, (as well as the
- // emulators) specifies there is
- // no AVX, so bcc generates an sret function because we cannot natively return
+ // handled as normal register pairs, but as a hidden sret type. This is not
+ // reflected in the debug info or mangled symbol name, and the android ABI
+ // for x86 and x86_64, (as well as the emulators) specifies there is no AVX,
+ // so bcc generates an sret function because we cannot natively return
// 256 bit vectors.
// This function simply checks whether a function has a > 128bit return type.
- // It is perhaps an
- // unreliable heuristic, and relies on bcc not generating AVX code, so if the
- // android ABI one day
- // provides for AVX, this function may go out of fashion.
+ // It is perhaps an unreliable heuristic, and relies on bcc not generating
+ // AVX code, so if the android ABI one day provides for AVX, this function
+ // may go out of fashion.
(void)module;
if (!call_inst || !call_inst->getCalledFunction())
return false;
@@ -88,12 +85,11 @@ bool isRSAllocationTyCallSite(llvm::Module &module, llvm::CallInst *call_inst) {
llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
// on x86 StructReturn functions return a pointer to the return value, rather
- // than the return
- // value itself [ref](http://www.agner.org/optimize/calling_conventions.pdf
- // section 6).
- // We create a return type by getting the pointer type of the old return type,
- // and inserting a new
- // initial argument of pointer type of the original return type.
+ // than the return value itself
+ // [ref](http://www.agner.org/optimize/calling_conventions.pdf section 6). We
+ // create a return type by getting the pointer type of the old return type,
+ // and inserting a new initial argument of pointer type of the original
+ // return type.
Log *log(
GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_EXPRESSIONS));
@@ -112,8 +108,7 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
orig_type->param_end()};
// This may not work if the function is somehow declared void as llvm is
- // strongly typed
- // and represents void* with i8*
+ // strongly typed and represents void* with i8*
assert(!orig_type->getReturnType()->isVoidTy() &&
"Cannot add StructRet attribute to void function");
llvm::PointerType *return_type_ptr_type =
@@ -126,8 +121,8 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {
if (log)
log->Printf("%s - return type pointer type for StructRet clone @ '0x%p':\n",
__FUNCTION__, (void *)return_type_ptr_type);
- // put the the sret pointer argument in place at the beginning of the argument
- // list.
+ // put the the sret pointer argument in place at the beginning of the
+ // argument list.
params.emplace(params.begin(), return_type_ptr_type);
assert(params.size() == num_params + 1);
return llvm::FunctionType::get(return_type_ptr_type, params,
@@ -157,11 +152,9 @@ bool findRSCallSites(llvm::Module &module,
bool fixupX86StructRetCalls(llvm::Module &module) {
bool changed = false;
- // changing a basic block while iterating over it seems to have some undefined
- // behaviour
- // going on so we find all RS callsites first, then fix them up after
- // consuming
- // the iterator.
+ // changing a basic block while iterating over it seems to have some
+ // undefined behaviour going on so we find all RS callsites first, then fix
+ // them up after consuming the iterator.
std::set<llvm::CallInst *> rs_callsites;
if (!findRSCallSites(module, rs_callsites, isRSLargeReturnCall))
return false;
@@ -180,8 +173,7 @@ bool fixupX86StructRetCalls(llvm::Module &module) {
// Allocate enough space to store the return value of the original function
// we pass a pointer to this allocation as the StructRet param, and then
- // copy its
- // value into the lldb return value
+ // copy its value into the lldb return value
const llvm::DataLayout &DL = module.getDataLayout();
llvm::AllocaInst *return_value_alloc = new llvm::AllocaInst(
func->getReturnType(), DL.getAllocaAddrSpace(), "var_vector_return_alloc",
@@ -222,19 +214,15 @@ bool fixupX86StructRetCalls(llvm::Module &module) {
bool fixupRSAllocationStructByValCalls(llvm::Module &module) {
// On x86_64, calls to functions in the RS runtime that take an
- // `rs_allocation` type argument
- // are actually handled as by-ref params by bcc, but appear to be passed by
- // value by lldb (the callsite all use
- // `struct byval`).
- // On x86_64 Linux, struct arguments are transferred in registers if the
- // struct size is no bigger than
- // 128bits [ref](http://www.agner.org/optimize/calling_conventions.pdf)
- // section 7.1 "Passing and returning objects"
- // otherwise passed on the stack.
- // an object of type `rs_allocation` is actually 256bits, so should be passed
- // on the stack. However, code generated
- // by bcc actually treats formal params of type `rs_allocation` as
- // `rs_allocation *` so we need to convert the
+ // `rs_allocation` type argument are actually handled as by-ref params by
+ // bcc, but appear to be passed by value by lldb (the callsite all use
+ // `struct byval`). On x86_64 Linux, struct arguments are transferred in
+ // registers if the struct size is no bigger than 128bits
+ // [ref](http://www.agner.org/optimize/calling_conventions.pdf) section 7.1
+ // "Passing and returning objects" otherwise passed on the stack. an object
+ // of type `rs_allocation` is actually 256bits, so should be passed on the
+ // stack. However, code generated by bcc actually treats formal params of
+ // type `rs_allocation` as `rs_allocation *` so we need to convert the
// calling convention to pass by reference, and remove any hint of byval from
// formal parameters.
bool changed = false;
OpenPOWER on IntegriCloud