[Lldb-commits] [lldb] r285902 - [Renderscript] Add commands for scriptgroup interaction.
Author: aidandodds Date: Thu Nov 3 08:20:37 2016 New Revision: 285902 URL: http://llvm.org/viewvc/llvm-project?rev=285902=rev Log: [Renderscript] Add commands for scriptgroup interaction. This commit hooks the nofity function that signals script group compilation. By tracking scriptgroups compiled at runtine, users are able to place breakpoints by script group name. Breakpoints will be placed on the kernels forming the group. Added: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptScriptGroup.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt?rev=285902=285901=285902=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/CMakeLists.txt Thu Nov 3 08:20:37 2016 @@ -2,6 +2,7 @@ add_lldb_library(lldbPluginRenderScriptR RenderScriptRuntime.cpp RenderScriptExpressionOpts.cpp RenderScriptx86ABIFixups.cpp + RenderScriptScriptGroup.cpp ) if(NOT LLDB_BUILT_STANDALONE) Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=285902=285901=285902=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Nov 3 08:20:37 2016 @@ -14,6 +14,7 @@ // Project includes #include "RenderScriptRuntime.h" +#include "RenderScriptScriptGroup.h" #include "lldb/Breakpoint/StoppointCallbackContext.h" #include "lldb/Core/ConstString.h" @@ -31,11 +32,13 @@ #include "lldb/Interpreter/CommandObjectMultiword.h" #include "lldb/Interpreter/CommandReturnObject.h" #include "lldb/Interpreter/Options.h" +#include "lldb/Symbol/Function.h" #include "lldb/Symbol/Symbol.h" #include "lldb/Symbol/Type.h" #include "lldb/Symbol/VariableList.h" #include "lldb/Target/Process.h" #include "lldb/Target/RegisterContext.h" +#include "lldb/Target/SectionLoadList.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" @@ -475,6 +478,26 @@ bool ParseCoordinate(llvm::StringRef coo return get_index(0, coord.x) && get_index(1, coord.y) && get_index(2, coord.z); } + +bool SkipPrologue(lldb::ModuleSP , Address ) { + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + SymbolContext sc; + uint32_t resolved_flags = + module->ResolveSymbolContextForAddress(addr, eSymbolContextFunction, sc); + if (resolved_flags & eSymbolContextFunction) { +if (sc.function) { + const uint32_t offset = sc.function->GetPrologueByteSize(); + ConstString name = sc.GetFunctionName(); + if (offset) +addr.Slide(offset); + if (log) +log->Printf("%s: Prologue offset for %s is %" PRIu32, __FUNCTION__, +name.AsCString(), offset); +} +return true; + } else +return false; +} } // anonymous namespace // The ScriptDetails class collects data associated with a single script @@ -872,6 +895,80 @@ RSReduceBreakpointResolver::SearchCallba return eCallbackReturnContinue; } +Searcher::CallbackReturn RSScriptGroupBreakpointResolver::SearchCallback( +SearchFilter , SymbolContext , Address *addr, +bool containing) { + + if (!m_breakpoint) +return eCallbackReturnContinue; + + Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_BREAKPOINTS)); + ModuleSP = context.module_sp; + + if (!module || !IsRenderScriptScriptModule(module)) +return Searcher::eCallbackReturnContinue; + + std::vector names; + m_breakpoint->GetNames(names); + if (names.empty()) +return eCallbackReturnContinue; + + for (auto : 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()); + continue; +} + +if (log) + log->Printf("%s: Found ScriptGroup for %s", __FUNCTION__,
Re: [Lldb-commits] [PATCH] D19230: Properly unload modules from target image list when using svr4 packets
ADodds accepted this revision. ADodds added a comment. Looks fine to me. http://reviews.llvm.org/D19230 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263134 - [Renderscript] Add stack argument reading code for Mipsel 3
Author: aidandodds Date: Thu Mar 10 11:50:01 2016 New Revision: 263134 URL: http://llvm.org/viewvc/llvm-project?rev=263134=rev Log: [Renderscript] Add stack argument reading code for Mipsel 3 Fix a problem raised with the previous patches being applied in the wrong order. Committed on behalf of: Dean De LeoModified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263134=263133=263134=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Mar 10 11:50:01 2016 @@ -141,6 +141,8 @@ GetArgsX86(const GetArgsCtx , ArgIte { Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); +Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -365,20 +367,18 @@ GetArgsMipsel(GetArgsCtx , ArgItem * else { const size_t arg_size = sizeof(uint32_t); -uint64_t sp = ctx.reg_ctx->GetSP(); -uint32_t offset = i * arg_size; arg.value = 0; -Error error; -size_t bytes_read = ctx.process->ReadMemory(sp + offset, , arg_size, error); +size_t bytes_read = ctx.process->ReadMemory(sp, , arg_size, error); success = (error.Success() && bytes_read == arg_size); -if (!success && log) -log->Printf ("RenderScriptRuntime::GetArgSimple - error reading Mips stack: %s.", error.AsCString()); +// advance the stack pointer +sp += arg_size; } // fail if we couldn't read this argument if (!success) { if (log) -log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); +log->Printf("%s - error reading argument: %" PRIu64", reason: %s", +__FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263131 - [Renderscript] Add stack argument reading code for Mipsel 2
Author: aidandodds Date: Thu Mar 10 11:37:02 2016 New Revision: 263131 URL: http://llvm.org/viewvc/llvm-project?rev=263131=rev Log: [Renderscript] Add stack argument reading code for Mipsel 2 This commit implements the reading of stack spilled function arguments for little endian MIPS targets. Committed on behalf of: Dean De LeoModified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263131=263130=263131=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Mar 10 11:37:02 2016 @@ -364,8 +364,15 @@ GetArgsMipsel(GetArgsCtx , ArgItem * // arguments passed on the stack else { -if (log) -log->Printf("%s - reading arguments spilled to stack not implemented.", __FUNCTION__); +const size_t arg_size = sizeof(uint32_t); +uint64_t sp = ctx.reg_ctx->GetSP(); +uint32_t offset = i * arg_size; +arg.value = 0; +Error error; +size_t bytes_read = ctx.process->ReadMemory(sp + offset, , arg_size, error); +success = (error.Success() && bytes_read == arg_size); +if (!success && log) +log->Printf ("RenderScriptRuntime::GetArgSimple - error reading Mips stack: %s.", error.AsCString()); } // fail if we couldn't read this argument if (!success) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263130 - [Renderscript] Add stack argument reading code for Mipsel
Author: aidandodds Date: Thu Mar 10 11:27:41 2016 New Revision: 263130 URL: http://llvm.org/viewvc/llvm-project?rev=263130=rev Log: [Renderscript] Add stack argument reading code for Mipsel This commit implements the reading of stack spilled function arguments for little endian MIPS targets. Committed on behalf of: Dean De LeoModified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263130=263129=263130=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Mar 10 11:27:41 2016 @@ -184,6 +184,8 @@ GetArgsX86_64(GetArgsCtx , ArgItem * 4, // eBool, }}; +Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); // step over the return address @@ -227,7 +229,6 @@ GetArgsX86_64(GetArgsCtx , ArgItem * // read the argument from memory arg.value = 0; // note: due to little endian layout reading 4 or 8 bytes will give the correct value. -Error error; size_t read = ctx.process->ReadMemory(sp, , size, error); success = (error.Success() && read==size); // advance past this argument @@ -237,7 +238,8 @@ GetArgsX86_64(GetArgsCtx , ArgItem * if (!success) { if (log) -log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); +log->Printf("%s - error reading argument: %" PRIu64", reason: %s", +__FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } @@ -252,6 +254,8 @@ GetArgsArm(GetArgsCtx , ArgItem *arg Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); +Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -275,7 +279,6 @@ GetArgsArm(GetArgsCtx , ArgItem *arg // clear all 64bits arg.value = 0; // read this argument from memory -Error error; size_t bytes_read = ctx.process->ReadMemory(sp, , arg_size, error); success = (error.Success() && bytes_read == arg_size); // advance the stack pointer @@ -285,7 +288,8 @@ GetArgsArm(GetArgsCtx , ArgItem *arg if (!success) { if (log) -log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); +log->Printf("%s - error reading argument: %" PRIu64", reason: %s", +__FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } @@ -340,6 +344,11 @@ GetArgsMipsel(GetArgsCtx , ArgItem * Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); +Error error; + +// 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) { bool success = false; @@ -379,6 +388,8 @@ GetArgsMips64el(GetArgsCtx , ArgItem Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); +Error error; + // get the current stack pointer uint64_t sp = ctx.reg_ctx->GetSP(); @@ -402,7 +413,6 @@ GetArgsMips64el(GetArgsCtx , ArgItem // clear all 64bits arg.value = 0; // read this argument from memory -Error error; size_t bytes_read = ctx.process->ReadMemory(sp, , arg_size, error); success = (error.Success() && bytes_read == arg_size); // advance the stack pointer @@ -412,7 +422,8 @@ GetArgsMips64el(GetArgsCtx , ArgItem if (!success) { if (log) -log->Printf("%s - error reading argument: %" PRIu64, __FUNCTION__, uint64_t(i)); +log->Printf("%s - error reading argument: %" PRIu64", reason: %s", +__FUNCTION__, uint64_t(i), error.AsCString("n/a")); return false; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r263129 - [Renderscript] Explicitly set the language to evaluate allocations
Author: aidandodds Date: Thu Mar 10 11:23:33 2016 New Revision: 263129 URL: http://llvm.org/viewvc/llvm-project?rev=263129=rev Log: [Renderscript] Explicitly set the language to evaluate allocations Currently it is not specified, and since allocations are usually requested once we hit a renderscript breakpoint, the language will be inferred being as renderscript by the ExpressionParser. Actually allocations attempt to invoke functions part of the RS runtime, written in C/C++, so evaluating the calls in RenderScript could be misleading. In particular, in MIPS, the ABI between C/C++ (mips o32) and renderscript (arm) might introduce subtle bugs when evaluating such expressions. This change explicitly sets the language used to evaluate the allocations as C++. Committed on behalf of: Dean De LeoModified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=263129=263128=263129=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Mar 10 11:23:33 2016 @@ -1457,8 +1457,10 @@ RenderScriptRuntime::EvalRSExpression(co log->Printf("%s(%s)", __FUNCTION__, expression); ValueObjectSP expr_result; +EvaluateExpressionOptions options; +options.SetLanguage(lldb::eLanguageTypeC_plus_plus); // Perform the actual expression evaluation -GetProcess()->GetTarget().EvaluateExpression(expression, frame_ptr, expr_result); +GetProcess()->GetTarget().EvaluateExpression(expression, frame_ptr, expr_result, options); if (!expr_result) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r262041 - Fix bug with register values byte order in expression evaluation.
Sorry about the breakage, and thanks for working on a patch Chaoren. Hopefully Marianne will revise her merge request if this fix is still important for her. On 28/02/2016 00:06, Todd Fiala wrote: I brought the state of the lines changed there to what they were prior to the change. If you adjusted those same lines, then yes that got undone. We were failing different tests in those files. Your change may have fixed the new issues on Linux, but did not address the new failures on OS X. The OS X bot went green after the revert. -Todd On Feb 27, 2016, at 4:01 PM, Chaoren Lin <chaor...@google.com <mailto:chaor...@google.com>> wrote: I thought I fixed it with http://reviews.llvm.org/D17658. Did you revert that as well? On Sat, Feb 27, 2016 at 3:14 PM, Todd Fiala <todd.fi...@gmail.com <mailto:todd.fi...@gmail.com>> wrote: Hi all, The new assert was failing on the OS X testbot here: http://lab.llvm.org:8080/green/job/lldb_build_test/ The nag mail didn't make it to you since we have it only fire on the transition from good build to bad build, and Tamas had the privilege of earning that with a minor Xcode breakage just shortly before this issue showed up. However, that bot as been broken since this change went in. I reverted it in r262156. Feel free to reapply if you have a suggested fix for the test failure introduced. Thanks! -Todd On Fri, Feb 26, 2016 at 12:08 PM, Chaoren Lin via lldb-commits <lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org>> wrote: Hmm. Weird. That assert is failing on Linux: http://lab.llvm.org:8011/builders/lldb-x86_64-ubuntu-14.04-cmake/builds/11833 On Fri, Feb 26, 2016 at 9:40 AM, Aidan Dodds via lldb-commits <lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org>> wrote: Author: aidandodds Date: Fri Feb 26 11:40:50 2016 New Revision: 262041 URL: http://llvm.org/viewvc/llvm-project?rev=262041=rev Log: Fix bug with register values byte order in expression evaluation. The evaluation of expressions containing register values was broken for targets for which endianness differs from host. Committed on behalf of: mamai <marianne.mailhot.sarra...@gmail.com <mailto:marianne.mailhot.sarra...@gmail.com>> Differential revision: http://reviews.llvm.org/D17167 Modified: lldb/trunk/source/Expression/Materializer.cpp Modified: lldb/trunk/source/Expression/Materializer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262041=262040=262041=diff == --- lldb/trunk/source/Expression/Materializer.cpp (original) +++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 11:40:50 2016 @@ -26,6 +26,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/LLDBAssert.h" using namespace lldb_private; @@ -1275,9 +1276,14 @@ public: m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize())); Error write_error; - - map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error); - + +Scalar scalar; + reg_value.GetScalarValue(scalar); + + lldbassert(scalar.GetByteSize() == register_data.GetByteSize()); + + map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error); + if (!write_error.Success()) { err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name <http://m_register_info.name>, write_error.AsCString()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits -- -Todd
[Lldb-commits] [lldb] r262043 - remove unused local string in IRForTarget.cpp
Author: aidandodds Date: Fri Feb 26 12:03:06 2016 New Revision: 262043 URL: http://llvm.org/viewvc/llvm-project?rev=262043=rev Log: remove unused local string in IRForTarget.cpp Committed on behalf of: ldrummDifferential revision: http://reviews.llvm.org/D16412 Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp?rev=262043=262042=262043=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp Fri Feb 26 12:03:06 2016 @@ -134,8 +134,6 @@ IRForTarget::FixFunctionLinkage(llvm::Fu { llvm_function.setLinkage(GlobalValue::ExternalLinkage); -std::string name = llvm_function.getName().str(); - return true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16412: remove unused local string in IRForTarget.cpp
ADodds added a subscriber: ADodds. ADodds accepted this revision. ADodds added a reviewer: ADodds. ADodds added a comment. This revision is now accepted and ready to land. I'm happy to commit this for you. http://reviews.llvm.org/D16412 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r262041 - Fix bug with register values byte order in expression evaluation.
Author: aidandodds Date: Fri Feb 26 11:40:50 2016 New Revision: 262041 URL: http://llvm.org/viewvc/llvm-project?rev=262041=rev Log: Fix bug with register values byte order in expression evaluation. The evaluation of expressions containing register values was broken for targets for which endianness differs from host. Committed on behalf of: mamaiDifferential revision: http://reviews.llvm.org/D17167 Modified: lldb/trunk/source/Expression/Materializer.cpp Modified: lldb/trunk/source/Expression/Materializer.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/Materializer.cpp?rev=262041=262040=262041=diff == --- lldb/trunk/source/Expression/Materializer.cpp (original) +++ lldb/trunk/source/Expression/Materializer.cpp Fri Feb 26 11:40:50 2016 @@ -26,6 +26,7 @@ #include "lldb/Target/StackFrame.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" +#include "lldb/Utility/LLDBAssert.h" using namespace lldb_private; @@ -1275,9 +1276,14 @@ public: m_register_contents.reset(new DataBufferHeap(register_data.GetDataStart(), register_data.GetByteSize())); Error write_error; - -map.WriteMemory(load_addr, register_data.GetDataStart(), register_data.GetByteSize(), write_error); - + +Scalar scalar; +reg_value.GetScalarValue(scalar); + +lldbassert(scalar.GetByteSize() == register_data.GetByteSize()); + +map.WriteScalarToMemory(load_addr, scalar, scalar.GetByteSize(), write_error); + if (!write_error.Success()) { err.SetErrorStringWithFormat("couldn't write the contents of register %s: %s", m_register_info.name, write_error.AsCString()); ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r262021 - Add mips32 software breakpoints into platform::GetSoftwareBreakpointTrapOpcode().
Author: aidandodds Date: Fri Feb 26 09:11:01 2016 New Revision: 262021 URL: http://llvm.org/viewvc/llvm-project?rev=262021=rev Log: Add mips32 software breakpoints into platform::GetSoftwareBreakpointTrapOpcode(). The software breakpoint definitions for mips32 should have been included in my recent patch that moved the software breakpoint definitions into the base platform class. Modified: lldb/trunk/source/Target/Platform.cpp Modified: lldb/trunk/source/Target/Platform.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=262021=262020=262021=diff == --- lldb/trunk/source/Target/Platform.cpp (original) +++ lldb/trunk/source/Target/Platform.cpp Fri Feb 26 09:11:01 2016 @@ -2096,6 +2096,7 @@ Platform::GetSoftwareBreakpointTrapOpcod } break; +case llvm::Triple::mips: case llvm::Triple::mips64: { static const uint8_t g_hex_opcode[] = {0x00, 0x00, 0x00, 0x0d}; @@ -2104,6 +2105,7 @@ Platform::GetSoftwareBreakpointTrapOpcod } break; +case llvm::Triple::mipsel: case llvm::Triple::mips64el: { static const uint8_t g_hex_opcode[] = {0x0d, 0x00, 0x00, 0x00}; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261861 - Improve readability and performance of ClangExpressionParser::FindFunctionInModule
Author: aidandodds Date: Thu Feb 25 07:07:04 2016 New Revision: 261861 URL: http://llvm.org/viewvc/llvm-project?rev=261861=rev Log: Improve readability and performance of ClangExpressionParser::FindFunctionInModule Committed on behalf of: Luke Drummond Differential Revision: http://reviews.llvm.org/D17274 Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Modified: lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp?rev=261861=261860=261861=diff == --- lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (original) +++ lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp Thu Feb 25 07:07:04 2016 @@ -542,13 +542,12 @@ static bool FindFunctionInModule (ConstS llvm::Module *module, const char *orig_name) { -for (llvm::Module::iterator fi = module->getFunctionList().begin(), fe = module->getFunctionList().end(); - fi != fe; - ++fi) +for (const auto : module->getFunctionList()) { -if (fi->getName().str().find(orig_name) != std::string::npos) +const StringRef = func.getName(); +if (name.find(orig_name) != StringRef::npos) { -mangled_name.SetCString(fi->getName().str().c_str()); +mangled_name.SetString(name); return true; } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r261741 - [Renderscript] Change expression strings to use portable format specifiers.
Author: aidandodds Date: Wed Feb 24 08:17:33 2016 New Revision: 261741 URL: http://llvm.org/viewvc/llvm-project?rev=261741=rev Log: [Renderscript] Change expression strings to use portable format specifiers. Mips64 tests were failing on windows because the sscanf implementation differs between clang/gcc/msvc such that on windows %lx specifies a 32bits parameter and %llx is for 64bits. For us this meant that 64bit pointers were being truncated to 32bits on their way into a JIT'd expression. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=261741=261740=261741=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Feb 24 08:17:33 2016 @@ -1531,38 +1531,42 @@ JITTemplate(ExpressionStrings e) // Format strings containing the expressions we may need to evaluate. static std::array runtimeExpressions = {{ // Mangled GetOffsetPointer(Allocation*, xoff, yoff, zoff, lod, cubemap) - "(int*)_Z12GetOffsetPtrPKN7android12renderscript10AllocationE23RsAllocationCubemapFace(0x%lx, %u, %u, %u, 0, 0)", + "(int*)_Z12GetOffsetPtrPKN7android12renderscript10AllocationE23RsAllocationCubemapFace" + "(0x%" PRIx64 ", %" PRIu32 ", %" PRIu32 ", %" PRIu32 ", 0, 0)", // Type* rsaAllocationGetType(Context*, Allocation*) - "(void*)rsaAllocationGetType(0x%lx, 0x%lx)", + "(void*)rsaAllocationGetType(0x%" PRIx64 ", 0x%" PRIx64 ")", // 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 - "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); data[0]", // X dim - "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); data[1]", // Y dim - "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); data[2]", // Z dim - "uint%u_t data[6]; (void*)rsaTypeGetNativeData(0x%lx, 0x%lx, data, 6); data[5]", // Element ptr + "uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 6); data[0]", // X dim + "uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 6); data[1]", // Y dim + "uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 6); data[2]", // Z dim + "uint%" PRIu32 "_t data[6]; (void*)rsaTypeGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 6); data[5]", // Element ptr // rsaElementGetNativeData(Context*, Element*, uint32_t* elemData,size) // Pack mType; mKind; mNormalized; mVectorSize; NumSubElements into elemData - "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); data[0]", // Type - "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); data[1]", // Kind - "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); data[3]", // Vector Size - "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%lx, 0x%lx, data, 5); data[4]", // Field Count - - // rsaElementGetSubElements(RsContext con, RsElement elem, uintptr_t *ids, const char **names, - // size_t *arraySizes, uint32_t dataSize) - // Needed for Allocations of structs to gather details about fields/Subelements - "void *ids[%u]; const char *names[%u]; size_t arr_size[%u];" - "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); ids[%u]", // Element* of field - - "void *ids[%u]; const char *names[%u]; size_t arr_size[%u];" - "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); names[%u]", // Name of field - - "void *ids[%u]; const char *names[%u]; size_t arr_size[%u];" - "(void*)rsaElementGetSubElements(0x%lx, 0x%lx, ids, names, arr_size, %u); arr_size[%u]" // Array size of field + "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 5); data[0]", // Type + "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 5); data[1]", // Kind + "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 5); data[3]", // Vector Size + "uint32_t data[5]; (void*)rsaElementGetNativeData(0x%" PRIx64 ", 0x%" PRIx64 ", data, 5); data[4]", //
[Lldb-commits] [lldb] r261536 - Refactor GetSoftwareBreakpointTrapOpcode
Author: aidandodds Date: Mon Feb 22 11:29:56 2016 New Revision: 261536 URL: http://llvm.org/viewvc/llvm-project?rev=261536=rev Log: Refactor GetSoftwareBreakpointTrapOpcode This patch aims to reduce the code duplication among all of the platforms in GetSoftwareBreakpointTrapOpcode by pushing all common code into the Platform base class. Differential Revision: http://reviews.llvm.org/D17395 Modified: lldb/trunk/include/lldb/Target/Platform.h lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp lldb/trunk/source/Plugins/Platform/NetBSD/PlatformNetBSD.h lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.cpp lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h lldb/trunk/source/Target/Platform.cpp Modified: lldb/trunk/include/lldb/Target/Platform.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=261536=261535=261536=diff == --- lldb/trunk/include/lldb/Target/Platform.h (original) +++ lldb/trunk/include/lldb/Target/Platform.h Mon Feb 22 11:29:56 2016 @@ -427,7 +427,7 @@ class ModuleCache; virtual size_t GetSoftwareBreakpointTrapOpcode (Target , - BreakpointSite *bp_site) = 0; + BreakpointSite *bp_site); //-- /// Launch a new process on a platform, not necessarily for Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=261536=261535=261536=diff == --- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original) +++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Mon Feb 22 11:29:56 2016 @@ -614,84 +614,32 @@ PlatformFreeBSD::GetStatus (Stream size_t PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode (Target , BreakpointSite *bp_site) { -ArchSpec arch = target.GetArchitecture(); -const uint8_t *trap_opcode = NULL; -size_t trap_opcode_size = 0; - -switch (arch.GetMachine()) +switch (target.GetArchitecture().GetMachine()) { -default: -assert(false && "Unhandled architecture in PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode()"); -break; -case llvm::Triple::aarch64: -{ -static const uint8_t g_aarch64_opcode[] = { 0x00, 0x00, 0x20, 0xd4 }; -trap_opcode = g_aarch64_opcode; -trap_opcode_size = sizeof(g_aarch64_opcode); -} -break; -// TODO: support big-endian arm and thumb trap codes. case llvm::Triple::arm: { -static const uint8_t g_arm_breakpoint_opcode[] = { 0xfe, 0xde, 0xff, 0xe7 }; -static const uint8_t g_thumb_breakpoint_opcode[] = { 0x01, 0xde }; - -lldb::BreakpointLocationSP bp_loc_sp (bp_site->GetOwnerAtIndex (0)); +lldb::BreakpointLocationSP bp_loc_sp(bp_site->GetOwnerAtIndex(0)); AddressClass addr_class = eAddressClassUnknown; if (bp_loc_sp) -addr_class = bp_loc_sp->GetAddress ().GetAddressClass (); +{ +addr_class = bp_loc_sp->GetAddress().GetAddressClass(); +if (addr_class == eAddressClassUnknown && (bp_loc_sp->GetAddress().GetFileAddress() & 1)) +addr_class = eAddressClassCodeAlternateISA; +} -if (addr_class == eAddressClassCodeAlternateISA -|| (addr_class == eAddressClassUnknown && (bp_site->GetLoadAddress() & 1))) +if (addr_class == eAddressClassCodeAlternateISA) { // TODO: Enable when FreeBSD supports thumb breakpoints. // FreeBSD kernel as of 10.x, does not support thumb breakpoints -trap_opcode = g_thumb_breakpoint_opcode; -trap_opcode_size = 0; +return 0; } -else -{ -trap_opcode = g_arm_breakpoint_opcode; -trap_opcode_size = sizeof(g_arm_breakpoint_opcode); -} -} -break; -case llvm::Triple::mips64: -{ -static const uint8_t g_hex_opcode[] = { 0x00, 0x00, 0x00, 0x0d }; -trap_opcode = g_hex_opcode; -trap_opcode_size = sizeof(g_hex_opcode); -} -break; -case llvm::Triple::mips64el: -{ -static const uint8_t g_hex_opcode[] = { 0x0d, 0x00, 0x00, 0x00 }; -
[Lldb-commits] [PATCH] D17395: Refactor GetSoftwareBreakpointTrapOpcode
ADodds created this revision. ADodds added reviewers: clayborg, emaste, ted, zturner, jasonmolenda. ADodds added a subscriber: lldb-commits. ADodds set the repository for this revision to rL LLVM. Herald added a subscriber: emaste. This patch aims to reduce the code duplication among all of the platforms in GetSoftwareBreakpointTrapOpcode. Common code has been pushed into the Platform base class, and only special case platform code has been left in the derived platforms. When remote debugging it can be the case that your current host platform will be queried for the trap opcode to use on the target, which currently lead to different results depending on the host lldb is running on. With this patch, platforms have a more unified view of trap opcodes for targets. Some platforms however have specific/special case requirements so I should not have effected their functionality. Do others think this is a usefull refactor, or have suggestions/feedback? Repository: rL LLVM http://reviews.llvm.org/D17395 Files: include/lldb/Target/Platform.h source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp source/Plugins/Platform/Linux/PlatformLinux.cpp source/Plugins/Platform/Linux/PlatformLinux.h source/Plugins/Platform/MacOSX/PlatformDarwin.cpp source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp source/Plugins/Platform/NetBSD/PlatformNetBSD.h source/Plugins/Platform/Windows/PlatformWindows.cpp source/Plugins/Platform/Windows/PlatformWindows.h source/Target/Platform.cpp Index: source/Target/Platform.cpp === --- source/Target/Platform.cpp +++ source/Target/Platform.cpp @@ -19,6 +19,7 @@ // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointIDList.h" +#include "lldb/Breakpoint/BreakpointLocation.h" #include "lldb/Core/DataBufferHeap.h" #include "lldb/Core/Debugger.h" #include "lldb/Core/Error.h" @@ -2087,3 +2088,105 @@ error.Clear(); return 0; } + +size_t +Platform::GetSoftwareBreakpointTrapOpcode(Target , BreakpointSite *bp_site) +{ +ArchSpec arch = target.GetArchitecture(); +const uint8_t *trap_opcode = nullptr; +size_t trap_opcode_size = 0; + +switch (arch.GetMachine()) +{ +case llvm::Triple::aarch64: +{ +static const uint8_t g_aarch64_opcode[] = {0x00, 0x00, 0x20, 0xd4}; +trap_opcode = g_aarch64_opcode; +trap_opcode_size = sizeof(g_aarch64_opcode); +} +break; + +// TODO: support big-endian arm and thumb trap codes. +case llvm::Triple::arm: +{ +// The ARM reference recommends the use of 0xe7fddefe and 0xdefe +// but the linux kernel does otherwise. +static const uint8_t g_arm_breakpoint_opcode[] = {0xf0, 0x01, 0xf0, 0xe7}; +static const uint8_t g_thumb_breakpoint_opcode[] = {0x01, 0xde}; + +lldb::BreakpointLocationSP bp_loc_sp(bp_site->GetOwnerAtIndex(0)); +AddressClass addr_class = eAddressClassUnknown; + +if (bp_loc_sp) +{ +addr_class = bp_loc_sp->GetAddress().GetAddressClass(); +if (addr_class == eAddressClassUnknown && (bp_loc_sp->GetAddress().GetFileAddress() & 1)) +addr_class = eAddressClassCodeAlternateISA; +} + +if (addr_class == eAddressClassCodeAlternateISA) +{ +trap_opcode = g_thumb_breakpoint_opcode; +trap_opcode_size = sizeof(g_thumb_breakpoint_opcode); +} +else +{ +trap_opcode = g_arm_breakpoint_opcode; +trap_opcode_size = sizeof(g_arm_breakpoint_opcode); +} +} +break; + +case llvm::Triple::mips64: +{ +static const uint8_t g_hex_opcode[] = {0x00, 0x00, 0x00, 0x0d}; +trap_opcode = g_hex_opcode; +trap_opcode_size = sizeof(g_hex_opcode); +} +break; + +case llvm::Triple::mips64el: +{ +static const uint8_t g_hex_opcode[] = {0x0d, 0x00, 0x00, 0x00}; +trap_opcode = g_hex_opcode; +trap_opcode_size = sizeof(g_hex_opcode); +} +break; + +case llvm::Triple::hexagon: +{ +static const uint8_t g_hex_opcode[] = {0x0c, 0xdb, 0x00, 0x54}; +trap_opcode = g_hex_opcode; +trap_opcode_size = sizeof(g_hex_opcode); +} +break; + +case llvm::Triple::ppc: +case llvm::Triple::ppc64: +{ +static const uint8_t g_ppc_opcode[] = {0x7f, 0xe0, 0x00, 0x08}; +trap_opcode = g_ppc_opcode; +trap_opcode_size = sizeof(g_ppc_opcode); +} +break; + +case llvm::Triple::x86: +case llvm::Triple::x86_64: +{ +static const uint8_t g_i386_opcode[] = {0xCC}; +trap_opcode = g_i386_opcode; +
[Lldb-commits] [lldb] r261202 - [Renderscript] Refactor .rs.info parser.
Author: aidandodds Date: Thu Feb 18 04:59:46 2016 New Revision: 261202 URL: http://llvm.org/viewvc/llvm-project?rev=261202=rev Log: [Renderscript] Refactor .rs.info parser. This patch refactors the .rs.info table parser so that its more in line with the current language runtime code. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=261202=261201=261202=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Feb 18 04:59:46 2016 @@ -2644,84 +2644,98 @@ RenderScriptRuntime::Update() // The maximum line length of an .rs.info packet #define MAXLINE 500 +#define STRINGIFY(x) #x +#define MAXLINESTR_(x) "%" STRINGIFY(x) "s" +#define MAXLINESTR MAXLINESTR_(MAXLINE) // 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. bool RSModuleDescriptor::ParseRSInfo() { +assert(m_module); const Symbol *info_sym = m_module->FindFirstSymbolWithNameAndType(ConstString(".rs.info"), eSymbolTypeData); -if (info_sym) -{ -const addr_t addr = info_sym->GetAddressRef().GetFileAddress(); -const addr_t size = info_sym->GetByteSize(); -const FileSpec fs = m_module->GetFileSpec(); +if (!info_sym) +return false; -DataBufferSP buffer = fs.ReadFileContents(addr, size); +const addr_t addr = info_sym->GetAddressRef().GetFileAddress(); +if (addr == LLDB_INVALID_ADDRESS) +return false; + +const addr_t size = info_sym->GetByteSize(); +const FileSpec fs = m_module->GetFileSpec(); + +const DataBufferSP buffer = fs.ReadFileContents(addr, size); +if (!buffer) +return false; -if (!buffer) -return false; +// split rs.info. contents into lines +std::vector info_lines; +{ +const std::string info((const char *)buffer->GetBytes()); +for (size_t tail = 0; tail < info.size();) +{ +// find next new line or end of string +size_t head = info.find('\n', tail); +head = (head == std::string::npos) ? info.size() : head; +std::string line = info.substr(tail, head - tail); +// add to line list +info_lines.push_back(line); +tail = head + 1; +} +} -std::string info((const char *)buffer->GetBytes()); +std::arrayname = {'\0'}; +std::array value = {'\0'}; -std::vector info_lines; -size_t lpos = info.find('\n'); -while (lpos != std::string::npos) +// parse all text lines of .rs.info +for (auto line = info_lines.begin(); line != info_lines.end(); ++line) +{ +uint32_t numDefns = 0; +if (sscanf(line->c_str(), "exportVarCount: %" PRIu32 "", ) == 1) { -info_lines.push_back(info.substr(0, lpos)); -info = info.substr(lpos + 1); -lpos = info.find('\n'); +while (numDefns--) +m_globals.push_back(RSGlobalDescriptor(this, (++line)->c_str())); } -size_t offset = 0; -while (offset < info_lines.size()) +else if (sscanf(line->c_str(), "exportForEachCount: %" PRIu32 "", ) == 1) { -std::string line = info_lines[offset]; -// Parse directives -uint32_t numDefns = 0; -if (sscanf(line.c_str(), "exportVarCount: %" PRIu32 "", ) == 1) -{ -while (numDefns--) -m_globals.push_back(RSGlobalDescriptor(this, info_lines[++offset].c_str())); -} -else if (sscanf(line.c_str(), "exportFuncCount: %" PRIu32 "", ) == 1) +while (numDefns--) { -} -else if (sscanf(line.c_str(), "exportForEachCount: %" PRIu32 "", ) == 1) -{ -char name[MAXLINE]; -while (numDefns--) +uint32_t slot = 0; +name[0] = '\0'; +static const char *fmt_s = "%" PRIu32 " - " MAXLINESTR; +if (sscanf((++line)->c_str(), fmt_s, , name.data()) == 2) { -uint32_t slot = 0; -name[0] = '\0'; -if (sscanf(info_lines[++offset].c_str(), "%" PRIu32 " - %s", , [0]) == 2) -{ -m_kernels.push_back(RSKernelDescriptor(this,
[Lldb-commits] [lldb] r260525 - [Renderscript] Refactor target argument reading code.
Author: aidandodds Date: Thu Feb 11 09:16:37 2016 New Revision: 260525 URL: http://llvm.org/viewvc/llvm-project?rev=260525=rev Log: [Renderscript] Refactor target argument reading code. This patch reworks the function argument reading code, allowing us to annotate arguments with their types. The type/size information is needed to correctly parse arguments passed on the stack. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=260525=260524=260525=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Feb 11 09:16:37 2016 @@ -112,6 +112,360 @@ protected: type_t data; }; +// ArgItem is used by the GetArgs() function when reading function arguments from the target. +struct ArgItem +{ +enum +{ +ePointer, +eInt32, +eInt64, +eLong, +eBool +} type; + +uint64_t value; + +explicit operator uint64_t() const { return value; } +}; + +// Context structure to be passed into GetArgsXXX(), argument reading functions below. +struct GetArgsCtx +{ +RegisterContext *reg_ctx; +Process *process; +}; + +bool +GetArgsX86(const GetArgsCtx , ArgItem *arg_list, size_t num_args) +{ +Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + +// get the current stack pointer +uint64_t sp = ctx.reg_ctx->GetSP(); + +for (size_t i = 0; i < num_args; ++i) +{ +ArgItem = arg_list[i]; +// advance up the stack by one argument +sp += sizeof(uint32_t); +// get the argument type size +size_t arg_size = sizeof(uint32_t); +// read the argument from memory +arg.value = 0; +Error error; +size_t read = ctx.process->ReadMemory(sp, , sizeof(uint32_t), error); +if (read != arg_size || !error.Success()) +{ +if (log) +log->Printf("%s - error reading argument: %" PRIu64 " '%s'", __FUNCTION__, uint64_t(i), +error.AsCString()); +return false; +} +} +return true; +} + +bool +GetArgsX86_64(GetArgsCtx , ArgItem *arg_list, size_t num_args) +{ +Log *log = GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE); + +// number of arguments passed in registers +static const uint32_t c_args_in_reg = 6; +// register passing order +static const std::array c_reg_names = {"rdi", "rsi", "rdx", "rcx", "r8", "r9"}; +// argument type to size mapping +static const std::arrayarg_size = { +8, // ePointer, +4, // eInt32, +8, // eInt64, +8, // eLong, +4, // eBool, +}; + +// get the current stack pointer +uint64_t sp = ctx.reg_ctx->GetSP(); +// step over the return address +sp += sizeof(uint64_t); + +// check the stack alignment was correct (16 byte aligned) +if ((sp & 0xf) != 0x0) +{ +if (log) +log->Printf("%s - stack misaligned", __FUNCTION__); +return false; +} + +// find the start of arguments on the stack +uint64_t sp_offset = 0; +for (uint32_t i = c_args_in_reg; i < num_args; ++i) +{ +sp_offset += arg_size[arg_list[i].type]; +} +// round up to multiple of 16 +sp_offset = (sp_offset + 0xf) & 0xf; +sp += sp_offset; + +for (size_t i = 0; i < num_args; ++i) +{ +bool success = false; +ArgItem = arg_list[i]; +// arguments passed in registers +if (i < c_args_in_reg) +{ +const RegisterInfo *rArg = ctx.reg_ctx->GetRegisterInfoByName(c_reg_names[i]); +RegisterValue rVal; +if (ctx.reg_ctx->ReadRegister(rArg, rVal)) +arg.value = rVal.GetAsUInt64(0, ); +} +// arguments passed on the stack +else +{ +// get the argument type size +const size_t size = arg_size[arg_list[i].type]; +// read the argument from memory +arg.value = 0; +// note: due to little endian layout reading 4 or 8 bytes will give the correct value. +Error error; +size_t read = ctx.process->ReadMemory(sp, , size, error); +success = (error.Success() && read==size); +// advance past this argument +sp -= size; +} +// fail if we couldn't read this
[Lldb-commits] [lldb] r260546 - [Renderscript] Fix typo in mips64 argument reading code.
Author: aidandodds Date: Thu Feb 11 11:17:12 2016 New Revision: 260546 URL: http://llvm.org/viewvc/llvm-project?rev=260546=rev Log: [Renderscript] Fix typo in mips64 argument reading code. A typo in the mips64 argument reading code would cause register passed arguments to be truncated to 32bits. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=260546=260545=260546=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Feb 11 11:17:12 2016 @@ -392,7 +392,7 @@ GetArgsMips64el(GetArgsCtx , ArgItem const RegisterInfo *rArg = ctx.reg_ctx->GetRegisterInfoAtIndex(i + c_reg_offset); RegisterValue rVal; if (ctx.reg_ctx->ReadRegister(rArg, rVal)) -arg.value = rVal.GetAsUInt32(0, ); +arg.value = rVal.GetAsUInt64(0, ); } // arguments passed on the stack else ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r259042 - Fix const cast error for MSVC2015 build.
Author: aidandodds Date: Thu Jan 28 07:05:21 2016 New Revision: 259042 URL: http://llvm.org/viewvc/llvm-project?rev=259042=rev Log: Fix const cast error for MSVC2015 build. The Visual Studio 2015 build was failing with the following error: error C2440: 'initializing': cannot convert from 'const char [12]' to 'char *' This should fix the problem by initializing a non const char array, instead of taking a pointer to const static data. Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Modified: lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp?rev=259042=259041=259042=diff == --- lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp (original) +++ lldb/trunk/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Thu Jan 28 07:05:21 2016 @@ -146,7 +146,7 @@ private: size_t size = 0; static wchar_t *g_python_home = Py_DecodeLocale(LLDB_PYTHON_HOME, ); #else -static char *g_python_home = LLDB_PYTHON_HOME; +static char g_python_home[] = LLDB_PYTHON_HOME; #endif Py_SetPythonHome(g_python_home); #endif ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r257772 - [RenderScript] Hook kernel invocation.
Author: aidandodds Date: Thu Jan 14 09:39:28 2016 New Revision: 257772 URL: http://llvm.org/viewvc/llvm-project?rev=257772=rev Log: [RenderScript] Hook kernel invocation. This patch adds a hook to track kernel invocations and to track all script and allocation objects used. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=257772=257771=257772=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Jan 14 09:39:28 2016 @@ -581,28 +581,12 @@ const RenderScriptRuntime::HookDefn Rend _private::RenderScriptRuntime::CaptureScriptInit1 // handler }, { -"rsdScriptInvokeForEach", // name - "_Z22rsdScriptInvokeForEachPKN7android12renderscript7ContextEPNS0_6ScriptEjPKNS0_10AllocationEPS6_PKvjPK12RsScriptCall", // symbol name 32bit - "_Z22rsdScriptInvokeForEachPKN7android12renderscript7ContextEPNS0_6ScriptEjPKNS0_10AllocationEPS6_PKvmPK12RsScriptCall", // symbol name 64bit -0, // version -RenderScriptRuntime::eModuleKindDriver, // type -nullptr // handler -}, -{ "rsdScriptInvokeForEachMulti", // name "_Z27rsdScriptInvokeForEachMultiPKN7android12renderscript7ContextEPNS0_6ScriptEjPPKNS0_10AllocationEjPS6_PKvjPK12RsScriptCall", // symbol name 32bit "_Z27rsdScriptInvokeForEachMultiPKN7android12renderscript7ContextEPNS0_6ScriptEjPPKNS0_10AllocationEmPS6_PKvmPK12RsScriptCall", // symbol name 64bit 0, // version RenderScriptRuntime::eModuleKindDriver, // type -nullptr // handler -}, -{ -"rsdScriptInvokeFunction", // name - "_Z23rsdScriptInvokeFunctionPKN7android12renderscript7ContextEPNS0_6ScriptEjPKvj", // symbol name 32bit - "_Z23rsdScriptInvokeFunctionPKN7android12renderscript7ContextEPNS0_6ScriptEjPKvm", // symbol name 64bit -0, // version -RenderScriptRuntime::eModuleKindDriver, // type -nullptr // handler +_private::RenderScriptRuntime::CaptureScriptInvokeForEachMulti // handler }, { "rsdScriptSetGlobalVar", // name @@ -906,6 +890,119 @@ RenderScriptRuntime::GetArgSimple(Execut } void +RenderScriptRuntime::CaptureScriptInvokeForEachMulti(RuntimeHook* hook_info, + ExecutionContext& context) +{ +Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); + +struct args_t +{ +uint64_t context; // const Context *rsc +uint64_t script;// Script *s +uint64_t slot; // uint32_t slot +uint64_t aIns; // const Allocation **aIns +uint64_t inLen; // size_t inLen +uint64_t aOut; // Allocation *aout +uint64_t usr; // const void *usr +uint64_t usrLen;// size_t usrLen +uint64_t sc;// const RsScriptCall *sc +} +args; + +bool success = +GetArgSimple(context, 0, ) && +GetArgSimple(context, 1, ) && +GetArgSimple(context, 2, ) && +GetArgSimple(context, 3, ) && +GetArgSimple(context, 4, ) && +GetArgSimple(context, 5, ) && +GetArgSimple(context, 6, ) && +GetArgSimple(context, 7, ) && +GetArgSimple(context, 8, ); + +if (!success) +{ +if (log) + log->Printf("RenderScriptRuntime::CaptureScriptInvokeForEachMulti()" +" - Error while reading the function parameters"); +return; +} + +const uint32_t target_ptr_size = m_process->GetAddressByteSize(); +Error error; +std::vector allocs; + +// traverse allocation list +for (uint64_t i = 0; i < args.inLen; ++i) +{ +// calculate offest to allocation pointer +const lldb::addr_t addr = args.aIns + i * target_ptr_size; + +// Note: due to little endian layout, reading 32bits or 64bits into res64 will +// give the correct results. + +uint64_t res64 = 0; +size_t read = m_process->ReadMemory(addr, , target_ptr_size, error); +if (read != target_ptr_size || !error.Success()) +{ +if (log) + log->Printf("RenderScriptRuntime::CaptureScriptInvokeForEachMulti()" +" - Error while reading
[Lldb-commits] [lldb] r256941 - [Renderscript] Fix stack argument inspection.
Author: aidandodds Date: Wed Jan 6 09:43:52 2016 New Revision: 256941 URL: http://llvm.org/viewvc/llvm-project?rev=256941=rev Log: [Renderscript] Fix stack argument inspection. Function arguments that were spilled and passed on the stack were incorrectly read. The value was written back into the output pointer rather then the memory being pointed to. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=256941=256940=256941=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Wed Jan 6 09:43:52 2016 @@ -452,7 +452,7 @@ RenderScriptRuntime::GetPluginNameStatic return g_name; } -RenderScriptRuntime::ModuleKind +RenderScriptRuntime::ModuleKind RenderScriptRuntime::GetModuleKind(const lldb::ModuleSP _sp) { if (module_sp) @@ -493,7 +493,7 @@ RenderScriptRuntime::IsRenderScriptModul return GetModuleKind(module_sp) != eModuleKindIgnored; } -void +void RenderScriptRuntime::ModulesDidLoad(const ModuleList _list ) { Mutex::Locker locker (module_list.GetMutex ()); @@ -640,11 +640,11 @@ RenderScriptRuntime::HookCallback(void * RenderScriptRuntime *lang_rt = (RenderScriptRuntime *)context.GetProcessPtr()->GetLanguageRuntime(eLanguageTypeExtRenderScript); lang_rt->HookCallback(hook_info, context); - + return false; } -void +void RenderScriptRuntime::HookCallback(RuntimeHook* hook_info, ExecutionContext& context) { Log* log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_LANGUAGE)); @@ -652,7 +652,7 @@ RenderScriptRuntime::HookCallback(Runtim if (log) log->Printf ("RenderScriptRuntime::HookCallback - '%s' .", hook_info->defn->name); -if (hook_info->defn->grabber) +if (hook_info->defn->grabber) { (this->*(hook_info->defn->grabber))(hook_info, context); } @@ -706,7 +706,6 @@ RenderScriptRuntime::GetArgSimple(Execut *data = result; success = true; } - break; } case llvm::Triple::ArchType::x86_64: @@ -741,6 +740,7 @@ RenderScriptRuntime::GetArgSimple(Execut case llvm::Triple::ArchType::arm: { // arm 32 bit +// first 4 arguments are passed via registers if (arg < 4) { const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg); @@ -760,18 +760,19 @@ RenderScriptRuntime::GetArgSimple(Execut { uint64_t sp = reg_ctx->GetSP(); uint32_t offset = (arg-4) * sizeof(uint32_t); -process->ReadMemory(sp + offset, , sizeof(uint32_t), error); -if (error.Fail()) +uint32_t value = 0; +size_t bytes_read = process->ReadMemory(sp + offset, , sizeof(value), error); +if (error.Fail() || bytes_read != sizeof(value)) { if (log) log->Printf("RenderScriptRuntime::GetArgSimple - error reading ARM stack: %s.", error.AsCString()); } else { +*data = value; success = true; } } - break; } case llvm::Triple::ArchType::aarch64: @@ -803,8 +804,8 @@ RenderScriptRuntime::GetArgSimple(Execut } case llvm::Triple::ArchType::mipsel: { - // read from the registers +// first 4 arguments are passed in registers if (arg < 4){ const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg + 4); RegisterValue rVal; @@ -818,26 +819,25 @@ RenderScriptRuntime::GetArgSimple(Execut if (log) log->Printf("RenderScriptRuntime::GetArgSimple() - Mips - Error while reading the argument #%d", arg); } - } - -// read from the stack +// arguments > 4 are read from the stack else { uint64_t sp = reg_ctx->GetSP(); uint32_t offset = arg * sizeof(uint32_t); -process->ReadMemory(sp + offset, , sizeof(uint32_t), error); -if (error.Fail()) +uint32_t value = 0; +size_t bytes_read = process->ReadMemory(sp + offset, , sizeof(value), error); +if (error.Fail() || bytes_read != sizeof(value))
[Lldb-commits] [lldb] r255893 - Patch cmake to allow detection of python 2.7.9+
Author: aidandodds Date: Thu Dec 17 08:13:39 2015 New Revision: 255893 URL: http://llvm.org/viewvc/llvm-project?rev=255893=rev Log: Patch cmake to allow detection of python 2.7.9+ Some distributions of python have their version defined as follows in patchlevel.h (note the '+'): #define PY_VERSION "2.7.9+" The '+' char needs to be stripped by the cmake regex so that LLDBs python lib detection is successful. Differential Revision: http://reviews.llvm.org/D15566 Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=255893=255892=255893=diff == --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Dec 17 08:13:39 2015 @@ -71,8 +71,8 @@ function(find_python_libs_windows) if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h") file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") -string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" - PYTHONLIBS_VERSION_STRING "${python_version_str}") +string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}") string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}") unset(python_version_str) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D15566: Patch cmake to allow detection of python 2.7.9+
ADodds created this revision. ADodds added a reviewer: zturner. ADodds added a subscriber: lldb-commits. ADodds set the repository for this revision to rL LLVM. Some distributions of python have their version defined as follows in patchlevel.h (note the '+'): #define PY_VERSION "2.7.9+" The '+' char needs to be stripped by the cmake regex so that LLDBs python lib detection is successfull. Repository: rL LLVM http://reviews.llvm.org/D15566 Files: cmake/modules/LLDBConfig.cmake Index: cmake/modules/LLDBConfig.cmake === --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -71,8 +71,8 @@ if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h") file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") -string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" - PYTHONLIBS_VERSION_STRING "${python_version_str}") +string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}") string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}") unset(python_version_str) Index: cmake/modules/LLDBConfig.cmake === --- cmake/modules/LLDBConfig.cmake +++ cmake/modules/LLDBConfig.cmake @@ -71,8 +71,8 @@ if(EXISTS "${PYTHON_INCLUDE_DIRS}/patchlevel.h") file(STRINGS "${PYTHON_INCLUDE_DIRS}/patchlevel.h" python_version_str REGEX "^#define[ \t]+PY_VERSION[ \t]+\"[^\"]+\"") -string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"]+)\".*" "\\1" - PYTHONLIBS_VERSION_STRING "${python_version_str}") +string(REGEX REPLACE "^#define[ \t]+PY_VERSION[ \t]+\"([^\"+]+)[+]?\".*" "\\1" + PYTHONLIBS_VERSION_STRING "${python_version_str}") message("-- Found Python version ${PYTHONLIBS_VERSION_STRING}") string(REGEX REPLACE "([0-9]+)[.]([0-9]+)[.][0-9]+" "python\\1\\2" PYTHONLIBS_BASE_NAME "${PYTHONLIBS_VERSION_STRING}") unset(python_version_str) ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r255237 - Differential Revision: http://reviews.llvm.org/D15333
Author: aidandodds Date: Thu Dec 10 04:11:49 2015 New Revision: 255237 URL: http://llvm.org/viewvc/llvm-project?rev=255237=rev Log: Differential Revision: http://reviews.llvm.org/D15333 Modified: lldb/trunk/source/Core/DataExtractor.cpp Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=255237=255236=255237=diff == --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Thu Dec 10 04:11:49 2015 @@ -14,6 +14,7 @@ #include #include #include +#include #include "clang/AST/ASTContext.h" @@ -1405,24 +1406,21 @@ DumpAPInt (Stream *s, const DataExtracto return offset; } -static float half2float (uint16_t half) +static float +half2float (uint16_t half) { -#ifdef _MSC_VER -llvm_unreachable("half2float not implemented for MSVC"); -#else -union{ float f; uint32_tu;}u; +union { float f; uint32_t u; } u; int32_t v = (int16_t) half; - -if( 0 == (v & 0x7c00)) + +if (0 == (v & 0x7c00)) { u.u = v & 0x80007FFFU; return u.f * ldexpf(1, 125); } - + v <<= 13; u.u = v | 0x7000U; return u.f * ldexpf(1, -112); -#endif } lldb::offset_t ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r255237 - Differential Revision: http://reviews.llvm.org/D15333
Hi Tamas, Your right, sorry about that, I will be sure to add a commit message in the future. Thanks, Aidan On 10/12/2015 11:10, Tamas Berghammer wrote: Hi Aidan, Next time please add a commit message describing the change itself (next to the review link). In general I think copying the review title and the summary into the commit message is a good baseline. It will help us understand your change when somebody looking at git logs as we don't have to open an external link also. Thanks, Tamas On Thu, Dec 10, 2015 at 10:14 AM Aidan Dodds via lldb-commits <lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org>> wrote: Author: aidandodds Date: Thu Dec 10 04:11:49 2015 New Revision: 255237 URL: http://llvm.org/viewvc/llvm-project?rev=255237=rev Log: Differential Revision: http://reviews.llvm.org/D15333 Modified: lldb/trunk/source/Core/DataExtractor.cpp Modified: lldb/trunk/source/Core/DataExtractor.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=255237=255236=255237=diff == --- lldb/trunk/source/Core/DataExtractor.cpp (original) +++ lldb/trunk/source/Core/DataExtractor.cpp Thu Dec 10 04:11:49 2015 @@ -14,6 +14,7 @@ #include #include #include +#include #include "clang/AST/ASTContext.h" @@ -1405,24 +1406,21 @@ DumpAPInt (Stream *s, const DataExtracto return offset; } -static float half2float (uint16_t half) +static float +half2float (uint16_t half) { -#ifdef _MSC_VER -llvm_unreachable("half2float not implemented for MSVC"); -#else -union{ float f; uint32_tu;}u; +union { float f; uint32_t u; } u; int32_t v = (int16_t) half; - -if( 0 == (v & 0x7c00)) + +if (0 == (v & 0x7c00)) { u.u = v & 0x80007FFFU; return u.f * ldexpf(1, 125); } - + v <<= 13; u.u = v | 0x7000U; return u.f * ldexpf(1, -112); -#endif } lldb::offset_t ___ lldb-commits mailing list lldb-commits@lists.llvm.org <mailto:lldb-commits@lists.llvm.org> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D15333: Enable half2float() on windows.
ADodds added a comment. If there are no objections, are you happy to accept this? Repository: rL LLVM http://reviews.llvm.org/D15333 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r252914 - Allow renderscript runtime to read MIPS target arguments.
Author: aidandodds Date: Thu Nov 12 11:39:42 2015 New Revision: 252914 URL: http://llvm.org/viewvc/llvm-project?rev=252914=rev Log: Allow renderscript runtime to read MIPS target arguments. Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=252914=252913=252914=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Thu Nov 12 11:39:42 2015 @@ -665,6 +665,45 @@ RenderScriptRuntime::GetArgSimple(Execut } break; } +case llvm::Triple::ArchType::mipsel: +{ + +// read from the registers +if (arg < 4){ +const RegisterInfo* rArg = reg_ctx->GetRegisterInfoAtIndex(arg + 4); +RegisterValue rVal; +success = reg_ctx->ReadRegister(rArg, rVal); +if (success) +{ +*data = rVal.GetAsUInt64(); +} +else +{ +if (log) +log->Printf("RenderScriptRuntime::GetArgSimple() - Mips - Error while reading the argument #%d", arg); +} + +} + +// read from the stack +else +{ +uint64_t sp = reg_ctx->GetSP(); +uint32_t offset = arg * sizeof(uint32_t); +process->ReadMemory(sp + offset, , sizeof(uint32_t), error); +if (error.Fail()) +{ +if (log) +log->Printf ("RenderScriptRuntime::GetArgSimple - error reading Mips stack: %s.", error.AsCString()); +} +else +{ +success = true; +} +} + +break; +} case llvm::Triple::ArchType::mips64el: { // read from the registers @@ -883,11 +922,12 @@ RenderScriptRuntime::LoadRuntimeHooks(ll if (targetArchType != llvm::Triple::ArchType::x86 && targetArchType != llvm::Triple::ArchType::arm && targetArchType != llvm::Triple::ArchType::aarch64 +&& targetArchType != llvm::Triple::ArchType::mipsel && targetArchType != llvm::Triple::ArchType::mips64el ) { if (log) -log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to hook runtime. Only X86, ARM, Mips64 supported currently."); +log->Printf ("RenderScriptRuntime::LoadRuntimeHooks - Unable to hook runtime. Only X86, ARM, Mips supported currently."); return; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D14538: Fix DwarfSymbolFile when appending global functions from different modules
ADodds created this revision. ADodds added a reviewer: clayborg. ADodds added a subscriber: lldb-commits. ADodds set the repository for this revision to rL LLVM. This patch fixes a bug in SymbolFileDWARF::FindFunctions(), where functions may not be correctly found when appending to a list already containing some symbols. Upon entering this function, original_size is set to the size of sc_list, however the target code should be executed not when the list is empty but when this list has not grown during this function invocation. This patch corrects this problem. Running the lldb test suite shows no regressions caused by this change, and fixes Bug 25433. https://llvm.org/bugs/show_bug.cgi?id=25433 Repository: rL LLVM http://reviews.llvm.org/D14538 Files: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2711,7 +2711,7 @@ // TODO: The arch in the object file isn't correct for MSVC // binaries on windows, we should find a way to make it // correct and handle those symbols as well. -if (sc_list.GetSize() == 0) +if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && Index: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp === --- source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2711,7 +2711,7 @@ // TODO: The arch in the object file isn't correct for MSVC // binaries on windows, we should find a way to make it // correct and handle those symbols as well. -if (sc_list.GetSize() == 0) +if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r252605 - Differential Revision: http://reviews.llvm.org/D14538
Author: aidandodds Date: Tue Nov 10 08:10:57 2015 New Revision: 252605 URL: http://llvm.org/viewvc/llvm-project?rev=252605=rev Log: Differential Revision: http://reviews.llvm.org/D14538 Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=252605=252604=252605=diff == --- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original) +++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Tue Nov 10 08:10:57 2015 @@ -2711,7 +2711,7 @@ SymbolFileDWARF::FindFunctions (const Co // TODO: The arch in the object file isn't correct for MSVC // binaries on windows, we should find a way to make it // correct and handle those symbols as well. -if (sc_list.GetSize() == 0) +if (sc_list.GetSize() == original_size) { ArchSpec arch; if (!parent_decl_ctx && ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r251104 - Fix the build when building with LLDB_DISABLE_PYTHON.
Author: aidandodds Date: Fri Oct 23 05:27:16 2015 New Revision: 251104 URL: http://llvm.org/viewvc/llvm-project?rev=251104=rev Log: Fix the build when building with LLDB_DISABLE_PYTHON. Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Modified: lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp?rev=251104=251103=251104=diff == --- lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp (original) +++ lldb/trunk/tools/lldb-mi/MICmnLLDBDebugger.cpp Fri Oct 23 05:27:16 2015 @@ -58,8 +58,12 @@ static inline bool MI_add_summary(lldb::SBTypeCategory category, const char *typeName, lldb::SBTypeSummary::FormatCallback cb, uint32_t options, bool regex = false) { +#if defined(LLDB_DISABLE_PYTHON) +return false; +#else lldb::SBTypeSummary summary = lldb::SBTypeSummary::CreateWithCallback(cb, options); return summary.IsValid() ? category.AddTypeSummary(lldb::SBTypeNameSpecifier(typeName, regex), summary) : false; +#endif } //++ ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r248003 - Differential Revision: http://reviews.llvm.org/D12966
Author: aidandodds Date: Fri Sep 18 11:49:39 2015 New Revision: 248003 URL: http://llvm.org/viewvc/llvm-project?rev=248003=rev Log: Differential Revision: http://reviews.llvm.org/D12966 On behalf of Dean De Leo Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h Modified: lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp?rev=248003=248002=248003=diff == --- lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp (original) +++ lldb/trunk/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp Fri Sep 18 11:49:39 2015 @@ -210,15 +210,64 @@ RenderScriptRuntime::CreateExceptionReso const RenderScriptRuntime::HookDefn RenderScriptRuntime::s_runtimeHookDefns[] = { //rsdScript -{"rsdScriptInit", "_Z13rsdScriptInitPKN7android12renderscript7ContextEPNS0_7ScriptCEPKcS7_PKhjj", 0, RenderScriptRuntime::eModuleKindDriver, _private::RenderScriptRuntime::CaptureScriptInit1}, -{"rsdScriptInvokeForEach", "_Z22rsdScriptInvokeForEachPKN7android12renderscript7ContextEPNS0_6ScriptEjPKNS0_10AllocationEPS6_PKvjPK12RsScriptCall", 0, RenderScriptRuntime::eModuleKindDriver, nullptr}, -{"rsdScriptInvokeForEachMulti", "_Z27rsdScriptInvokeForEachMultiPKN7android12renderscript7ContextEPNS0_6ScriptEjPPKNS0_10AllocationEjPS6_PKvjPK12RsScriptCall", 0, RenderScriptRuntime::eModuleKindDriver, nullptr}, -{"rsdScriptInvokeFunction", "_Z23rsdScriptInvokeFunctionPKN7android12renderscript7ContextEPNS0_6ScriptEjPKvj", 0, RenderScriptRuntime::eModuleKindDriver, nullptr}, -{"rsdScriptSetGlobalVar", "_Z21rsdScriptSetGlobalVarPKN7android12renderscript7ContextEPKNS0_6ScriptEjPvj", 0, RenderScriptRuntime::eModuleKindDriver, _private::RenderScriptRuntime::CaptureSetGlobalVar1}, +{ +"rsdScriptInit", //name + "_Z13rsdScriptInitPKN7android12renderscript7ContextEPNS0_7ScriptCEPKcS7_PKhjj", // symbol name 32 bit + "_Z13rsdScriptInitPKN7android12renderscript7ContextEPNS0_7ScriptCEPKcS7_PKhmj", // symbol name 64 bit +0, // version +RenderScriptRuntime::eModuleKindDriver, // type +_private::RenderScriptRuntime::CaptureScriptInit1 // handler +}, +{ +"rsdScriptInvokeForEach", // name + "_Z22rsdScriptInvokeForEachPKN7android12renderscript7ContextEPNS0_6ScriptEjPKNS0_10AllocationEPS6_PKvjPK12RsScriptCall", // symbol name 32bit + "_Z22rsdScriptInvokeForEachPKN7android12renderscript7ContextEPNS0_6ScriptEjPKNS0_10AllocationEPS6_PKvmPK12RsScriptCall", // symbol name 64bit +0, // version +RenderScriptRuntime::eModuleKindDriver, // type +nullptr // handler +}, +{ +"rsdScriptInvokeForEachMulti", // name + "_Z27rsdScriptInvokeForEachMultiPKN7android12renderscript7ContextEPNS0_6ScriptEjPPKNS0_10AllocationEjPS6_PKvjPK12RsScriptCall", // symbol name 32bit + "_Z27rsdScriptInvokeForEachMultiPKN7android12renderscript7ContextEPNS0_6ScriptEjPPKNS0_10AllocationEmPS6_PKvmPK12RsScriptCall", // symbol name 64bit +0, // version +RenderScriptRuntime::eModuleKindDriver, // type +nullptr // handler +}, +{ +"rsdScriptInvokeFunction", // name + "_Z23rsdScriptInvokeFunctionPKN7android12renderscript7ContextEPNS0_6ScriptEjPKvj", // symbol name 32bit + "_Z23rsdScriptInvokeFunctionPKN7android12renderscript7ContextEPNS0_6ScriptEjPKvm", // symbol name 64bit +0, // version +RenderScriptRuntime::eModuleKindDriver, // type +nullptr // handler +}, +{ +"rsdScriptSetGlobalVar", // name + "_Z21rsdScriptSetGlobalVarPKN7android12renderscript7ContextEPKNS0_6ScriptEjPvj", // symbol name 32bit + "_Z21rsdScriptSetGlobalVarPKN7android12renderscript7ContextEPKNS0_6ScriptEjPvm", // symbol name 64bit +0, // version +RenderScriptRuntime::eModuleKindDriver, // type +_private::RenderScriptRuntime::CaptureSetGlobalVar1 // handler +}, //rsdAllocation -{"rsdAllocationInit", "_Z17rsdAllocationInitPKN7android12renderscript7ContextEPNS0_10AllocationEb", 0, RenderScriptRuntime::eModuleKindDriver, _private::RenderScriptRuntime::CaptureAllocationInit1}, -{"rsdAllocationRead2D", "_Z19rsdAllocationRead2DPKN7android12renderscript7ContextEPKNS0_10AllocationEjjj23RsAllocationCubemapFacejjPvjj", 0, RenderScriptRuntime::eModuleKindDriver, nullptr}, +{ +"rsdAllocationInit", // name + "_Z17rsdAllocationInitPKN7android12renderscript7ContextEPNS0_10AllocationEb", //