diff options
Diffstat (limited to 'source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime')
4 files changed, 324 insertions, 440 deletions
| diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp index 60549663db66..b396781e6726 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp @@ -140,10 +140,10 @@ bool RenderScriptRuntimeModulePass::runOnModule(llvm::Module &module) {      // 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.      if (log) { -      log->Printf("%s - Changing RS target triple to '%s'", __FUNCTION__, -                  real_triple.str().c_str()); -      log->Printf( -          "%s - Changing RS datalayout to '%s'", __FUNCTION__, +      LLDB_LOGF(log, "%s - Changing RS target triple to '%s'", __FUNCTION__, +                real_triple.str().c_str()); +      LLDB_LOGF( +          log, "%s - Changing RS datalayout to '%s'", __FUNCTION__,            target_machine->createDataLayout().getStringRepresentation().c_str());      }      module.setTargetTriple(real_triple); diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp index c9cd34cf379d..5200749d759f 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp @@ -138,9 +138,8 @@ bool GetArgsX86(const GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      size_t read =          ctx.process->ReadMemory(sp, &arg.value, sizeof(uint32_t), err);      if (read != arg_size || !err.Success()) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64 " '%s'", -                    __FUNCTION__, uint64_t(i), err.AsCString()); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 " '%s'", +                __FUNCTION__, uint64_t(i), err.AsCString());        return false;      }    } @@ -173,8 +172,7 @@ bool GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {    // check the stack alignment was correct (16 byte aligned)    if ((sp & 0xf) != 0x0) { -    if (log) -      log->Printf("%s - stack misaligned", __FUNCTION__); +    LLDB_LOGF(log, "%s - stack misaligned", __FUNCTION__);      return false;    } @@ -213,9 +211,8 @@ bool GetArgsX86_64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      }      // fail if we couldn't read this argument      if (!success) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s", -                    __FUNCTION__, uint64_t(i), err.AsCString("n/a")); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s", +                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));        return false;      }    } @@ -258,9 +255,8 @@ bool GetArgsArm(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      }      // fail if we couldn't read this argument      if (!success) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s", -                    __FUNCTION__, uint64_t(i), err.AsCString("n/a")); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s", +                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));        return false;      }    } @@ -285,15 +281,13 @@ bool GetArgsAarch64(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      }      // arguments passed on the stack      else { -      if (log) -        log->Printf("%s - reading arguments spilled to stack not implemented", -                    __FUNCTION__); +      LLDB_LOGF(log, "%s - reading arguments spilled to stack not implemented", +                __FUNCTION__);      }      // fail if we couldn't read this argument      if (!success) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, -                    uint64_t(i)); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64, __FUNCTION__, +                uint64_t(i));        return false;      }    } @@ -337,9 +331,8 @@ bool GetArgsMipsel(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      }      // fail if we couldn't read this argument      if (!success) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s", -                    __FUNCTION__, uint64_t(i), err.AsCString("n/a")); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s", +                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));        return false;      }    } @@ -385,9 +378,8 @@ bool GetArgsMips64el(GetArgsCtx &ctx, ArgItem *arg_list, size_t num_args) {      }      // fail if we couldn't read this argument      if (!success) { -      if (log) -        log->Printf("%s - error reading argument: %" PRIu64 ", reason: %s", -                    __FUNCTION__, uint64_t(i), err.AsCString("n/a")); +      LLDB_LOGF(log, "%s - error reading argument: %" PRIu64 ", reason: %s", +                __FUNCTION__, uint64_t(i), err.AsCString("n/a"));        return false;      }    } @@ -399,8 +391,7 @@ bool GetArgs(ExecutionContext &exe_ctx, ArgItem *arg_list, size_t num_args) {    // verify that we have a target    if (!exe_ctx.GetTargetPtr()) { -    if (log) -      log->Printf("%s - invalid target", __FUNCTION__); +    LLDB_LOGF(log, "%s - invalid target", __FUNCTION__);      return false;    } @@ -430,9 +421,8 @@ bool GetArgs(ExecutionContext &exe_ctx, ArgItem *arg_list, size_t num_args) {    default:      // unsupported architecture      if (log) { -      log->Printf( -          "%s - architecture not supported: '%s'", __FUNCTION__, -          exe_ctx.GetTargetRef().GetArchitecture().GetArchitectureName()); +      LLDB_LOGF(log, "%s - architecture not supported: '%s'", __FUNCTION__, +                exe_ctx.GetTargetRef().GetArchitecture().GetArchitectureName());      }      return false;    } @@ -452,28 +442,20 @@ bool ParseCoordinate(llvm::StringRef coord_s, RSCoordinate &coord) {    // elements fails the contents of &coord are undefined and `false` is    // returned, `true` otherwise -  RegularExpression regex; -  RegularExpression::Match regex_match(3); - -  bool matched = false; -  if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+),([0-9]+)$")) && -      regex.Execute(coord_s, ®ex_match)) -    matched = true; -  else if (regex.Compile(llvm::StringRef("^([0-9]+),([0-9]+)$")) && -           regex.Execute(coord_s, ®ex_match)) -    matched = true; -  else if (regex.Compile(llvm::StringRef("^([0-9]+)$")) && -           regex.Execute(coord_s, ®ex_match)) -    matched = true; - -  if (!matched) +  llvm::SmallVector<llvm::StringRef, 4> matches; + +  if (!RegularExpression("^([0-9]+),([0-9]+),([0-9]+)$") +           .Execute(coord_s, &matches) && +      !RegularExpression("^([0-9]+),([0-9]+)$").Execute(coord_s, &matches) && +      !RegularExpression("^([0-9]+)$").Execute(coord_s, &matches))      return false; -  auto get_index = [&](int idx, uint32_t &i) -> bool { +  auto get_index = [&](size_t idx, uint32_t &i) -> bool {      std::string group;      errno = 0; -    if (regex_match.GetMatchAtIndex(coord_s.str().c_str(), idx + 1, group)) -      return !llvm::StringRef(group).getAsInteger<uint32_t>(10, i); +    if (idx + 1 < matches.size()) { +      return !llvm::StringRef(matches[idx + 1]).getAsInteger<uint32_t>(10, i); +    }      return true;    }; @@ -492,9 +474,8 @@ bool SkipPrologue(lldb::ModuleSP &module, Address &addr) {        ConstString name = sc.GetFunctionName();        if (offset)          addr.Slide(offset); -      if (log) -        log->Printf("%s: Prologue offset for %s is %" PRIu32, __FUNCTION__, -                    name.AsCString(), offset); +      LLDB_LOGF(log, "%s: Prologue offset for %s is %" PRIu32, __FUNCTION__, +                name.AsCString(), offset);      }      return true;    } else @@ -809,7 +790,7 @@ RenderScriptRuntime::CreateInstance(Process *process,  // symbol.  Searcher::CallbackReturn  RSBreakpointResolver::SearchCallback(SearchFilter &filter, -                                     SymbolContext &context, Address *, bool) { +                                     SymbolContext &context, Address *) {    ModuleSP module = context.module_sp;    if (!module || !IsRenderScriptScriptModule(module)) @@ -839,7 +820,7 @@ RSBreakpointResolver::SearchCallback(SearchFilter &filter,  Searcher::CallbackReturn  RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,                                             lldb_private::SymbolContext &context, -                                           Address *, bool) { +                                           Address *) {    // 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. @@ -884,14 +865,13 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,          if (filter.AddressPasses(address)) {            bool new_bp;            if (!SkipPrologue(module, address)) { -            if (log) -              log->Printf("%s: Error trying to skip prologue", __FUNCTION__); +            LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__);            }            m_breakpoint->AddLocation(address, &new_bp); -          if (log) -            log->Printf("%s: %s reduction breakpoint on %s in %s", __FUNCTION__, -                        new_bp ? "new" : "existing", kernel_name.GetCString(), -                        address.GetModule()->GetFileSpec().GetCString()); +          LLDB_LOGF(log, "%s: %s reduction breakpoint on %s in %s", +                    __FUNCTION__, new_bp ? "new" : "existing", +                    kernel_name.GetCString(), +                    address.GetModule()->GetFileSpec().GetCString());          }        }      } @@ -900,8 +880,7 @@ RSReduceBreakpointResolver::SearchCallback(lldb_private::SearchFilter &filter,  }  Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( -    SearchFilter &filter, SymbolContext &context, Address *addr, -    bool containing) { +    SearchFilter &filter, SymbolContext &context, Address *addr) {    if (!m_breakpoint)      return eCallbackReturnContinue; @@ -920,48 +899,43 @@ Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback(    for (auto &name : names) {      const RSScriptGroupDescriptorSP sg = FindScriptGroup(ConstString(name));      if (!sg) { -      if (log) -        log->Printf("%s: could not find script group for %s", __FUNCTION__, -                    name.c_str()); +      LLDB_LOGF(log, "%s: could not find script group for %s", __FUNCTION__, +                name.c_str());        continue;      } -    if (log) -      log->Printf("%s: Found ScriptGroup for %s", __FUNCTION__, name.c_str()); +    LLDB_LOGF(log, "%s: Found ScriptGroup for %s", __FUNCTION__, name.c_str());      for (const RSScriptGroupDescriptor::Kernel &k : sg->m_kernels) {        if (log) { -        log->Printf("%s: Adding breakpoint for %s", __FUNCTION__, -                    k.m_name.AsCString()); -        log->Printf("%s: Kernel address 0x%" PRIx64, __FUNCTION__, k.m_addr); +        LLDB_LOGF(log, "%s: Adding breakpoint for %s", __FUNCTION__, +                  k.m_name.AsCString()); +        LLDB_LOGF(log, "%s: Kernel address 0x%" PRIx64, __FUNCTION__, k.m_addr);        }        const lldb_private::Symbol *sym =            module->FindFirstSymbolWithNameAndType(k.m_name, eSymbolTypeCode);        if (!sym) { -        if (log) -          log->Printf("%s: Unable to find symbol for %s", __FUNCTION__, -                      k.m_name.AsCString()); +        LLDB_LOGF(log, "%s: Unable to find symbol for %s", __FUNCTION__, +                  k.m_name.AsCString());          continue;        }        if (log) { -        log->Printf("%s: Found symbol name is %s", __FUNCTION__, -                    sym->GetName().AsCString()); +        LLDB_LOGF(log, "%s: Found symbol name is %s", __FUNCTION__, +                  sym->GetName().AsCString());        }        auto address = sym->GetAddress();        if (!SkipPrologue(module, address)) { -        if (log) -          log->Printf("%s: Error trying to skip prologue", __FUNCTION__); +        LLDB_LOGF(log, "%s: Error trying to skip prologue", __FUNCTION__);        }        bool new_bp;        m_breakpoint->AddLocation(address, &new_bp); -      if (log) -        log->Printf("%s: Placed %sbreakpoint on %s", __FUNCTION__, -                    new_bp ? "new " : "", k.m_name.AsCString()); +      LLDB_LOGF(log, "%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 @@ -1136,8 +1110,7 @@ void RenderScriptRuntime::HookCallback(RuntimeHook *hook,                                         ExecutionContext &exe_ctx) {    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); -  if (log) -    log->Printf("%s - '%s'", __FUNCTION__, hook->defn->name); +  LLDB_LOGF(log, "%s - '%s'", __FUNCTION__, hook->defn->name);    if (hook->defn->grabber) {      (this->*(hook->defn->grabber))(hook, exe_ctx); @@ -1163,19 +1136,18 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(    }};    if (!GetArgs(context, args.data(), args.size())) { -    if (log) -      log->Printf("%s - Error while reading the function parameters", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - Error while reading the function parameters", +              __FUNCTION__);      return;    } else if (log) { -    log->Printf("%s - groupName    : 0x%" PRIx64, __FUNCTION__, -                addr_t(args[eGroupName])); -    log->Printf("%s - groupNameSize: %" PRIu64, __FUNCTION__, -                uint64_t(args[eGroupNameSize])); -    log->Printf("%s - kernel       : 0x%" PRIx64, __FUNCTION__, -                addr_t(args[eKernel])); -    log->Printf("%s - kernelCount  : %" PRIu64, __FUNCTION__, -                uint64_t(args[eKernelCount])); +    LLDB_LOGF(log, "%s - groupName    : 0x%" PRIx64, __FUNCTION__, +              addr_t(args[eGroupName])); +    LLDB_LOGF(log, "%s - groupNameSize: %" PRIu64, __FUNCTION__, +              uint64_t(args[eGroupNameSize])); +    LLDB_LOGF(log, "%s - kernel       : 0x%" PRIx64, __FUNCTION__, +              addr_t(args[eKernel])); +    LLDB_LOGF(log, "%s - kernelCount  : %" PRIu64, __FUNCTION__, +              uint64_t(args[eKernelCount]));    }    // parse script group name @@ -1187,12 +1159,10 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(      m_process->ReadMemory(addr_t(args[eGroupName]), buffer.get(), len, err);      buffer.get()[len] = '\0';      if (!err.Success()) { -      if (log) -        log->Printf("Error reading scriptgroup name from target"); +      LLDB_LOGF(log, "Error reading scriptgroup name from target");        return;      } else { -      if (log) -        log->Printf("Extracted scriptgroup name %s", buffer.get()); +      LLDB_LOGF(log, "Extracted scriptgroup name %s", buffer.get());      }      // write back the script group name      group_name.SetCString(buffer.get()); @@ -1214,9 +1184,8 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(        m_scriptGroups.push_back(group);      } else {        // already have this script group -      if (log) -        log->Printf("Attempt to add duplicate script group %s", -                    group_name.AsCString()); +      LLDB_LOGF(log, "Attempt to add duplicate script group %s", +                group_name.AsCString());        return;      }    } @@ -1234,21 +1203,18 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(      size_t read =          m_process->ReadMemory(ptr_addr, &kernel_addr, target_ptr_size, err);      if (!err.Success() || read != target_ptr_size) { -      if (log) -        log->Printf("Error parsing kernel address %" PRIu64 " in script group", -                    i); +      LLDB_LOGF(log, "Error parsing kernel address %" PRIu64 " in script group", +                i);        return;      } -    if (log) -      log->Printf("Extracted scriptgroup kernel address - 0x%" PRIx64, -                  kernel_addr); +    LLDB_LOGF(log, "Extracted scriptgroup kernel address - 0x%" PRIx64, +              kernel_addr);      kernel.m_addr = kernel_addr;      // try to resolve the associated kernel name      if (!ResolveKernelName(kernel.m_addr, kernel.m_name)) { -      if (log) -        log->Printf("Parsed scriptgroup kernel %" PRIu64 " - 0x%" PRIx64, i, -                    kernel_addr); +      LLDB_LOGF(log, "Parsed scriptgroup kernel %" PRIu64 " - 0x%" PRIx64, i, +                kernel_addr);        return;      } @@ -1261,9 +1227,8 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(          // verify this function is a valid kernel          if (IsKnownKernel(base_kernel)) {            kernel.m_name = base_kernel; -          if (log) -            log->Printf("%s - found non expand version '%s'", __FUNCTION__, -                        base_kernel.GetCString()); +          LLDB_LOGF(log, "%s - found non expand version '%s'", __FUNCTION__, +                    base_kernel.GetCString());          }        }      } @@ -1276,15 +1241,13 @@ void RenderScriptRuntime::CaptureDebugHintScriptGroup2(      Target &target = m_process->GetTarget();      const BreakpointList &list = target.GetBreakpointList();      const size_t num_breakpoints = list.GetSize(); -    if (log) -      log->Printf("Resolving %zu breakpoints", num_breakpoints); +    LLDB_LOGF(log, "Resolving %zu breakpoints", num_breakpoints);      for (size_t i = 0; i < num_breakpoints; ++i) {        const BreakpointSP bp = list.GetBreakpointAtIndex(i);        if (bp) {          if (bp->MatchesName(group_name.AsCString())) { -          if (log) -            log->Printf("Found breakpoint with name %s", -                        group_name.AsCString()); +          LLDB_LOGF(log, "Found breakpoint with name %s", +                    group_name.AsCString());            bp->ResolveBreakpoint();          }        } @@ -1322,9 +1285,8 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti(    bool success = GetArgs(exe_ctx, &args[0], args.size());    if (!success) { -    if (log) -      log->Printf("%s - Error while reading the function parameters", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - Error while reading the function parameters", +              __FUNCTION__);      return;    } @@ -1342,10 +1304,9 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti(      uint64_t result = 0;      size_t read = m_process->ReadMemory(addr, &result, target_ptr_size, err);      if (read != target_ptr_size || !err.Success()) { -      if (log) -        log->Printf( -            "%s - Error while reading allocation list argument %" PRIu64, -            __FUNCTION__, i); +      LLDB_LOGF(log, +                "%s - Error while reading allocation list argument %" PRIu64, +                __FUNCTION__, i);      } else {        allocs.push_back(result);      } @@ -1375,8 +1336,8 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti(        if (log) {          if (alloc->context.isValid() &&              *alloc->context.get() != addr_t(args[eRsContext])) -          log->Printf("%s - Allocation used by multiple contexts", -                      __FUNCTION__); +          LLDB_LOGF(log, "%s - Allocation used by multiple contexts", +                    __FUNCTION__);        }        alloc->context = addr_t(args[eRsContext]);      } @@ -1388,7 +1349,7 @@ void RenderScriptRuntime::CaptureScriptInvokeForEachMulti(      if (log) {        if (script->context.isValid() &&            *script->context.get() != addr_t(args[eRsContext])) -        log->Printf("%s - Script used by multiple contexts", __FUNCTION__); +        LLDB_LOGF(log, "%s - Script used by multiple contexts", __FUNCTION__);      }      script->context = addr_t(args[eRsContext]);    } @@ -1416,26 +1377,26 @@ void RenderScriptRuntime::CaptureSetGlobalVar(RuntimeHook *hook,    bool success = GetArgs(context, &args[0], args.size());    if (!success) { -    if (log) -      log->Printf("%s - error reading the function parameters.", __FUNCTION__); +    LLDB_LOGF(log, "%s - error reading the function parameters.", __FUNCTION__);      return;    }    if (log) { -    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 " slot %" PRIu64 " = 0x%" PRIx64 -                ":%" PRIu64 "bytes.", -                __FUNCTION__, uint64_t(args[eRsContext]), -                uint64_t(args[eRsScript]), uint64_t(args[eRsId]), -                uint64_t(args[eRsData]), uint64_t(args[eRsLength])); +    LLDB_LOGF(log, +              "%s - 0x%" PRIx64 ",0x%" PRIx64 " slot %" PRIu64 " = 0x%" PRIx64 +              ":%" PRIu64 "bytes.", +              __FUNCTION__, uint64_t(args[eRsContext]), +              uint64_t(args[eRsScript]), uint64_t(args[eRsId]), +              uint64_t(args[eRsData]), uint64_t(args[eRsLength]));      addr_t script_addr = addr_t(args[eRsScript]);      if (m_scriptMappings.find(script_addr) != m_scriptMappings.end()) {        auto rsm = m_scriptMappings[script_addr];        if (uint64_t(args[eRsId]) < rsm->m_globals.size()) {          auto rsg = rsm->m_globals[uint64_t(args[eRsId])]; -        log->Printf("%s - Setting of '%s' within '%s' inferred", __FUNCTION__, -                    rsg.m_name.AsCString(), -                    rsm->m_module->GetFileSpec().GetFilename().AsCString()); +        LLDB_LOGF(log, "%s - Setting of '%s' within '%s' inferred", +                  __FUNCTION__, rsg.m_name.AsCString(), +                  rsm->m_module->GetFileSpec().GetFilename().AsCString());        }      }    } @@ -1455,16 +1416,14 @@ void RenderScriptRuntime::CaptureAllocationInit(RuntimeHook *hook,    bool success = GetArgs(exe_ctx, &args[0], args.size());    if (!success) { -    if (log) -      log->Printf("%s - error while reading the function parameters", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - error while reading the function parameters", +              __FUNCTION__);      return;    } -  if (log) -    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 " .", -                __FUNCTION__, uint64_t(args[eRsContext]), -                uint64_t(args[eRsAlloc]), uint64_t(args[eRsForceZero])); +  LLDB_LOGF(log, "%s - 0x%" PRIx64 ",0x%" PRIx64 ",0x%" PRIx64 " .", +            __FUNCTION__, uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]), +            uint64_t(args[eRsForceZero]));    AllocationDetails *alloc = CreateAllocation(uint64_t(args[eRsAlloc]));    if (alloc) @@ -1487,29 +1446,25 @@ void RenderScriptRuntime::CaptureAllocationDestroy(RuntimeHook *hook,    bool success = GetArgs(exe_ctx, &args[0], args.size());    if (!success) { -    if (log) -      log->Printf("%s - error while reading the function parameters.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - error while reading the function parameters.", +              __FUNCTION__);      return;    } -  if (log) -    log->Printf("%s - 0x%" PRIx64 ", 0x%" PRIx64 ".", __FUNCTION__, -                uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc])); +  LLDB_LOGF(log, "%s - 0x%" PRIx64 ", 0x%" PRIx64 ".", __FUNCTION__, +            uint64_t(args[eRsContext]), uint64_t(args[eRsAlloc]));    for (auto iter = m_allocations.begin(); iter != m_allocations.end(); ++iter) {      auto &allocation_up = *iter; // get the unique pointer      if (allocation_up->address.isValid() &&          *allocation_up->address.get() == addr_t(args[eRsAlloc])) {        m_allocations.erase(iter); -      if (log) -        log->Printf("%s - deleted allocation entry.", __FUNCTION__); +      LLDB_LOGF(log, "%s - deleted allocation entry.", __FUNCTION__);        return;      }    } -  if (log) -    log->Printf("%s - couldn't find destroyed allocation.", __FUNCTION__); +  LLDB_LOGF(log, "%s - couldn't find destroyed allocation.", __FUNCTION__);  }  void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook, @@ -1526,32 +1481,28 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook,         ArgItem{ArgItem::ePointer, 0}, ArgItem{ArgItem::ePointer, 0}}};    bool success = GetArgs(exe_ctx, &args[0], args.size());    if (!success) { -    if (log) -      log->Printf("%s - error while reading the function parameters.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - error while reading the function parameters.", +              __FUNCTION__);      return;    }    std::string res_name;    process->ReadCStringFromMemory(addr_t(args[eRsResNamePtr]), res_name, err);    if (err.Fail()) { -    if (log) -      log->Printf("%s - error reading res_name: %s.", __FUNCTION__, -                  err.AsCString()); +    LLDB_LOGF(log, "%s - error reading res_name: %s.", __FUNCTION__, +              err.AsCString());    }    std::string cache_dir;    process->ReadCStringFromMemory(addr_t(args[eRsCachedDirPtr]), cache_dir, err);    if (err.Fail()) { -    if (log) -      log->Printf("%s - error reading cache_dir: %s.", __FUNCTION__, -                  err.AsCString()); +    LLDB_LOGF(log, "%s - error reading cache_dir: %s.", __FUNCTION__, +              err.AsCString());    } -  if (log) -    log->Printf("%s - 0x%" PRIx64 ",0x%" PRIx64 " => '%s' at '%s' .", -                __FUNCTION__, uint64_t(args[eRsContext]), -                uint64_t(args[eRsScript]), res_name.c_str(), cache_dir.c_str()); +  LLDB_LOGF(log, "%s - 0x%" PRIx64 ",0x%" PRIx64 " => '%s' at '%s' .", +            __FUNCTION__, uint64_t(args[eRsContext]), uint64_t(args[eRsScript]), +            res_name.c_str(), cache_dir.c_str());    if (res_name.size() > 0) {      StreamString strm; @@ -1566,13 +1517,14 @@ void RenderScriptRuntime::CaptureScriptInit(RuntimeHook *hook,        script->context = addr_t(args[eRsContext]);      } -    if (log) -      log->Printf("%s - '%s' tagged with context 0x%" PRIx64 -                  " and script 0x%" PRIx64 ".", -                  __FUNCTION__, strm.GetData(), uint64_t(args[eRsContext]), -                  uint64_t(args[eRsScript])); +    LLDB_LOGF(log, +              "%s - '%s' tagged with context 0x%" PRIx64 +              " and script 0x%" PRIx64 ".", +              __FUNCTION__, strm.GetData(), uint64_t(args[eRsContext]), +              uint64_t(args[eRsScript]));    } else if (log) { -    log->Printf("%s - resource name invalid, Script not tagged.", __FUNCTION__); +    LLDB_LOGF(log, "%s - resource name invalid, Script not tagged.", +              __FUNCTION__);    }  } @@ -1593,8 +1545,7 @@ void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module,        machine != llvm::Triple::ArchType::mipsel &&        machine != llvm::Triple::ArchType::mips64el &&        machine != llvm::Triple::ArchType::x86_64) { -    if (log) -      log->Printf("%s - unable to hook runtime functions.", __FUNCTION__); +    LLDB_LOGF(log, "%s - unable to hook runtime functions.", __FUNCTION__);      return;    } @@ -1618,23 +1569,22 @@ void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module,          ConstString(symbol_name), eSymbolTypeCode);      if (!sym) {        if (log) { -        log->Printf("%s - symbol '%s' related to the function %s not found", -                    __FUNCTION__, symbol_name, hook_defn->name); +        LLDB_LOGF(log, "%s - symbol '%s' related to the function %s not found", +                  __FUNCTION__, symbol_name, hook_defn->name);        }        continue;      }      addr_t addr = sym->GetLoadAddress(&target);      if (addr == LLDB_INVALID_ADDRESS) { -      if (log) -        log->Printf("%s - unable to resolve the address of hook function '%s' " -                    "with symbol '%s'.", -                    __FUNCTION__, hook_defn->name, symbol_name); +      LLDB_LOGF(log, +                "%s - unable to resolve the address of hook function '%s' " +                "with symbol '%s'.", +                __FUNCTION__, hook_defn->name, symbol_name);        continue;      } else { -      if (log) -        log->Printf("%s - function %s, address resolved at 0x%" PRIx64, -                    __FUNCTION__, hook_defn->name, addr); +      LLDB_LOGF(log, "%s - function %s, address resolved at 0x%" PRIx64, +                __FUNCTION__, hook_defn->name, addr);      }      RuntimeHookSP hook(new RuntimeHook()); @@ -1644,11 +1594,12 @@ void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module,      hook->bp_sp->SetCallback(HookCallback, hook.get(), true);      m_runtimeHooks[addr] = hook;      if (log) { -      log->Printf("%s - successfully hooked '%s' in '%s' version %" PRIu64 -                  " at 0x%" PRIx64 ".", -                  __FUNCTION__, hook_defn->name, -                  module->GetFileSpec().GetFilename().AsCString(), -                  (uint64_t)hook_defn->version, (uint64_t)addr); +      LLDB_LOGF(log, +                "%s - successfully hooked '%s' in '%s' version %" PRIu64 +                " at 0x%" PRIx64 ".", +                __FUNCTION__, hook_defn->name, +                module->GetFileSpec().GetFilename().AsCString(), +                (uint64_t)hook_defn->version, (uint64_t)addr);      }      hook_placed[idx] = true;    } @@ -1661,8 +1612,8 @@ void RenderScriptRuntime::LoadRuntimeHooks(lldb::ModuleSP module,        const HookDefn &hook_defn = s_runtimeHookDefns[i];        if (hook_defn.kind != kind)          continue; -      log->Printf("%s - function %s was not hooked", __FUNCTION__, -                  hook_defn.name); +      LLDB_LOGF(log, "%s - function %s was not hooked", __FUNCTION__, +                hook_defn.name);      }    }  } @@ -1697,11 +1648,11 @@ void RenderScriptRuntime::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) {      if (m_scriptMappings.find(script) != m_scriptMappings.end()) {        // if the module we have stored is different to the one we just received.        if (m_scriptMappings[script] != rsmodule_sp) { -        if (log) -          log->Printf( -              "%s - script %" PRIx64 " wants reassigned to new rsmodule '%s'.", -              __FUNCTION__, (uint64_t)script, -              rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString()); +        LLDB_LOGF( +            log, +            "%s - script %" PRIx64 " wants reassigned to new rsmodule '%s'.", +            __FUNCTION__, (uint64_t)script, +            rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());        }      }      // We don't have a script mapping for the current script. @@ -1713,11 +1664,9 @@ void RenderScriptRuntime::FixupScriptDetails(RSModuleDescriptorSP rsmodule_sp) {          rsmodule_sp->m_resname = res_name;        // Add Script/Module pair to map.        m_scriptMappings[script] = rsmodule_sp; -      if (log) -        log->Printf( -            "%s - script %" PRIx64 " associated with rsmodule '%s'.", -            __FUNCTION__, (uint64_t)script, -            rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString()); +      LLDB_LOGF(log, "%s - script %" PRIx64 " associated with rsmodule '%s'.", +                __FUNCTION__, (uint64_t)script, +                rsmodule_sp->m_module->GetFileSpec().GetFilename().AsCString());      }    }  } @@ -1730,8 +1679,7 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr,                                             StackFrame *frame_ptr,                                             uint64_t *result) {    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); -  if (log) -    log->Printf("%s(%s)", __FUNCTION__, expr); +  LLDB_LOGF(log, "%s(%s)", __FUNCTION__, expr);    ValueObjectSP expr_result;    EvaluateExpressionOptions options; @@ -1741,8 +1689,7 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr,    target.EvaluateExpression(expr, frame_ptr, expr_result, options);    if (!expr_result) { -    if (log) -      log->Printf("%s: couldn't evaluate expression.", __FUNCTION__); +    LLDB_LOGF(log, "%s: couldn't evaluate expression.", __FUNCTION__);      return false;    } @@ -1751,16 +1698,14 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr,      Status err = expr_result->GetError();      // Expression returned is void, so this is actually a success      if (err.GetError() == UserExpression::kNoResult) { -      if (log) -        log->Printf("%s - expression returned void.", __FUNCTION__); +      LLDB_LOGF(log, "%s - expression returned void.", __FUNCTION__);        result = nullptr;        return true;      } -    if (log) -      log->Printf("%s - error evaluating expression result: %s", __FUNCTION__, -                  err.AsCString()); +    LLDB_LOGF(log, "%s - error evaluating expression result: %s", __FUNCTION__, +              err.AsCString());      return false;    } @@ -1769,9 +1714,8 @@ bool RenderScriptRuntime::EvalRSExpression(const char *expr,    *result = expr_result->GetValueAsUnsigned(0, &success);    if (!success) { -    if (log) -      log->Printf("%s - couldn't convert expression result to uint32_t", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - couldn't convert expression result to uint32_t", +              __FUNCTION__);      return false;    } @@ -1884,8 +1828,7 @@ bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!alloc->address.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -1895,12 +1838,10 @@ bool RenderScriptRuntime::JITDataPointer(AllocationDetails *alloc,    int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,                           *alloc->address.get(), x, y, z);    if (written < 0) { -    if (log) -      log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);      return false;    } else if (written >= jit_max_expr_size) { -    if (log) -      log->Printf("%s - expression too long.", __FUNCTION__); +    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);      return false;    } @@ -1922,8 +1863,7 @@ bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!alloc->address.isValid() || !alloc->context.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -1933,12 +1873,10 @@ bool RenderScriptRuntime::JITTypePointer(AllocationDetails *alloc,    int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,                           *alloc->context.get(), *alloc->address.get());    if (written < 0) { -    if (log) -      log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);      return false;    } else if (written >= jit_max_expr_size) { -    if (log) -      log->Printf("%s - expression too long.", __FUNCTION__); +    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);      return false;    } @@ -1960,8 +1898,7 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!alloc->type_ptr.isValid() || !alloc->context.isValid()) { -    if (log) -      log->Printf("%s - Failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - Failed to find allocation details.", __FUNCTION__);      return false;    } @@ -1983,12 +1920,10 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,      int written = snprintf(expr_bufs[i], jit_max_expr_size, fmt_str,                             *alloc->context.get(), bits, *alloc->type_ptr.get());      if (written < 0) { -      if (log) -        log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +      LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);        return false;      } else if (written >= jit_max_expr_size) { -      if (log) -        log->Printf("%s - expression too long.", __FUNCTION__); +      LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);        return false;      } @@ -2007,10 +1942,10 @@ bool RenderScriptRuntime::JITTypePacked(AllocationDetails *alloc,    addr_t element_ptr = static_cast<lldb::addr_t>(results[3]);    alloc->element.element_ptr = element_ptr; -  if (log) -    log->Printf("%s - dims (%" PRIu32 ", %" PRIu32 ", %" PRIu32 -                ") Element*: 0x%" PRIx64 ".", -                __FUNCTION__, dims.dim_1, dims.dim_2, dims.dim_3, element_ptr); +  LLDB_LOGF(log, +            "%s - dims (%" PRIu32 ", %" PRIu32 ", %" PRIu32 +            ") Element*: 0x%" PRIx64 ".", +            __FUNCTION__, dims.dim_1, dims.dim_2, dims.dim_3, element_ptr);    return true;  } @@ -2024,8 +1959,7 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!elem.element_ptr.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -2042,12 +1976,10 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem,      int written = snprintf(expr_bufs[i], jit_max_expr_size, fmt_str, context,                             *elem.element_ptr.get());      if (written < 0) { -      if (log) -        log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +      LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);        return false;      } else if (written >= jit_max_expr_size) { -      if (log) -        log->Printf("%s - expression too long.", __FUNCTION__); +      LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);        return false;      } @@ -2063,11 +1995,11 @@ bool RenderScriptRuntime::JITElementPacked(Element &elem,    elem.type_vec_size = static_cast<uint32_t>(results[2]);    elem.field_count = static_cast<uint32_t>(results[3]); -  if (log) -    log->Printf("%s - data type %" PRIu32 ", pixel type %" PRIu32 -                ", vector size %" PRIu32 ", field count %" PRIu32, -                __FUNCTION__, *elem.type.get(), *elem.type_kind.get(), -                *elem.type_vec_size.get(), *elem.field_count.get()); +  LLDB_LOGF(log, +            "%s - data type %" PRIu32 ", pixel type %" PRIu32 +            ", vector size %" PRIu32 ", field count %" PRIu32, +            __FUNCTION__, *elem.type.get(), *elem.type_kind.get(), +            *elem.type_vec_size.get(), *elem.field_count.get());    // If this Element has subelements then JIT rsaElementGetSubElements() for    // details about its fields @@ -2084,8 +2016,7 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!elem.element_ptr.isValid() || !elem.field_count.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -2107,12 +2038,10 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,                               context, field_count, field_count, field_count,                               *elem.element_ptr.get(), field_count, field_index);        if (written < 0) { -        if (log) -          log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +        LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);          return false;        } else if (written >= jit_max_expr_size) { -        if (log) -          log->Printf("%s - expression too long.", __FUNCTION__); +        LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);          return false;        } @@ -2120,8 +2049,7 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,        if (!EvalRSExpression(expr_buffer, frame_ptr, &results))          return false; -      if (log) -        log->Printf("%s - expr result 0x%" PRIx64 ".", __FUNCTION__, results); +      LLDB_LOGF(log, "%s - expr result 0x%" PRIx64 ".", __FUNCTION__, results);        switch (expr_index) {        case 0: // Element* of child @@ -2136,9 +2064,8 @@ bool RenderScriptRuntime::JITSubelements(Element &elem,          if (!err.Fail())            child.type_name = ConstString(name);          else { -          if (log) -            log->Printf("%s - warning: Couldn't read field name.", -                        __FUNCTION__); +          LLDB_LOGF(log, "%s - warning: Couldn't read field name.", +                    __FUNCTION__);          }          break;        } @@ -2173,8 +2100,7 @@ bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc,    if (!alloc->address.isValid() || !alloc->dimension.isValid() ||        !alloc->data_ptr.isValid() || !alloc->element.datum_size.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -2196,9 +2122,8 @@ bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc,      alloc->size = dim_x * dim_y * dim_z * *alloc->element.datum_size.get(); -    if (log) -      log->Printf("%s - inferred size of struct allocation %" PRIu32 ".", -                  __FUNCTION__, *alloc->size.get()); +    LLDB_LOGF(log, "%s - inferred size of struct allocation %" PRIu32 ".", +              __FUNCTION__, *alloc->size.get());      return true;    } @@ -2213,12 +2138,10 @@ bool RenderScriptRuntime::JITAllocationSize(AllocationDetails *alloc,    int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,                           *alloc->address.get(), dim_x, dim_y, dim_z);    if (written < 0) { -    if (log) -      log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);      return false;    } else if (written >= jit_max_expr_size) { -    if (log) -      log->Printf("%s - expression too long.", __FUNCTION__); +    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);      return false;    } @@ -2242,8 +2165,7 @@ bool RenderScriptRuntime::JITAllocationStride(AllocationDetails *alloc,    Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!alloc->address.isValid() || !alloc->data_ptr.isValid()) { -    if (log) -      log->Printf("%s - failed to find allocation details.", __FUNCTION__); +    LLDB_LOGF(log, "%s - failed to find allocation details.", __FUNCTION__);      return false;    } @@ -2253,12 +2175,10 @@ bool RenderScriptRuntime::JITAllocationStride(AllocationDetails *alloc,    int written = snprintf(expr_buf, jit_max_expr_size, fmt_str,                           *alloc->address.get(), 0, 1, 0);    if (written < 0) { -    if (log) -      log->Printf("%s - encoding error in snprintf().", __FUNCTION__); +    LLDB_LOGF(log, "%s - encoding error in snprintf().", __FUNCTION__);      return false;    } else if (written >= jit_max_expr_size) { -    if (log) -      log->Printf("%s - expression too long.", __FUNCTION__); +    LLDB_LOGF(log, "%s - expression too long.", __FUNCTION__);      return false;    } @@ -2354,9 +2274,8 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,      // '#rs_padding_[0-9]+'      if (found && num_children < elem.children.size()) {        const uint32_t size_diff = elem.children.size() - num_children; -      if (log) -        log->Printf("%s - %" PRIu32 " padding struct entries", __FUNCTION__, -                    size_diff); +      LLDB_LOGF(log, "%s - %" PRIu32 " padding struct entries", __FUNCTION__, +                size_diff);        for (uint32_t i = 0; i < size_diff; ++i) {          ConstString name = elem.children[num_children + i].type_name; @@ -2377,9 +2296,8 @@ void RenderScriptRuntime::FindStructTypeName(Element &elem,        // Save name of variable in Element.        elem.type_name = valobj_sp->GetTypeName(); -      if (log) -        log->Printf("%s - element name set to %s", __FUNCTION__, -                    elem.type_name.AsCString()); +      LLDB_LOGF(log, "%s - element name set to %s", __FUNCTION__, +                elem.type_name.AsCString());        return;      } @@ -2424,9 +2342,8 @@ void RenderScriptRuntime::SetElementSize(Element &elem) {    elem.padding = padding;    elem.datum_size = data_size + padding; -  if (log) -    log->Printf("%s - element size set to %" PRIu32, __FUNCTION__, -                data_size + padding); +  LLDB_LOGF(log, "%s - element size set to %" PRIu32, __FUNCTION__, +            data_size + padding);  }  // Given an allocation, this function copies the allocation contents from @@ -2439,13 +2356,11 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,    // JIT all the allocation details    if (alloc->ShouldRefresh()) { -    if (log) -      log->Printf("%s - allocation details not calculated yet, jitting info", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info", +              __FUNCTION__);      if (!RefreshAllocation(alloc, frame_ptr)) { -      if (log) -        log->Printf("%s - couldn't JIT allocation details", __FUNCTION__); +      LLDB_LOGF(log, "%s - couldn't JIT allocation details", __FUNCTION__);        return nullptr;      }    } @@ -2458,9 +2373,8 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,    const uint32_t size = *alloc->size.get();    std::shared_ptr<uint8_t> buffer(new uint8_t[size]);    if (!buffer) { -    if (log) -      log->Printf("%s - couldn't allocate a %" PRIu32 " byte buffer", -                  __FUNCTION__, size); +    LLDB_LOGF(log, "%s - couldn't allocate a %" PRIu32 " byte buffer", +              __FUNCTION__, size);      return nullptr;    } @@ -2469,10 +2383,10 @@ RenderScriptRuntime::GetAllocationData(AllocationDetails *alloc,    lldb::addr_t data_ptr = *alloc->data_ptr.get();    GetProcess()->ReadMemory(data_ptr, buffer.get(), size, err);    if (err.Fail()) { -    if (log) -      log->Printf("%s - '%s' Couldn't read %" PRIu32 -                  " bytes of allocation data from 0x%" PRIx64, -                  __FUNCTION__, err.AsCString(), size, data_ptr); +    LLDB_LOGF(log, +              "%s - '%s' Couldn't read %" PRIu32 +              " bytes of allocation data from 0x%" PRIx64, +              __FUNCTION__, err.AsCString(), size, data_ptr);      return nullptr;    } @@ -2493,19 +2407,16 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,    if (!alloc)      return false; -  if (log) -    log->Printf("%s - found allocation 0x%" PRIx64, __FUNCTION__, -                *alloc->address.get()); +  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64, __FUNCTION__, +            *alloc->address.get());    // JIT all the allocation details    if (alloc->ShouldRefresh()) { -    if (log) -      log->Printf("%s - allocation details not calculated yet, jitting info.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.", +              __FUNCTION__);      if (!RefreshAllocation(alloc, frame_ptr)) { -      if (log) -        log->Printf("%s - couldn't JIT allocation details", __FUNCTION__); +      LLDB_LOGF(log, "%s - couldn't JIT allocation details", __FUNCTION__);        return false;      }    } @@ -2559,9 +2470,8 @@ bool RenderScriptRuntime::LoadAllocation(Stream &strm, const uint32_t alloc_id,                             sizeof(AllocationDetails::FileHeader),           sizeof(AllocationDetails::ElementHeader)); -  if (log) -    log->Printf("%s - header type %" PRIu32 ", element size %" PRIu32, -                __FUNCTION__, root_el_hdr.type, root_el_hdr.element_size); +  LLDB_LOGF(log, "%s - header type %" PRIu32 ", element size %" PRIu32, +            __FUNCTION__, root_el_hdr.type, root_el_hdr.element_size);    // Check if the target allocation and file both have the same number of bytes    // for an Element @@ -2717,19 +2627,16 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,    if (!alloc)      return false; -  if (log) -    log->Printf("%s - found allocation 0x%" PRIx64 ".", __FUNCTION__, -                *alloc->address.get()); +  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64 ".", __FUNCTION__, +            *alloc->address.get());    // JIT all the allocation details    if (alloc->ShouldRefresh()) { -    if (log) -      log->Printf("%s - allocation details not calculated yet, jitting info.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.", +              __FUNCTION__);      if (!RefreshAllocation(alloc, frame_ptr)) { -      if (log) -        log->Printf("%s - couldn't JIT allocation details.", __FUNCTION__); +      LLDB_LOGF(log, "%s - couldn't JIT allocation details.", __FUNCTION__);        return false;      }    } @@ -2743,14 +2650,14 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,    // Check we can create writable file    FileSpec file_spec(path);    FileSystem::Instance().Resolve(file_spec); -  File file; -  FileSystem::Instance().Open(file, file_spec, -                              File::eOpenOptionWrite | -                                  File::eOpenOptionCanCreate | -                                  File::eOpenOptionTruncate); +  auto file = FileSystem::Instance().Open( +      file_spec, File::eOpenOptionWrite | File::eOpenOptionCanCreate | +                     File::eOpenOptionTruncate);    if (!file) { -    strm.Printf("Error: Failed to open '%s' for writing", path); +    std::string error = llvm::toString(file.takeError()); +    strm.Printf("Error: Failed to open '%s' for writing: %s", path, +                error.c_str());      strm.EOL();      return false;    } @@ -2779,11 +2686,10 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,    // Write the file header    size_t num_bytes = sizeof(AllocationDetails::FileHeader); -  if (log) -    log->Printf("%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__, -                (uint64_t)num_bytes); +  LLDB_LOGF(log, "%s - writing File Header, 0x%" PRIx64 " bytes", __FUNCTION__, +            (uint64_t)num_bytes); -  Status err = file.Write(&head, num_bytes); +  Status err = file.get()->Write(&head, num_bytes);    if (!err.Success()) {      strm.Printf("Error: '%s' when writing to file '%s'", err.AsCString(), path);      strm.EOL(); @@ -2805,11 +2711,10 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,    // Write headers for allocation element type to file    num_bytes = element_header_size; -  if (log) -    log->Printf("%s - writing element headers, 0x%" PRIx64 " bytes.", -                __FUNCTION__, (uint64_t)num_bytes); +  LLDB_LOGF(log, "%s - writing element headers, 0x%" PRIx64 " bytes.", +            __FUNCTION__, (uint64_t)num_bytes); -  err = file.Write(element_header_buffer.get(), num_bytes); +  err = file.get()->Write(element_header_buffer.get(), num_bytes);    if (!err.Success()) {      strm.Printf("Error: '%s' when writing to file '%s'", err.AsCString(), path);      strm.EOL(); @@ -2818,11 +2723,10 @@ bool RenderScriptRuntime::SaveAllocation(Stream &strm, const uint32_t alloc_id,    // Write allocation data to file    num_bytes = static_cast<size_t>(*alloc->size.get()); -  if (log) -    log->Printf("%s - writing 0x%" PRIx64 " bytes", __FUNCTION__, -                (uint64_t)num_bytes); +  LLDB_LOGF(log, "%s - writing 0x%" PRIx64 " bytes", __FUNCTION__, +            (uint64_t)num_bytes); -  err = file.Write(buffer.get(), num_bytes); +  err = file.get()->Write(buffer.get(), num_bytes);    if (!err.Success()) {      strm.Printf("Error: '%s' when writing to file '%s'", err.AsCString(), path);      strm.EOL(); @@ -2894,17 +2798,17 @@ bool RenderScriptRuntime::LoadModule(const lldb::ModuleSP &module_sp) {            addr_t addr = debug_present->GetLoadAddress(&target);            GetProcess()->WriteMemory(addr, &flag, sizeof(flag), err);            if (err.Success()) { -            if (log) -              log->Printf("%s - debugger present flag set on debugee.", -                          __FUNCTION__); +            LLDB_LOGF(log, "%s - debugger present flag set on debugee.", +                      __FUNCTION__);              m_debuggerPresentFlagged = true;            } else if (log) { -            log->Printf("%s - error writing debugger present flags '%s' ", -                        __FUNCTION__, err.AsCString()); +            LLDB_LOGF(log, "%s - error writing debugger present flags '%s' ", +                      __FUNCTION__, err.AsCString());            }          } else if (log) { -          log->Printf( +          LLDB_LOGF( +              log,                "%s - error writing debugger present flags - symbol not found",                __FUNCTION__);          } @@ -3004,8 +2908,7 @@ bool RSModuleDescriptor::ParseExportReduceCount(llvm::StringRef *lines,        return false;      } -    if (log) -      log->Printf("Found RenderScript reduction '%s'", spec[2].str().c_str()); +    LLDB_LOGF(log, "Found RenderScript reduction '%s'", spec[2].str().c_str());      m_reductions.push_back(RSReductionDescriptor(this, sig, accum_data_size,                                                   spec[2], spec[3], spec[4], @@ -3082,10 +2985,8 @@ bool RSModuleDescriptor::ParseRSInfo() {    {      const llvm::StringRef raw_rs_info((const char *)buffer->GetBytes());      raw_rs_info.split(info_lines, '\n'); -    if (log) -      log->Printf("'.rs.info symbol for '%s':\n%s", -                  m_module->GetFileSpec().GetCString(), -                  raw_rs_info.str().c_str()); +    LLDB_LOGF(log, "'.rs.info symbol for '%s':\n%s", +              m_module->GetFileSpec().GetCString(), raw_rs_info.str().c_str());    }    enum { @@ -3153,9 +3054,8 @@ bool RSModuleDescriptor::ParseRSInfo() {        success = ParseVersionInfo(line, n_lines);        break;      default: { -      if (log) -        log->Printf("%s - skipping .rs.info field '%s'", __FUNCTION__, -                    line->str().c_str()); +      LLDB_LOGF(log, "%s - skipping .rs.info field '%s'", __FUNCTION__, +                line->str().c_str());        continue;      }      } @@ -3276,15 +3176,13 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,    if (!alloc)      return false; // FindAllocByID() will print error message for us here -  if (log) -    log->Printf("%s - found allocation 0x%" PRIx64, __FUNCTION__, -                *alloc->address.get()); +  LLDB_LOGF(log, "%s - found allocation 0x%" PRIx64, __FUNCTION__, +            *alloc->address.get());    // Check we have information about the allocation, if not calculate it    if (alloc->ShouldRefresh()) { -    if (log) -      log->Printf("%s - allocation details not calculated yet, jitting info.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - allocation details not calculated yet, jitting info.", +              __FUNCTION__);      // JIT all the allocation information      if (!RefreshAllocation(alloc, frame_ptr)) { @@ -3313,9 +3211,8 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,    const uint32_t data_size = *alloc->element.datum_size.get(); -  if (log) -    log->Printf("%s - element size %" PRIu32 " bytes, including padding", -                __FUNCTION__, data_size); +  LLDB_LOGF(log, "%s - element size %" PRIu32 " bytes, including padding", +            __FUNCTION__, data_size);    // Allocate a buffer to copy data into    std::shared_ptr<uint8_t> buffer = GetAllocationData(alloc, frame_ptr); @@ -3340,10 +3237,10 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,    const uint32_t size = *alloc->size.get(); // Size of whole allocation    const uint32_t padding =        alloc->element.padding.isValid() ? *alloc->element.padding.get() : 0; -  if (log) -    log->Printf("%s - stride %" PRIu32 " bytes, size %" PRIu32 -                " bytes, padding %" PRIu32, -                __FUNCTION__, stride, size, padding); +  LLDB_LOGF(log, +            "%s - stride %" PRIu32 " bytes, size %" PRIu32 +            " bytes, padding %" PRIu32, +            __FUNCTION__, stride, size, padding);    // Find dimensions used to index loops, so need to be non-zero    uint32_t dim_x = alloc->dimension.get()->dim_1; @@ -3395,8 +3292,7 @@ bool RenderScriptRuntime::DumpAllocation(Stream &strm, StackFrame *frame_ptr,                         *alloc->data_ptr.get() + offset);            if (written < 0 || written >= jit_max_expr_size) { -            if (log) -              log->Printf("%s - error in snprintf().", __FUNCTION__); +            LLDB_LOGF(log, "%s - error in snprintf().", __FUNCTION__);              continue;            } @@ -3573,17 +3469,16 @@ void RenderScriptRuntime::SetBreakAllKernels(bool do_break, TargetSP target) {      for (const auto &module : m_rsmodules)        BreakOnModuleKernels(module); -    if (log) -      log->Printf("%s(True) - breakpoints set on all currently loaded kernels.", -                  __FUNCTION__); +    LLDB_LOGF(log, +              "%s(True) - breakpoints set on all currently loaded kernels.", +              __FUNCTION__);    } else if (!do_break &&               m_breakAllKernels) // Breakpoints won't be set on any new kernels.    {      m_breakAllKernels = false; -    if (log) -      log->Printf("%s(False) - breakpoints no longer automatically set.", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s(False) - breakpoints no longer automatically set.", +              __FUNCTION__);    }  } @@ -3595,8 +3490,8 @@ RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) {        GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));    if (!m_filtersp) { -    if (log) -      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__); +    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", +              __FUNCTION__);      return nullptr;    } @@ -3610,9 +3505,8 @@ RenderScriptRuntime::CreateKernelBreakpoint(ConstString name) {    Status err;    target.AddNameToBreakpoint(bp, "RenderScriptKernel", err);    if (err.Fail() && log) -    if (log) -      log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, -                  err.AsCString()); +    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__, +              err.AsCString());    return bp;  } @@ -3624,8 +3518,8 @@ RenderScriptRuntime::CreateReductionBreakpoint(ConstString name,        GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));    if (!m_filtersp) { -    if (log) -      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__); +    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", +              __FUNCTION__);      return nullptr;    } @@ -3640,8 +3534,8 @@ RenderScriptRuntime::CreateReductionBreakpoint(ConstString name,    Status err;    target.AddNameToBreakpoint(bp, "RenderScriptReduction", err);    if (err.Fail() && log) -      log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, -                  err.AsCString()); +    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__, +              err.AsCString());    return bp;  } @@ -3663,9 +3557,8 @@ bool RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp,            StackFrame::eExpressionPathOptionsAllowDirectIVarAccess,        var_sp, err));    if (!err.Success()) { -    if (log) -      log->Printf("%s - error, couldn't find '%s' in frame", __FUNCTION__, -                  var_name); +    LLDB_LOGF(log, "%s - error, couldn't find '%s' in frame", __FUNCTION__, +              var_name);      return false;    } @@ -3673,9 +3566,8 @@ bool RenderScriptRuntime::GetFrameVarAsUnsigned(const StackFrameSP frame_sp,    bool success = false;    val = value_sp->GetValueAsUnsigned(0, &success);    if (!success) { -    if (log) -      log->Printf("%s - error, couldn't parse '%s' as an uint32_t.", -                  __FUNCTION__, var_name); +    LLDB_LOGF(log, "%s - error, couldn't parse '%s' as an uint32_t.", +              __FUNCTION__, var_name);      return false;    } @@ -3695,8 +3587,7 @@ bool RenderScriptRuntime::GetKernelCoordinate(RSCoordinate &coord,    Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE));    if (!thread_ptr) { -    if (log) -      log->Printf("%s - Error, No thread pointer", __FUNCTION__); +    LLDB_LOGF(log, "%s - Error, No thread pointer", __FUNCTION__);      return false;    } @@ -3718,17 +3609,15 @@ bool RenderScriptRuntime::GetKernelCoordinate(RSCoordinate &coord,      if (!func_name)        continue; -    if (log) -      log->Printf("%s - Inspecting function '%s'", __FUNCTION__, -                  func_name.GetCString()); +    LLDB_LOGF(log, "%s - Inspecting function '%s'", __FUNCTION__, +              func_name.GetCString());      // Check if function name has .expand suffix      if (!func_name.GetStringRef().endswith(".expand"))        continue; -    if (log) -      log->Printf("%s - Found .expand function '%s'", __FUNCTION__, -                  func_name.GetCString()); +    LLDB_LOGF(log, "%s - Found .expand function '%s'", __FUNCTION__, +              func_name.GetCString());      // Get values for variables in .expand frame that tell us the current      // kernel invocation @@ -3770,9 +3659,8 @@ bool RenderScriptRuntime::KernelBreakpointHit(void *baton,    // Coordinate we want to stop on    RSCoordinate target_coord = *static_cast<RSCoordinate *>(baton); -  if (log) -    log->Printf("%s - Break ID %" PRIu64 ", " FMT_COORD, __FUNCTION__, break_id, -                target_coord.x, target_coord.y, target_coord.z); +  LLDB_LOGF(log, "%s - Break ID %" PRIu64 ", " FMT_COORD, __FUNCTION__, +            break_id, target_coord.x, target_coord.y, target_coord.z);    // Select current thread    ExecutionContext context(ctx->exe_ctx_ref); @@ -3782,22 +3670,19 @@ bool RenderScriptRuntime::KernelBreakpointHit(void *baton,    // Find current kernel invocation from .expand frame variables    RSCoordinate current_coord{};    if (!GetKernelCoordinate(current_coord, thread_ptr)) { -    if (log) -      log->Printf("%s - Error, couldn't select .expand stack frame", -                  __FUNCTION__); +    LLDB_LOGF(log, "%s - Error, couldn't select .expand stack frame", +              __FUNCTION__);      return false;    } -  if (log) -    log->Printf("%s - " FMT_COORD, __FUNCTION__, current_coord.x, -                current_coord.y, current_coord.z); +  LLDB_LOGF(log, "%s - " FMT_COORD, __FUNCTION__, current_coord.x, +            current_coord.y, current_coord.z);    // Check if the current kernel invocation coordinate matches our target    // coordinate    if (target_coord == current_coord) { -    if (log) -      log->Printf("%s, BREAKING " FMT_COORD, __FUNCTION__, current_coord.x, -                  current_coord.y, current_coord.z); +    LLDB_LOGF(log, "%s, BREAKING " FMT_COORD, __FUNCTION__, current_coord.x, +              current_coord.y, current_coord.z);      BreakpointSP breakpoint_sp =          context.GetTargetPtr()->GetBreakpointByID(break_id); @@ -3865,8 +3750,8 @@ RenderScriptRuntime::CreateScriptGroupBreakpoint(ConstString name,        GetLogIfAnyCategoriesSet(LIBLLDB_LOG_LANGUAGE | LIBLLDB_LOG_BREAKPOINTS));    if (!m_filtersp) { -    if (log) -      log->Printf("%s - error, no breakpoint search filter set.", __FUNCTION__); +    LLDB_LOGF(log, "%s - error, no breakpoint search filter set.", +              __FUNCTION__);      return nullptr;    } @@ -3880,8 +3765,8 @@ RenderScriptRuntime::CreateScriptGroupBreakpoint(ConstString name,    Status err;    target.AddNameToBreakpoint(bp, name.GetCString(), err);    if (err.Fail() && log) -    log->Printf("%s - error setting break name, '%s'.", __FUNCTION__, -                err.AsCString()); +    LLDB_LOGF(log, "%s - error setting break name, '%s'.", __FUNCTION__, +              err.AsCString());    // ask the breakpoint to resolve itself    bp->ResolveBreakpoint();    return bp; @@ -3964,9 +3849,8 @@ RenderScriptRuntime::CreateAllocation(addr_t address) {    auto it = m_allocations.begin();    while (it != m_allocations.end()) {      if (*((*it)->address) == address) { -      if (log) -        log->Printf("%s - Removing allocation id: %d, address: 0x%" PRIx64, -                    __FUNCTION__, (*it)->id, address); +      LLDB_LOGF(log, "%s - Removing allocation id: %d, address: 0x%" PRIx64, +                __FUNCTION__, (*it)->id, address);        it = m_allocations.erase(it);      } else { @@ -3988,9 +3872,8 @@ bool RenderScriptRuntime::ResolveKernelName(lldb::addr_t kernel_addr,    Address resolved;    // RenderScript module    if (!target.GetSectionLoadList().ResolveLoadAddress(kernel_addr, resolved)) { -    if (log) -      log->Printf("%s: unable to resolve 0x%" PRIx64 " to a loaded symbol", -                  __FUNCTION__, kernel_addr); +    LLDB_LOGF(log, "%s: unable to resolve 0x%" PRIx64 " to a loaded symbol", +              __FUNCTION__, kernel_addr);      return false;    } @@ -4000,9 +3883,8 @@ bool RenderScriptRuntime::ResolveKernelName(lldb::addr_t kernel_addr,    name = sym->GetName();    assert(IsRenderScriptModule(resolved.CalculateSymbolContextModule())); -  if (log) -    log->Printf("%s: 0x%" PRIx64 " resolved to the symbol '%s'", __FUNCTION__, -                kernel_addr, name.GetCString()); +  LLDB_LOGF(log, "%s: 0x%" PRIx64 " resolved to the symbol '%s'", __FUNCTION__, +            kernel_addr, name.GetCString());    return true;  } @@ -4256,13 +4138,12 @@ 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... -      RegularExpression::Match match(/* max_matches */ 5);        RegularExpression match_type_list(            llvm::StringRef("^([[:alpha:]]+)(,[[:alpha:]]+){0,4}$"));        assert(match_type_list.IsValid()); -      if (!match_type_list.Execute(option_val, &match)) { +      if (!match_type_list.Execute(option_val)) {          err_str.PutCString(              "a comma-separated list of kernel types is required");          return false; @@ -4696,32 +4577,36 @@ public:        return false;      } -    Stream *output_strm = nullptr; -    StreamFile outfile_stream; +    Stream *output_stream_p = nullptr; +    std::unique_ptr<Stream> output_stream_storage; +      const FileSpec &outfile_spec =          m_options.m_outfile; // Dump allocation to file instead      if (outfile_spec) {        // Open output file        std::string path = outfile_spec.GetPath(); -      auto error = FileSystem::Instance().Open( -          outfile_stream.GetFile(), outfile_spec, -          File::eOpenOptionWrite | File::eOpenOptionCanCreate); -      if (error.Success()) { -        output_strm = &outfile_stream; +      auto file = FileSystem::Instance().Open( +          outfile_spec, File::eOpenOptionWrite | File::eOpenOptionCanCreate); +      if (file) { +        output_stream_storage = +            std::make_unique<StreamFile>(std::move(file.get())); +        output_stream_p = output_stream_storage.get();          result.GetOutputStream().Printf("Results written to '%s'",                                          path.c_str());          result.GetOutputStream().EOL();        } else { -        result.AppendErrorWithFormat("Couldn't open file '%s'", path.c_str()); +        std::string error = llvm::toString(file.takeError()); +        result.AppendErrorWithFormat("Couldn't open file '%s': %s", +                                     path.c_str(), error.c_str());          result.SetStatus(eReturnStatusFailed);          return false;        }      } else -      output_strm = &result.GetOutputStream(); +      output_stream_p = &result.GetOutputStream(); -    assert(output_strm != nullptr); +    assert(output_stream_p != nullptr);      bool dumped = -        runtime->DumpAllocation(*output_strm, m_exe_ctx.GetFramePtr(), id); +        runtime->DumpAllocation(*output_stream_p, m_exe_ctx.GetFramePtr(), id);      if (dumped)        result.SetStatus(eReturnStatusSuccessFinishResult); diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h index 3923221d4302..c3740ba55a11 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h @@ -67,8 +67,8 @@ public:    void Dump(Stream *s) const override {}    Searcher::CallbackReturn SearchCallback(SearchFilter &filter, -                                          SymbolContext &context, Address *addr, -                                          bool containing) override; +                                          SymbolContext &context, +                                          Address *addr) override;    lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } @@ -117,8 +117,8 @@ public:    void Dump(Stream *s) const override {}    Searcher::CallbackReturn SearchCallback(SearchFilter &filter, -                                          SymbolContext &context, Address *addr, -                                          bool containing) override; +                                          SymbolContext &context, +                                          Address *addr) override;    lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } @@ -262,8 +262,8 @@ public:    void Dump(Stream *s) const override {}    Searcher::CallbackReturn SearchCallback(SearchFilter &filter, -                                          SymbolContext &context, Address *addr, -                                          bool containing) override; +                                          SymbolContext &context, +                                          Address *addr) override;    lldb::SearchDepth GetDepth() override { return lldb::eSearchDepthModule; } diff --git a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp index 4725e8c5b0eb..a6d225d2fbd8 100644 --- a/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp +++ b/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp @@ -93,9 +93,8 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {    assert(orig && "CallInst has no called function");    llvm::FunctionType *orig_type = orig->getFunctionType();    auto name = orig->getName(); -  if (log) -    log->Printf("%s - cloning to StructRet function for '%s'", __FUNCTION__, -                name.str().c_str()); +  LLDB_LOGF(log, "%s - cloning to StructRet function for '%s'", __FUNCTION__, +            name.str().c_str());    unsigned num_params = orig_type->getNumParams();    std::vector<llvm::Type *> new_params{num_params + 1, nullptr}; @@ -113,9 +112,9 @@ llvm::FunctionType *cloneToStructRetFnTy(llvm::CallInst *call_inst) {    if (!return_type_ptr_type)      return nullptr; -  if (log) -    log->Printf("%s - return type pointer type for StructRet clone @ '0x%p':\n", -                __FUNCTION__, (void *)return_type_ptr_type); +  LLDB_LOGF(log, +            "%s - return type pointer type for StructRet clone @ '0x%p':\n", +            __FUNCTION__, (void *)return_type_ptr_type);    // put the sret pointer argument in place at the beginning of the    // argument list.    params.emplace(params.begin(), return_type_ptr_type); | 
