Date: Sun, 13 Jun 2021 20:02:53 GMT From: Dimitry Andric <dim@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: d409305fa383 - main - Merge llvm-project 12.0.0 release Message-ID: <202106132002.15DK2rjR014110@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=d409305fa3838fb39b38c26fc085fb729b8766d5 commit d409305fa3838fb39b38c26fc085fb729b8766d5 Merge: e8d8bef961a5 b4125f7d51da Author: Dimitry Andric <dim@FreeBSD.org> AuthorDate: 2021-04-26 11:23:24 +0000 Commit: Dimitry Andric <dim@FreeBSD.org> CommitDate: 2021-06-13 20:01:15 +0000 Merge llvm-project 12.0.0 release This updates llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp to llvmorg-12.0.0-0-gd28af7c654d8, a.k.a. 12.0.0 release. PR: 255570 MFC after: 6 weeks .../clang/include/clang/AST/ASTContext.h | 3 + .../llvm-project/clang/include/clang/AST/Decl.h | 11 +- .../llvm-project/clang/include/clang/AST/DeclCXX.h | 6 + .../llvm-project/clang/include/clang/AST/Expr.h | 3 +- .../llvm-project/clang/include/clang/AST/Mangle.h | 3 + .../include/clang/AST/MangleNumberingContext.h | 5 + .../clang/include/clang/AST/RecursiveASTVisitor.h | 12 + .../clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- .../clang/include/clang/Basic/CodeGenOptions.def | 3 + .../clang/include/clang/Basic/CodeGenOptions.h | 6 + .../clang/include/clang/Driver/Options.td | 7 +- .../clang/include/clang/Lex/VariadicMacroSupport.h | 10 +- .../llvm-project/clang/include/clang/Sema/Sema.h | 18 +- contrib/llvm-project/clang/lib/AST/ASTImporter.cpp | 2 + contrib/llvm-project/clang/lib/AST/CXXABI.h | 5 +- contrib/llvm-project/clang/lib/AST/Decl.cpp | 29 +- contrib/llvm-project/clang/lib/AST/DeclCXX.cpp | 14 + .../llvm-project/clang/lib/AST/ExprConstant.cpp | 50 +- .../llvm-project/clang/lib/AST/ItaniumCXXABI.cpp | 6 + .../llvm-project/clang/lib/AST/ItaniumMangle.cpp | 346 +++-- .../llvm-project/clang/lib/AST/MicrosoftCXXABI.cpp | 33 +- .../clang/lib/ASTMatchers/ASTMatchFinder.cpp | 48 +- .../clang/lib/ASTMatchers/ASTMatchersInternal.cpp | 2 +- .../llvm-project/clang/lib/Basic/ProfileList.cpp | 1 + .../llvm-project/clang/lib/Basic/Targets/PPC.cpp | 3 - .../llvm-project/clang/lib/Basic/Targets/RISCV.cpp | 6 +- .../llvm-project/clang/lib/CodeGen/CGBuiltin.cpp | 2 + .../llvm-project/clang/lib/CodeGen/CGCUDANV.cpp | 8 + contrib/llvm-project/clang/lib/CodeGen/CGCall.cpp | 5 + .../clang/lib/CodeGen/CGExprConstant.cpp | 2 +- .../clang/lib/CodeGen/CGOpenMPRuntime.cpp | 34 +- .../clang/lib/CodeGen/CodeGenFunction.h | 11 + .../clang/lib/Driver/ToolChains/Arch/RISCV.cpp | 2 +- .../clang/lib/Driver/ToolChains/Clang.cpp | 15 +- .../clang/lib/Driver/ToolChains/CommonArgs.cpp | 5 + .../clang/lib/Driver/ToolChains/Linux.cpp | 9 - .../clang/lib/Driver/ToolChains/MSVC.cpp | 6 +- .../clang/lib/Driver/ToolChains/OpenBSD.cpp | 1 + .../clang/lib/Format/UnwrappedLineFormatter.cpp | 2 +- .../clang/lib/Frontend/CompilerInvocation.cpp | 7 +- .../clang/lib/Frontend/InitPreprocessor.cpp | 2 +- .../llvm-project/clang/lib/Headers/avx512fintrin.h | 16 +- .../llvm-project/clang/lib/Lex/Preprocessor.cpp | 8 +- contrib/llvm-project/clang/lib/Lex/TokenLexer.cpp | 10 +- contrib/llvm-project/clang/lib/Parse/ParseDecl.cpp | 3 +- contrib/llvm-project/clang/lib/Sema/Sema.cpp | 43 +- .../clang/lib/Sema/SemaCodeComplete.cpp | 21 +- contrib/llvm-project/clang/lib/Sema/SemaDecl.cpp | 88 +- contrib/llvm-project/clang/lib/Sema/SemaExpr.cpp | 2 +- contrib/llvm-project/clang/lib/Sema/SemaLambda.cpp | 10 +- contrib/llvm-project/clang/lib/Sema/SemaOpenMP.cpp | 23 +- .../llvm-project/clang/lib/Sema/TreeTransform.h | 7 +- .../clang/lib/Serialization/ASTReaderDecl.cpp | 1 + .../clang/lib/Serialization/ASTWriter.cpp | 1 + .../sanitizer_platform_interceptors.h | 2 +- contrib/llvm-project/libcxx/include/__locale | 20 +- .../libcxx/include/__threading_support | 2 +- contrib/llvm-project/libcxx/include/bit | 2 +- contrib/llvm-project/libcxx/include/limits | 4 +- contrib/llvm-project/libcxx/include/memory | 2 +- contrib/llvm-project/libcxx/src/atomic.cpp | 6 + contrib/llvm-project/libcxx/src/locale.cpp | 2 +- contrib/llvm-project/lld/ELF/InputSection.cpp | 5 +- contrib/llvm-project/lld/docs/ReleaseNotes.rst | 108 +- .../source/Host/common/NativeProcessProtocol.cpp | 11 +- .../Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp | 48 +- .../Plugins/Platform/FreeBSD/PlatformFreeBSD.h | 3 - .../Plugins/Process/FreeBSD/FreeBSDThread.cpp | 615 --------- .../source/Plugins/Process/FreeBSD/FreeBSDThread.h | 111 -- .../NativeProcessFreeBSD.cpp | 57 +- .../NativeProcessFreeBSD.h | 11 +- .../NativeRegisterContextFreeBSD.cpp | 2 +- .../NativeRegisterContextFreeBSD.h | 0 .../FreeBSD/NativeRegisterContextFreeBSD_arm.cpp | 202 +++ .../FreeBSD/NativeRegisterContextFreeBSD_arm.h | 68 + .../FreeBSD/NativeRegisterContextFreeBSD_arm64.cpp | 288 ++++ .../FreeBSD/NativeRegisterContextFreeBSD_arm64.h | 86 ++ .../NativeRegisterContextFreeBSD_mips64.cpp | 186 +++ .../FreeBSD/NativeRegisterContextFreeBSD_mips64.h | 71 + .../NativeRegisterContextFreeBSD_powerpc.cpp | 289 ++++ .../FreeBSD/NativeRegisterContextFreeBSD_powerpc.h | 74 + .../NativeRegisterContextFreeBSD_x86_64.cpp | 0 .../NativeRegisterContextFreeBSD_x86_64.h | 6 +- .../NativeThreadFreeBSD.cpp | 5 + .../NativeThreadFreeBSD.h | 2 +- .../Plugins/Process/FreeBSD/POSIXStopInfo.cpp | 44 - .../source/Plugins/Process/FreeBSD/POSIXStopInfo.h | 66 - .../Plugins/Process/FreeBSD/ProcessFreeBSD.cpp | 1080 --------------- .../Plugins/Process/FreeBSD/ProcessFreeBSD.h | 221 --- .../Plugins/Process/FreeBSD/ProcessMonitor.cpp | 1424 -------------------- .../Plugins/Process/FreeBSD/ProcessMonitor.h | 279 ---- .../Plugins/Process/FreeBSD/RegisterContextPOSIX.h | 63 - .../RegisterContextPOSIXProcessMonitor_arm.cpp | 260 ---- .../RegisterContextPOSIXProcessMonitor_arm.h | 80 -- .../RegisterContextPOSIXProcessMonitor_arm64.cpp | 267 ---- .../RegisterContextPOSIXProcessMonitor_arm64.h | 82 -- .../RegisterContextPOSIXProcessMonitor_mips64.cpp | 262 ---- .../RegisterContextPOSIXProcessMonitor_mips64.h | 82 -- .../RegisterContextPOSIXProcessMonitor_powerpc.cpp | 274 ---- .../RegisterContextPOSIXProcessMonitor_powerpc.h | 84 -- .../RegisterContextPOSIXProcessMonitor_x86.cpp | 613 --------- .../RegisterContextPOSIXProcessMonitor_x86.h | 81 -- .../NetBSD/NativeRegisterContextNetBSD_x86_64.h | 4 +- .../Utility/NativeProcessSoftwareSingleStep.cpp | 182 +++ .../Utility/NativeProcessSoftwareSingleStep.h | 31 + .../Utility/NativeRegisterContextDBReg_arm64.cpp | 466 +++++++ .../Utility/NativeRegisterContextDBReg_arm64.h | 79 ++ ..._x86.cpp => NativeRegisterContextDBReg_x86.cpp} | 38 +- ...oint_x86.h => NativeRegisterContextDBReg_x86.h} | 10 +- .../Process/Utility/RegisterInfos_powerpc.h | 4 +- .../lldb/tools/lldb-server/lldb-gdbserver.cpp | 2 +- contrib/llvm-project/llvm/include/llvm-c/Core.h | 6 +- contrib/llvm-project/llvm/include/llvm-c/Orc.h | 7 +- .../llvm/include/llvm/Analysis/AssumptionCache.h | 2 +- .../llvm/include/llvm/CodeGen/FastISel.h | 5 +- .../llvm/include/llvm/CodeGen/MachineInstr.h | 7 + .../llvm/include/llvm/CodeGen/TargetLowering.h | 4 + .../llvm/include/llvm/Demangle/ItaniumDemangle.h | 68 +- .../llvm/include/llvm/Frontend/OpenMP/OMPKinds.def | 4 +- .../llvm-project/llvm/include/llvm/IR/InstrTypes.h | 3 - .../llvm/include/llvm/IR/Instruction.h | 7 + .../llvm/include/llvm/IR/IntrinsicInst.h | 8 +- .../llvm/include/llvm/IR/Intrinsics.td | 2 +- .../llvm/include/llvm/IR/IntrinsicsRISCV.td | 7 +- .../llvm-project/llvm/include/llvm/IR/Metadata.h | 18 + .../llvm-project/llvm/include/llvm/IR/Operator.h | 5 + .../llvm/include/llvm/IR/PseudoProbe.h | 27 +- .../include/llvm/Passes/StandardInstrumentations.h | 2 + .../llvm/include/llvm/ProfileData/ProfileCommon.h | 3 + .../llvm/include/llvm/ProfileData/SampleProf.h | 29 +- .../include/llvm/ProfileData/SampleProfReader.h | 4 + .../llvm/include/llvm/Support/CommandLine.h | 13 + .../llvm/Transforms/IPO/SampleContextTracker.h | 19 +- .../llvm/Transforms/IPO/SampleProfileProbe.h | 41 + .../llvm/include/llvm/Transforms/Utils/Cloning.h | 7 + .../llvm/lib/Analysis/DemandedBits.cpp | 2 +- .../llvm/lib/Analysis/IVDescriptors.cpp | 5 +- .../llvm-project/llvm/lib/Analysis/MemorySSA.cpp | 26 - .../llvm/lib/Analysis/TypeBasedAliasAnalysis.cpp | 81 ++ .../llvm/lib/Analysis/ValueTracking.cpp | 28 +- .../llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp | 9 +- .../lib/CodeGen/GlobalISel/LegalizerHelper.cpp | 5 + .../llvm/lib/CodeGen/LiveRangeShrink.cpp | 3 +- .../llvm-project/llvm/lib/CodeGen/MachineInstr.cpp | 3 +- .../llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | 17 +- .../llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 10 +- .../CodeGen/SelectionDAG/SelectionDAGBuilder.cpp | 5 +- .../lib/CodeGen/SelectionDAG/TargetLowering.cpp | 31 +- .../llvm/lib/CodeGen/StackProtector.cpp | 2 +- .../llvm/lib/CodeGen/TwoAddressInstructionPass.cpp | 8 +- .../lib/ExecutionEngine/Orc/OrcV2CBindings.cpp | 2 +- contrib/llvm-project/llvm/lib/IR/AutoUpgrade.cpp | 42 + contrib/llvm-project/llvm/lib/IR/ConstantFold.cpp | 59 +- contrib/llvm-project/llvm/lib/IR/Instruction.cpp | 14 + contrib/llvm-project/llvm/lib/IR/Operator.cpp | 20 +- contrib/llvm-project/llvm/lib/IR/PseudoProbe.cpp | 41 + contrib/llvm-project/llvm/lib/IR/Verifier.cpp | 6 - .../llvm-project/llvm/lib/MC/ELFObjectWriter.cpp | 11 + .../llvm-project/llvm/lib/Passes/PassBuilder.cpp | 6 + .../llvm-project/llvm/lib/Passes/PassRegistry.def | 1 + .../llvm/lib/Passes/StandardInstrumentations.cpp | 1 + .../lib/ProfileData/Coverage/CoverageMapping.cpp | 1 - .../llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | 34 + .../llvm/lib/ProfileData/SampleProfReader.cpp | 99 +- .../llvm/lib/ProfileData/SampleProfWriter.cpp | 15 +- .../llvm-project/llvm/lib/Support/CommandLine.cpp | 25 +- .../llvm-project/llvm/lib/Support/Windows/Path.inc | 24 +- .../lib/Target/AArch64/AArch64ISelLowering.cpp | 7 +- .../AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp | 2 +- .../lib/Target/AMDGPU/SIShrinkInstructions.cpp | 24 +- .../llvm/lib/Target/ARM/ARMISelLowering.cpp | 6 +- .../llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp | 6 + .../llvm/lib/Target/PowerPC/PPCISelLowering.cpp | 12 +- .../llvm/lib/Target/PowerPC/PPCISelLowering.h | 3 + .../lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp | 6 +- .../RISCV/MCTargetDesc/RISCVTargetStreamer.cpp | 6 +- .../llvm/lib/Target/RISCV/RISCVCleanupVSETVLI.cpp | 37 +- .../lib/Target/RISCV/RISCVExpandPseudoInsts.cpp | 11 +- .../llvm/lib/Target/RISCV/RISCVISelDAGToDAG.cpp | 118 +- .../llvm/lib/Target/RISCV/RISCVISelDAGToDAG.h | 5 +- .../llvm/lib/Target/RISCV/RISCVInstrFormatsV.td | 23 +- .../llvm/lib/Target/RISCV/RISCVInstrInfoB.td | 67 - .../llvm/lib/Target/RISCV/RISCVInstrInfoV.td | 116 +- .../lib/Target/RISCV/RISCVInstrInfoVPseudos.td | 239 ++-- .../lib/Target/RISCV/RISCVInstrInfoVSDPatterns.td | 6 +- contrib/llvm-project/llvm/lib/Target/VE/VE.h | 10 +- .../Target/X86/Disassembler/X86Disassembler.cpp | 1 + .../llvm/lib/Target/X86/X86FastISel.cpp | 8 + .../llvm/lib/Target/X86/X86ISelLowering.cpp | 9 +- .../llvm/lib/Target/X86/X86InstrAVX512.td | 4 +- .../llvm/lib/Target/X86/X86InstrSSE.td | 16 +- .../llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 10 +- .../lib/Transforms/IPO/SampleContextTracker.cpp | 118 +- .../llvm/lib/Transforms/IPO/SampleProfile.cpp | 713 ++++++++-- .../llvm/lib/Transforms/IPO/SampleProfileProbe.cpp | 162 ++- .../Transforms/InstCombine/InstCombineCasts.cpp | 1 + .../lib/Transforms/InstCombine/InstCombinePHI.cpp | 8 +- .../InstCombine/InstCombineSimplifyDemanded.cpp | 8 +- .../InstCombine/InstructionCombining.cpp | 7 +- .../llvm/lib/Transforms/Scalar/ADCE.cpp | 2 +- .../llvm/lib/Transforms/Scalar/JumpThreading.cpp | 10 + .../llvm/lib/Transforms/Scalar/LoopUnswitch.cpp | 10 +- .../llvm/lib/Transforms/Scalar/SROA.cpp | 38 +- .../llvm/lib/Transforms/Utils/BuildLibCalls.cpp | 67 - .../llvm/lib/Transforms/Utils/CloneFunction.cpp | 8 + .../llvm/lib/Transforms/Utils/InlineFunction.cpp | 12 +- .../llvm/lib/Transforms/Utils/Local.cpp | 33 +- .../llvm/lib/Transforms/Utils/LoopPeel.cpp | 19 +- .../llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 19 +- .../Vectorize/LoopVectorizationPlanner.h | 4 + .../lib/Transforms/Vectorize/LoopVectorize.cpp | 40 +- .../llvm-project/llvm/tools/llvm-dwp/llvm-dwp.cpp | 4 +- .../llvm/tools/llvm-objdump/llvm-objdump.cpp | 30 +- .../llvm/tools/llvm-profdata/llvm-profdata.cpp | 2 +- .../llvm/tools/llvm-symbolizer/llvm-symbolizer.cpp | 7 +- .../llvm/utils/TableGen/IntrinsicEmitter.cpp | 4 +- .../openmp/runtime/src/kmp_config.h.cmake | 4 +- .../openmp/runtime/src/kmp_runtime.cpp | 21 +- .../openmp/runtime/src/kmp_settings.cpp | 10 +- .../openmp/runtime/src/kmp_tasking.cpp | 3 +- etc/mtree/BSD.include.dist | 2 + lib/clang/include/Plugins/Plugins.def | 1 - lib/clang/include/VCSVersion.inc | 8 +- lib/clang/include/clang/Config/config.h | 2 +- lib/clang/include/llvm/Config/config.h | 4 +- lib/clang/include/llvm/Config/llvm-config.h | 2 +- lib/clang/include/llvm/Support/VCSRevision.h | 2 +- lib/clang/liblldb/Makefile | 36 +- lib/clang/libllvm/Makefile | 1 + lib/libc++/Makefile | 26 +- lib/libc++/__config_site | 40 + lib/libomp/kmp_config.h | 18 + lib/libomp/kmp_i18n_default.inc | 10 +- lib/libomp/kmp_i18n_id.inc | 4 +- lib/libomp/omp-tools.h | 141 +- lib/libomp/omp.h | 144 +- sys/sys/param.h | 2 +- tools/build/mk/OptionalObsoleteFiles.inc | 11 + usr.bin/clang/Makefile | 1 + usr.bin/clang/bugpoint/bugpoint.1 | 8 +- usr.bin/clang/clang/clang.1 | 42 +- usr.bin/clang/llc/llc.1 | 22 +- usr.bin/clang/lldb-server/Makefile | 53 + usr.bin/clang/lldb-server/lldb-server.1 | 262 ++++ usr.bin/clang/lldb/lldb.1 | 39 +- usr.bin/clang/lli/lli.1 | 10 +- usr.bin/clang/llvm-ar/llvm-ar.1 | 10 +- usr.bin/clang/llvm-ar/llvm-ranlib.1 | 8 +- usr.bin/clang/llvm-as/llvm-as.1 | 8 +- usr.bin/clang/llvm-bcanalyzer/llvm-bcanalyzer.1 | 8 +- usr.bin/clang/llvm-cov/llvm-cov.1 | 25 +- usr.bin/clang/llvm-cxxfilt/llvm-cxxfilt.1 | 18 +- usr.bin/clang/llvm-diff/llvm-diff.1 | 8 +- usr.bin/clang/llvm-dis/llvm-dis.1 | 8 +- usr.bin/clang/llvm-dwarfdump/llvm-dwarfdump.1 | 54 +- usr.bin/clang/llvm-extract/llvm-extract.1 | 56 +- usr.bin/clang/llvm-link/llvm-link.1 | 8 +- usr.bin/clang/llvm-mca/llvm-mca.1 | 25 +- usr.bin/clang/llvm-nm/llvm-nm.1 | 15 +- usr.bin/clang/llvm-objcopy/llvm-objcopy.1 | 116 +- usr.bin/clang/llvm-objdump/llvm-objdump.1 | 683 +++++++--- usr.bin/clang/llvm-pdbutil/llvm-pdbutil.1 | 8 +- usr.bin/clang/llvm-profdata/llvm-profdata.1 | 85 +- usr.bin/clang/llvm-size/llvm-size.1 | 10 +- usr.bin/clang/llvm-strings/llvm-strings.1 | 10 +- usr.bin/clang/llvm-symbolizer/llvm-addr2line.1 | 29 +- usr.bin/clang/llvm-symbolizer/llvm-symbolizer.1 | 98 +- usr.bin/clang/llvm-tblgen/llvm-tblgen.1 | 806 ++++++++++- usr.bin/clang/opt/opt.1 | 8 +- 269 files changed, 7470 insertions(+), 7919 deletions(-) diff --cc contrib/llvm-project/clang/include/clang/AST/Decl.h index 47c282f0a63d,47c282f0a63d..1c5827b9c3a4 --- a/contrib/llvm-project/clang/include/clang/AST/Decl.h +++ b/contrib/llvm-project/clang/include/clang/AST/Decl.h @@@ -1276,15 -1276,15 +1276,12 @@@ public EvaluatedStmt *getEvaluatedStmt() const; /// Attempt to evaluate the value of the initializer attached to this -- /// declaration, and produce notes explaining why it cannot be evaluated. -- /// Returns a pointer to the value if evaluation succeeded, 0 otherwise. ++ /// declaration, and produce notes explaining why it cannot be evaluated or is ++ /// not a constant expression. Returns a pointer to the value if evaluation ++ /// succeeded, 0 otherwise. APValue *evaluateValue() const; ++ APValue *evaluateValue(SmallVectorImpl<PartialDiagnosticAt> &Notes) const; --private: -- APValue *evaluateValueImpl(SmallVectorImpl<PartialDiagnosticAt> &Notes, -- bool IsConstantInitialization) const; -- --public: /// Return the already-evaluated value of this variable's /// initializer, or NULL if the value is not yet known. Returns pointer /// to untyped APValue if the value could not be evaluated. diff --cc contrib/llvm-project/clang/include/clang/AST/Expr.h index a44d06967431,a44d06967431..52f8f18af205 --- a/contrib/llvm-project/clang/include/clang/AST/Expr.h +++ b/contrib/llvm-project/clang/include/clang/AST/Expr.h @@@ -699,8 -699,8 +699,7 @@@ public /// notes will be produced if the expression is not a constant expression. bool EvaluateAsInitializer(APValue &Result, const ASTContext &Ctx, const VarDecl *VD, -- SmallVectorImpl<PartialDiagnosticAt> &Notes, -- bool IsConstantInitializer) const; ++ SmallVectorImpl<PartialDiagnosticAt> &Notes) const; /// EvaluateWithSubstitution - Evaluate an expression as if from the context /// of a call to the given function with the given arguments, inside an diff --cc contrib/llvm-project/clang/lib/AST/Decl.cpp index feb9b0645ebc,feb9b0645ebc..10cfe145b3f0 --- a/contrib/llvm-project/clang/lib/AST/Decl.cpp +++ b/contrib/llvm-project/clang/lib/AST/Decl.cpp @@@ -2384,11 -2384,11 +2384,11 @@@ EvaluatedStmt *VarDecl::getEvaluatedStm APValue *VarDecl::evaluateValue() const { SmallVector<PartialDiagnosticAt, 8> Notes; -- return evaluateValueImpl(Notes, hasConstantInitialization()); ++ return evaluateValue(Notes); } --APValue *VarDecl::evaluateValueImpl(SmallVectorImpl<PartialDiagnosticAt> &Notes, -- bool IsConstantInitialization) const { ++APValue *VarDecl::evaluateValue( ++ SmallVectorImpl<PartialDiagnosticAt> &Notes) const { EvaluatedStmt *Eval = ensureEvaluatedStmt(); const auto *Init = cast<Expr>(Eval->Value); @@@ -2407,16 -2407,16 +2407,8 @@@ Eval->IsEvaluating = true; -- ASTContext &Ctx = getASTContext(); -- bool Result = Init->EvaluateAsInitializer(Eval->Evaluated, Ctx, this, Notes, -- IsConstantInitialization); -- -- // In C++11, this isn't a constant initializer if we produced notes. In that -- // case, we can't keep the result, because it may only be correct under the -- // assumption that the initializer is a constant context. -- if (IsConstantInitialization && Ctx.getLangOpts().CPlusPlus11 && -- !Notes.empty()) -- Result = false; ++ bool Result = Init->EvaluateAsInitializer(Eval->Evaluated, getASTContext(), ++ this, Notes); // Ensure the computed APValue is cleaned up later if evaluation succeeded, // or that it's empty (so that there's nothing to clean up) if evaluation @@@ -2424,7 -2424,7 +2416,7 @@@ if (!Result) Eval->Evaluated = APValue(); else if (Eval->Evaluated.needsCleanup()) -- Ctx.addDestruction(&Eval->Evaluated); ++ getASTContext().addDestruction(&Eval->Evaluated); Eval->IsEvaluating = false; Eval->WasEvaluated = true; @@@ -2478,14 -2478,14 +2470,7 @@@ bool VarDecl::checkForConstantInitializ assert(!cast<Expr>(Eval->Value)->isValueDependent()); // Evaluate the initializer to check whether it's a constant expression. -- Eval->HasConstantInitialization = -- evaluateValueImpl(Notes, true) && Notes.empty(); -- -- // If evaluation as a constant initializer failed, allow re-evaluation as a -- // non-constant initializer if we later find we want the value. -- if (!Eval->HasConstantInitialization) -- Eval->WasEvaluated = false; -- ++ Eval->HasConstantInitialization = evaluateValue(Notes) && Notes.empty(); return Eval->HasConstantInitialization; } diff --cc contrib/llvm-project/clang/lib/AST/ExprConstant.cpp index 56181bbe1166,1bdad771a923..b24025664684 --- a/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp +++ b/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp @@@ -3302,9 -3302,9 +3302,12 @@@ static bool evaluateVarDeclInit(EvalInf // Check that we can fold the initializer. In C++, we will have already done // this in the cases where it matters for conformance. -- if (!VD->evaluateValue()) { -- Info.FFDiag(E, diag::note_constexpr_var_init_non_constant, 1) << VD; ++ SmallVector<PartialDiagnosticAt, 8> Notes; ++ if (!VD->evaluateValue(Notes)) { ++ Info.FFDiag(E, diag::note_constexpr_var_init_non_constant, ++ Notes.size() + 1) << VD; NoteLValueLocation(Info, Base); ++ Info.addNotes(Notes); return false; } @@@ -14856,8 -14866,8 +14869,7 @@@ bool Expr::EvaluateAsConstantExpr(EvalR bool Expr::EvaluateAsInitializer(APValue &Value, const ASTContext &Ctx, const VarDecl *VD, -- SmallVectorImpl<PartialDiagnosticAt> &Notes, -- bool IsConstantInitialization) const { ++ SmallVectorImpl<PartialDiagnosticAt> &Notes) const { assert(!isValueDependent() && "Expression evaluator can't be called on a dependent expression."); @@@ -14870,12 -14880,12 +14882,11 @@@ Expr::EvalStatus EStatus; EStatus.Diag = &Notes; -- EvalInfo Info(Ctx, EStatus, -- (IsConstantInitialization && Ctx.getLangOpts().CPlusPlus11) -- ? EvalInfo::EM_ConstantExpression -- : EvalInfo::EM_ConstantFold); ++ EvalInfo Info(Ctx, EStatus, VD->isConstexpr() ++ ? EvalInfo::EM_ConstantExpression ++ : EvalInfo::EM_ConstantFold); Info.setEvaluatingDecl(VD, Value); -- Info.InConstantContext = IsConstantInitialization; ++ Info.InConstantContext = true; SourceLocation DeclLoc = VD->getLocation(); QualType DeclTy = VD->getType(); diff --cc contrib/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp index 497f9c04c9f8,497f9c04c9f8..decb8129e644 --- a/contrib/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprConstant.cpp @@@ -1622,8 -1622,8 +1622,8 @@@ llvm::Constant *ConstantEmitter::tryEmi if (CD->isTrivial() && CD->isDefaultConstructor()) return CGM.EmitNullConstant(D.getType()); } ++ InConstantContext = true; } -- InConstantContext = D.hasConstantInitialization(); QualType destType = D.getType(); diff --cc contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp index 57cc2d60e2af,83dfa0780547..caa5291ff6fa --- a/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp +++ b/contrib/llvm-project/clang/lib/CodeGen/CGOpenMPRuntime.cpp @@@ -409,6 -409,6 +409,7 @@@ class InlinedOpenMPRegionRAII llvm::DenseMap<const VarDecl *, FieldDecl *> LambdaCaptureFields; FieldDecl *LambdaThisCaptureField = nullptr; const CodeGen::CGBlockInfo *BlockInfo = nullptr; ++ bool NoInheritance = false; public: /// Constructs region for combined constructs. @@@ -416,16 -416,16 +417,19 @@@ /// a list of functions used for code generation of implicitly inlined /// regions. InlinedOpenMPRegionRAII(CodeGenFunction &CGF, const RegionCodeGenTy &CodeGen, -- OpenMPDirectiveKind Kind, bool HasCancel) -- : CGF(CGF) { ++ OpenMPDirectiveKind Kind, bool HasCancel, ++ bool NoInheritance = true) ++ : CGF(CGF), NoInheritance(NoInheritance) { // Start emission for the construct. CGF.CapturedStmtInfo = new CGOpenMPInlinedRegionInfo( CGF.CapturedStmtInfo, CodeGen, Kind, HasCancel); -- std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); -- LambdaThisCaptureField = CGF.LambdaThisCaptureField; -- CGF.LambdaThisCaptureField = nullptr; -- BlockInfo = CGF.BlockInfo; -- CGF.BlockInfo = nullptr; ++ if (NoInheritance) { ++ std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); ++ LambdaThisCaptureField = CGF.LambdaThisCaptureField; ++ CGF.LambdaThisCaptureField = nullptr; ++ BlockInfo = CGF.BlockInfo; ++ CGF.BlockInfo = nullptr; ++ } } ~InlinedOpenMPRegionRAII() { @@@ -434,9 -434,9 +438,11 @@@ cast<CGOpenMPInlinedRegionInfo>(CGF.CapturedStmtInfo)->getOldCSI(); delete CGF.CapturedStmtInfo; CGF.CapturedStmtInfo = OldCSI; -- std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); -- CGF.LambdaThisCaptureField = LambdaThisCaptureField; -- CGF.BlockInfo = BlockInfo; ++ if (NoInheritance) { ++ std::swap(CGF.LambdaCaptureFields, LambdaCaptureFields); ++ CGF.LambdaThisCaptureField = LambdaThisCaptureField; ++ CGF.BlockInfo = BlockInfo; ++ } } }; @@@ -3853,7 -3853,7 +3859,7 @@@ static void emitPrivatesInit(CodeGenFun // Processing for implicitly captured variables. InlinedOpenMPRegionRAII Region( CGF, [](CodeGenFunction &, PrePostActionTy &) {}, OMPD_unknown, -- /*HasCancel=*/false); ++ /*HasCancel=*/false, /*NoInheritance=*/true); SharedRefLValue = CGF.EmitLValue(Pair.second.OriginalRef); } if (Type->isArrayType()) { @@@ -6214,7 -6214,7 +6220,9 @@@ void CGOpenMPRuntime::emitInlinedDirect bool HasCancel) { if (!CGF.HaveInsertPoint()) return; -- InlinedOpenMPRegionRAII Region(CGF, CodeGen, InnerKind, HasCancel); ++ InlinedOpenMPRegionRAII Region(CGF, CodeGen, InnerKind, HasCancel, ++ InnerKind != OMPD_critical && ++ InnerKind != OMPD_master); CGF.CapturedStmtInfo->EmitBody(CGF, /*S=*/nullptr); } diff --cc contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp index 493e14cb904b,493e14cb904b..070fda664678 --- a/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/contrib/llvm-project/lldb/source/Host/common/NativeProcessProtocol.cpp @@@ -522,7 -522,7 +522,8 @@@ NativeProcessProtocol::GetSoftwareBreak static const uint8_t g_mips64_opcode[] = {0x00, 0x00, 0x00, 0x0d}; static const uint8_t g_mips64el_opcode[] = {0x0d, 0x00, 0x00, 0x00}; static const uint8_t g_s390x_opcode[] = {0x00, 0x01}; -- static const uint8_t g_ppc64le_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap ++ static const uint8_t g_ppc_opcode[] = {0x7f, 0xe0, 0x00, 0x08}; // trap ++ static const uint8_t g_ppcle_opcode[] = {0x08, 0x00, 0xe0, 0x7f}; // trap switch (GetArchitecture().GetMachine()) { case llvm::Triple::aarch64: @@@ -544,8 -544,8 +545,12 @@@ case llvm::Triple::systemz: return llvm::makeArrayRef(g_s390x_opcode); ++ case llvm::Triple::ppc: ++ case llvm::Triple::ppc64: ++ return llvm::makeArrayRef(g_ppc_opcode); ++ case llvm::Triple::ppc64le: -- return llvm::makeArrayRef(g_ppc64le_opcode); ++ return llvm::makeArrayRef(g_ppcle_opcode); default: return llvm::createStringError(llvm::inconvertibleErrorCode(), @@@ -568,6 -568,6 +573,8 @@@ size_t NativeProcessProtocol::GetSoftwa case llvm::Triple::mips64el: case llvm::Triple::mips: case llvm::Triple::mipsel: ++ case llvm::Triple::ppc: ++ case llvm::Triple::ppc64: case llvm::Triple::ppc64le: // On these architectures the PC doesn't get updated for breakpoint hits. return 0; diff --cc contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index f4d44eb7e745,f4d44eb7e745..6b39a83fd668 --- a/contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@@ -214,55 -214,55 +214,9 @@@ void PlatformFreeBSD::GetStatus(Stream #endif } --size_t --PlatformFreeBSD::GetSoftwareBreakpointTrapOpcode(Target &target, -- BreakpointSite *bp_site) { -- switch (target.GetArchitecture().GetMachine()) { -- case llvm::Triple::arm: { -- lldb::BreakpointLocationSP bp_loc_sp(bp_site->GetOwnerAtIndex(0)); -- AddressClass addr_class = AddressClass::eUnknown; -- -- if (bp_loc_sp) { -- addr_class = bp_loc_sp->GetAddress().GetAddressClass(); -- if (addr_class == AddressClass::eUnknown && -- (bp_loc_sp->GetAddress().GetFileAddress() & 1)) -- addr_class = AddressClass::eCodeAlternateISA; -- } -- -- if (addr_class == AddressClass::eCodeAlternateISA) { -- // TODO: Enable when FreeBSD supports thumb breakpoints. -- // FreeBSD kernel as of 10.x, does not support thumb breakpoints -- return 0; -- } -- -- static const uint8_t g_arm_breakpoint_opcode[] = {0xFE, 0xDE, 0xFF, 0xE7}; -- size_t trap_opcode_size = sizeof(g_arm_breakpoint_opcode); -- assert(bp_site); -- if (bp_site->SetTrapOpcode(g_arm_breakpoint_opcode, trap_opcode_size)) -- return trap_opcode_size; -- } -- LLVM_FALLTHROUGH; -- default: -- return Platform::GetSoftwareBreakpointTrapOpcode(target, bp_site); -- } --} -- bool PlatformFreeBSD::CanDebugProcess() { if (IsHost()) { -- llvm::Triple host_triple{llvm::sys::getProcessTriple()}; -- bool use_legacy_plugin; -- -- switch (host_triple.getArch()) { -- case llvm::Triple::x86: -- case llvm::Triple::x86_64: -- // FreeBSDRemote plugin supports x86 only at the moment -- use_legacy_plugin = !!getenv("FREEBSD_LEGACY_PLUGIN"); -- break; -- default: -- use_legacy_plugin = true; -- } -- -- return !use_legacy_plugin; ++ return true; } else { // If we're connected, we can debug. return IsConnected(); diff --cc contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h index c198ea18638d,c198ea18638d..4fd10fb1be73 --- a/contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h +++ b/contrib/llvm-project/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h @@@ -44,9 -44,9 +44,6 @@@ public bool CanDebugProcess() override; -- size_t GetSoftwareBreakpointTrapOpcode(Target &target, -- BreakpointSite *bp_site) override; -- void CalculateTrapHandlerSymbolNames() override; MmapArgList GetMmapArgumentList(const ArchSpec &arch, lldb::addr_t addr, diff --cc contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp index 163093c2ab1f,163093c2ab1f..5961ff4439db --- a/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp @@@ -213,8 -213,8 +213,9 @@@ void NativeProcessFreeBSD::MonitorSIGTR llvm::Error error = t.CopyWatchpointsFrom( static_cast<NativeThreadFreeBSD &>(*GetCurrentThread())); if (error) { -- LLDB_LOG(log, "failed to copy watchpoints to new thread {0}: {1}", -- info.pl_lwpid, llvm::toString(std::move(error))); ++ LLDB_LOG_ERROR(log, std::move(error), ++ "failed to copy watchpoints to new thread {1}: {0}", ++ info.pl_lwpid); SetState(StateType::eStateInvalid); return; } @@@ -264,19 -264,19 +265,35 @@@ switch (info.pl_siginfo.si_code) { case TRAP_BRKPT: ++ LLDB_LOG(log, "SIGTRAP/TRAP_BRKPT: si_addr: {0}", ++ info.pl_siginfo.si_addr); ++ if (thread) { -- thread->SetStoppedByBreakpoint(); ++ auto thread_info = ++ m_threads_stepping_with_breakpoint.find(thread->GetID()); ++ if (thread_info != m_threads_stepping_with_breakpoint.end()) { ++ thread->SetStoppedByTrace(); ++ Status brkpt_error = RemoveBreakpoint(thread_info->second); ++ if (brkpt_error.Fail()) ++ LLDB_LOG(log, "pid = {0} remove stepping breakpoint: {1}", ++ thread_info->first, brkpt_error); ++ m_threads_stepping_with_breakpoint.erase(thread_info); ++ } else ++ thread->SetStoppedByBreakpoint(); FixupBreakpointPCAsNeeded(*thread); } SetState(StateType::eStateStopped, true); return; case TRAP_TRACE: ++ LLDB_LOG(log, "SIGTRAP/TRAP_TRACE: si_addr: {0}", ++ info.pl_siginfo.si_addr); ++ if (thread) { auto ®ctx = static_cast<NativeRegisterContextFreeBSD &>( thread->GetRegisterContext()); uint32_t wp_index = LLDB_INVALID_INDEX32; -- Status error = -- regctx.GetWatchpointHitIndex(wp_index, LLDB_INVALID_ADDRESS); ++ Status error = regctx.GetWatchpointHitIndex( ++ wp_index, reinterpret_cast<uintptr_t>(info.pl_siginfo.si_addr)); if (error.Fail()) LLDB_LOG(log, "received error while checking for watchpoint hits, pid = " @@@ -354,6 -354,6 +371,27 @@@ Status NativeProcessFreeBSD::PtraceWrap return error; } ++llvm::Expected<llvm::ArrayRef<uint8_t>> ++NativeProcessFreeBSD::GetSoftwareBreakpointTrapOpcode(size_t size_hint) { ++ static const uint8_t g_arm_opcode[] = {0xfe, 0xde, 0xff, 0xe7}; ++ static const uint8_t g_thumb_opcode[] = {0x01, 0xde}; ++ ++ switch (GetArchitecture().GetMachine()) { ++ case llvm::Triple::arm: ++ switch (size_hint) { ++ case 2: ++ return llvm::makeArrayRef(g_thumb_opcode); ++ case 4: ++ return llvm::makeArrayRef(g_arm_opcode); ++ default: ++ return llvm::createStringError(llvm::inconvertibleErrorCode(), ++ "Unrecognised trap opcode size hint!"); ++ } ++ default: ++ return NativeProcessProtocol::GetSoftwareBreakpointTrapOpcode(size_hint); ++ } ++} ++ Status NativeProcessFreeBSD::Resume(const ResumeActionList &resume_actions) { Log *log(ProcessPOSIXLog::GetLogIfAllCategoriesSet(POSIX_LOG_PROCESS)); LLDB_LOG(log, "pid {0}", GetID()); @@@ -623,9 -623,9 +661,8 @@@ size_t NativeProcessFreeBSD::UpdateThre Status NativeProcessFreeBSD::SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) { if (hardware) -- return Status("NativeProcessFreeBSD does not support hardware breakpoints"); -- else -- return SetSoftwareBreakpoint(addr, size); ++ return SetHardwareBreakpoint(addr, size); ++ return SetSoftwareBreakpoint(addr, size); } Status NativeProcessFreeBSD::GetLoadedModuleFileSpec(const char *module_path, @@@ -878,3 -878,3 +915,7 @@@ Status NativeProcessFreeBSD::Reinitiali return error; } ++ ++bool NativeProcessFreeBSD::SupportHardwareSingleStepping() const { ++ return !m_arch.IsMIPS(); ++} diff --cc contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h index 3c7a9400f9c4,3c7a9400f9c4..ceffc370ca33 --- a/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h +++ b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.h @@@ -10,6 -10,6 +10,8 @@@ #define liblldb_NativeProcessFreeBSD_H_ #include "Plugins/Process/POSIX/NativeProcessELF.h" ++#include "Plugins/Process/Utility/NativeProcessSoftwareSingleStep.h" ++ #include "lldb/Target/MemoryRegionInfo.h" #include "lldb/Utility/ArchSpec.h" #include "lldb/Utility/FileSpec.h" @@@ -25,7 -25,7 +27,8 @@@ namespace process_freebsd /// for debugging. /// /// Changes in the inferior process state are broadcasted. --class NativeProcessFreeBSD : public NativeProcessELF { ++class NativeProcessFreeBSD : public NativeProcessELF, ++ private NativeProcessSoftwareSingleStep { public: class Factory : public NativeProcessProtocol::Factory { public: @@@ -84,6 -84,6 +87,12 @@@ static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr = nullptr, int data = 0, int *result = nullptr); ++ bool SupportHardwareSingleStepping() const; ++ ++protected: ++ llvm::Expected<llvm::ArrayRef<uint8_t>> ++ GetSoftwareBreakpointTrapOpcode(size_t size_hint) override; ++ private: MainLoop::SignalHandleUP m_sigchld_handle; ArchSpec m_arch; diff --cc contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.cpp index ac3cc4fe788a,ac3cc4fe788a..3d744f773a26 --- a/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.cpp +++ b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD.cpp @@@ -8,7 -8,7 +8,7 @@@ #include "NativeRegisterContextFreeBSD.h" --#include "Plugins/Process/FreeBSDRemote/NativeProcessFreeBSD.h" ++#include "Plugins/Process/FreeBSD/NativeProcessFreeBSD.h" #include "lldb/Host/common/NativeProcessProtocol.h" diff --cc contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.cpp index 000000000000,000000000000..c4ee3773eaeb new file mode 100644 --- /dev/null +++ b/contrib/llvm-project/lldb/source/Plugins/Process/FreeBSD/NativeRegisterContextFreeBSD_arm.cpp @@@ -1,0 -1,0 +1,202 @@@ ++//===-- NativeRegisterContextFreeBSD_arm.cpp ------------------------------===// ++// ++// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. ++// See https://llvm.org/LICENSE.txt for license information. ++// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception ++// ++//===----------------------------------------------------------------------===// ++ ++#if defined(__arm__) ++ ++#include "NativeRegisterContextFreeBSD_arm.h" ++ ++#include "lldb/Utility/DataBufferHeap.h" ++#include "lldb/Utility/RegisterValue.h" ++#include "lldb/Utility/Status.h" ++ ++#include "Plugins/Process/FreeBSD/NativeProcessFreeBSD.h" ++#include "Plugins/Process/Utility/RegisterInfoPOSIX_arm.h" ++ ++// clang-format off ++#include <sys/param.h> ++#include <sys/ptrace.h> ++#include <sys/types.h> ++// clang-format on ++ ++using namespace lldb; ++using namespace lldb_private; ++using namespace lldb_private::process_freebsd; ++ ++NativeRegisterContextFreeBSD * ++NativeRegisterContextFreeBSD::CreateHostNativeRegisterContextFreeBSD( ++ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) { ++ return new NativeRegisterContextFreeBSD_arm(target_arch, native_thread); ++} ++ ++NativeRegisterContextFreeBSD_arm::NativeRegisterContextFreeBSD_arm( ++ const ArchSpec &target_arch, NativeThreadProtocol &native_thread) ++ : NativeRegisterContextRegisterInfo( ++ native_thread, new RegisterInfoPOSIX_arm(target_arch)) {} ++ ++RegisterInfoPOSIX_arm & ++NativeRegisterContextFreeBSD_arm::GetRegisterInfo() const { ++ return static_cast<RegisterInfoPOSIX_arm &>(*m_register_info_interface_up); ++} ++ ++uint32_t NativeRegisterContextFreeBSD_arm::GetRegisterSetCount() const { ++ return GetRegisterInfo().GetRegisterSetCount(); ++} ++ ++const RegisterSet * ++NativeRegisterContextFreeBSD_arm::GetRegisterSet(uint32_t set_index) const { ++ return GetRegisterInfo().GetRegisterSet(set_index); ++} ++ ++uint32_t NativeRegisterContextFreeBSD_arm::GetUserRegisterCount() const { ++ uint32_t count = 0; ++ for (uint32_t set_index = 0; set_index < GetRegisterSetCount(); ++set_index) ++ count += GetRegisterSet(set_index)->num_registers; ++ return count; ++} ++ ++Status NativeRegisterContextFreeBSD_arm::ReadRegisterSet(uint32_t set) { ++ switch (set) { ++ case RegisterInfoPOSIX_arm::GPRegSet: ++ return NativeProcessFreeBSD::PtraceWrapper(PT_GETREGS, m_thread.GetID(), ++ m_reg_data.data()); ++ case RegisterInfoPOSIX_arm::FPRegSet: ++ return NativeProcessFreeBSD::PtraceWrapper( ++ PT_GETVFPREGS, m_thread.GetID(), ++ m_reg_data.data() + sizeof(RegisterInfoPOSIX_arm::GPR)); ++ } ++ llvm_unreachable("NativeRegisterContextFreeBSD_arm::ReadRegisterSet"); ++} ++ ++Status NativeRegisterContextFreeBSD_arm::WriteRegisterSet(uint32_t set) { ++ switch (set) { ++ case RegisterInfoPOSIX_arm::GPRegSet: ++ return NativeProcessFreeBSD::PtraceWrapper(PT_SETREGS, m_thread.GetID(), ++ m_reg_data.data()); ++ case RegisterInfoPOSIX_arm::FPRegSet: ++ return NativeProcessFreeBSD::PtraceWrapper( ++ PT_SETVFPREGS, m_thread.GetID(), ++ m_reg_data.data() + sizeof(RegisterInfoPOSIX_arm::GPR)); ++ } ++ llvm_unreachable("NativeRegisterContextFreeBSD_arm::WriteRegisterSet"); ++} ++ ++Status ++NativeRegisterContextFreeBSD_arm::ReadRegister(const RegisterInfo *reg_info, ++ RegisterValue ®_value) { ++ Status error; ++ ++ if (!reg_info) { ++ error.SetErrorString("reg_info NULL"); ++ return error; ++ } ++ ++ const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; ++ ++ if (reg == LLDB_INVALID_REGNUM) ++ return Status("no lldb regnum for %s", reg_info && reg_info->name ++ ? reg_info->name ++ : "<unknown register>"); ++ ++ uint32_t set = GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg); ++ error = ReadRegisterSet(set); ++ if (error.Fail()) ++ return error; ++ ++ assert(reg_info->byte_offset + reg_info->byte_size <= m_reg_data.size()); ++ reg_value.SetBytes(m_reg_data.data() + reg_info->byte_offset, ++ reg_info->byte_size, endian::InlHostByteOrder()); ++ return error; ++} ++ ++Status NativeRegisterContextFreeBSD_arm::WriteRegister( ++ const RegisterInfo *reg_info, const RegisterValue ®_value) { ++ Status error; ++ ++ if (!reg_info) ++ return Status("reg_info NULL"); ++ ++ const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB]; ++ ++ if (reg == LLDB_INVALID_REGNUM) ++ return Status("no lldb regnum for %s", reg_info && reg_info->name ++ ? reg_info->name ++ : "<unknown register>"); ++ ++ uint32_t set = GetRegisterInfo().GetRegisterSetFromRegisterIndex(reg); ++ error = ReadRegisterSet(set); ++ if (error.Fail()) ++ return error; ++ ++ assert(reg_info->byte_offset + reg_info->byte_size <= m_reg_data.size()); ++ ::memcpy(m_reg_data.data() + reg_info->byte_offset, reg_value.GetBytes(), ++ reg_info->byte_size); ++ ++ return WriteRegisterSet(set); ++} ++ ++Status NativeRegisterContextFreeBSD_arm::ReadAllRegisterValues( ++ lldb::DataBufferSP &data_sp) { ++ Status error; ++ ++ error = ReadRegisterSet(RegisterInfoPOSIX_arm::GPRegSet); ++ if (error.Fail()) ++ return error; ++ ++ error = ReadRegisterSet(RegisterInfoPOSIX_arm::FPRegSet); ++ if (error.Fail()) ++ return error; ++ ++ data_sp.reset(new DataBufferHeap(m_reg_data.size(), 0)); ++ uint8_t *dst = data_sp->GetBytes(); ++ ::memcpy(dst, m_reg_data.data(), m_reg_data.size()); ++ ++ return error; ++} ++ ++Status NativeRegisterContextFreeBSD_arm::WriteAllRegisterValues( ++ const lldb::DataBufferSP &data_sp) { ++ Status error; ++ ++ if (!data_sp) { ++ error.SetErrorStringWithFormat( ++ "NativeRegisterContextFreeBSD_arm::%s invalid data_sp provided", ++ __FUNCTION__); ++ return error; ++ } ++ ++ if (data_sp->GetByteSize() != m_reg_data.size()) { ++ error.SetErrorStringWithFormat( ++ "NativeRegisterContextFreeBSD_arm::%s data_sp contained mismatched " ++ "data size, expected %" PRIu64 ", actual %" PRIu64, ++ __FUNCTION__, m_reg_data.size(), data_sp->GetByteSize()); ++ return error; ++ } ++ ++ uint8_t *src = data_sp->GetBytes(); ++ if (src == nullptr) { ++ error.SetErrorStringWithFormat("NativeRegisterContextFreeBSD_arm::%s " ++ "DataBuffer::GetBytes() returned a null " ++ "pointer", ++ __FUNCTION__); ++ return error; ++ } ++ ::memcpy(m_reg_data.data(), src, m_reg_data.size()); ++ ++ error = WriteRegisterSet(RegisterInfoPOSIX_arm::GPRegSet); ++ if (error.Fail()) ++ return error; *** 31327 LINES SKIPPED ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202106132002.15DK2rjR014110>