Re: [Lldb-commits] [PATCH] D16916: [LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS
On Thu, Feb 4, 2016 at 11:32 PM Bhushan Attarde via lldb-commits < lldb-commits@lists.llvm.org> wrote: > bhushan created this revision. > bhushan added a reviewer: clayborg. > bhushan added subscribers: lldb-commits, nitesh.jain, mohit.bhakkad, > sagar, jaydeep. > bhushan set the repository for this revision to rL LLVM. > > This test (TestExpressionInSyscall.py) checks if we are able to evaluate > expressions when the inferior is blocked in a syscall. > > As a part of expression evaluation LLDB checks for memory allocation on > target (by executing mmap). > So we setup call to mmap by setting argument registers and PC. > Now the process is stopped in the syscall and when it continue to allocate > memory, the system call is restarted. > > In MIPS, to restart a syscall, kernel decreases the PC by 4 so the > resulting PC now points to mmap-4 > and also register R7 that provides 'flags' argument to mmap gets clobbered > to 0 and hence mmap fails. > > A fix to this issue is to postpone the syscall restart until the > expression is evaluated. > In MIPS, register R0 controls syscall restart. This patch writes 0 into > register R0 when preparing call to mmap. > This setting avoids a syscall restart and prevents automatic decrement of > the PC so that expression can be evaluated correctly. > > Once the expression completes the registers are restored and program > resumes the interrupted syscall when the continue command is issued. > > This fixes TestExpressionInSyscall.py and solves bug 23659 for MIPS. > > Repository: > rL LLVM > > http://reviews.llvm.org/D16916 > > Files: > source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp > source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp > > Index: source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp > === > --- source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp > +++ source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp > @@ -207,6 +207,17 @@ > const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo > (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); > const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo > (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); > const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", > 0); > +const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", > 0); > + > +if (log) > +log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0); > Your indentation is wrong here. Please use clang-format on this patch. > + > +/* Write r0 with 0, in case we are stopped in syscall, > + * such setting prevents automatic decrement of the PC. > + * This clears the bug 23659 for MIPS. > +*/ > +if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0)) > +return false; > > if (log) > log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); > Index: source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp > === > --- source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp > +++ source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp > @@ -242,6 +242,17 @@ > const RegisterInfo *sp_reg_info = reg_ctx->GetRegisterInfo > (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_SP); > const RegisterInfo *ra_reg_info = reg_ctx->GetRegisterInfo > (eRegisterKindGeneric, LLDB_REGNUM_GENERIC_RA); > const RegisterInfo *r25_info = reg_ctx->GetRegisterInfoByName("r25", > 0); > +const RegisterInfo *r0_info = reg_ctx->GetRegisterInfoByName("zero", > 0); > + > +if (log) > +log->Printf("Writing R0: 0x%" PRIx64, (uint64_t)0); > Also wrong here. > + > +/* Write r0 with 0, in case we are stopped in syscall, > + * such setting prevents automatic decrement of the PC. > + * This clears the bug 23659 for MIPS. > +*/ > +if (!reg_ctx->WriteRegisterFromUnsigned (r0_info, (uint64_t)0)) > +return false; > > if (log) > log->Printf("Writing SP: 0x%" PRIx64, (uint64_t)sp); > > > ___ > lldb-commits mailing list > 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] D16858: Add verbose logging support to gdb-remote tests
:-) Okay. I'll attack that problem when I get ambitious and need a break from something else. On Fri, Feb 5, 2016 at 1:53 AM, Pavel Labathwrote: > On 5 February 2016 at 03:13, Todd Fiala wrote: > > True. > > > > Maybe I'll wait until then. > > Just don't hold your breath for too long. What I said is what I would > _like_ to do, but currently I don't see myself having enough time to > do that. If you want to do something sooner, then by all means, go > ahead. Maybe the easiest solution would be to put the decorator on > every test, as making it work on classes looks like a non-trivial job. > > pl > -- -Todd ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16916: [LLDB][MIPS] Fix TestExpressionInSyscall.py for MIPS
clayborg accepted this revision. clayborg added a comment. This revision is now accepted and ready to land. Sounds reasonable. Repository: rL LLVM http://reviews.llvm.org/D16916 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r259902 - Take 2: Use an artifical namespace so that member vars do not hide local vars.
Author: sivachandra Date: Fri Feb 5 13:10:04 2016 New Revision: 259902 URL: http://llvm.org/viewvc/llvm-project?rev=259902=rev Log: Take 2: Use an artifical namespace so that member vars do not hide local vars. Summary: This relands r259810 with fix for failures on Mac. Reviewers: spyffe, tfiala Subscribers: tfiala, lldb-commits Differential Revision: http://reviews.llvm.org/D16900 Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/main.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h lldb/trunk/include/lldb/Symbol/TypeSystem.h lldb/trunk/source/Expression/ExpressionSourceCode.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp lldb/trunk/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h lldb/trunk/source/Symbol/ClangASTContext.cpp lldb/trunk/source/Symbol/CompilerDeclContext.cpp lldb/trunk/source/Symbol/TypeSystem.cpp Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=259902=259901=259902=diff == --- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original) +++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Fri Feb 5 13:10:04 2016 @@ -422,6 +422,11 @@ public: GetUniqueNamespaceDeclaration (const char *name, clang::DeclContext *decl_ctx); +static clang::NamespaceDecl * +GetUniqueNamespaceDeclaration (clang::ASTContext *ast, + const char *name, + clang::DeclContext *decl_ctx); + //-- // Function Types //-- @@ -565,7 +570,9 @@ public: //-- std::vector -DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name) override; +DeclContextFindDeclByName (void *opaque_decl_ctx, + ConstString name, + const bool ignore_using_decls) override; bool DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override; Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=259902=259901=259902=diff == --- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original) +++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Fri Feb 5 13:10:04 2016 @@ -66,7 +66,7 @@ public: IsClang () const; std::vector -FindDeclByName (ConstString name); +FindDeclByName (ConstString name, const bool ignore_using_decls); //-- /// Checks if this decl context represents a method of a class. Modified: lldb/trunk/include/lldb/Symbol/TypeSystem.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeSystem.h?rev=259902=259901=259902=diff == --- lldb/trunk/include/lldb/Symbol/TypeSystem.h (original) +++ lldb/trunk/include/lldb/Symbol/TypeSystem.h Fri Feb 5 13:10:04 2016 @@ -143,7 +143,9 @@ public: //-- virtual std::vector -DeclContextFindDeclByName (void *opaque_decl_ctx, ConstString name); +DeclContextFindDeclByName (void *opaque_decl_ctx, + ConstString name, + const bool ignore_imported_decls); virtual bool DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) = 0; Added: lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile?rev=259902=auto == --- lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile (added) +++ lldb/trunk/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/Makefile Fri Feb 5 13:10:04 2016 @@ -0,0 +1,5 @@ +LEVEL = ../../../make + +CXX_SOURCES = main.cpp + +include $(LEVEL)/Makefile.rules Added:
Re: [Lldb-commits] [PATCH] D16936: Remove expectedFailureWindows decorator
zturner added a comment. One more thing. This patch also causes skips and xfails to include the bugnumber as part of the reason. So you can see bugnumbers on summary output. See the changes to `decorators.py` for the relevant code. http://reviews.llvm.org/D16936 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16858: Add verbose logging support to gdb-remote tests
On 5 February 2016 at 03:13, Todd Fialawrote: > True. > > Maybe I'll wait until then. Just don't hold your breath for too long. What I said is what I would _like_ to do, but currently I don't see myself having enough time to do that. If you want to do something sooner, then by all means, go ahead. Maybe the easiest solution would be to put the decorator on every test, as making it work on classes looks like a non-trivial job. pl ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r259878 - Bump up the packet timeout for gdbremote tests
Author: labath Date: Fri Feb 5 05:17:22 2016 New Revision: 259878 URL: http://llvm.org/viewvc/llvm-project?rev=259878=rev Log: Bump up the packet timeout for gdbremote tests Log confirmed that the we are sometimes timing out on the receive, even though the server is sending the correct packets. Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py?rev=259878=259877=259878=diff == --- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py (original) +++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/gdbremote_testcase.py Fri Feb 5 05:17:22 2016 @@ -26,7 +26,7 @@ import logging class GdbRemoteTestCaseBase(TestBase): -_TIMEOUT_SECONDS = 5 +_TIMEOUT_SECONDS = 7 _GDBREMOTE_KILL_PACKET = "$k#6b" ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16627: Add support to detect arm hard float ABI based binaries for ABISysV_arm
This revision was automatically updated to reflect the committed changes. Closed by commit rL259885: Add support to detect arm hard float ABI based binaries for ABISysV_arm (authored by omjavaid). Changed prior to commit: http://reviews.llvm.org/D16627?vs=46620=47014#toc Repository: rL LLVM http://reviews.llvm.org/D16627 Files: lldb/trunk/include/lldb/Core/ArchSpec.h lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Index: lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp === --- lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp +++ lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp @@ -1562,6 +1562,15 @@ } } +if (arch_spec.GetMachine() == llvm::Triple::arm || +arch_spec.GetMachine() == llvm::Triple::thumb) +{ +if (header.e_flags & llvm::ELF::EF_ARM_SOFT_FLOAT) +arch_spec.SetFlags (ArchSpec::eARM_abi_soft_float); +else if (header.e_flags & llvm::ELF::EF_ARM_VFP_FLOAT) +arch_spec.SetFlags (ArchSpec::eARM_abi_hard_float); +} + // If there are no section headers we are done. if (header.e_shnum == 0) return 0; Index: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h === --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h @@ -79,6 +79,9 @@ const lldb_private::RegisterInfo * GetRegisterInfoArray (uint32_t ) override; +bool +IsArmHardFloat (lldb_private::Thread ) const; + //-- // Static Functions //-- Index: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp === --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp @@ -414,6 +414,20 @@ return true; } +bool +ABISysV_arm::IsArmHardFloat (Thread ) const +{ +ProcessSP process_sp (thread.GetProcess()); +if (process_sp) +{ +const ArchSpec (process_sp->GetTarget().GetArchitecture()); + +return (arch.GetFlags() & ArchSpec::eARM_abi_hard_float) != 0; +} + +return false; +} + ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl (Thread , lldb_private::CompilerType _type) const @@ -516,19 +530,42 @@ case 64: { static_assert(sizeof(double) == sizeof(uint64_t), ""); -const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2); -uint64_t raw_value; -raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; -raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; -value.GetScalar() = *reinterpret_cast(_value); + +if (IsArmHardFloat(thread)) +{ +RegisterValue reg_value; +const RegisterInfo *d0_reg_info = reg_ctx->GetRegisterInfoByName("d0", 0); +reg_ctx->ReadRegister(d0_reg_info, reg_value); +value.GetScalar() = reg_value.GetAsDouble(); +} +else +{ +uint64_t raw_value; +const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2); +raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; +raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; +value.GetScalar() = *reinterpret_cast (_value); +} break; } case 16: // Half precision returned after a conversion to single precision case 32: { static_assert(sizeof(float) == sizeof(uint32_t), ""); -uint32_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; -value.GetScalar() = *reinterpret_cast (_value); + +if (IsArmHardFloat(thread)) +{ +RegisterValue reg_value; +const RegisterInfo *s0_reg_info = reg_ctx->GetRegisterInfoByName("s0", 0); +reg_ctx->ReadRegister(s0_reg_info, reg_value); +value.GetScalar() =
[Lldb-commits] [lldb] r259885 - Add support to detect arm hard float ABI based binaries for ABISysV_arm
Author: omjavaid Date: Fri Feb 5 08:37:53 2016 New Revision: 259885 URL: http://llvm.org/viewvc/llvm-project?rev=259885=rev Log: Add support to detect arm hard float ABI based binaries for ABISysV_arm This patch adds logic to detect if underlying binary is using arm hard float abi and use that information while handling return values in ABISysV_arm. Differential revision: http://reviews.llvm.org/D16627 Modified: lldb/trunk/include/lldb/Core/ArchSpec.h lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.h lldb/trunk/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp Modified: lldb/trunk/include/lldb/Core/ArchSpec.h URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ArchSpec.h?rev=259885=259884=259885=diff == --- lldb/trunk/include/lldb/Core/ArchSpec.h (original) +++ lldb/trunk/include/lldb/Core/ArchSpec.h Fri Feb 5 08:37:53 2016 @@ -72,6 +72,13 @@ public: eMIPSABI_mask = 0x000ff000 }; +// ARM specific e_flags +enum ARMeflags +{ +eARM_abi_soft_float = 0x0200, +eARM_abi_hard_float = 0x0400 +}; + enum Core { eCore_arm_generic, Modified: lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp?rev=259885=259884=259885=diff == --- lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp (original) +++ lldb/trunk/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp Fri Feb 5 08:37:53 2016 @@ -414,6 +414,20 @@ GetReturnValuePassedInMemory(Thread return true; } +bool +ABISysV_arm::IsArmHardFloat (Thread ) const +{ +ProcessSP process_sp (thread.GetProcess()); +if (process_sp) +{ +const ArchSpec (process_sp->GetTarget().GetArchitecture()); + +return (arch.GetFlags() & ArchSpec::eARM_abi_hard_float) != 0; +} + +return false; +} + ValueObjectSP ABISysV_arm::GetReturnValueObjectImpl (Thread , lldb_private::CompilerType _type) const @@ -516,19 +530,42 @@ ABISysV_arm::GetReturnValueObjectImpl (T case 64: { static_assert(sizeof(double) == sizeof(uint64_t), ""); -const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2); -uint64_t raw_value; -raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; -raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; -value.GetScalar() = *reinterpret_cast(_value); + +if (IsArmHardFloat(thread)) +{ +RegisterValue reg_value; +const RegisterInfo *d0_reg_info = reg_ctx->GetRegisterInfoByName("d0", 0); +reg_ctx->ReadRegister(d0_reg_info, reg_value); +value.GetScalar() = reg_value.GetAsDouble(); +} +else +{ +uint64_t raw_value; +const RegisterInfo *r1_reg_info = reg_ctx->GetRegisterInfo(eRegisterKindGeneric, LLDB_REGNUM_GENERIC_ARG2); +raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; +raw_value |= ((uint64_t)(reg_ctx->ReadRegisterAsUnsigned(r1_reg_info, 0) & UINT32_MAX)) << 32; +value.GetScalar() = *reinterpret_cast (_value); +} break; } case 16: // Half precision returned after a conversion to single precision case 32: { static_assert(sizeof(float) == sizeof(uint32_t), ""); -uint32_t raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; -value.GetScalar() = *reinterpret_cast (_value); + +if (IsArmHardFloat(thread)) +{ +RegisterValue reg_value; +const RegisterInfo *s0_reg_info = reg_ctx->GetRegisterInfoByName("s0", 0); +reg_ctx->ReadRegister(s0_reg_info, reg_value); +value.GetScalar() = reg_value.GetAsFloat(); +} +else +{ +uint32_t raw_value; +raw_value = reg_ctx->ReadRegisterAsUnsigned(r0_reg_info, 0) & UINT32_MAX; +value.GetScalar() = *reinterpret_cast (_value); +}
Re: [Lldb-commits] [lldb] r259964 - Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and
> On Feb 5, 2016, at 4:43 PM, Enrico Granata via lldb-commits >wrote: > > Modified: lldb/trunk/source/Target/LanguageRuntime.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259964=259963=259964=diff > == > --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) > +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb 5 18:43:07 2016 > @@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (Com > CommandObjectSP command = > command_callback(parent->GetCommandInterpreter()); > if (command) > { > +// the CommandObject vended by a Language plugin cannot be > created once and cached because > +// we may create multiple debuggers and need one instance of > the command each - the implementing function > +// is meant to create a new instance of the command each > time it is invoked > +assert(>GetCommandInterpreter() == > >GetCommandInterpreter() && "language plugin returned command for a > mismatched CommandInterpreter"); Should CommandObject::LoadSubCommand do this check? > parent->LoadSubCommand(command->GetCommandName(), command); > } > } Jim ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r259964 - Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and
Is it ever right for a Command to add a subcommand from a different CommandInterpreter? If it is not (and I am pretty sure it isn't) then this check should be done in LoadSubCommand, where you would check the to-be-added command's interpreter against the added-to's interpreter. This would immediately catch this error if anybody makes it in the future. Probably good to do this in AddCommand for the interpreter as well. Jim > On Feb 5, 2016, at 5:02 PM, Enrico Granatawrote: > >> >> On Feb 5, 2016, at 4:57 PM, Jim Ingham wrote: >> >> >>> On Feb 5, 2016, at 4:43 PM, Enrico Granata via lldb-commits >>> wrote: >>> >>> Modified: lldb/trunk/source/Target/LanguageRuntime.cpp >>> URL: >>> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259964=259963=259964=diff >>> == >>> --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) >>> +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb 5 18:43:07 2016 >>> @@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (Com >>>CommandObjectSP command = >>> command_callback(parent->GetCommandInterpreter()); >>>if (command) >>>{ >>> +// the CommandObject vended by a Language plugin cannot be >>> created once and cached because >>> +// we may create multiple debuggers and need one instance >>> of the command each - the implementing function >>> +// is meant to create a new instance of the command each >>> time it is invoked >>> +assert(>GetCommandInterpreter() == >>> >GetCommandInterpreter() && "language plugin returned command for a >>> mismatched CommandInterpreter"); >> >> Should CommandObject::LoadSubCommand do this check? >> >>>parent->LoadSubCommand(command->GetCommandName(), command); >>>} >>>} >> >> Jim >> > > You mean the assert? The point of the assert is that the language plugin was > creating a command once and caching it and then returning the cached version > to a different debugger > Hence I am doing the check specifically for those commands. > > But maybe I am missing what you’re trying to suggest here. > > Thanks, > - Enrico > egranata@.com ☎️ 27683 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] LLVM buildmaster will be restarted tonight
Hello everyone, LLVM buildmaster will be updated and restarted after 6 PM Pacific time today. Thanks Galina ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16936: Remove expectedFailureWindows decorator
tfiala added a comment. I'll go ahead and run this before and after and compare totals. http://reviews.llvm.org/D16936 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [PATCH] D16938: A number of improvements to decorator conditionals
tfiala added a comment. I'll have a look at this after I get through http://reviews.llvm.org/D16936. Concept sounds great. http://reviews.llvm.org/D16938 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r259972 - Per Jim's suggestion, move checks that we're not mixing and matching Debuggers and Commands deeper in the bowels of LLDB
Author: enrico Date: Fri Feb 5 19:36:07 2016 New Revision: 259972 URL: http://llvm.org/viewvc/llvm-project?rev=259972=rev Log: Per Jim's suggestion, move checks that we're not mixing and matching Debuggers and Commands deeper in the bowels of LLDB NFC Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp lldb/trunk/source/Interpreter/CommandInterpreter.cpp lldb/trunk/source/Target/LanguageRuntime.cpp Modified: lldb/trunk/source/Commands/CommandObjectMultiword.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectMultiword.cpp?rev=259972=259971=259972=diff == --- lldb/trunk/source/Commands/CommandObjectMultiword.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectMultiword.cpp Fri Feb 5 19:36:07 2016 @@ -92,6 +92,9 @@ CommandObjectMultiword::LoadSubCommand const CommandObjectSP& cmd_obj ) { +if (cmd_obj.get()) +assert((() == _obj->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter"); + CommandMap::iterator pos; bool success = true; Modified: lldb/trunk/source/Interpreter/CommandInterpreter.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Interpreter/CommandInterpreter.cpp?rev=259972=259971=259972=diff == --- lldb/trunk/source/Interpreter/CommandInterpreter.cpp (original) +++ lldb/trunk/source/Interpreter/CommandInterpreter.cpp Fri Feb 5 19:36:07 2016 @@ -874,6 +874,9 @@ CommandInterpreter::GetCommandSP (const bool CommandInterpreter::AddCommand (const char *name, const lldb::CommandObjectSP _sp, bool can_replace) { +if (cmd_sp.get()) +assert((this == _sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter"); + if (name && name[0]) { std::string name_sstr(name); @@ -893,9 +896,11 @@ CommandInterpreter::AddUserCommand (std: const lldb::CommandObjectSP _sp, bool can_replace) { +if (cmd_sp.get()) +assert((this == _sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter"); + if (!name.empty()) { - const char* name_cstr = name.c_str(); // do not allow replacement of internal commands @@ -1110,6 +1115,9 @@ CommandInterpreter::UserCommandExists (c void CommandInterpreter::AddAlias (const char *alias_name, CommandObjectSP& command_obj_sp) { +if (command_obj_sp.get()) +assert((this == _obj_sp->GetCommandInterpreter()) && "tried to add a CommandObject from a different interpreter"); + command_obj_sp->SetIsAlias (true); m_alias_dict[alias_name] = command_obj_sp; } Modified: lldb/trunk/source/Target/LanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259972=259971=259972=diff == --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb 5 19:36:07 2016 @@ -339,7 +339,6 @@ LanguageRuntime::InitializeCommands (Com // the CommandObject vended by a Language plugin cannot be created once and cached because // we may create multiple debuggers and need one instance of the command each - the implementing function // is meant to create a new instance of the command each time it is invoked -assert(>GetCommandInterpreter() == >GetCommandInterpreter() && "language plugin returned command for a mismatched CommandInterpreter"); parent->LoadSubCommand(command->GetCommandName(), command); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [PATCH] D16938: A number of improvements to decorator conditionals
zturner created this revision. zturner added reviewers: tfiala, labath, tberghammer. zturner added a subscriber: lldb-commits. The goal here is to try to improve consistency across the variety of decorators we support. This patch makes the following changes: * Change the `not_in` function to be a class object called `no_match`. This indicates that it can be used for more than just checking list membership, and that instead it negates whatever condition is used to normally match. * Change the name of `_check_list_or_lambda` to `match_decorator_property`. This indicates that it could be more than a list or a lambda. * Always use a regex match when matching strings in `match_decorator_property`. This allows any string on any decoratory property to automatically support regex matching. * Also support the use of compiled regexes on decorator properties. * Fix a bug in the compiler check used by `_decorateTest`. The two arguments were reversed, so that check was not matching when it should have matched. * Change one test that uses `skipUnlessArch` to use `skipIf`. Now that `skipIf` supports regex matching on the architecture property, this works, and as a followup `skipUnlessArch` will be removed entirely. Note that you won't be able to apply this patch unless you apply it on top of my previous review D16936. http://reviews.llvm.org/D16938 Files: packages/Python/lldbsuite/test/decorators.py packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py Index: packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py === --- packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py +++ packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py @@ -7,7 +7,7 @@ mydir = TestBase.compute_mydir(__file__) -@skipIf(debug_info=not_in(["dwarf"])) +@skipIf(debug_info=no_match(["dwarf"])) def test_limit_debug_info(self): self.build() Index: packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py === --- packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py @@ -14,7 +14,7 @@ mydir = TestBase.compute_mydir(__file__) -@skipIf(archs=not_in(["i386", "i686"])) +@skipIf(archs=no_match(["i386", "i686"])) @no_debug_info_test def test_asm_int_3(self): """Test that intrinsics like `__debugbreak();` and `asm {"int3"}` are treated like breakpoints.""" Index: packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py === --- packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py +++ packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py @@ -16,7 +16,7 @@ mydir = TestBase.compute_mydir(__file__) -@skipUnlessArch(archs=re.compile('mips*')) +@skipIf(archs=no_match(re.compile('mips*'))) def test(self): self.build() exe = os.path.join(os.getcwd(), "a.out") Index: packages/Python/lldbsuite/test/decorators.py === --- packages/Python/lldbsuite/test/decorators.py +++ packages/Python/lldbsuite/test/decorators.py @@ -25,6 +25,13 @@ class DecorateMode: Skip, Xfail = range(2) + +# You can use no_match to reverse the test of the conditional that is used to match keyword +# arguments in the skip / xfail decorators. If oslist=["windows", "linux"] skips windows +# and linux, oslist=no_match(["windows", "linux"]) skips *unless* windows or linux. +class no_match: +def __init__(self, item): +self.item = item def _check_expected_version(comparison, expected, actual): def fn_leq(x,y): return x <= y @@ -49,18 +56,21 @@ return op_lookup[comparison](LooseVersion(actual_str), LooseVersion(expected_str)) -def _check_list_or_lambda(list_or_lambda, value): -if six.callable(list_or_lambda): -return list_or_lambda(value) -elif isinstance(list_or_lambda, list): -for item in list_or_lambda: -if value in item: +def _match_decorator_property(expected, actual): +if actual is None or expected is None: +return True + +if isinstance(expected, no_match): +return not _match_decorator_property(expected.item, actual) +elif isinstance(expected, list): +for
Re: [Lldb-commits] [lldb] r259962 - Fix "thread backtrace -s": option was misparsed because of a missing break.
Sounds like we don't have a test for thread backtrace -s. I know I usually argue against tests of the CLI, but only when they're used instead of tests for the api. Seems like we should have at least one test for every option of every command. On Fri, Feb 5, 2016 at 4:35 PM Jim Ingham via lldb-commits < lldb-commits@lists.llvm.org> wrote: > Author: jingham > Date: Fri Feb 5 18:31:23 2016 > New Revision: 259962 > > URL: http://llvm.org/viewvc/llvm-project?rev=259962=rev > Log: > Fix "thread backtrace -s": option was misparsed because of a missing break. > > > > Modified: > lldb/trunk/source/Commands/CommandObjectThread.cpp > > Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=259962=259961=259962=diff > > == > --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) > +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Feb 5 18:31:23 > 2016 > @@ -194,6 +194,7 @@ public: > if (!success) > error.SetErrorStringWithFormat("invalid integer > value for option '%c'", short_option); > } > +break; > case 'e': > { > bool success; > > > ___ > lldb-commits mailing list > 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
[Lldb-commits] [lldb] r259962 - Fix "thread backtrace -s": option was misparsed because of a missing break.
Author: jingham Date: Fri Feb 5 18:31:23 2016 New Revision: 259962 URL: http://llvm.org/viewvc/llvm-project?rev=259962=rev Log: Fix "thread backtrace -s": option was misparsed because of a missing break. Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp Modified: lldb/trunk/source/Commands/CommandObjectThread.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectThread.cpp?rev=259962=259961=259962=diff == --- lldb/trunk/source/Commands/CommandObjectThread.cpp (original) +++ lldb/trunk/source/Commands/CommandObjectThread.cpp Fri Feb 5 18:31:23 2016 @@ -194,6 +194,7 @@ public: if (!success) error.SetErrorStringWithFormat("invalid integer value for option '%c'", short_option); } +break; case 'e': { bool success; ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r259964 - Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and
> On Feb 5, 2016, at 4:57 PM, Jim Inghamwrote: > > >> On Feb 5, 2016, at 4:43 PM, Enrico Granata via lldb-commits >> wrote: >> >> Modified: lldb/trunk/source/Target/LanguageRuntime.cpp >> URL: >> http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259964=259963=259964=diff >> == >> --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) >> +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb 5 18:43:07 2016 >> @@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (Com >>CommandObjectSP command = >> command_callback(parent->GetCommandInterpreter()); >>if (command) >>{ >> +// the CommandObject vended by a Language plugin cannot be >> created once and cached because >> +// we may create multiple debuggers and need one instance >> of the command each - the implementing function >> +// is meant to create a new instance of the command each >> time it is invoked >> +assert(>GetCommandInterpreter() == >> >GetCommandInterpreter() && "language plugin returned command for a >> mismatched CommandInterpreter"); > > Should CommandObject::LoadSubCommand do this check? > >>parent->LoadSubCommand(command->GetCommandName(), command); >>} >>} > > Jim > You mean the assert? The point of the assert is that the language plugin was creating a command once and caching it and then returning the cached version to a different debugger Hence I am doing the check specifically for those commands. But maybe I am missing what you’re trying to suggest here. Thanks, - Enrico egranata@.com ☎️ 27683 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
Re: [Lldb-commits] [lldb] r259964 - Fix an issue where certain CommandObjects (or Options thereof) were being created once, bound to a specific CommandInterpreter (and hence a specific Debugger), and
> On Feb 5, 2016, at 5:05 PM, Jim Inghamwrote: > > Is it ever right for a Command to add a subcommand from a different > CommandInterpreter? If it is not (and I am pretty sure it isn't) then this > check should be done in LoadSubCommand, where you would check the to-be-added > command's interpreter against the added-to's interpreter. This would > immediately catch this error if anybody makes it in the future. Probably > good to do this in AddCommand for the interpreter as well. > > Jim > >> On Feb 5, 2016, at 5:02 PM, Enrico Granata wrote: >> >>> >>> On Feb 5, 2016, at 4:57 PM, Jim Ingham wrote: >>> >>> On Feb 5, 2016, at 4:43 PM, Enrico Granata via lldb-commits wrote: Modified: lldb/trunk/source/Target/LanguageRuntime.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/LanguageRuntime.cpp?rev=259964=259963=259964=diff == --- lldb/trunk/source/Target/LanguageRuntime.cpp (original) +++ lldb/trunk/source/Target/LanguageRuntime.cpp Fri Feb 5 18:43:07 2016 @@ -336,6 +336,10 @@ LanguageRuntime::InitializeCommands (Com CommandObjectSP command = command_callback(parent->GetCommandInterpreter()); if (command) { +// the CommandObject vended by a Language plugin cannot be created once and cached because +// we may create multiple debuggers and need one instance of the command each - the implementing function +// is meant to create a new instance of the command each time it is invoked +assert(>GetCommandInterpreter() == >GetCommandInterpreter() && "language plugin returned command for a mismatched CommandInterpreter"); >>> >>> Should CommandObject::LoadSubCommand do this check? >>> parent->LoadSubCommand(command->GetCommandName(), command); } } >>> >>> Jim >>> >> >> You mean the assert? The point of the assert is that the language plugin was >> creating a command once and caching it and then returning the cached version >> to a different debugger >> Hence I am doing the check specifically for those commands. >> >> But maybe I am missing what you’re trying to suggest here. >> >> Thanks, >> - Enrico >> egranata@.com ☎️ 27683 > Aha! Yeah, now I see what you’re saying. And, yes, you do make a good point. I can move the assert there alright. Thanks, - Enrico egranata@.com ☎️ 27683 ___ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] r259983 - ProcessMachCore scans through the core file pages looking for a
Author: jmolenda Date: Fri Feb 5 22:55:26 2016 New Revision: 259983 URL: http://llvm.org/viewvc/llvm-project?rev=259983=rev Log: ProcessMachCore scans through the core file pages looking for a user process dyld binary and/or a mach kernel binary image. By default, it prefers the kernel if it finds both. But if it finds two kernel binary images (which can happen when random things are mapped into memory), it may pick the wrong kernel image. DynamicLoaderDarwinKernel has heuristics to find a kernel in memory; once we've established that there is a kernel binary in memory, call over to that class to see if it can find a kernel address via its search methods. If it does, use that. Some minor cleanups to DynamicLoaderDarwinKernel while I was at it. Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.h lldb/trunk/source/Plugins/Process/mach-core/ProcessMachCore.cpp Modified: lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp?rev=259983=259982=259983=diff == --- lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp (original) +++ lldb/trunk/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Fri Feb 5 22:55:26 2016 @@ -254,37 +254,29 @@ DynamicLoaderDarwinKernel::SearchForKern Error read_err; addr_t addr = LLDB_INVALID_ADDRESS; -if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 8) +addr_t kernel_addresses_64[] = { 0xff802010ULL, 0xff804010ULL, + 0xfff02010ULL, 0xfff04010ULL, + LLDB_INVALID_ADDRESS }; +addr_t kernel_addresses_32[] = { 0x0110, + LLDB_INVALID_ADDRESS }; +for (size_t i = 0; kernel_addresses_64[i] != LLDB_INVALID_ADDRESS; i++) { -addr = process->ReadUnsignedIntegerFromMemory (0xff802010ULL, 8, LLDB_INVALID_ADDRESS, read_err); -if (CheckForKernelImageAtAddress (addr, process).IsValid()) -{ -return addr; -} -addr = process->ReadUnsignedIntegerFromMemory (0xff804010ULL, 8, LLDB_INVALID_ADDRESS, read_err); -if (CheckForKernelImageAtAddress (addr, process).IsValid()) -{ -return addr; -} -addr = process->ReadUnsignedIntegerFromMemory (0xfff02010ULL, 8, LLDB_INVALID_ADDRESS, read_err); -if (CheckForKernelImageAtAddress (addr, process).IsValid()) -{ -return addr; -} -addr = process->ReadUnsignedIntegerFromMemory (0xfff04010ULL, 8, LLDB_INVALID_ADDRESS, read_err); +addr = process->ReadUnsignedIntegerFromMemory (kernel_addresses_64[i], 8, LLDB_INVALID_ADDRESS, read_err); if (CheckForKernelImageAtAddress (addr, process).IsValid()) { return addr; } } -else + +for (size_t i = 0; kernel_addresses_32[i] != LLDB_INVALID_ADDRESS; i++) { -addr = process->ReadUnsignedIntegerFromMemory (0x0110, 4, LLDB_INVALID_ADDRESS, read_err); +addr = process->ReadUnsignedIntegerFromMemory (kernel_addresses_32[i], 4, LLDB_INVALID_ADDRESS, read_err); if (CheckForKernelImageAtAddress (addr, process).IsValid()) { return addr; } } + return LLDB_INVALID_ADDRESS; } @@ -311,28 +303,14 @@ DynamicLoaderDarwinKernel::SearchForKern if (pc == LLDB_INVALID_ADDRESS) return LLDB_INVALID_ADDRESS; -addr_t kernel_range_low; -if (process->GetTarget().GetArchitecture().GetAddressByteSize() == 8) -{ -kernel_range_low = 1ULL << 63; -} -else -{ -kernel_range_low = 1ULL << 31; -} - -// Outside the normal kernel address range, this is probably userland code running right now -if (pc < kernel_range_low) -return LLDB_INVALID_ADDRESS; - // The kernel will load at at one megabyte boundary (0x10), or at that boundary plus -// an offset of one page (0x1000) or two, depending on the device. +// an offset of one page (0x1000) or two, or four (0x4000), depending on the device. // Round the current pc down to the nearest one megabyte boundary - the place where we will start searching. addr_t addr = pc & ~0xf; -int i = 0; -while (i < 32 && pc >= kernel_range_low) +// Search backwards 32 megabytes, looking for the start of the kernel at each one-megabyte boundary. +for (int i = 0; i < 32; i++, addr -= 0x10) { if (CheckForKernelImageAtAddress (addr, process).IsValid())