repo_name
stringlengths
5
122
path
stringlengths
3
232
text
stringlengths
6
1.05M
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/ArchSpec.h
//===-- ArchSpec.h ----------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ArchSpec_h_ #define liblldb_ArchSpec_h_ #if defined(__cplusplus) #include "lldb/Core/ConstString.h" #include "lldb/lldb-forward.h" #include "llvm/ADT/Triple.h" namespace lldb_private { struct CoreDefinition; //---------------------------------------------------------------------- /// @class ArchSpec ArchSpec.h "lldb/Core/ArchSpec.h" /// @brief An architecture specification class. /// /// A class designed to be created from a cpu type and subtype, a /// string representation, or an llvm::Triple. Keeping all of the /// conversions of strings to architecture enumeration values confined /// to this class allows new architecture support to be added easily. //---------------------------------------------------------------------- class ArchSpec { public: enum MIPSSubType { eMIPSSubType_unknown, eMIPSSubType_mips32, eMIPSSubType_mips32r2, eMIPSSubType_mips32r6, eMIPSSubType_mips32el, eMIPSSubType_mips32r2el, eMIPSSubType_mips32r6el, eMIPSSubType_mips64, eMIPSSubType_mips64r2, eMIPSSubType_mips64r6, eMIPSSubType_mips64el, eMIPSSubType_mips64r2el, eMIPSSubType_mips64r6el, }; // Masks for the ases word of an ABI flags structure. enum MIPSASE { eMIPSAse_dsp = 0x00000001, // DSP ASE eMIPSAse_dspr2 = 0x00000002, // DSP R2 ASE eMIPSAse_eva = 0x00000004, // Enhanced VA Scheme eMIPSAse_mcu = 0x00000008, // MCU (MicroController) ASE eMIPSAse_mdmx = 0x00000010, // MDMX ASE eMIPSAse_mips3d = 0x00000020, // MIPS-3D ASE eMIPSAse_mt = 0x00000040, // MT ASE eMIPSAse_smartmips = 0x00000080, // SmartMIPS ASE eMIPSAse_virt = 0x00000100, // VZ ASE eMIPSAse_msa = 0x00000200, // MSA ASE eMIPSAse_mips16 = 0x00000400, // MIPS16 ASE eMIPSAse_micromips = 0x00000800, // MICROMIPS ASE eMIPSAse_xpa = 0x00001000, // XPA ASE eMIPSAse_mask = 0x00001fff, eMIPSABI_O32 = 0x00002000, eMIPSABI_N32 = 0x00004000, eMIPSABI_N64 = 0x00008000, eMIPSABI_O64 = 0x00020000, eMIPSABI_EABI32 = 0x00040000, eMIPSABI_EABI64 = 0x00080000, eMIPSABI_mask = 0x000ff000 }; // MIPS Floating point ABI Values enum MIPS_ABI_FP { eMIPS_ABI_FP_ANY = 0x00000000, eMIPS_ABI_FP_DOUBLE = 0x00100000, // hard float / -mdouble-float eMIPS_ABI_FP_SINGLE = 0x00200000, // hard float / -msingle-float eMIPS_ABI_FP_SOFT = 0x00300000, // soft float eMIPS_ABI_FP_OLD_64 = 0x00400000, // -mips32r2 -mfp64 eMIPS_ABI_FP_XX = 0x00500000, // -mfpxx eMIPS_ABI_FP_64 = 0x00600000, // -mips32r2 -mfp64 eMIPS_ABI_FP_64A = 0x00700000, // -mips32r2 -mfp64 -mno-odd-spreg eMIPS_ABI_FP_mask = 0x00700000 }; // ARM specific e_flags enum ARMeflags { eARM_abi_soft_float = 0x00000200, eARM_abi_hard_float = 0x00000400 }; enum Core { eCore_arm_generic, eCore_arm_armv4, eCore_arm_armv4t, eCore_arm_armv5, eCore_arm_armv5e, eCore_arm_armv5t, eCore_arm_armv6, eCore_arm_armv6m, eCore_arm_armv7, eCore_arm_armv7f, eCore_arm_armv7s, eCore_arm_armv7k, eCore_arm_armv7m, eCore_arm_armv7em, eCore_arm_xscale, eCore_thumb, eCore_thumbv4t, eCore_thumbv5, eCore_thumbv5e, eCore_thumbv6, eCore_thumbv6m, eCore_thumbv7, eCore_thumbv7s, eCore_thumbv7k, eCore_thumbv7f, eCore_thumbv7m, eCore_thumbv7em, eCore_arm_arm64, eCore_arm_armv8, eCore_arm_aarch64, eCore_mips32, eCore_mips32r2, eCore_mips32r3, eCore_mips32r5, eCore_mips32r6, eCore_mips32el, eCore_mips32r2el, eCore_mips32r3el, eCore_mips32r5el, eCore_mips32r6el, eCore_mips64, eCore_mips64r2, eCore_mips64r3, eCore_mips64r5, eCore_mips64r6, eCore_mips64el, eCore_mips64r2el, eCore_mips64r3el, eCore_mips64r5el, eCore_mips64r6el, eCore_ppc_generic, eCore_ppc_ppc601, eCore_ppc_ppc602, eCore_ppc_ppc603, eCore_ppc_ppc603e, eCore_ppc_ppc603ev, eCore_ppc_ppc604, eCore_ppc_ppc604e, eCore_ppc_ppc620, eCore_ppc_ppc750, eCore_ppc_ppc7400, eCore_ppc_ppc7450, eCore_ppc_ppc970, eCore_ppc64_generic, eCore_ppc64_ppc970_64, eCore_s390x_generic, eCore_sparc_generic, eCore_sparc9_generic, eCore_x86_32_i386, eCore_x86_32_i486, eCore_x86_32_i486sx, eCore_x86_32_i686, eCore_x86_64_x86_64, eCore_x86_64_x86_64h, // Haswell enabled x86_64 eCore_hexagon_generic, eCore_hexagon_hexagonv4, eCore_hexagon_hexagonv5, eCore_uknownMach32, eCore_uknownMach64, eCore_kalimba3, eCore_kalimba4, eCore_kalimba5, kNumCores, kCore_invalid, // The following constants are used for wildcard matching only kCore_any, kCore_arm_any, kCore_ppc_any, kCore_ppc64_any, kCore_x86_32_any, kCore_x86_64_any, kCore_hexagon_any, kCore_arm_first = eCore_arm_generic, kCore_arm_last = eCore_arm_xscale, kCore_thumb_first = eCore_thumb, kCore_thumb_last = eCore_thumbv7em, kCore_ppc_first = eCore_ppc_generic, kCore_ppc_last = eCore_ppc_ppc970, kCore_ppc64_first = eCore_ppc64_generic, kCore_ppc64_last = eCore_ppc64_ppc970_64, kCore_x86_32_first = eCore_x86_32_i386, kCore_x86_32_last = eCore_x86_32_i686, kCore_x86_64_first = eCore_x86_64_x86_64, kCore_x86_64_last = eCore_x86_64_x86_64h, kCore_hexagon_first = eCore_hexagon_generic, kCore_hexagon_last = eCore_hexagon_hexagonv5, kCore_kalimba_first = eCore_kalimba3, kCore_kalimba_last = eCore_kalimba5, kCore_mips32_first = eCore_mips32, kCore_mips32_last = eCore_mips32r6, kCore_mips32el_first = eCore_mips32el, kCore_mips32el_last = eCore_mips32r6el, kCore_mips64_first = eCore_mips64, kCore_mips64_last = eCore_mips64r6, kCore_mips64el_first = eCore_mips64el, kCore_mips64el_last = eCore_mips64r6el, kCore_mips_first = eCore_mips32, kCore_mips_last = eCore_mips64r6el }; typedef void (*StopInfoOverrideCallbackType)(lldb_private::Thread &thread); //------------------------------------------------------------------ /// Default constructor. /// /// Default constructor that initializes the object with invalid /// cpu type and subtype values. //------------------------------------------------------------------ ArchSpec(); //------------------------------------------------------------------ /// Constructor over triple. /// /// Constructs an ArchSpec with properties consistent with the given /// Triple. //------------------------------------------------------------------ explicit ArchSpec(const llvm::Triple &triple); explicit ArchSpec(const char *triple_cstr); explicit ArchSpec(llvm::StringRef triple_str); ArchSpec(const char *triple_cstr, Platform *platform); ArchSpec(llvm::StringRef triple_str, Platform *platform); //------------------------------------------------------------------ /// Constructor over architecture name. /// /// Constructs an ArchSpec with properties consistent with the given /// object type and architecture name. //------------------------------------------------------------------ explicit ArchSpec(ArchitectureType arch_type, uint32_t cpu_type, uint32_t cpu_subtype); //------------------------------------------------------------------ /// Destructor. //------------------------------------------------------------------ ~ArchSpec(); //------------------------------------------------------------------ /// Assignment operator. /// /// @param[in] rhs another ArchSpec object to copy. /// /// @return A const reference to this object. //------------------------------------------------------------------ const ArchSpec &operator=(const ArchSpec &rhs); static size_t AutoComplete(llvm::StringRef name, StringList &matches); //------------------------------------------------------------------ /// Returns a static string representing the current architecture. /// /// @return A static string correcponding to the current /// architecture. //------------------------------------------------------------------ const char *GetArchitectureName() const; //----------------------------------------------------------------- /// if MIPS architecture return true. /// /// @return a boolean value. //----------------------------------------------------------------- bool IsMIPS() const; //------------------------------------------------------------------ /// Returns a string representing current architecture as a target CPU /// for tools like compiler, disassembler etc. /// /// @return A string representing target CPU for the current /// architecture. //------------------------------------------------------------------ std::string GetClangTargetCPU(); //------------------------------------------------------------------ /// Return a string representing target application ABI. /// /// @return A string representing target application ABI. //------------------------------------------------------------------ std::string GetTargetABI() const; //------------------------------------------------------------------ /// Clears the object state. /// /// Clears the object state back to a default invalid state. //------------------------------------------------------------------ void Clear(); //------------------------------------------------------------------ /// Returns the size in bytes of an address of the current /// architecture. /// /// @return The byte size of an address of the current architecture. //------------------------------------------------------------------ uint32_t GetAddressByteSize() const; //------------------------------------------------------------------ /// Returns a machine family for the current architecture. /// /// @return An LLVM arch type. //------------------------------------------------------------------ llvm::Triple::ArchType GetMachine() const; //------------------------------------------------------------------ /// Returns the distribution id of the architecture. /// /// This will be something like "ubuntu", "fedora", etc. on Linux. /// /// @return A ConstString ref containing the distribution id, /// potentially empty. //------------------------------------------------------------------ const ConstString &GetDistributionId() const; //------------------------------------------------------------------ /// Set the distribution id of the architecture. /// /// This will be something like "ubuntu", "fedora", etc. on Linux. /// This should be the same value returned by /// HostInfo::GetDistributionId (). ///------------------------------------------------------------------ void SetDistributionId(const char *distribution_id); //------------------------------------------------------------------ /// Tests if this ArchSpec is valid. /// /// @return True if the current architecture is valid, false /// otherwise. //------------------------------------------------------------------ bool IsValid() const { return m_core >= eCore_arm_generic && m_core < kNumCores; } bool TripleVendorWasSpecified() const { return !m_triple.getVendorName().empty(); } bool TripleVendorIsUnspecifiedUnknown() const { return m_triple.getVendor() == llvm::Triple::UnknownVendor && m_triple.getVendorName().empty(); } bool TripleOSWasSpecified() const { return !m_triple.getOSName().empty(); } bool TripleEnvironmentWasSpecified() const { return !m_triple.getEnvironmentName().empty(); } bool TripleOSIsUnspecifiedUnknown() const { return m_triple.getOS() == llvm::Triple::UnknownOS && m_triple.getOSName().empty(); } //------------------------------------------------------------------ /// Merges fields from another ArchSpec into this ArchSpec. /// /// This will use the supplied ArchSpec to fill in any fields of /// the triple in this ArchSpec which were unspecified. This can /// be used to refine a generic ArchSpec with a more specific one. /// For example, if this ArchSpec's triple is something like /// i386-unknown-unknown-unknown, and we have a triple which is /// x64-pc-windows-msvc, then merging that triple into this one /// will result in the triple i386-pc-windows-msvc. /// //------------------------------------------------------------------ void MergeFrom(const ArchSpec &other); //------------------------------------------------------------------ /// Change the architecture object type, CPU type and OS type. /// /// @param[in] arch_type The object type of this ArchSpec. /// /// @param[in] cpu The required CPU type. /// /// @param[in] os The optional OS type /// The default value of 0 was chosen to from the ELF spec value /// ELFOSABI_NONE. ELF is the only one using this parameter. If another /// format uses this parameter and 0 does not work, use a value over /// 255 because in the ELF header this is value is only a byte. /// /// @return True if the object, and CPU were successfully set. /// /// As a side effect, the vendor value is usually set to unknown. /// The exections are /// aarch64-apple-ios /// arm-apple-ios /// thumb-apple-ios /// x86-apple- /// x86_64-apple- /// /// As a side effect, the os value is usually set to unknown /// The exceptions are /// *-*-aix /// aarch64-apple-ios /// arm-apple-ios /// thumb-apple-ios /// powerpc-apple-darwin /// *-*-freebsd /// *-*-linux /// *-*-netbsd /// *-*-openbsd /// *-*-solaris //------------------------------------------------------------------ bool SetArchitecture(ArchitectureType arch_type, uint32_t cpu, uint32_t sub, uint32_t os = 0); //------------------------------------------------------------------ /// Returns the byte order for the architecture specification. /// /// @return The endian enumeration for the current endianness of /// the architecture specification //------------------------------------------------------------------ lldb::ByteOrder GetByteOrder() const; //------------------------------------------------------------------ /// Sets this ArchSpec's byte order. /// /// In the common case there is no need to call this method as the /// byte order can almost always be determined by the architecture. /// However, many CPU's are bi-endian (ARM, Alpha, PowerPC, etc) /// and the default/assumed byte order may be incorrect. //------------------------------------------------------------------ void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; } uint32_t GetMinimumOpcodeByteSize() const; uint32_t GetMaximumOpcodeByteSize() const; Core GetCore() const { return m_core; } uint32_t GetMachOCPUType() const; uint32_t GetMachOCPUSubType() const; //------------------------------------------------------------------ /// Architecture data byte width accessor /// /// @return the size in 8-bit (host) bytes of a minimum addressable /// unit from the Architecture's data bus //------------------------------------------------------------------ uint32_t GetDataByteSize() const; //------------------------------------------------------------------ /// Architecture code byte width accessor /// /// @return the size in 8-bit (host) bytes of a minimum addressable /// unit from the Architecture's code bus //------------------------------------------------------------------ uint32_t GetCodeByteSize() const; //------------------------------------------------------------------ /// Architecture tripple accessor. /// /// @return A triple describing this ArchSpec. //------------------------------------------------------------------ llvm::Triple &GetTriple() { return m_triple; } //------------------------------------------------------------------ /// Architecture tripple accessor. /// /// @return A triple describing this ArchSpec. //------------------------------------------------------------------ const llvm::Triple &GetTriple() const { return m_triple; } void DumpTriple(Stream &s) const; //------------------------------------------------------------------ /// Architecture tripple setter. /// /// Configures this ArchSpec according to the given triple. If the /// triple has unknown components in all of the vendor, OS, and /// the optional environment field (i.e. "i386-unknown-unknown") /// then default values are taken from the host. Architecture and /// environment components are used to further resolve the CPU type /// and subtype, endian characteristics, etc. /// /// @return A triple describing this ArchSpec. //------------------------------------------------------------------ bool SetTriple(const llvm::Triple &triple); bool SetTriple(llvm::StringRef triple_str); bool SetTriple(llvm::StringRef triple_str, Platform *platform); bool SetTriple(const char *triple_cstr); bool SetTriple(const char *triple_cstr, Platform *platform); //------------------------------------------------------------------ /// Returns the default endianness of the architecture. /// /// @return The endian enumeration for the default endianness of /// the architecture. //------------------------------------------------------------------ lldb::ByteOrder GetDefaultEndian() const; //------------------------------------------------------------------ /// Returns true if 'char' is a signed type by defualt in the /// architecture false otherwise /// /// @return True if 'char' is a signed type by default on the /// architecture and false otherwise. //------------------------------------------------------------------ bool CharIsSignedByDefault() const; //------------------------------------------------------------------ /// Compare an ArchSpec to another ArchSpec, requiring an exact cpu /// type match between them. /// e.g. armv7s is not an exact match with armv7 - this would return false /// /// @return true if the two ArchSpecs match. //------------------------------------------------------------------ bool IsExactMatch(const ArchSpec &rhs) const; //------------------------------------------------------------------ /// Compare an ArchSpec to another ArchSpec, requiring a compatible /// cpu type match between them. /// e.g. armv7s is compatible with armv7 - this method would return true /// /// @return true if the two ArchSpecs are compatible //------------------------------------------------------------------ bool IsCompatibleMatch(const ArchSpec &rhs) const; //------------------------------------------------------------------ /// Get a stop info override callback for the current architecture. /// /// Most platform specific code should go in lldb_private::Platform, /// but there are cases where no matter which platform you are on /// certain things hold true. /// /// This callback is currently intended to handle cases where a /// program stops at an instruction that won't get executed and it /// allows the stop reasonm, like "breakpoint hit", to be replaced /// with a different stop reason like "no stop reason". /// /// This is specifically used for ARM in Thumb code when we stop in /// an IT instruction (if/then/else) where the instruction won't get /// executed and therefore it wouldn't be correct to show the program /// stopped at the current PC. The code is generic and applies to all /// ARM CPUs. /// /// @return NULL or a valid stop info override callback for the /// current architecture. //------------------------------------------------------------------ StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const; bool IsFullySpecifiedTriple() const; void PiecewiseTripleCompare(const ArchSpec &other, bool &arch_different, bool &vendor_different, bool &os_different, bool &os_version_different, bool &env_different); //------------------------------------------------------------------ /// Detect whether this architecture uses thumb code exclusively /// /// Some embedded ARM chips (e.g. the ARM Cortex M0-7 line) can /// only execute the Thumb instructions, never Arm. We should normally /// pick up arm/thumbness from their the processor status bits (cpsr/xpsr) /// or hints on each function - but when doing bare-boards low level /// debugging (especially common with these embedded processors), we may /// not have those things easily accessible. /// /// @return true if this is an arm ArchSpec which can only execute Thumb /// instructions //------------------------------------------------------------------ bool IsAlwaysThumbInstructions() const; uint32_t GetFlags() const { return m_flags; } void SetFlags(uint32_t flags) { m_flags = flags; } void SetFlags(std::string elf_abi); protected: bool IsEqualTo(const ArchSpec &rhs, bool exact_match) const; llvm::Triple m_triple; Core m_core = kCore_invalid; lldb::ByteOrder m_byte_order = lldb::eByteOrderInvalid; // Additional arch flags which we cannot get from triple and core // For MIPS these are application specific extensions like // micromips, mips16 etc. uint32_t m_flags = 0; ConstString m_distribution_id; // Called when m_def or m_entry are changed. Fills in all remaining // members with default values. void CoreUpdated(bool update_triple); }; //------------------------------------------------------------------ /// @fn bool operator< (const ArchSpec& lhs, const ArchSpec& rhs) /// @brief Less than operator. /// /// Tests two ArchSpec objects to see if \a lhs is less than \a /// rhs. /// /// @param[in] lhs The Left Hand Side ArchSpec object to compare. /// @param[in] rhs The Left Hand Side ArchSpec object to compare. /// /// @return true if \a lhs is less than \a rhs //------------------------------------------------------------------ bool operator<(const ArchSpec &lhs, const ArchSpec &rhs); bool ParseMachCPUDashSubtypeTriple(llvm::StringRef triple_str, ArchSpec &arch); } // namespace lldb_private #endif // #if defined(__cplusplus) #endif // #ifndef liblldb_ArchSpec_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Breakpoint/BreakpointID.h
//===-- BreakpointID.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_BreakpointID_h_ #define liblldb_BreakpointID_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringRef.h" namespace lldb_private { //---------------------------------------------------------------------- // class BreakpointID //---------------------------------------------------------------------- class BreakpointID { public: BreakpointID(lldb::break_id_t bp_id = LLDB_INVALID_BREAK_ID, lldb::break_id_t loc_id = LLDB_INVALID_BREAK_ID); virtual ~BreakpointID(); lldb::break_id_t GetBreakpointID() const { return m_break_id; } lldb::break_id_t GetLocationID() const { return m_location_id; } void SetID(lldb::break_id_t bp_id, lldb::break_id_t loc_id) { m_break_id = bp_id; m_location_id = loc_id; } void SetBreakpointID(lldb::break_id_t bp_id) { m_break_id = bp_id; } void SetBreakpointLocationID(lldb::break_id_t loc_id) { m_location_id = loc_id; } void GetDescription(Stream *s, lldb::DescriptionLevel level); static bool IsRangeIdentifier(llvm::StringRef str); static bool IsValidIDExpression(llvm::StringRef str); static llvm::ArrayRef<llvm::StringRef> GetRangeSpecifiers(); //------------------------------------------------------------------ /// Takes an input string containing the description of a breakpoint or /// breakpoint and location and returns the a BreakpointID filled out with /// the proper id and location. /// /// @param[in] input /// A string containing JUST the breakpoint description. /// @return /// If \p input was not a valid breakpoint ID string, returns /// \b llvm::None. Otherwise returns a BreakpointID with members filled /// out accordingly. //------------------------------------------------------------------ static llvm::Optional<BreakpointID> ParseCanonicalReference(llvm::StringRef input); //------------------------------------------------------------------ /// Takes an input string and checks to see whether it is a breakpoint name. /// If it is a mal-formed breakpoint name, error will be set to an appropriate /// error string. /// /// @param[in] input /// A string containing JUST the breakpoint description. /// @param[out] error /// If the name is a well-formed breakpoint name, set to success, /// otherwise set to an error. /// @return /// \b true if the name is a breakpoint name (as opposed to an ID or /// range) false otherwise. //------------------------------------------------------------------ static bool StringIsBreakpointName(llvm::StringRef str, Error &error); //------------------------------------------------------------------ /// Takes a breakpoint ID and the breakpoint location id and returns /// a string containing the canonical description for the breakpoint /// or breakpoint location. /// /// @param[out] break_id /// This is the break id. /// /// @param[out] break_loc_id /// This is breakpoint location id, or LLDB_INVALID_BREAK_ID is no /// location is to be specified. //------------------------------------------------------------------ static void GetCanonicalReference(Stream *s, lldb::break_id_t break_id, lldb::break_id_t break_loc_id); protected: lldb::break_id_t m_break_id; lldb::break_id_t m_location_id; }; } // namespace lldb_private #endif // liblldb_BreakpointID_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Swift/SwiftExpressionVariable.h
//===-- SwiftExpressionVariable.h -------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef liblldb_SwiftExpressionVariable_h_ #define liblldb_SwiftExpressionVariable_h_ // C Includes #include <signal.h> #include <stdint.h> #include <string.h> // C++ Includes #include <map> #include <string> #include <vector> // Other libraries and framework includes #include "llvm/Support/Casting.h" // Project includes #include "lldb/Core/ClangForward.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Value.h" #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/lldb-public.h" namespace llvm { class Value; } namespace lldb_private { class SwiftExpressionVariable : public ExpressionVariable { public: SwiftExpressionVariable(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size); SwiftExpressionVariable(const lldb::ValueObjectSP &valobj_sp); SwiftExpressionVariable(ExecutionContextScope *exe_scope, const ConstString &name, const TypeFromUser &user_type, lldb::ByteOrder byte_order, uint32_t addr_byte_size); //---------------------------------------------------------------------- /// Utility functions for dealing with ExpressionVariableLists in /// Clang-specific ways //---------------------------------------------------------------------- static SwiftExpressionVariable * CreateVariableInList(ExpressionVariableList &list, ExecutionContextScope *exe_scope, const ConstString &name, const TypeFromUser &user_type, lldb::ByteOrder byte_order, uint32_t addr_byte_size) { SwiftExpressionVariable *swift_var = new SwiftExpressionVariable(exe_scope, byte_order, addr_byte_size); lldb::ExpressionVariableSP var_sp(swift_var); swift_var->SetName(name); swift_var->SetCompilerType(user_type); list.AddVariable(var_sp); return swift_var; } bool GetIsModifiable() const { return (m_swift_flags & EVSIsModifiable); } void SetIsModifiable(bool is_modifiable) { if (is_modifiable) m_swift_flags |= EVSIsModifiable; else m_swift_flags &= ~EVSIsModifiable; } bool GetIsComputed() const { return (m_swift_flags & EVSIsComputed); } void SetIsComputed(bool is_computed) { if (is_computed) m_swift_flags |= EVSIsComputed; else m_swift_flags &= ~EVSIsComputed; } enum SwiftFlags { EVSNone = 0, EVSNeedsInit = 1 << 0, ///< This variable's contents are not yet initialized ///(for result variables and new persistent ///variables) EVSIsModifiable = 1 << 1, ///< This variable is a "let" and should not be modified. EVSIsComputed = 1 << 2 ///< This variable is a computed property and has no backing store. }; typedef uint8_t SwiftFlagType; SwiftFlagType m_swift_flags; // takes elements of Flags //------------------------------------------------------------------ // llvm casting support //------------------------------------------------------------------ static bool classof(const ExpressionVariable *ev) { return ev->getKind() == ExpressionVariable::eKindSwift; } //---------------------------------------------------------------------- /// Members //---------------------------------------------------------------------- DISALLOW_COPY_AND_ASSIGN(SwiftExpressionVariable); }; } // namespace lldb_private #endif // liblldb_SwiftExpressionVariable_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Utils.h
#ifndef Utils_h #define Utils_h #include "llvm/Support/Error.h" #include <set> #include <string> #include <vector> #include <sstream> namespace swift { namespace obfuscation { /// A factory function for creating the llvm::Error object. /// /// The returned object has the llvm::StringError type. /// Its message is set to \p Message. /// It is transformable to std::error of value given in \p Error. /// /// Typical usage: /// \code /// return stringError("couldn't generate unique type name"); /// \endcode /// /// \param Message Message to be included in llvm::StringError. /// \param Error Standard error_code that the resulting llvm::Error /// object will be transformable to. It's an optional parameter. /// If ommited, it's the generic category error code 1. /// /// \returns the constructed llvm::Error object. llvm::Error stringError(const std::string Message, const std::error_code Error = std::error_code(1, std::generic_category())); template<typename ElementType> void copyToVector(const std::vector<ElementType> &FromVector, std::vector<ElementType> &ToVector); template<typename ElementType, typename CompareFrom> void copyToVector(const std::set<ElementType, CompareFrom> &FromSet, std::vector<ElementType> &ToVector); template<typename ElementType, typename CompareFrom, typename CompareTo> void copyToSet(const std::set<ElementType, CompareFrom> &FromSet, std::set<ElementType, CompareTo> &ToSet); template<typename ElementType, typename CompareTo> void copyToSet(const std::vector<ElementType> &FromVector, std::set<ElementType, CompareTo> &ToSet); template<typename ElementType> void copyToStream(const std::vector<ElementType> &FromVector, std::ostream_iterator<ElementType> Inserter); std::vector<std::string> split(const std::string &String, char Delimiter); template<typename T> void removeFromVector(std::vector<T> &FromVector, const T &Element); std::string combineIdentifier(std::vector<std::string> &); } //namespace obfuscation } //namespace swift #include "swift/Obfuscation/Utils-Template.h" #endif /* Utils_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/tools/debugserver/source/MacOSX/MachVMMemory.h
//===-- MachVMMemory.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Created by <NAME> on 6/26/07. // //===----------------------------------------------------------------------===// #ifndef __MachVMMemory_h__ #define __MachVMMemory_h__ #include "DNBDefs.h" #include "DNBError.h" #include <mach/mach.h> class MachVMMemory { public: MachVMMemory(); ~MachVMMemory(); nub_size_t Read(task_t task, nub_addr_t address, void *data, nub_size_t data_count); nub_size_t Write(task_t task, nub_addr_t address, const void *data, nub_size_t data_count); nub_size_t PageSize(task_t task); nub_bool_t GetMemoryRegionInfo(task_t task, nub_addr_t address, DNBRegionInfo *region_info); #if defined(HOST_VM_INFO64_COUNT) nub_bool_t GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics64_data_t &vminfo, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size, mach_vm_size_t &purgeable, mach_vm_size_t &anonymous); #else nub_bool_t GetMemoryProfile(DNBProfileDataScanType scanType, task_t task, struct task_basic_info ti, cpu_type_t cputype, nub_process_t pid, vm_statistics_data_t &vminfo, uint64_t &physical_memory, mach_vm_size_t &rprvt, mach_vm_size_t &rsize, mach_vm_size_t &vprvt, mach_vm_size_t &vsize, mach_vm_size_t &dirty_size, mach_vm_size_t &purgeable, mach_vm_size_t &anonymous); #endif protected: nub_size_t MaxBytesLeftInPage(task_t task, nub_addr_t addr, nub_size_t count); uint64_t GetStolenPages(task_t task); void GetRegionSizes(task_t task, mach_vm_size_t &rsize, mach_vm_size_t &dirty_size); void GetMemorySizes(task_t task, cpu_type_t cputype, nub_process_t pid, mach_vm_size_t &rprvt, mach_vm_size_t &vprvt); nub_size_t WriteRegion(task_t task, const nub_addr_t address, const void *data, const nub_size_t data_count); vm_size_t m_page_size; DNBError m_err; }; #endif // #ifndef __MachVMMemory_h__
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/UUID.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Core/UUID.h<gh_stars>100-1000 //===-- UUID.h --------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_UUID_h_ #define liblldb_UUID_h_ // C Includes // C++ Includes #include <string> // Other libraries and framework includes // Project includes #include "lldb/lldb-private.h" namespace lldb_private { class UUID { public: // Most UUIDs are 16 bytes, but some Linux build-ids (SHA1) are 20. typedef uint8_t ValueType[20]; //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ UUID(); UUID(const UUID &rhs); UUID(const void *uuid_bytes, uint32_t num_uuid_bytes); ~UUID(); const UUID &operator=(const UUID &rhs); void Clear(); void Dump(Stream *s) const; const void *GetBytes() const; size_t GetByteSize(); bool IsValid() const; bool SetBytes(const void *uuid_bytes, uint32_t num_uuid_bytes = 16); std::string GetAsString(const char *separator = nullptr) const; size_t SetFromCString(const char *c_str, uint32_t num_uuid_bytes = 16); // Decode as many UUID bytes (up to 16) as possible from the C string "cstr" // This is used for auto completion where a partial UUID might have been // typed in. It //------------------------------------------------------------------ /// Decode as many UUID bytes (up to 16) as possible from the C /// string \a cstr. /// /// @param[in] cstr /// A NULL terminate C string that points at a UUID string value /// (no leading spaces). The string must contain only hex /// characters and optionally can contain the '-' sepearators. /// /// @param[in] uuid_bytes /// A buffer of bytes that will contain a full or patially /// decoded UUID. /// /// @return /// The original string, with all decoded bytes removed. //------------------------------------------------------------------ static llvm::StringRef DecodeUUIDBytesFromString(llvm::StringRef str, ValueType &uuid_bytes, uint32_t &bytes_decoded, uint32_t num_uuid_bytes = 16); protected: //------------------------------------------------------------------ // Classes that inherit from UUID can see and modify these //------------------------------------------------------------------ uint32_t m_num_uuid_bytes; // Should be 16 or 20 ValueType m_uuid; }; bool operator==(const UUID &lhs, const UUID &rhs); bool operator!=(const UUID &lhs, const UUID &rhs); bool operator<(const UUID &lhs, const UUID &rhs); bool operator<=(const UUID &lhs, const UUID &rhs); bool operator>(const UUID &lhs, const UUID &rhs); bool operator>=(const UUID &lhs, const UUID &rhs); } // namespace lldb_private #endif // liblldb_UUID_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/lib/Format/Comments.h
//===--- Comments.cpp - Comment manipulation -----------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Declares comment manipulation functionality. /// //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_LIB_FORMAT_COMMENTS_H #define LLVM_CLANG_LIB_FORMAT_COMMENTS_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/StringRef.h" namespace clang { namespace format { /// \brief Returns the comment prefix of the line comment \p Comment. /// /// The comment prefix consists of a leading known prefix, like "//" or "///", /// together with the following whitespace. StringRef getLineCommentIndentPrefix(StringRef Comment); } // namespace format } // namespace clang #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Clang/ASTDumper.h
<gh_stars>100-1000 //===-- ASTDumper.h ---------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ASTDumper_h_ #define liblldb_ASTDumper_h_ #include "clang/AST/DeclVisitor.h" #include "clang/AST/TypeVisitor.h" #include "lldb/Core/Stream.h" #include "llvm/ADT/DenseSet.h" namespace lldb_private { class ASTDumper { public: ASTDumper(clang::Decl *decl); ASTDumper(clang::DeclContext *decl_ctx); ASTDumper(const clang::Type *type); ASTDumper(clang::QualType type); ASTDumper(lldb::opaque_compiler_type_t type); ASTDumper(const CompilerType &compiler_type); const char *GetCString(); void ToSTDERR(); void ToLog(Log *log, const char *prefix); void ToStream(lldb::StreamSP &stream); private: std::string m_dump; }; } // namespace lldb_private #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h
<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugPubnamesSet.h //===-- DWARFDebugPubnamesSet.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SymbolFileDWARF_DWARFDebugPubnamesSet_h_ #define SymbolFileDWARF_DWARFDebugPubnamesSet_h_ #include "SymbolFileDWARF.h" #include <string> #include <vector> #if __cplusplus >= 201103L || defined(_MSC_VER) #include <unordered_map> #else #include <ext/hash_map> #endif class DWARFDebugPubnamesSet { public: struct Header { uint32_t length; // length of the set of entries for this compilation unit, // not including the length field itself uint16_t version; // The DWARF version number uint32_t die_offset; // compile unit .debug_info offset uint32_t die_length; // compile unit .debug_info length Header() : length(10), version(2), die_offset(DW_INVALID_OFFSET), die_length(0) { } }; struct Descriptor { Descriptor() : offset(), name() {} Descriptor(dw_offset_t the_offset, const char *the_name) : offset(the_offset), name(the_name ? the_name : "") {} dw_offset_t offset; std::string name; }; DWARFDebugPubnamesSet(); DWARFDebugPubnamesSet(dw_offset_t debug_aranges_offset, dw_offset_t cu_die_offset, dw_offset_t die_length); dw_offset_t GetOffset() const { return m_offset; } void SetOffset(dw_offset_t offset) { m_offset = offset; } DWARFDebugPubnamesSet::Header &GetHeader() { return m_header; } const DWARFDebugPubnamesSet::Header &GetHeader() const { return m_header; } const DWARFDebugPubnamesSet::Descriptor *GetDescriptor(uint32_t i) const { if (i < m_descriptors.size()) return &m_descriptors[i]; return NULL; } uint32_t NumDescriptors() const { return m_descriptors.size(); } void AddDescriptor(dw_offset_t cu_rel_offset, const char *name); void Clear(); bool Extract(const lldb_private::DWARFDataExtractor &debug_pubnames_data, lldb::offset_t *offset_ptr); void Dump(lldb_private::Log *s) const; void InitNameIndexes() const; void Find(const char *name, bool ignore_case, std::vector<dw_offset_t> &die_offset_coll) const; void Find(const lldb_private::RegularExpression &regex, std::vector<dw_offset_t> &die_offsets) const; dw_offset_t GetOffsetOfNextEntry() const; protected: typedef std::vector<Descriptor> DescriptorColl; typedef DescriptorColl::iterator DescriptorIter; typedef DescriptorColl::const_iterator DescriptorConstIter; dw_offset_t m_offset; Header m_header; #if __cplusplus >= 201103L || defined(_MSC_VER) typedef std::unordered_multimap<const char *, uint32_t, std::hash<const char *>, CStringEqualBinaryPredicate> cstr_to_index_mmap; #else typedef __gnu_cxx::hash_multimap<const char *, uint32_t, __gnu_cxx::hash<const char *>, CStringEqualBinaryPredicate> cstr_to_index_mmap; #endif DescriptorColl m_descriptors; mutable cstr_to_index_mmap m_name_to_descriptor_index; }; #endif // SymbolFileDWARF_DWARFDebugPubnamesSet_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.h
<filename>SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/One/One.h #ifndef ONE_H #define ONE_H void one(); #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h
<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.h //===-- PlatformMacOSX.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_PlatformMacOSX_h_ #define liblldb_PlatformMacOSX_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "PlatformDarwin.h" class PlatformMacOSX : public PlatformDarwin { public: PlatformMacOSX(bool is_host); ~PlatformMacOSX() override; //------------------------------------------------------------ // Class functions //------------------------------------------------------------ static lldb::PlatformSP CreateInstance(bool force, const lldb_private::ArchSpec *arch); static void Initialize(); static void Terminate(); static lldb_private::ConstString GetPluginNameStatic(bool is_host); static const char *GetDescriptionStatic(bool is_host); //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ lldb_private::ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); } uint32_t GetPluginVersion() override { return 1; } lldb_private::Error GetSharedModule(const lldb_private::ModuleSpec &module_spec, lldb_private::Process *process, lldb::ModuleSP &module_sp, const lldb_private::FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) override; const char *GetDescription() override { return GetDescriptionStatic(IsHost()); } lldb_private::Error GetSymbolFile(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file); lldb_private::Error GetFile(const lldb_private::FileSpec &source, const lldb_private::FileSpec &destination) override { return PlatformDarwin::GetFile(source, destination); } lldb_private::Error GetFileWithUUID(const lldb_private::FileSpec &platform_file, const lldb_private::UUID *uuid_ptr, lldb_private::FileSpec &local_file) override; bool GetSupportedArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch) override; lldb_private::ConstString GetSDKDirectory(lldb_private::Target &target) override; void AddClangModuleCompilationOptions(lldb_private::Target *target, std::vector<std::string> &options) override { return PlatformDarwin::AddClangModuleCompilationOptionsForSDKType( target, options, PlatformDarwin::SDKType::MacOSX); } private: DISALLOW_COPY_AND_ASSIGN(PlatformMacOSX); }; #endif // liblldb_PlatformMacOSX_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/llvm/include/llvm/DebugInfo/CodeView/TypeDatabase.h
//===- TypeDatabase.h - A collection of CodeView type records ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H #define LLVM_DEBUGINFO_CODEVIEW_TYPEDATABASE_H #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/DebugInfo/CodeView/TypeIndex.h" #include "llvm/DebugInfo/CodeView/TypeRecord.h" #include "llvm/Support/Allocator.h" #include "llvm/Support/StringSaver.h" namespace llvm { namespace codeview { class TypeDatabase { public: TypeDatabase() : TypeNameStorage(Allocator) {} /// Gets the type index for the next type record. TypeIndex getNextTypeIndex() const; /// Records the name of a type, and reserves its type index. void recordType(StringRef Name, const CVType &Data); /// Saves the name in a StringSet and creates a stable StringRef. StringRef saveTypeName(StringRef TypeName); StringRef getTypeName(TypeIndex Index) const; bool containsTypeIndex(TypeIndex Index) const; uint32_t size() const; private: BumpPtrAllocator Allocator; /// All user defined type records in .debug$T live in here. Type indices /// greater than 0x1000 are user defined. Subtract 0x1000 from the index to /// index into this vector. SmallVector<StringRef, 10> CVUDTNames; SmallVector<CVType, 10> TypeRecords; StringSaver TypeNameStorage; }; } } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/cmark/src/utf8.c
#include <stdlib.h> #include <stdint.h> #include <assert.h> #include "cmark_ctype.h" #include "utf8.h" static const int8_t utf8proc_utf8class[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0}; static void encode_unknown(cmark_strbuf *buf) { static const uint8_t repl[] = {239, 191, 189}; cmark_strbuf_put(buf, repl, 3); } static int utf8proc_charlen(const uint8_t *str, bufsize_t str_len) { int length, i; if (!str_len) return 0; length = utf8proc_utf8class[str[0]]; if (!length) return -1; if (str_len >= 0 && (bufsize_t)length > str_len) return -str_len; for (i = 1; i < length; i++) { if ((str[i] & 0xC0) != 0x80) return -i; } return length; } // Validate a single UTF-8 character according to RFC 3629. static int utf8proc_valid(const uint8_t *str, bufsize_t str_len) { int length = utf8proc_utf8class[str[0]]; if (!length) return -1; if ((bufsize_t)length > str_len) return -str_len; switch (length) { case 2: if ((str[1] & 0xC0) != 0x80) return -1; if (str[0] < 0xC2) { // Overlong return -length; } break; case 3: if ((str[1] & 0xC0) != 0x80) return -1; if ((str[2] & 0xC0) != 0x80) return -2; if (str[0] == 0xE0) { if (str[1] < 0xA0) { // Overlong return -length; } } else if (str[0] == 0xED) { if (str[1] >= 0xA0) { // Surrogate return -length; } } break; case 4: if ((str[1] & 0xC0) != 0x80) return -1; if ((str[2] & 0xC0) != 0x80) return -2; if ((str[3] & 0xC0) != 0x80) return -3; if (str[0] == 0xF0) { if (str[1] < 0x90) { // Overlong return -length; } } else if (str[0] >= 0xF4) { if (str[0] > 0xF4 || str[1] >= 0x90) { // Above 0x10FFFF return -length; } } break; } return length; } void cmark_utf8proc_check(cmark_strbuf *ob, const uint8_t *line, bufsize_t size) { bufsize_t i = 0; while (i < size) { bufsize_t org = i; int charlen = 0; while (i < size) { if (line[i] < 0x80 && line[i] != 0) { i++; } else if (line[i] >= 0x80) { charlen = utf8proc_valid(line + i, size - i); if (charlen < 0) { charlen = -charlen; break; } i += charlen; } else if (line[i] == 0) { // ASCII NUL is technically valid but rejected // for security reasons. charlen = 1; break; } } if (i > org) { cmark_strbuf_put(ob, line + org, i - org); } if (i >= size) { break; } else { // Invalid UTF-8 encode_unknown(ob); i += charlen; } } } int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst) { int length; int32_t uc = -1; *dst = -1; length = utf8proc_charlen(str, str_len); if (length < 0) return -1; switch (length) { case 1: uc = str[0]; break; case 2: uc = ((str[0] & 0x1F) << 6) + (str[1] & 0x3F); if (uc < 0x80) uc = -1; break; case 3: uc = ((str[0] & 0x0F) << 12) + ((str[1] & 0x3F) << 6) + (str[2] & 0x3F); if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000)) uc = -1; break; case 4: uc = ((str[0] & 0x07) << 18) + ((str[1] & 0x3F) << 12) + ((str[2] & 0x3F) << 6) + (str[3] & 0x3F); if (uc < 0x10000 || uc >= 0x110000) uc = -1; break; } if (uc < 0) return -1; *dst = uc; return length; } void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf) { uint8_t dst[4]; bufsize_t len = 0; assert(uc >= 0); if (uc < 0x80) { dst[0] = (uint8_t)(uc); len = 1; } else if (uc < 0x800) { dst[0] = (uint8_t)(0xC0 + (uc >> 6)); dst[1] = 0x80 + (uc & 0x3F); len = 2; } else if (uc == 0xFFFF) { dst[0] = 0xFF; len = 1; } else if (uc == 0xFFFE) { dst[0] = 0xFE; len = 1; } else if (uc < 0x10000) { dst[0] = (uint8_t)(0xE0 + (uc >> 12)); dst[1] = 0x80 + ((uc >> 6) & 0x3F); dst[2] = 0x80 + (uc & 0x3F); len = 3; } else if (uc < 0x110000) { dst[0] = (uint8_t)(0xF0 + (uc >> 18)); dst[1] = 0x80 + ((uc >> 12) & 0x3F); dst[2] = 0x80 + ((uc >> 6) & 0x3F); dst[3] = 0x80 + (uc & 0x3F); len = 4; } else { encode_unknown(buf); return; } cmark_strbuf_put(buf, dst, len); } void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, bufsize_t len) { int32_t c; #define bufpush(x) cmark_utf8proc_encode_char(x, dest) while (len > 0) { bufsize_t char_len = cmark_utf8proc_iterate(str, len, &c); if (char_len >= 0) { #include "case_fold_switch.inc" } else { encode_unknown(dest); char_len = -char_len; } str += char_len; len -= char_len; } } // matches anything in the Zs class, plus LF, CR, TAB, FF. int cmark_utf8proc_is_space(int32_t uc) { return (uc == 9 || uc == 10 || uc == 12 || uc == 13 || uc == 32 || uc == 160 || uc == 5760 || (uc >= 8192 && uc <= 8202) || uc == 8239 || uc == 8287 || uc == 12288); } // matches anything in the P[cdefios] classes. int cmark_utf8proc_is_punctuation(int32_t uc) { return ( (uc < 128 && cmark_ispunct((char)uc)) || uc == 161 || uc == 167 || uc == 171 || uc == 182 || uc == 183 || uc == 187 || uc == 191 || uc == 894 || uc == 903 || (uc >= 1370 && uc <= 1375) || uc == 1417 || uc == 1418 || uc == 1470 || uc == 1472 || uc == 1475 || uc == 1478 || uc == 1523 || uc == 1524 || uc == 1545 || uc == 1546 || uc == 1548 || uc == 1549 || uc == 1563 || uc == 1566 || uc == 1567 || (uc >= 1642 && uc <= 1645) || uc == 1748 || (uc >= 1792 && uc <= 1805) || (uc >= 2039 && uc <= 2041) || (uc >= 2096 && uc <= 2110) || uc == 2142 || uc == 2404 || uc == 2405 || uc == 2416 || uc == 2800 || uc == 3572 || uc == 3663 || uc == 3674 || uc == 3675 || (uc >= 3844 && uc <= 3858) || uc == 3860 || (uc >= 3898 && uc <= 3901) || uc == 3973 || (uc >= 4048 && uc <= 4052) || uc == 4057 || uc == 4058 || (uc >= 4170 && uc <= 4175) || uc == 4347 || (uc >= 4960 && uc <= 4968) || uc == 5120 || uc == 5741 || uc == 5742 || uc == 5787 || uc == 5788 || (uc >= 5867 && uc <= 5869) || uc == 5941 || uc == 5942 || (uc >= 6100 && uc <= 6102) || (uc >= 6104 && uc <= 6106) || (uc >= 6144 && uc <= 6154) || uc == 6468 || uc == 6469 || uc == 6686 || uc == 6687 || (uc >= 6816 && uc <= 6822) || (uc >= 6824 && uc <= 6829) || (uc >= 7002 && uc <= 7008) || (uc >= 7164 && uc <= 7167) || (uc >= 7227 && uc <= 7231) || uc == 7294 || uc == 7295 || (uc >= 7360 && uc <= 7367) || uc == 7379 || (uc >= 8208 && uc <= 8231) || (uc >= 8240 && uc <= 8259) || (uc >= 8261 && uc <= 8273) || (uc >= 8275 && uc <= 8286) || uc == 8317 || uc == 8318 || uc == 8333 || uc == 8334 || (uc >= 8968 && uc <= 8971) || uc == 9001 || uc == 9002 || (uc >= 10088 && uc <= 10101) || uc == 10181 || uc == 10182 || (uc >= 10214 && uc <= 10223) || (uc >= 10627 && uc <= 10648) || (uc >= 10712 && uc <= 10715) || uc == 10748 || uc == 10749 || (uc >= 11513 && uc <= 11516) || uc == 11518 || uc == 11519 || uc == 11632 || (uc >= 11776 && uc <= 11822) || (uc >= 11824 && uc <= 11842) || (uc >= 12289 && uc <= 12291) || (uc >= 12296 && uc <= 12305) || (uc >= 12308 && uc <= 12319) || uc == 12336 || uc == 12349 || uc == 12448 || uc == 12539 || uc == 42238 || uc == 42239 || (uc >= 42509 && uc <= 42511) || uc == 42611 || uc == 42622 || (uc >= 42738 && uc <= 42743) || (uc >= 43124 && uc <= 43127) || uc == 43214 || uc == 43215 || (uc >= 43256 && uc <= 43258) || uc == 43310 || uc == 43311 || uc == 43359 || (uc >= 43457 && uc <= 43469) || uc == 43486 || uc == 43487 || (uc >= 43612 && uc <= 43615) || uc == 43742 || uc == 43743 || uc == 43760 || uc == 43761 || uc == 44011 || uc == 64830 || uc == 64831 || (uc >= 65040 && uc <= 65049) || (uc >= 65072 && uc <= 65106) || (uc >= 65108 && uc <= 65121) || uc == 65123 || uc == 65128 || uc == 65130 || uc == 65131 || (uc >= 65281 && uc <= 65283) || (uc >= 65285 && uc <= 65290) || (uc >= 65292 && uc <= 65295) || uc == 65306 || uc == 65307 || uc == 65311 || uc == 65312 || (uc >= 65339 && uc <= 65341) || uc == 65343 || uc == 65371 || uc == 65373 || (uc >= 65375 && uc <= 65381) || (uc >= 65792 && uc <= 65794) || uc == 66463 || uc == 66512 || uc == 66927 || uc == 67671 || uc == 67871 || uc == 67903 || (uc >= 68176 && uc <= 68184) || uc == 68223 || (uc >= 68336 && uc <= 68342) || (uc >= 68409 && uc <= 68415) || (uc >= 68505 && uc <= 68508) || (uc >= 69703 && uc <= 69709) || uc == 69819 || uc == 69820 || (uc >= 69822 && uc <= 69825) || (uc >= 69952 && uc <= 69955) || uc == 70004 || uc == 70005 || (uc >= 70085 && uc <= 70088) || uc == 70093 || (uc >= 70200 && uc <= 70205) || uc == 70854 || (uc >= 71105 && uc <= 71113) || (uc >= 71233 && uc <= 71235) || (uc >= 74864 && uc <= 74868) || uc == 92782 || uc == 92783 || uc == 92917 || (uc >= 92983 && uc <= 92987) || uc == 92996 || uc == 113823); }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Driver/aarch64-cpus.c
<reponame>Polidea/SiriusObfuscator // Check target CPUs are correctly passed. // RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64_be -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s // GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" // RUN: %clang -target arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // RUN: %clang -target arm64 -mcpu=generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // RUN: %clang -target arm64 -mlittle-endian -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // RUN: %clang -target arm64 -mlittle-endian -mcpu-generic -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERIC %s // ARM64-GENERIC: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic" // RUN: %clang -target arm64-apple-darwin -arch arm64 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-DARWIN %s // ARM64-DARWIN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cyclone" // RUN: %clang -target aarch64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // RUN: %clang -target aarch64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35 %s // CA35: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a35" // RUN: %clang -target arm64 -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s // RUN: %clang -target arm64 -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA35 %s // ARM64-CA35: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a35" // RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s // CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target arm64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s // RUN: %clang -target arm64 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA53 %s // ARM64-CA53: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // RUN: %clang -target aarch64 -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s // CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57" // RUN: %clang -target arm64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s // RUN: %clang -target arm64 -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA57 %s // ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57" // RUN: %clang -target aarch64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // RUN: %clang -target aarch64 -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72 %s // CA72: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a72" // RUN: %clang -target arm64 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s // RUN: %clang -target arm64 -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CA72 %s // ARM64-CA72: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a72" // RUN: %clang -target aarch64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // RUN: %clang -target aarch64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73 %s // CORTEX-A73: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a73" // RUN: %clang -target arm64 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CORTEX-A73 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CORTEX-A73 %s // RUN: %clang -target arm64 -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CORTEX-A73 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-CORTEX-A73 %s // ARM64-CORTEX-A73: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a73" // RUN: %clang -target aarch64 -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // RUN: %clang -target aarch64 -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1 %s // M1: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "exynos-m1" // RUN: %clang -target aarch64 -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // RUN: %clang -target aarch64 -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2 %s // M2: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "exynos-m2" // RUN: %clang -target aarch64_be -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // RUN: %clang -target aarch64_be -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // RUN: %clang -target aarch64 -mbig-endian -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3 %s // M3: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "exynos-m3" // RUN: %clang -target arm64 -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M1 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M1 %s // RUN: %clang -target arm64 -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M1 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M1 %s // ARM64-M1: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "exynos-m1" // RUN: %clang -target arm64 -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M2 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M2 %s // RUN: %clang -target arm64 -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M2 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M2 %s // ARM64-M2: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "exynos-m2" // RUN: %clang -target arm64 -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M3 %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M3 %s // RUN: %clang -target arm64 -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M3 %s // RUN: %clang -target arm64 -mlittle-endian -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-M3 %s // ARM64-M3: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "exynos-m3" // RUN: %clang -target aarch64 -mcpu=falkor -### -c %s 2>&1 | FileCheck -check-prefix=FALKOR %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=falkor -### -c %s 2>&1 | FileCheck -check-prefix=FALKOR %s // RUN: %clang -target aarch64 -mtune=falkor -### -c %s 2>&1 | FileCheck -check-prefix=FALKOR %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=falkor -### -c %s 2>&1 | FileCheck -check-prefix=FALKOR %s // FALKOR: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "falkor" // RUN: %clang -target arm64 -mcpu=falkor -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-FALKOR %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=falkor -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-FALKOR %s // RUN: %clang -target arm64 -mtune=falkor -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-FALKOR %s // RUN: %clang -target arm64 -mlittle-endian -mtune=falkor -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-FALKOR %s // ARM64-FALKOR: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "falkor" // RUN: %clang -target aarch64 -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=KRYO %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=KRYO %s // RUN: %clang -target aarch64 -mtune=kryo -### -c %s 2>&1 | FileCheck -check-prefix=KRYO %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=kryo -### -c %s 2>&1 | FileCheck -check-prefix=KRYO %s // KRYO: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "kryo" // RUN: %clang -target arm64 -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-KRYO %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=kryo -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-KRYO %s // RUN: %clang -target arm64 -mtune=kryo -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-KRYO %s // RUN: %clang -target arm64 -mlittle-endian -mtune=kryo -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-KRYO %s // ARM64-KRYO: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "kryo" // RUN: %clang -target aarch64 -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s // RUN: %clang -target aarch64 -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s // RUN: %clang -target aarch64_be -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN %s // RUN: %clang -target aarch64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s // RUN: %clang -target aarch64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s // RUN: %clang -target aarch64_be -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-TUNE %s // VULCAN: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "vulcan" "-target-feature" "+v8.1a" // VULCAN-TUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "vulcan" // VULCAN-TUNE-NOT: +v8.1a // RUN: %clang -target arm64 -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s // RUN: %clang -target arm64 -mlittle-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN %s // RUN: %clang -target arm64 -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN-TUNE %s // RUN: %clang -target arm64 -mlittle-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-VULCAN-TUNE %s // ARM64-VULCAN: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "vulcan" "-target-feature" "+v8.1a" // ARM64-VULCAN-TUNE: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "vulcan" // ARM64-VULCAN-TUNE-NOT: +v8.1a // RUN: %clang -target aarch64_be -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // RUN: %clang -target aarch64 -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // RUN: %clang -target aarch64_be -mbig-endian -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC-BE %s // GENERIC-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" // RUN: %clang -target aarch64_be -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // RUN: %clang -target aarch64_be -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a35 -### -c %s 2>&1 | FileCheck -check-prefix=CA35-BE %s // CA35-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a35" // RUN: %clang -target aarch64_be -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64_be -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53-BE %s // CA53-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target aarch64_be -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // RUN: %clang -target aarch64_be -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57-BE %s // CA57-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a57" // RUN: %clang -target aarch64_be -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // RUN: %clang -target aarch64_be -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=CA72-BE %s // CA72-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a72" // RUN: %clang -target aarch64_be -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // RUN: %clang -target aarch64_be -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=CORTEX-A73-BE %s // CORTEX-A73-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "cortex-a73" // RUN: %clang -target aarch64_be -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // RUN: %clang -target aarch64_be -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=exynos-m1 -### -c %s 2>&1 | FileCheck -check-prefix=M1-BE %s // M1-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "exynos-m1" // RUN: %clang -target aarch64_be -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // RUN: %clang -target aarch64_be -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=exynos-m2 -### -c %s 2>&1 | FileCheck -check-prefix=M2-BE %s // M2-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "exynos-m2" // RUN: %clang -target aarch64_be -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // RUN: %clang -target aarch64_be -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=exynos-m3 -### -c %s 2>&1 | FileCheck -check-prefix=M3-BE %s // M3-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "exynos-m3" // RUN: %clang -target aarch64_be -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // RUN: %clang -target aarch64 -mbig-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // RUN: %clang -target aarch64_be -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // RUN: %clang -target aarch64 -mbig-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // RUN: %clang -target aarch64_be -mbig-endian -mtune=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=VULCAN-BE %s // VULCAN-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "vulcan" // RUN: %clang -target aarch64 -mcpu=cortex-a57 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mcpu=cortex-a72 -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=cortex-a72 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=cortex-a73 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mcpu=vulcan -mtune=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // RUN: %clang -target aarch64 -mtune=cortex-a53 -mcpu=vulcan -### -c %s 2>&1 | FileCheck -check-prefix=MCPU-MTUNE %s // MCPU-MTUNE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target aarch64 -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // RUN: %clang -target aarch64 -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A %s // GENERICV81A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" // RUN: %clang -target arm64 -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // RUN: %clang -target arm64 -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // RUN: %clang -target arm64 -mlittle-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // RUN: %clang -target arm64 -mlittle-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=ARM64-GENERICV81A %s // ARM64-GENERICV81A: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" // RUN: %clang -target aarch64_be -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64 -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64 -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=armv8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64 -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // RUN: %clang -target aarch64 -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // RUN: %clang -target aarch64 -mlittle-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // RUN: %clang -target aarch64_be -mlittle-endian -march=armv8.2-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A %s // GENERICV82A: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" // RUN: %clang -target aarch64 -march=armv8.2-a+fp16 -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16 %s // GENERICV82A-FP16: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16" // RUN: %clang -target aarch64 -march=armv8.2-a+profile -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-SPE %s // GENERICV82A-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+spe" // // RUN: %clang -target aarch64 -march=armv8.2-a+fp16+profile -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV82A-FP16-SPE %s // GENERICV82A-FP16-SPE: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.2a" "-target-feature" "+fullfp16" "-target-feature" "+spe" // ================== Check whether -march accepts mixed-case values. // RUN: %clang -target aarch64_be -march=ARMV8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -march=ARMV8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64 -mbig-endian -march=Armv8.1-A -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=ARMv8.1a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // RUN: %clang -target aarch64_be -mbig-endian -march=ARMV8.1-a -### -c %s 2>&1 | FileCheck -check-prefix=GENERICV81A-BE %s // GENERICV81A-BE: "-cc1"{{.*}} "-triple" "aarch64_be{{.*}}" "-target-cpu" "generic" "-target-feature" "+neon" "-target-feature" "+v8.1a" // ================== Check whether -mcpu and -mtune accept mixed-case values. // RUN: %clang -target aarch64 -mcpu=Cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA53 %s // RUN: %clang -target aarch64 -mtune=Cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA53 %s // CASE-INSENSITIVE-CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target arm64 -mcpu=cortex-A53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA53 %s // RUN: %clang -target arm64 -mtune=cortex-A53 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA53 %s // CASE-INSENSITIVE-ARM64-CA53: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a53" // RUN: %clang -target aarch64 -mcpu=CORTEX-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA57 %s // RUN: %clang -target aarch64 -mtune=CORTEX-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-CA57 %s // CASE-INSENSITIVE-CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57" // RUN: %clang -target arm64 -mcpu=Cortex-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA57 %s // RUN: %clang -target arm64 -mtune=Cortex-A57 -### -c %s 2>&1 | FileCheck -check-prefix=CASE-INSENSITIVE-ARM64-CA57 %s // CASE-INSENSITIVE-ARM64-CA57: "-cc1"{{.*}} "-triple" "arm64{{.*}}" "-target-cpu" "cortex-a57"
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/cmark/src/inlines.c
<reponame>Polidea/SiriusObfuscator<gh_stars>100-1000 #include <stdlib.h> #include <string.h> #include <stdio.h> #include "cmark_ctype.h" #include "config.h" #include "node.h" #include "parser.h" #include "references.h" #include "cmark.h" #include "houdini.h" #include "utf8.h" #include "scanners.h" #include "inlines.h" static const char *EMDASH = "\xE2\x80\x94"; static const char *ENDASH = "\xE2\x80\x93"; static const char *ELLIPSES = "\xE2\x80\xA6"; static const char *LEFTDOUBLEQUOTE = "\xE2\x80\x9C"; static const char *RIGHTDOUBLEQUOTE = "\xE2\x80\x9D"; static const char *LEFTSINGLEQUOTE = "\xE2\x80\x98"; static const char *RIGHTSINGLEQUOTE = "\xE2\x80\x99"; // Macros for creating various kinds of simple. #define make_str(s) make_literal(CMARK_NODE_TEXT, s) #define make_code(s) make_literal(CMARK_NODE_CODE, s) #define make_raw_html(s) make_literal(CMARK_NODE_INLINE_HTML, s) #define make_linebreak() make_simple(CMARK_NODE_LINEBREAK) #define make_softbreak() make_simple(CMARK_NODE_SOFTBREAK) #define make_emph() make_simple(CMARK_NODE_EMPH) #define make_strong() make_simple(CMARK_NODE_STRONG) typedef struct delimiter { struct delimiter *previous; struct delimiter *next; cmark_node *inl_text; bufsize_t position; unsigned char delim_char; bool can_open; bool can_close; bool active; } delimiter; typedef struct { cmark_chunk input; bufsize_t pos; cmark_reference_map *refmap; delimiter *last_delim; } subject; static inline bool S_is_line_end_char(char c) { return (c == '\n' || c == '\r'); } static delimiter *S_insert_emph(subject *subj, delimiter *opener, delimiter *closer); static int parse_inline(subject *subj, cmark_node *parent, int options); static void subject_from_buf(subject *e, cmark_strbuf *buffer, cmark_reference_map *refmap); static bufsize_t subject_find_special_char(subject *subj, int options); // Create an inline with a literal string value. static inline cmark_node *make_literal(cmark_node_type t, cmark_chunk s) { cmark_node *e = (cmark_node *)calloc(1, sizeof(*e)); if (e != NULL) { e->type = t; e->as.literal = s; e->next = NULL; e->prev = NULL; e->parent = NULL; e->first_child = NULL; e->last_child = NULL; // These fields aren't used for inlines: e->start_line = 0; e->start_column = 0; e->end_line = 0; } return e; } // Create an inline with no value. static inline cmark_node *make_simple(cmark_node_type t) { cmark_node *e = (cmark_node *)calloc(1, sizeof(*e)); if (e != NULL) { e->type = t; e->next = NULL; e->prev = NULL; e->parent = NULL; e->first_child = NULL; e->last_child = NULL; // These fields aren't used for inlines: e->start_line = 0; e->start_column = 0; e->end_line = 0; } return e; } // Like make_str, but parses entities. static cmark_node *make_str_with_entities(cmark_chunk *content) { cmark_strbuf unescaped = GH_BUF_INIT; if (houdini_unescape_html(&unescaped, content->data, content->len)) { return make_str(cmark_chunk_buf_detach(&unescaped)); } else { return make_str(*content); } } // Duplicate a chunk by creating a copy of the buffer not by reusing the // buffer like cmark_chunk_dup does. static cmark_chunk chunk_clone(cmark_chunk *src) { cmark_chunk c; bufsize_t len = src->len; c.len = len; c.data = (unsigned char *)malloc(len + 1); c.alloc = 1; memcpy(c.data, src->data, len); c.data[len] = '\0'; return c; } static cmark_chunk cmark_clean_autolink(cmark_chunk *url, int is_email) { cmark_strbuf buf = GH_BUF_INIT; cmark_chunk_trim(url); if (url->len == 0) { cmark_chunk result = CMARK_CHUNK_EMPTY; return result; } if (is_email) cmark_strbuf_puts(&buf, "mailto:"); houdini_unescape_html_f(&buf, url->data, url->len); return cmark_chunk_buf_detach(&buf); } static inline cmark_node *make_autolink(cmark_chunk url, int is_email) { cmark_node *link = make_simple(CMARK_NODE_LINK); link->as.link.url = cmark_clean_autolink(&url, is_email); link->as.link.title = cmark_chunk_literal(""); cmark_node_append_child(link, make_str_with_entities(&url)); return link; } static void subject_from_buf(subject *e, cmark_strbuf *buffer, cmark_reference_map *refmap) { e->input.data = buffer->ptr; e->input.len = buffer->size; e->input.alloc = 0; e->pos = 0; e->refmap = refmap; e->last_delim = NULL; } static inline int isbacktick(int c) { return (c == '`'); } static inline unsigned char peek_char(subject *subj) { // NULL bytes should have been stripped out by now. If they're // present, it's a programming error: assert(!(subj->pos < subj->input.len && subj->input.data[subj->pos] == 0)); return (subj->pos < subj->input.len) ? subj->input.data[subj->pos] : 0; } static inline unsigned char peek_at(subject *subj, bufsize_t pos) { return subj->input.data[pos]; } // Return true if there are more characters in the subject. static inline int is_eof(subject *subj) { return (subj->pos >= subj->input.len); } // Advance the subject. Doesn't check for eof. #define advance(subj) (subj)->pos += 1 static inline bool skip_spaces(subject *subj) { bool skipped = false; while (peek_char(subj) == ' ' || peek_char(subj) == '\t') { advance(subj); skipped = true; } return skipped; } static inline bool skip_line_end(subject *subj) { bool seen_line_end_char = false; if (peek_char(subj) == '\r') { advance(subj); seen_line_end_char = true; } if (peek_char(subj) == '\n') { advance(subj); seen_line_end_char = true; } return seen_line_end_char || is_eof(subj); } // Take characters while a predicate holds, and return a string. static inline cmark_chunk take_while(subject *subj, int (*f)(int)) { unsigned char c; bufsize_t startpos = subj->pos; bufsize_t len = 0; while ((c = peek_char(subj)) && (*f)(c)) { advance(subj); len++; } return cmark_chunk_dup(&subj->input, startpos, len); } // Try to process a backtick code span that began with a // span of ticks of length openticklength length (already // parsed). Return 0 if you don't find matching closing // backticks, otherwise return the position in the subject // after the closing backticks. static bufsize_t scan_to_closing_backticks(subject *subj, bufsize_t openticklength) { // read non backticks unsigned char c; while ((c = peek_char(subj)) && c != '`') { advance(subj); } if (is_eof(subj)) { return 0; // did not find closing ticks, return 0 } bufsize_t numticks = 0; while (peek_char(subj) == '`') { advance(subj); numticks++; } if (numticks != openticklength) { return (scan_to_closing_backticks(subj, openticklength)); } return (subj->pos); } // Parse backtick code section or raw backticks, return an inline. // Assumes that the subject has a backtick at the current position. static cmark_node *handle_backticks(subject *subj) { cmark_chunk openticks = take_while(subj, isbacktick); bufsize_t startpos = subj->pos; bufsize_t endpos = scan_to_closing_backticks(subj, openticks.len); if (endpos == 0) { // not found subj->pos = startpos; // rewind return make_str(openticks); } else { cmark_strbuf buf = GH_BUF_INIT; cmark_strbuf_set(&buf, subj->input.data + startpos, endpos - startpos - openticks.len); cmark_strbuf_trim(&buf); cmark_strbuf_normalize_whitespace(&buf); return make_code(cmark_chunk_buf_detach(&buf)); } } // Scan ***, **, or * and return number scanned, or 0. // Advances position. static int scan_delims(subject *subj, unsigned char c, bool *can_open, bool *can_close) { int numdelims = 0; bufsize_t before_char_pos; int32_t after_char = 0; int32_t before_char = 0; int len; bool left_flanking, right_flanking; if (subj->pos == 0) { before_char = 10; } else { before_char_pos = subj->pos - 1; // walk back to the beginning of the UTF_8 sequence: while (peek_at(subj, before_char_pos) >> 6 == 2 && before_char_pos > 0) { before_char_pos -= 1; } len = cmark_utf8proc_iterate(subj->input.data + before_char_pos, subj->pos - before_char_pos, &before_char); if (len == -1) { before_char = 10; } } if (c == '\'' || c == '"') { numdelims++; advance(subj); // limit to 1 delim for quotes } else { while (peek_char(subj) == c) { numdelims++; advance(subj); } } len = cmark_utf8proc_iterate(subj->input.data + subj->pos, subj->input.len - subj->pos, &after_char); if (len == -1) { after_char = 10; } left_flanking = numdelims > 0 && !cmark_utf8proc_is_space(after_char) && !(cmark_utf8proc_is_punctuation(after_char) && !cmark_utf8proc_is_space(before_char) && !cmark_utf8proc_is_punctuation(before_char)); right_flanking = numdelims > 0 && !cmark_utf8proc_is_space(before_char) && !(cmark_utf8proc_is_punctuation(before_char) && !cmark_utf8proc_is_space(after_char) && !cmark_utf8proc_is_punctuation(after_char)); if (c == '_') { *can_open = left_flanking && (!right_flanking || cmark_utf8proc_is_punctuation(before_char)); *can_close = right_flanking && (!left_flanking || cmark_utf8proc_is_punctuation(after_char)); } else if (c == '\'' || c == '"') { *can_open = left_flanking && !right_flanking; *can_close = right_flanking; } else { *can_open = left_flanking; *can_close = right_flanking; } return numdelims; } /* static void print_delimiters(subject *subj) { delimiter *delim; delim = subj->last_delim; while (delim != NULL) { printf("Item at stack pos %p, text pos %d: %d %d %d next(%p) prev(%p)\n", (void*)delim, delim->position, delim->delim_char, delim->can_open, delim->can_close, (void*)delim->next, (void*)delim->previous); delim = delim->previous; } } */ static void remove_delimiter(subject *subj, delimiter *delim) { if (delim == NULL) return; if (delim->next == NULL) { // end of list: assert(delim == subj->last_delim); subj->last_delim = delim->previous; } else { delim->next->previous = delim->previous; } if (delim->previous != NULL) { delim->previous->next = delim->next; } free(delim); } static void push_delimiter(subject *subj, unsigned char c, bool can_open, bool can_close, cmark_node *inl_text) { delimiter *delim = (delimiter *)malloc(sizeof(delimiter)); if (delim == NULL) { return; } delim->delim_char = c; delim->can_open = can_open; delim->can_close = can_close; delim->inl_text = inl_text; delim->previous = subj->last_delim; delim->next = NULL; if (delim->previous != NULL) { delim->previous->next = delim; } delim->position = subj->pos; delim->active = true; subj->last_delim = delim; } // Assumes the subject has a c at the current position. static cmark_node *handle_delim(subject *subj, unsigned char c, bool smart) { bufsize_t numdelims; cmark_node *inl_text; bool can_open, can_close; cmark_chunk contents; numdelims = scan_delims(subj, c, &can_open, &can_close); if (c == '\'' && smart) { contents = cmark_chunk_literal(RIGHTSINGLEQUOTE); } else if (c == '"' && smart) { contents = cmark_chunk_literal(can_close ? RIGHTDOUBLEQUOTE : LEFTDOUBLEQUOTE); } else { contents = cmark_chunk_dup(&subj->input, subj->pos - numdelims, numdelims); } inl_text = make_str(contents); if ((can_open || can_close) && (!(c == '\'' || c == '"') || smart)) { push_delimiter(subj, c, can_open, can_close, inl_text); } return inl_text; } // Assumes we have a hyphen at the current position. static cmark_node *handle_hyphen(subject *subj, bool smart) { int startpos = subj->pos; advance(subj); if (!smart || peek_char(subj) != '-') { return make_str(cmark_chunk_literal("-")); } while (smart && peek_char(subj) == '-') { advance(subj); } int numhyphens = subj->pos - startpos; int en_count = 0; int em_count = 0; int i; cmark_strbuf buf = GH_BUF_INIT; if (numhyphens % 3 == 0) { // if divisible by 3, use all em dashes em_count = numhyphens / 3; } else if (numhyphens % 2 == 0) { // if divisible by 2, use all en dashes en_count = numhyphens / 2; } else if (numhyphens % 3 == 2) { // use one en dash at end en_count = 1; em_count = (numhyphens - 2) / 3; } else { // use two en dashes at the end en_count = 2; em_count = (numhyphens - 4) / 3; } for (i = em_count; i > 0; i--) { cmark_strbuf_puts(&buf, EMDASH); } for (i = en_count; i > 0; i--) { cmark_strbuf_puts(&buf, ENDASH); } return make_str(cmark_chunk_buf_detach(&buf)); } // Assumes we have a period at the current position. static cmark_node *handle_period(subject *subj, bool smart) { advance(subj); if (smart && peek_char(subj) == '.') { advance(subj); if (peek_char(subj) == '.') { advance(subj); return make_str(cmark_chunk_literal(ELLIPSES)); } else { return make_str(cmark_chunk_literal("..")); } } else { return make_str(cmark_chunk_literal(".")); } } static void process_emphasis(subject *subj, delimiter *stack_bottom) { delimiter *closer = subj->last_delim; delimiter *opener; delimiter *old_closer; bool opener_found; delimiter *openers_bottom[128]; // initialize openers_bottom: openers_bottom['*'] = stack_bottom; openers_bottom['_'] = stack_bottom; openers_bottom['\''] = stack_bottom; openers_bottom['"'] = stack_bottom; // move back to first relevant delim. while (closer != NULL && closer->previous != stack_bottom) { closer = closer->previous; } // now move forward, looking for closers, and handling each while (closer != NULL) { if (closer->can_close && (closer->delim_char == '*' || closer->delim_char == '_' || closer->delim_char == '"' || closer->delim_char == '\'')) { // Now look backwards for first matching opener: opener = closer->previous; opener_found = false; while (opener != NULL && opener != stack_bottom && opener != openers_bottom[closer->delim_char]) { if (opener->delim_char == closer->delim_char && opener->can_open) { opener_found = true; break; } opener = opener->previous; } old_closer = closer; if (closer->delim_char == '*' || closer->delim_char == '_') { if (opener_found) { closer = S_insert_emph(subj, opener, closer); } else { closer = closer->next; } } else if (closer->delim_char == '\'') { cmark_chunk_free(&closer->inl_text->as.literal); closer->inl_text->as.literal = cmark_chunk_literal(RIGHTSINGLEQUOTE); if (opener_found) { cmark_chunk_free(&opener->inl_text->as.literal); opener->inl_text->as.literal = cmark_chunk_literal(LEFTSINGLEQUOTE); } closer = closer->next; } else if (closer->delim_char == '"') { cmark_chunk_free(&closer->inl_text->as.literal); closer->inl_text->as.literal = cmark_chunk_literal(RIGHTDOUBLEQUOTE); if (opener_found) { cmark_chunk_free(&opener->inl_text->as.literal); opener->inl_text->as.literal = cmark_chunk_literal(LEFTDOUBLEQUOTE); } closer = closer->next; } if (!opener_found) { // set lower bound for future searches for openers: openers_bottom[old_closer->delim_char] = old_closer->previous; if (!old_closer->can_open) { // we can remove a closer that can't be an // opener, once we've seen there's no // matching opener: remove_delimiter(subj, old_closer); } } } else { closer = closer->next; } } // free all delimiters in list until stack_bottom: while (subj->last_delim != stack_bottom) { remove_delimiter(subj, subj->last_delim); } } static delimiter *S_insert_emph(subject *subj, delimiter *opener, delimiter *closer) { delimiter *delim, *tmp_delim; bufsize_t use_delims; cmark_node *opener_inl = opener->inl_text; cmark_node *closer_inl = closer->inl_text; bufsize_t opener_num_chars = opener_inl->as.literal.len; bufsize_t closer_num_chars = closer_inl->as.literal.len; cmark_node *tmp, *emph, *first_child, *last_child; // calculate the actual number of characters used from this closer if (closer_num_chars < 3 || opener_num_chars < 3) { use_delims = closer_num_chars <= opener_num_chars ? closer_num_chars : opener_num_chars; } else { // closer and opener both have >= 3 characters use_delims = closer_num_chars % 2 == 0 ? 2 : 1; } // remove used characters from associated inlines. opener_num_chars -= use_delims; closer_num_chars -= use_delims; opener_inl->as.literal.len = opener_num_chars; closer_inl->as.literal.len = closer_num_chars; // free delimiters between opener and closer delim = closer->previous; while (delim != NULL && delim != opener) { tmp_delim = delim->previous; remove_delimiter(subj, delim); delim = tmp_delim; } first_child = opener_inl->next; last_child = closer_inl->prev; // if opener has 0 characters, remove it and its associated inline if (opener_num_chars == 0) { // replace empty opener inline with emph cmark_chunk_free(&(opener_inl->as.literal)); emph = opener_inl; emph->type = use_delims == 1 ? CMARK_NODE_EMPH : CMARK_NODE_STRONG; // remove opener from list remove_delimiter(subj, opener); } else { // create new emph or strong, and splice it in to our inlines // between the opener and closer emph = use_delims == 1 ? make_emph() : make_strong(); emph->parent = opener_inl->parent; emph->prev = opener_inl; opener_inl->next = emph; } // push children below emph emph->next = closer_inl; closer_inl->prev = emph; emph->first_child = first_child; emph->last_child = last_child; // fix children pointers first_child->prev = NULL; last_child->next = NULL; for (tmp = first_child; tmp != NULL; tmp = tmp->next) { tmp->parent = emph; } // if closer has 0 characters, remove it and its associated inline if (closer_num_chars == 0) { // remove empty closer inline cmark_node_free(closer_inl); // remove closer from list tmp_delim = closer->next; remove_delimiter(subj, closer); closer = tmp_delim; } return closer; } // Parse backslash-escape or just a backslash, returning an inline. static cmark_node *handle_backslash(subject *subj) { advance(subj); unsigned char nextchar = peek_char(subj); if (cmark_ispunct( nextchar)) { // only ascii symbols and newline can be escaped advance(subj); return make_str(cmark_chunk_dup(&subj->input, subj->pos - 1, 1)); } else if (!is_eof(subj) && skip_line_end(subj)) { return make_linebreak(); } else { return make_str(cmark_chunk_literal("\\")); } } // Parse an entity or a regular "&" string. // Assumes the subject has an '&' character at the current position. static cmark_node *handle_entity(subject *subj) { cmark_strbuf ent = GH_BUF_INIT; bufsize_t len; advance(subj); len = houdini_unescape_ent(&ent, subj->input.data + subj->pos, subj->input.len - subj->pos); if (len == 0) return make_str(cmark_chunk_literal("&")); subj->pos += len; return make_str(cmark_chunk_buf_detach(&ent)); } // Clean a URL: remove surrounding whitespace and surrounding <>, // and remove \ that escape punctuation. cmark_chunk cmark_clean_url(cmark_chunk *url) { cmark_strbuf buf = GH_BUF_INIT; cmark_chunk_trim(url); if (url->len == 0) { cmark_chunk result = CMARK_CHUNK_EMPTY; return result; } if (url->data[0] == '<' && url->data[url->len - 1] == '>') { houdini_unescape_html_f(&buf, url->data + 1, url->len - 2); } else { houdini_unescape_html_f(&buf, url->data, url->len); } cmark_strbuf_unescape(&buf); return cmark_chunk_buf_detach(&buf); } cmark_chunk cmark_clean_title(cmark_chunk *title) { cmark_strbuf buf = GH_BUF_INIT; unsigned char first, last; if (title->len == 0) { cmark_chunk result = CMARK_CHUNK_EMPTY; return result; } first = title->data[0]; last = title->data[title->len - 1]; // remove surrounding quotes if any: if ((first == '\'' && last == '\'') || (first == '(' && last == ')') || (first == '"' && last == '"')) { houdini_unescape_html_f(&buf, title->data + 1, title->len - 2); } else { houdini_unescape_html_f(&buf, title->data, title->len); } cmark_strbuf_unescape(&buf); return cmark_chunk_buf_detach(&buf); } // Parse an autolink or HTML tag. // Assumes the subject has a '<' character at the current position. static cmark_node *handle_pointy_brace(subject *subj) { bufsize_t matchlen = 0; cmark_chunk contents; advance(subj); // advance past first < // first try to match a URL autolink matchlen = scan_autolink_uri(&subj->input, subj->pos); if (matchlen > 0) { contents = cmark_chunk_dup(&subj->input, subj->pos, matchlen - 1); subj->pos += matchlen; return make_autolink(contents, 0); } // next try to match an email autolink matchlen = scan_autolink_email(&subj->input, subj->pos); if (matchlen > 0) { contents = cmark_chunk_dup(&subj->input, subj->pos, matchlen - 1); subj->pos += matchlen; return make_autolink(contents, 1); } // finally, try to match an html tag matchlen = scan_html_tag(&subj->input, subj->pos); if (matchlen > 0) { contents = cmark_chunk_dup(&subj->input, subj->pos - 1, matchlen + 1); subj->pos += matchlen; return make_raw_html(contents); } // if nothing matches, just return the opening <: return make_str(cmark_chunk_literal("<")); } // Parse a link label. Returns 1 if successful. // Note: unescaped brackets are not allowed in labels. // The label begins with `[` and ends with the first `]` character // encountered. Backticks in labels do not start code spans. static int link_label(subject *subj, cmark_chunk *raw_label) { bufsize_t startpos = subj->pos; int length = 0; unsigned char c; // advance past [ if (peek_char(subj) == '[') { advance(subj); } else { return 0; } while ((c = peek_char(subj)) && c != '[' && c != ']') { if (c == '\\') { advance(subj); length++; if (cmark_ispunct(peek_char(subj))) { advance(subj); length++; } } else { advance(subj); length++; } if (length > MAX_LINK_LABEL_LENGTH) { goto noMatch; } } if (c == ']') { // match found *raw_label = cmark_chunk_dup(&subj->input, startpos + 1, subj->pos - (startpos + 1)); cmark_chunk_trim(raw_label); advance(subj); // advance past ] return 1; } noMatch: subj->pos = startpos; // rewind return 0; } // Return a link, an image, or a literal close bracket. static cmark_node *handle_close_bracket(subject *subj, cmark_node *parent) { bufsize_t initial_pos; bufsize_t starturl, endurl, starttitle, endtitle, endall; bufsize_t n; bufsize_t sps; cmark_reference *ref; bool is_image = false; cmark_chunk url_chunk, title_chunk; cmark_chunk url, title; delimiter *opener; cmark_node *link_text; cmark_node *inl; cmark_chunk raw_label; int found_label; advance(subj); // advance past ] initial_pos = subj->pos; // look through list of delimiters for a [ or ! opener = subj->last_delim; while (opener) { if (opener->delim_char == '[' || opener->delim_char == '!') { break; } opener = opener->previous; } if (opener == NULL) { return make_str(cmark_chunk_literal("]")); } if (!opener->active) { // take delimiter off stack remove_delimiter(subj, opener); return make_str(cmark_chunk_literal("]")); } // If we got here, we matched a potential link/image text. is_image = opener->delim_char == '!'; link_text = opener->inl_text->next; // Now we check to see if it's a link/image. // First, look for an inline link. if (peek_char(subj) == '(' && ((sps = scan_spacechars(&subj->input, subj->pos + 1)) > -1) && ((n = scan_link_url(&subj->input, subj->pos + 1 + sps)) > -1)) { // try to parse an explicit link: starturl = subj->pos + 1 + sps; // after ( endurl = starturl + n; starttitle = endurl + scan_spacechars(&subj->input, endurl); // ensure there are spaces btw url and title endtitle = (starttitle == endurl) ? starttitle : starttitle + scan_link_title(&subj->input, starttitle); endall = endtitle + scan_spacechars(&subj->input, endtitle); if (peek_at(subj, endall) == ')') { subj->pos = endall + 1; url_chunk = cmark_chunk_dup(&subj->input, starturl, endurl - starturl); title_chunk = cmark_chunk_dup(&subj->input, starttitle, endtitle - starttitle); url = cmark_clean_url(&url_chunk); title = cmark_clean_title(&title_chunk); cmark_chunk_free(&url_chunk); cmark_chunk_free(&title_chunk); goto match; } else { goto noMatch; } } // Next, look for a following [link label] that matches in refmap. // skip spaces subj->pos = subj->pos + scan_spacechars(&subj->input, subj->pos); raw_label = cmark_chunk_literal(""); found_label = link_label(subj, &raw_label); if (!found_label || raw_label.len == 0) { cmark_chunk_free(&raw_label); raw_label = cmark_chunk_dup(&subj->input, opener->position, initial_pos - opener->position - 1); } if (!found_label) { // If we have a shortcut reference link, back up // to before the spacse we skipped. subj->pos = initial_pos; } ref = cmark_reference_lookup(subj->refmap, &raw_label); cmark_chunk_free(&raw_label); if (ref != NULL) { // found url = chunk_clone(&ref->url); title = chunk_clone(&ref->title); goto match; } else { goto noMatch; } noMatch: // If we fall through to here, it means we didn't match a link: remove_delimiter(subj, opener); // remove this opener from delimiter list subj->pos = initial_pos; return make_str(cmark_chunk_literal("]")); match: inl = opener->inl_text; inl->type = is_image ? CMARK_NODE_IMAGE : CMARK_NODE_LINK; cmark_chunk_free(&inl->as.literal); inl->first_child = link_text; process_emphasis(subj, opener); inl->as.link.url = url; inl->as.link.title = title; inl->next = NULL; if (link_text) { cmark_node *tmp; link_text->prev = NULL; for (tmp = link_text; tmp->next != NULL; tmp = tmp->next) { tmp->parent = inl; } tmp->parent = inl; inl->last_child = tmp; } parent->last_child = inl; // Now, if we have a link, we also want to deactivate earlier link // delimiters. (This code can be removed if we decide to allow links // inside links.) remove_delimiter(subj, opener); if (!is_image) { opener = subj->last_delim; while (opener != NULL) { if (opener->delim_char == '[') { if (!opener->active) { break; } else { opener->active = false; } } opener = opener->previous; } } return NULL; } // Parse a hard or soft linebreak, returning an inline. // Assumes the subject has a cr or newline at the current position. static cmark_node *handle_newline(subject *subj) { bufsize_t nlpos = subj->pos; // skip over cr, crlf, or lf: if (peek_at(subj, subj->pos) == '\r') { advance(subj); } if (peek_at(subj, subj->pos) == '\n') { advance(subj); } // skip spaces at beginning of line skip_spaces(subj); if (nlpos > 1 && peek_at(subj, nlpos - 1) == ' ' && peek_at(subj, nlpos - 2) == ' ') { return make_linebreak(); } else { return make_softbreak(); } } static bufsize_t subject_find_special_char(subject *subj, int options) { // "\r\n\\`&_*[]<!" static const int8_t SPECIAL_CHARS[256] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; // " ' . - static const char SMART_PUNCT_CHARS[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; bufsize_t n = subj->pos + 1; while (n < subj->input.len) { if (SPECIAL_CHARS[subj->input.data[n]]) return n; if (options & CMARK_OPT_SMART && SMART_PUNCT_CHARS[subj->input.data[n]]) return n; n++; } return subj->input.len; } // Parse an inline, advancing subject, and add it as a child of parent. // Return 0 if no inline can be parsed, 1 otherwise. static int parse_inline(subject *subj, cmark_node *parent, int options) { cmark_node *new_inl = NULL; cmark_chunk contents; unsigned char c; bufsize_t endpos; c = peek_char(subj); if (c == 0) { return 0; } switch (c) { case '\r': case '\n': new_inl = handle_newline(subj); break; case '`': new_inl = handle_backticks(subj); break; case '\\': new_inl = handle_backslash(subj); break; case '&': new_inl = handle_entity(subj); break; case '<': new_inl = handle_pointy_brace(subj); break; case '*': case '_': case '\'': case '"': new_inl = handle_delim(subj, c, (options & CMARK_OPT_SMART) != 0); break; case '-': new_inl = handle_hyphen(subj, (options & CMARK_OPT_SMART) != 0); break; case '.': new_inl = handle_period(subj, (options & CMARK_OPT_SMART) != 0); break; case '[': advance(subj); new_inl = make_str(cmark_chunk_literal("[")); push_delimiter(subj, '[', true, false, new_inl); break; case ']': new_inl = handle_close_bracket(subj, parent); break; case '!': advance(subj); if (peek_char(subj) == '[') { advance(subj); new_inl = make_str(cmark_chunk_literal("![")); push_delimiter(subj, '!', false, true, new_inl); } else { new_inl = make_str(cmark_chunk_literal("!")); } break; default: endpos = subject_find_special_char(subj, options); contents = cmark_chunk_dup(&subj->input, subj->pos, endpos - subj->pos); subj->pos = endpos; // if we're at a newline, strip trailing spaces. if (S_is_line_end_char(peek_char(subj))) { cmark_chunk_rtrim(&contents); } new_inl = make_str(contents); } if (new_inl != NULL) { cmark_node_append_child(parent, new_inl); } return 1; } // Parse inlines from parent's string_content, adding as children of parent. extern void cmark_parse_inlines(cmark_node *parent, cmark_reference_map *refmap, int options) { subject subj; subject_from_buf(&subj, &parent->string_content, refmap); cmark_chunk_rtrim(&subj.input); while (!is_eof(&subj) && parse_inline(&subj, parent, options)) ; process_emphasis(&subj, NULL); } // Parse zero or more space characters, including at most one newline. static void spnl(subject *subj) { skip_spaces(subj); if (skip_line_end(subj)) { skip_spaces(subj); } } // Parse reference. Assumes string begins with '[' character. // Modify refmap if a reference is encountered. // Return 0 if no reference found, otherwise position of subject // after reference is parsed. bufsize_t cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map *refmap) { subject subj; cmark_chunk lab; cmark_chunk url; cmark_chunk title; bufsize_t matchlen = 0; bufsize_t beforetitle; subject_from_buf(&subj, input, NULL); // parse label: if (!link_label(&subj, &lab) || lab.len == 0) return 0; // colon: if (peek_char(&subj) == ':') { advance(&subj); } else { return 0; } // parse link url: spnl(&subj); matchlen = scan_link_url(&subj.input, subj.pos); if (matchlen) { url = cmark_chunk_dup(&subj.input, subj.pos, matchlen); subj.pos += matchlen; } else { return 0; } // parse optional link_title beforetitle = subj.pos; spnl(&subj); matchlen = scan_link_title(&subj.input, subj.pos); if (matchlen) { title = cmark_chunk_dup(&subj.input, subj.pos, matchlen); subj.pos += matchlen; } else { subj.pos = beforetitle; title = cmark_chunk_literal(""); } // parse final spaces and newline: skip_spaces(&subj); if (!skip_line_end(&subj)) { if (matchlen) { // try rewinding before title subj.pos = beforetitle; skip_spaces(&subj); if (!skip_line_end(&subj)) { return 0; } } else { return 0; } } // insert reference into refmap cmark_reference_create(refmap, &lab, &url, &title); return subj.pos; }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Analysis/valist-uninitialized-no-undef.c
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -analyze -analyzer-checker=core,valist.Uninitialized,valist.CopyToSelf -analyzer-output=text -analyzer-store=region -verify %s #include "Inputs/system-header-simulator-for-valist.h" // This is called in call_inlined_uses_arg(), // and the warning is generated during the analysis of call_inlined_uses_arg(). void inlined_uses_arg(va_list arg) { (void)va_arg(arg, int); // expected-warning{{va_arg() is called on an uninitialized va_list}} // expected-note@-1{{va_arg() is called on an uninitialized va_list}} } void call_inlined_uses_arg(int fst, ...) { va_list va; inlined_uses_arg(va); // expected-note{{Calling 'inlined_uses_arg'}} } void f6(va_list *fst, ...) { va_start(*fst, fst); // FIXME: There should be no warning for this. (void)va_arg(*fst, int); // expected-warning{{va_arg() is called on an uninitialized va_list}} // expected-note@-1{{va_arg() is called on an uninitialized va_list}} va_end(*fst); } void call_vprintf_bad(int isstring, ...) { va_list va; vprintf(isstring ? "%s" : "%d", va); // expected-warning{{Function 'vprintf' is called with an uninitialized va_list argument}} // expected-note@-1{{Function 'vprintf' is called with an uninitialized va_list argument}} // expected-note@-2{{Assuming 'isstring' is 0}} // expected-note@-3{{'?' condition is false}} } void call_vsprintf_bad(char *buffer, ...) { va_list va; va_start(va, buffer); // expected-note{{Initialized va_list}} va_end(va); // expected-note{{Ended va_list}} vsprintf(buffer, "%s %d %d %lf %03d", va); // expected-warning{{Function 'vsprintf' is called with an uninitialized va_list argument}} // expected-note@-1{{Function 'vsprintf' is called with an uninitialized va_list argument}} }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/posix/ProcessLauncherPosix.h
//===-- ProcessLauncherPosix.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_Host_posix_ProcessLauncherPosix_h_ #define lldb_Host_posix_ProcessLauncherPosix_h_ #include "lldb/Host/ProcessLauncher.h" namespace lldb_private { class ProcessLauncherPosix : public ProcessLauncher { public: HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error) override; }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Random.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Random.h<gh_stars>100-1000 #ifndef Random_h #define Random_h #include "swift/Obfuscation/Utils.h" #include <cassert> #include <vector> #include <string> #include <random> namespace swift { namespace obfuscation { /// Generates integer value from a specified [Min; Max] range. /// /// \tparam EngineType random number engine type such as std::mt19937 /// \tparam DistributionType type of probability distribution /// such as std::uniform_int_distribution<int> template<typename EngineType, typename DistributionType> class RandomIntegerGenerator { private: EngineType Engine; DistributionType Distribution; public: RandomIntegerGenerator(int Min, int Max); int rand(); }; /// Chooses random element from the specified vector. /// /// \tparam ElementType type of the elements in vector /// \tparam GeneratorType type of the generator used to generate the index /// of chosen element template<typename ElementType, typename GeneratorType> class RandomElementChooser { private: GeneratorType Generator; std::vector<ElementType> List; public: RandomElementChooser(const std::vector<ElementType> &ListToChooseFrom); ElementType rand(); }; template<typename ElementType> using length_type = typename std::vector<ElementType>::size_type; /// Generates the vector of elements randomly chosen from the specified vector. /// /// \tparam ElementType type of the elements in vector /// \tparam ChooserType class that generates random elements from predefined set template<typename ElementType, typename ChooserType> class RandomVectorGenerator { private: ChooserType Chooser; public: RandomVectorGenerator(const std::vector<ElementType> &ListToChooseFrom); std::vector<ElementType> rand(length_type<ElementType> Length); }; /// Generates string of specified length containing elements randomly chosed /// from the specified vector. /// /// \tparam ChooserType type of the chooser used by RandomVectorGenerator template<typename ChooserType> class RandomStringGenerator { private: RandomVectorGenerator<std::string, ChooserType> Generator; public: RandomStringGenerator(const std::vector<std::string> &ListToChooseFrom); std::string rand(length_type<std::string> Length); }; using RandomUniformIntGenerator = RandomIntegerGenerator<std::mt19937, std::uniform_int_distribution<int>>; using RandomUniformCharacterChooser = RandomElementChooser<std::string, RandomUniformIntGenerator>; using RandomUniformStringGenerator = RandomStringGenerator<RandomUniformCharacterChooser>; } //namespace obfuscation } //namespace swift #include "Random-Template.h" #endif /* Random_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/common/TCPSocket.h
//===-- TCPSocket.h ---------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_TCPSocket_h_ #define liblldb_TCPSocket_h_ #include "lldb/Host/Socket.h" namespace lldb_private { class TCPSocket : public Socket { public: TCPSocket(NativeSocket socket, bool should_close); TCPSocket(bool child_processes_inherit, Error &error); // returns port number or 0 if error uint16_t GetLocalPortNumber() const; // returns ip address string or empty string if error std::string GetLocalIPAddress() const; // must be connected // returns port number or 0 if error uint16_t GetRemotePortNumber() const; // must be connected // returns ip address string or empty string if error std::string GetRemoteIPAddress() const; int SetOptionNoDelay(); int SetOptionReuseAddress(); Error Connect(llvm::StringRef name) override; Error Listen(llvm::StringRef name, int backlog) override; Error Accept(llvm::StringRef name, bool child_processes_inherit, Socket *&conn_socket) override; }; } #endif // ifndef liblldb_TCPSocket_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.h
//===-- PlatformAppleSimulator.h --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_PlatformAppleSimulator_h_ #define liblldb_PlatformAppleSimulator_h_ // C Includes // C++ Includes #include <mutex> // Other libraries and framework includes // Project includes #include "PlatformDarwin.h" #include "PlatformiOSSimulatorCoreSimulatorSupport.h" #include "lldb/Host/FileSpec.h" #include "llvm/ADT/Optional.h" class PlatformAppleSimulator : public PlatformDarwin { public: //------------------------------------------------------------ // Class Functions //------------------------------------------------------------ static void Initialize(); static void Terminate(); //------------------------------------------------------------ // Class Methods //------------------------------------------------------------ PlatformAppleSimulator(); virtual ~PlatformAppleSimulator(); lldb_private::Error LaunchProcess(lldb_private::ProcessLaunchInfo &launch_info) override; void GetStatus(lldb_private::Stream &strm) override; lldb_private::Error ConnectRemote(lldb_private::Args &args) override; lldb_private::Error DisconnectRemote() override; lldb::ProcessSP DebugProcess(lldb_private::ProcessLaunchInfo &launch_info, lldb_private::Debugger &debugger, lldb_private::Target *target, lldb_private::Error &error) override; protected: std::mutex m_core_sim_path_mutex; llvm::Optional<lldb_private::FileSpec> m_core_simulator_framework_path; llvm::Optional<CoreSimulatorSupport::Device> m_device; lldb_private::FileSpec GetCoreSimulatorPath(); void LoadCoreSimulator(); #if defined(__APPLE__) CoreSimulatorSupport::Device GetSimulatorDevice(); #endif private: DISALLOW_COPY_AND_ASSIGN(PlatformAppleSimulator); }; #endif // liblldb_PlatformAppleSimulator_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/LockFileBase.h
//===-- LockFileBase.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Host_LockFileBase_h_ #define liblldb_Host_LockFileBase_h_ #include "lldb/Core/Error.h" #include <functional> namespace lldb_private { class LockFileBase { public: virtual ~LockFileBase() = default; bool IsLocked() const; Error WriteLock(const uint64_t start, const uint64_t len); Error TryWriteLock(const uint64_t start, const uint64_t len); Error ReadLock(const uint64_t start, const uint64_t len); Error TryReadLock(const uint64_t start, const uint64_t len); Error Unlock(); protected: using Locker = std::function<Error(const uint64_t, const uint64_t)>; LockFileBase(int fd); virtual bool IsValidFile() const; virtual Error DoWriteLock(const uint64_t start, const uint64_t len) = 0; virtual Error DoTryWriteLock(const uint64_t start, const uint64_t len) = 0; virtual Error DoReadLock(const uint64_t start, const uint64_t len) = 0; virtual Error DoTryReadLock(const uint64_t start, const uint64_t len) = 0; virtual Error DoUnlock() = 0; Error DoLock(const Locker &locker, const uint64_t start, const uint64_t len); int m_fd; // not owned. bool m_locked; uint64_t m_start; uint64_t m_len; }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/PDB/PDBASTParser.h
//===-- PDBASTParser.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLDB_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H #define LLDB_PLUGINS_SYMBOLFILE_PDB_PDBASTPARSER_H #include "lldb/lldb-forward.h" #include "lldb/Symbol/ClangASTImporter.h" namespace clang { class CharUnits; class CXXRecordDecl; class FieldDecl; class RecordDecl; } namespace lldb_private { class ClangASTContext; class CompilerType; } namespace llvm { namespace pdb { class PDBSymbol; class PDBSymbolData; class PDBSymbolTypeBuiltin; } } class PDBASTParser { public: PDBASTParser(lldb_private::ClangASTContext &ast); ~PDBASTParser(); lldb::TypeSP CreateLLDBTypeFromPDBType(const llvm::pdb::PDBSymbol &type); private: bool AddEnumValue(lldb_private::CompilerType enum_type, const llvm::pdb::PDBSymbolData &data) const; lldb_private::ClangASTContext &m_ast; lldb_private::ClangASTImporter m_ast_importer; }; #endif // SymbolFileDWARF_DWARFASTParserClang_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Processor.h
<reponame>Polidea/SiriusObfuscator #ifndef Processor_h #define Processor_h #include "swift/Obfuscation/DataStructures.h" #include "swift/Obfuscation/Extractor.h" namespace swift { namespace obfuscation { class Processor { public: virtual ~Processor() = 0; virtual DeclsWithRangesOrErrors declarationFrom(Expr *) = 0; virtual DeclsWithRangesOrErrors declarationFrom(Decl *) = 0; }; class ExpressionProcessor : public Processor { private: ParameterExtractor Extractor; DeclsWithRangesOrErrors parse(CallExpr *); DeclsWithRangesOrErrors parseCallExpressionWithArguments(CallExpr *); DeclsWithRangesOrErrors parse(EnumIsCaseExpr *); llvm::Expected<AbstractFunctionDecl*> declarationOfFunctionCalledInExpression(CallExpr *); std::vector<std::pair<Identifier, SourceLoc>> validArguments(CallExpr *CallExpression); llvm::Expected<CharSourceRange> rangeOfFirstOccurenceOfStringInSourceLoc(std::string String, SourceLoc StartSourceLoc); DeclsWithRangesOrErrors parseGenericParameters(BoundGenericType *BoundGenericType, SourceLoc OpeningAngleBracketLoc); public: ExpressionProcessor(ParameterExtractor &Extractor); DeclsWithRangesOrErrors declarationFrom(Expr *) override; DeclsWithRangesOrErrors declarationFrom(Decl *) override; }; class WhereClauseProcessor : public Processor { private: TypeRepresentationExtractor Extractor; DeclsWithRangesOrErrors handleWhereClause(TrailingWhereClause *); public: WhereClauseProcessor(TypeRepresentationExtractor &); DeclsWithRangesOrErrors declarationFrom(Expr *) override; DeclsWithRangesOrErrors declarationFrom(Decl *) override; }; } //namespace obfuscation } //namespace swift #endif /* Processor_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Target/Process.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Target/Process.h<gh_stars>100-1000 //===-- Process.h -----------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Process_h_ #define liblldb_Process_h_ #include "lldb/Host/Config.h" // C Includes #include <limits.h> // C++ Includes #include <chrono> #include <list> #include <memory> #include <mutex> #include <string> #include <unordered_set> #include <vector> // Other libraries and framework includes // Project includes #include "lldb/Breakpoint/BreakpointSiteList.h" #include "lldb/Core/ArchSpec.h" #include "lldb/Core/Broadcaster.h" #include "lldb/Core/Communication.h" #include "lldb/Core/Error.h" #include "lldb/Core/Event.h" #include "lldb/Core/Listener.h" #include "lldb/Core/LoadedModuleInfoList.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" #include "lldb/Core/ThreadSafeValue.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/ProcessRunLock.h" #include "lldb/Interpreter/Options.h" #include "lldb/Target/ExecutionContextScope.h" #include "lldb/Target/InstrumentationRuntime.h" #include "lldb/Target/Memory.h" #include "lldb/Target/ProcessInfo.h" #include "lldb/Target/ProcessLaunchInfo.h" #include "lldb/Target/QueueList.h" #include "lldb/Target/ThreadList.h" #include "lldb/lldb-private.h" #include "llvm/ADT/ArrayRef.h" namespace lldb_private { template <typename B, typename S> struct Range; //---------------------------------------------------------------------- // ProcessProperties //---------------------------------------------------------------------- class ProcessProperties : public Properties { public: // Pass nullptr for "process" if the ProcessProperties are to be the global // copy ProcessProperties(lldb_private::Process *process); ~ProcessProperties() override; bool GetDisableMemoryCache() const; uint64_t GetMemoryCacheLineSize() const; Args GetExtraStartupCommands() const; void SetExtraStartupCommands(const Args &args); FileSpec GetPythonOSPluginPath() const; void SetPythonOSPluginPath(const FileSpec &file); bool GetIgnoreBreakpointsInExpressions() const; void SetIgnoreBreakpointsInExpressions(bool ignore); bool GetUnwindOnErrorInExpressions() const; void SetUnwindOnErrorInExpressions(bool ignore); bool GetStopOnSharedLibraryEvents() const; void SetStopOnSharedLibraryEvents(bool stop); bool GetDetachKeepsStopped() const; void SetDetachKeepsStopped(bool keep_stopped); bool GetWarningsOptimization() const; protected: static void OptionValueChangedCallback(void *baton, OptionValue *option_value); Process *m_process; // Can be nullptr for global ProcessProperties }; typedef std::shared_ptr<ProcessProperties> ProcessPropertiesSP; //---------------------------------------------------------------------- // ProcessInstanceInfo // // Describes an existing process and any discoverable information that // pertains to that process. //---------------------------------------------------------------------- class ProcessInstanceInfo : public ProcessInfo { public: ProcessInstanceInfo() : ProcessInfo(), m_euid(UINT32_MAX), m_egid(UINT32_MAX), m_parent_pid(LLDB_INVALID_PROCESS_ID) {} ProcessInstanceInfo(const char *name, const ArchSpec &arch, lldb::pid_t pid) : ProcessInfo(name, arch, pid), m_euid(UINT32_MAX), m_egid(UINT32_MAX), m_parent_pid(LLDB_INVALID_PROCESS_ID) {} void Clear() { ProcessInfo::Clear(); m_euid = UINT32_MAX; m_egid = UINT32_MAX; m_parent_pid = LLDB_INVALID_PROCESS_ID; } uint32_t GetEffectiveUserID() const { return m_euid; } uint32_t GetEffectiveGroupID() const { return m_egid; } bool EffectiveUserIDIsValid() const { return m_euid != UINT32_MAX; } bool EffectiveGroupIDIsValid() const { return m_egid != UINT32_MAX; } void SetEffectiveUserID(uint32_t uid) { m_euid = uid; } void SetEffectiveGroupID(uint32_t gid) { m_egid = gid; } lldb::pid_t GetParentProcessID() const { return m_parent_pid; } void SetParentProcessID(lldb::pid_t pid) { m_parent_pid = pid; } bool ParentProcessIDIsValid() const { return m_parent_pid != LLDB_INVALID_PROCESS_ID; } void Dump(Stream &s, Platform *platform) const; static void DumpTableHeader(Stream &s, Platform *platform, bool show_args, bool verbose); void DumpAsTableRow(Stream &s, Platform *platform, bool show_args, bool verbose) const; protected: uint32_t m_euid; uint32_t m_egid; lldb::pid_t m_parent_pid; }; //---------------------------------------------------------------------- // ProcessAttachInfo // // Describes any information that is required to attach to a process. //---------------------------------------------------------------------- class ProcessAttachInfo : public ProcessInstanceInfo { public: ProcessAttachInfo() : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(), m_plugin_name(), m_resume_count(0), m_wait_for_launch(false), m_ignore_existing(true), m_continue_once_attached(false), m_detach_on_error(true), m_async(false) {} ProcessAttachInfo(const ProcessLaunchInfo &launch_info) : ProcessInstanceInfo(), m_listener_sp(), m_hijack_listener_sp(), m_plugin_name(), m_resume_count(0), m_wait_for_launch(false), m_ignore_existing(true), m_continue_once_attached(false), m_detach_on_error(true), m_async(false) { ProcessInfo::operator=(launch_info); SetProcessPluginName(launch_info.GetProcessPluginName()); SetResumeCount(launch_info.GetResumeCount()); SetListener(launch_info.GetListener()); SetHijackListener(launch_info.GetHijackListener()); m_detach_on_error = launch_info.GetDetachOnError(); } bool GetWaitForLaunch() const { return m_wait_for_launch; } void SetWaitForLaunch(bool b) { m_wait_for_launch = b; } bool GetAsync() const { return m_async; } void SetAsync(bool b) { m_async = b; } bool GetIgnoreExisting() const { return m_ignore_existing; } void SetIgnoreExisting(bool b) { m_ignore_existing = b; } bool GetContinueOnceAttached() const { return m_continue_once_attached; } void SetContinueOnceAttached(bool b) { m_continue_once_attached = b; } uint32_t GetResumeCount() const { return m_resume_count; } void SetResumeCount(uint32_t c) { m_resume_count = c; } const char *GetProcessPluginName() const { return (m_plugin_name.empty() ? nullptr : m_plugin_name.c_str()); } void SetProcessPluginName(llvm::StringRef plugin) { m_plugin_name = plugin; } void Clear() { ProcessInstanceInfo::Clear(); m_plugin_name.clear(); m_resume_count = 0; m_wait_for_launch = false; m_ignore_existing = true; m_continue_once_attached = false; } bool ProcessInfoSpecified() const { if (GetExecutableFile()) return true; if (GetProcessID() != LLDB_INVALID_PROCESS_ID) return true; if (GetParentProcessID() != LLDB_INVALID_PROCESS_ID) return true; return false; } lldb::ListenerSP GetHijackListener() const { return m_hijack_listener_sp; } void SetHijackListener(const lldb::ListenerSP &listener_sp) { m_hijack_listener_sp = listener_sp; } bool GetDetachOnError() const { return m_detach_on_error; } void SetDetachOnError(bool enable) { m_detach_on_error = enable; } // Get and set the actual listener that will be used for the process events lldb::ListenerSP GetListener() const { return m_listener_sp; } void SetListener(const lldb::ListenerSP &listener_sp) { m_listener_sp = listener_sp; } lldb::ListenerSP GetListenerForProcess(Debugger &debugger); protected: lldb::ListenerSP m_listener_sp; lldb::ListenerSP m_hijack_listener_sp; std::string m_plugin_name; uint32_t m_resume_count; // How many times do we resume after launching bool m_wait_for_launch; bool m_ignore_existing; bool m_continue_once_attached; // Supports the use-case scenario of // immediately continuing the process once // attached. bool m_detach_on_error; // If we are debugging remotely, instruct the stub to // detach rather than killing the target on error. bool m_async; // Use an async attach where we start the attach and return // immediately (used by GUI programs with --waitfor so they can // call SBProcess::Stop() to cancel attach) }; class ProcessLaunchCommandOptions : public Options { public: ProcessLaunchCommandOptions() : Options() { // Keep default values of all options in one place: OptionParsingStarting () OptionParsingStarting(nullptr); } ~ProcessLaunchCommandOptions() override = default; Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override { launch_info.Clear(); disable_aslr = eLazyBoolCalculate; } llvm::ArrayRef<OptionDefinition> GetDefinitions() override; // Instance variables to hold the values for command options. ProcessLaunchInfo launch_info; lldb_private::LazyBool disable_aslr; }; //---------------------------------------------------------------------- // ProcessInstanceInfoMatch // // A class to help matching one ProcessInstanceInfo to another. //---------------------------------------------------------------------- class ProcessInstanceInfoMatch { public: ProcessInstanceInfoMatch() : m_match_info(), m_name_match_type(eNameMatchIgnore), m_match_all_users(false) {} ProcessInstanceInfoMatch(const char *process_name, NameMatchType process_name_match_type) : m_match_info(), m_name_match_type(process_name_match_type), m_match_all_users(false) { m_match_info.GetExecutableFile().SetFile(process_name, false); } ProcessInstanceInfo &GetProcessInfo() { return m_match_info; } const ProcessInstanceInfo &GetProcessInfo() const { return m_match_info; } bool GetMatchAllUsers() const { return m_match_all_users; } void SetMatchAllUsers(bool b) { m_match_all_users = b; } NameMatchType GetNameMatchType() const { return m_name_match_type; } void SetNameMatchType(NameMatchType name_match_type) { m_name_match_type = name_match_type; } bool NameMatches(const char *process_name) const; bool Matches(const ProcessInstanceInfo &proc_info) const; bool MatchAllProcesses() const; void Clear(); protected: ProcessInstanceInfo m_match_info; NameMatchType m_name_match_type; bool m_match_all_users; }; class ProcessInstanceInfoList { public: ProcessInstanceInfoList() = default; void Clear() { m_infos.clear(); } size_t GetSize() { return m_infos.size(); } void Append(const ProcessInstanceInfo &info) { m_infos.push_back(info); } const char *GetProcessNameAtIndex(size_t idx) { return ((idx < m_infos.size()) ? m_infos[idx].GetName() : nullptr); } size_t GetProcessNameLengthAtIndex(size_t idx) { return ((idx < m_infos.size()) ? m_infos[idx].GetNameLength() : 0); } lldb::pid_t GetProcessIDAtIndex(size_t idx) { return ((idx < m_infos.size()) ? m_infos[idx].GetProcessID() : 0); } bool GetInfoAtIndex(size_t idx, ProcessInstanceInfo &info) { if (idx < m_infos.size()) { info = m_infos[idx]; return true; } return false; } // You must ensure "idx" is valid before calling this function const ProcessInstanceInfo &GetProcessInfoAtIndex(size_t idx) const { assert(idx < m_infos.size()); return m_infos[idx]; } protected: typedef std::vector<ProcessInstanceInfo> collection; collection m_infos; }; // This class tracks the Modification state of the process. Things that can // currently modify // the program are running the program (which will up the StopID) and writing // memory (which // will up the MemoryID.) // FIXME: Should we also include modification of register states? class ProcessModID { friend bool operator==(const ProcessModID &lhs, const ProcessModID &rhs); public: ProcessModID() : m_stop_id(0), m_last_natural_stop_id(0), m_resume_id(0), m_memory_id(0), m_last_user_expression_resume(0), m_running_user_expression(false) {} ProcessModID(const ProcessModID &rhs) : m_stop_id(rhs.m_stop_id), m_memory_id(rhs.m_memory_id) {} const ProcessModID &operator=(const ProcessModID &rhs) { if (this != &rhs) { m_stop_id = rhs.m_stop_id; m_memory_id = rhs.m_memory_id; } return *this; } ~ProcessModID() = default; void BumpStopID() { m_stop_id++; if (!IsLastResumeForUserExpression()) m_last_natural_stop_id++; } void BumpMemoryID() { m_memory_id++; } void BumpResumeID() { m_resume_id++; if (m_running_user_expression > 0) m_last_user_expression_resume = m_resume_id; } uint32_t GetStopID() const { return m_stop_id; } uint32_t GetLastNaturalStopID() const { return m_last_natural_stop_id; } uint32_t GetMemoryID() const { return m_memory_id; } uint32_t GetResumeID() const { return m_resume_id; } uint32_t GetLastUserExpressionResumeID() const { return m_last_user_expression_resume; } bool MemoryIDEqual(const ProcessModID &compare) const { return m_memory_id == compare.m_memory_id; } bool StopIDEqual(const ProcessModID &compare) const { return m_stop_id == compare.m_stop_id; } void SetInvalid() { m_stop_id = UINT32_MAX; } bool IsValid() const { return m_stop_id != UINT32_MAX; } bool IsLastResumeForUserExpression() const { // If we haven't yet resumed the target, then it can't be for a user // expression... if (m_resume_id == 0) return false; return m_resume_id == m_last_user_expression_resume; } void SetRunningUserExpression(bool on) { if (on) m_running_user_expression++; else m_running_user_expression--; } void SetStopEventForLastNaturalStopID(lldb::EventSP event_sp) { m_last_natural_stop_event = event_sp; } lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const { if (stop_id == m_last_natural_stop_id) return m_last_natural_stop_event; return lldb::EventSP(); } private: uint32_t m_stop_id; uint32_t m_last_natural_stop_id; uint32_t m_resume_id; uint32_t m_memory_id; uint32_t m_last_user_expression_resume; uint32_t m_running_user_expression; lldb::EventSP m_last_natural_stop_event; }; inline bool operator==(const ProcessModID &lhs, const ProcessModID &rhs) { if (lhs.StopIDEqual(rhs) && lhs.MemoryIDEqual(rhs)) return true; else return false; } inline bool operator!=(const ProcessModID &lhs, const ProcessModID &rhs) { return (!lhs.StopIDEqual(rhs) || !lhs.MemoryIDEqual(rhs)); } //---------------------------------------------------------------------- /// @class Process Process.h "lldb/Target/Process.h" /// @brief A plug-in interface definition class for debugging a process. //---------------------------------------------------------------------- class Process : public std::enable_shared_from_this<Process>, public ProcessProperties, public UserID, public Broadcaster, public ExecutionContextScope, public PluginInterface { friend class FunctionCaller; // For WaitForStateChangeEventsPrivate friend class Debugger; // For PopProcessIOHandler and ProcessIOHandlerIsActive friend class DynamicLoader; // For LoadOperatingSystemPlugin friend class ProcessEventData; friend class StopInfo; friend class Target; friend class ThreadList; public: //------------------------------------------------------------------ /// Broadcaster event bits definitions. //------------------------------------------------------------------ enum { eBroadcastBitStateChanged = (1 << 0), eBroadcastBitInterrupt = (1 << 1), eBroadcastBitSTDOUT = (1 << 2), eBroadcastBitSTDERR = (1 << 3), eBroadcastBitProfileData = (1 << 4), eBroadcastBitStructuredData = (1 << 5), }; enum { eBroadcastInternalStateControlStop = (1 << 0), eBroadcastInternalStateControlPause = (1 << 1), eBroadcastInternalStateControlResume = (1 << 2) }; //------------------------------------------------------------------ /// Process warning types. //------------------------------------------------------------------ enum Warnings { eWarningsOptimization = 1, eWarningsCantLoadSwift }; typedef Range<lldb::addr_t, lldb::addr_t> LoadRange; // We use a read/write lock to allow on or more clients to // access the process state while the process is stopped (reader). // We lock the write lock to control access to the process // while it is running (readers, or clients that want the process // stopped can block waiting for the process to stop, or just // try to lock it to see if they can immediately access the stopped // process. If the try read lock fails, then the process is running. typedef ProcessRunLock::ProcessRunLocker StopLocker; // These two functions fill out the Broadcaster interface: static ConstString &GetStaticBroadcasterClass(); ConstString &GetBroadcasterClass() const override { return GetStaticBroadcasterClass(); } //------------------------------------------------------------------ /// A notification structure that can be used by clients to listen /// for changes in a process's lifetime. /// /// @see RegisterNotificationCallbacks (const Notifications&) /// @see UnregisterNotificationCallbacks (const Notifications&) //------------------------------------------------------------------ #ifndef SWIG typedef struct { void *baton; void (*initialize)(void *baton, Process *process); void (*process_state_changed)(void *baton, Process *process, lldb::StateType state); } Notifications; class ProcessEventData : public EventData { friend class Process; public: ProcessEventData(); ProcessEventData(const lldb::ProcessSP &process, lldb::StateType state); ~ProcessEventData() override; static const ConstString &GetFlavorString(); const ConstString &GetFlavor() const override; lldb::ProcessSP GetProcessSP() const { return m_process_wp.lock(); } lldb::StateType GetState() const { return m_state; } bool GetRestarted() const { return m_restarted; } size_t GetNumRestartedReasons() { return m_restarted_reasons.size(); } const char *GetRestartedReasonAtIndex(size_t idx) { return ((idx < m_restarted_reasons.size()) ? m_restarted_reasons[idx].c_str() : nullptr); } bool GetInterrupted() const { return m_interrupted; } void Dump(Stream *s) const override; void DoOnRemoval(Event *event_ptr) override; static const Process::ProcessEventData * GetEventDataFromEvent(const Event *event_ptr); static lldb::ProcessSP GetProcessFromEvent(const Event *event_ptr); static lldb::StateType GetStateFromEvent(const Event *event_ptr); static bool GetRestartedFromEvent(const Event *event_ptr); static size_t GetNumRestartedReasons(const Event *event_ptr); static const char *GetRestartedReasonAtIndex(const Event *event_ptr, size_t idx); static void AddRestartedReason(Event *event_ptr, const char *reason); static void SetRestartedInEvent(Event *event_ptr, bool new_value); static bool GetInterruptedFromEvent(const Event *event_ptr); static void SetInterruptedInEvent(Event *event_ptr, bool new_value); static bool SetUpdateStateOnRemoval(Event *event_ptr); private: void SetUpdateStateOnRemoval() { m_update_state++; } void SetRestarted(bool new_value) { m_restarted = new_value; } void SetInterrupted(bool new_value) { m_interrupted = new_value; } void AddRestartedReason(const char *reason) { m_restarted_reasons.push_back(reason); } lldb::ProcessWP m_process_wp; lldb::StateType m_state; std::vector<std::string> m_restarted_reasons; bool m_restarted; // For "eStateStopped" events, this is true if the target // was automatically restarted. int m_update_state; bool m_interrupted; DISALLOW_COPY_AND_ASSIGN(ProcessEventData); }; #endif // SWIG //------------------------------------------------------------------ /// Construct with a shared pointer to a target, and the Process listener. /// Uses the Host UnixSignalsSP by default. //------------------------------------------------------------------ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp); //------------------------------------------------------------------ /// Construct with a shared pointer to a target, the Process listener, /// and the appropriate UnixSignalsSP for the process. //------------------------------------------------------------------ Process(lldb::TargetSP target_sp, lldb::ListenerSP listener_sp, const lldb::UnixSignalsSP &unix_signals_sp); //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be /// inherited from by the plug-in instance. //------------------------------------------------------------------ ~Process() override; static void SettingsInitialize(); static void SettingsTerminate(); static const ProcessPropertiesSP &GetGlobalProperties(); //------------------------------------------------------------------ /// Find a Process plug-in that can debug \a module using the /// currently selected architecture. /// /// Scans all loaded plug-in interfaces that implement versions of /// the Process plug-in interface and returns the first instance /// that can debug the file. /// /// @param[in] module_sp /// The module shared pointer that this process will debug. /// /// @param[in] plugin_name /// If nullptr, select the best plug-in for the binary. If non-nullptr /// then look for a plugin whose PluginInfo's name matches /// this string. /// /// @see Process::CanDebug () //------------------------------------------------------------------ static lldb::ProcessSP FindPlugin(lldb::TargetSP target_sp, llvm::StringRef plugin_name, lldb::ListenerSP listener_sp, const FileSpec *crash_file_path); //------------------------------------------------------------------ /// Static function that can be used with the \b host function /// Host::StartMonitoringChildProcess (). /// /// This function can be used by lldb_private::Process subclasses /// when they want to watch for a local process and have its exit /// status automatically set when the host child process exits. /// Subclasses should call Host::StartMonitoringChildProcess () /// with: /// callback = Process::SetHostProcessExitStatus /// pid = Process::GetID() /// monitor_signals = false //------------------------------------------------------------------ static bool SetProcessExitStatus(lldb::pid_t pid, // The process ID we want to monitor bool exited, int signo, // Zero for no signal int status); // Exit value of process if signal is zero lldb::ByteOrder GetByteOrder() const; uint32_t GetAddressByteSize() const; uint32_t GetUniqueID() const { return m_process_unique_id; } //------------------------------------------------------------------ /// Check if a plug-in instance can debug the file in \a module. /// /// Each plug-in is given a chance to say whether it can debug /// the file in \a module. If the Process plug-in instance can /// debug a file on the current system, it should return \b true. /// /// @return /// Returns \b true if this Process plug-in instance can /// debug the executable, \b false otherwise. //------------------------------------------------------------------ virtual bool CanDebug(lldb::TargetSP target, bool plugin_specified_by_name) = 0; //------------------------------------------------------------------ /// This object is about to be destroyed, do any necessary cleanup. /// /// Subclasses that override this method should always call this /// superclass method. //------------------------------------------------------------------ virtual void Finalize(); //------------------------------------------------------------------ /// Return whether this object is valid (i.e. has not been finalized.) /// /// @return /// Returns \b true if this Process has not been finalized /// and \b false otherwise. //------------------------------------------------------------------ bool IsValid() const { return !m_finalize_called; } //------------------------------------------------------------------ /// Return a multi-word command object that can be used to expose /// plug-in specific commands. /// /// This object will be used to resolve plug-in commands and can be /// triggered by a call to: /// /// (lldb) process commmand <args> /// /// @return /// A CommandObject which can be one of the concrete subclasses /// of CommandObject like CommandObjectRaw, CommandObjectParsed, /// or CommandObjectMultiword. //------------------------------------------------------------------ virtual CommandObject *GetPluginCommandObject() { return nullptr; } //------------------------------------------------------------------ /// Launch a new process. /// /// Launch a new process by spawning a new process using the /// target object's executable module's file as the file to launch. /// /// This function is not meant to be overridden by Process /// subclasses. It will first call Process::WillLaunch (Module *) /// and if that returns \b true, Process::DoLaunch (Module*, /// char const *[],char const *[],const char *,const char *, /// const char *) will be called to actually do the launching. If /// DoLaunch returns \b true, then Process::DidLaunch() will be /// called. /// /// @param[in] launch_info /// Details regarding the environment, STDIN/STDOUT/STDERR /// redirection, working path, etc. related to the requested launch. /// /// @return /// An error object. Call GetID() to get the process ID if /// the error object is success. //------------------------------------------------------------------ virtual Error Launch(ProcessLaunchInfo &launch_info); virtual Error LoadCore(); virtual Error DoLoadCore() { Error error; error.SetErrorStringWithFormat( "error: %s does not support loading core files.", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Get the dynamic loader plug-in for this process. /// /// The default action is to let the DynamicLoader plug-ins check /// the main executable and the DynamicLoader will select itself /// automatically. Subclasses can override this if inspecting the /// executable is not desired, or if Process subclasses can only /// use a specific DynamicLoader plug-in. //------------------------------------------------------------------ virtual DynamicLoader *GetDynamicLoader(); //------------------------------------------------------------------ // Returns AUXV structure found in many ELF-based environments. // // The default action is to return an empty data buffer. // // @return // A data buffer containing the contents of the AUXV data. //------------------------------------------------------------------ virtual const lldb::DataBufferSP GetAuxvData(); //------------------------------------------------------------------ /// Sometimes processes know how to retrieve and load shared libraries. /// This is normally done by DynamicLoader plug-ins, but sometimes the /// connection to the process allows retrieving this information. The /// dynamic loader plug-ins can use this function if they can't /// determine the current shared library load state. /// /// @return /// The number of shared libraries that were loaded //------------------------------------------------------------------ virtual size_t LoadModules() { return 0; } virtual size_t LoadModules(LoadedModuleInfoList &) { return 0; } protected: virtual JITLoaderList &GetJITLoaders(); public: //------------------------------------------------------------------ /// Get the system runtime plug-in for this process. /// /// @return /// Returns a pointer to the SystemRuntime plugin for this Process /// if one is available. Else returns nullptr. //------------------------------------------------------------------ virtual SystemRuntime *GetSystemRuntime(); //------------------------------------------------------------------ /// Attach to an existing process using the process attach info. /// /// This function is not meant to be overridden by Process /// subclasses. It will first call WillAttach (lldb::pid_t) /// or WillAttach (const char *), and if that returns \b /// true, DoAttach (lldb::pid_t) or DoAttach (const char *) will /// be called to actually do the attach. If DoAttach returns \b /// true, then Process::DidAttach() will be called. /// /// @param[in] pid /// The process ID that we should attempt to attach to. /// /// @return /// Returns \a pid if attaching was successful, or /// LLDB_INVALID_PROCESS_ID if attaching fails. //------------------------------------------------------------------ virtual Error Attach(ProcessAttachInfo &attach_info); //------------------------------------------------------------------ /// Attach to a remote system via a URL /// /// @param[in] strm /// A stream where output intended for the user /// (if the driver has a way to display that) generated during /// the connection. This may be nullptr if no output is needed.A /// /// @param[in] remote_url /// The URL format that we are connecting to. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error ConnectRemote(Stream *strm, llvm::StringRef remote_url); bool GetShouldDetach() const { return m_should_detach; } void SetShouldDetach(bool b) { m_should_detach = b; } //------------------------------------------------------------------ /// Get the image information address for the current process. /// /// Some runtimes have system functions that can help dynamic /// loaders locate the dynamic loader information needed to observe /// shared libraries being loaded or unloaded. This function is /// in the Process interface (as opposed to the DynamicLoader /// interface) to ensure that remote debugging can take advantage of /// this functionality. /// /// @return /// The address of the dynamic loader information, or /// LLDB_INVALID_ADDRESS if this is not supported by this /// interface. //------------------------------------------------------------------ virtual lldb::addr_t GetImageInfoAddress(); //------------------------------------------------------------------ /// Called when the process is about to broadcast a public stop. /// /// There are public and private stops. Private stops are when the /// process is doing things like stepping and the client doesn't /// need to know about starts and stop that implement a thread plan. /// Single stepping over a source line in code might end up being /// implemented by one or more process starts and stops. Public stops /// are when clients will be notified that the process is stopped. /// These events typically trigger UI updates (thread stack frames to /// be displayed, variables to be displayed, and more). This function /// can be overriden and allows process subclasses to do something /// before the eBroadcastBitStateChanged event is sent to public /// clients. //------------------------------------------------------------------ virtual void WillPublicStop() {} //------------------------------------------------------------------ /// Register for process and thread notifications. /// /// Clients can register notification callbacks by filling out a /// Process::Notifications structure and calling this function. /// /// @param[in] callbacks /// A structure that contains the notification baton and /// callback functions. /// /// @see Process::Notifications //------------------------------------------------------------------ #ifndef SWIG void RegisterNotificationCallbacks(const Process::Notifications &callbacks); #endif //------------------------------------------------------------------ /// Unregister for process and thread notifications. /// /// Clients can unregister notification callbacks by passing a copy of /// the original baton and callbacks in \a callbacks. /// /// @param[in] callbacks /// A structure that contains the notification baton and /// callback functions. /// /// @return /// Returns \b true if the notification callbacks were /// successfully removed from the process, \b false otherwise. /// /// @see Process::Notifications //------------------------------------------------------------------ #ifndef SWIG bool UnregisterNotificationCallbacks(const Process::Notifications &callbacks); #endif //================================================================== // Built in Process Control functions //================================================================== //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the /// Thread run control functions. /// /// Threads for a process should be updated with one of the run /// control actions (resume, step, or suspend) that they should take /// when the process is resumed. If no run control action is given /// to a thread it will be resumed by default. /// /// This function is not meant to be overridden by Process /// subclasses. This function will take care of disabling any /// breakpoints that threads may be stopped at, single stepping, and /// re-enabling breakpoints, and enabling the basic flow control /// that the plug-in instances need not worry about. /// /// N.B. This function also sets the Write side of the Run Lock, /// which is unset when the corresponding stop event is pulled off /// the Public Event Queue. If you need to resume the process without /// setting the Run Lock, use PrivateResume (though you should only do /// that from inside the Process class. /// /// @return /// Returns an error object. /// /// @see Thread:Resume() /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ Error Resume(); Error ResumeSynchronous(Stream *stream); //------------------------------------------------------------------ /// Halts a running process. /// /// This function is not meant to be overridden by Process /// subclasses. /// If the process is successfully halted, a eStateStopped /// process event with GetInterrupted will be broadcast. If false, we will /// halt the process with no events generated by the halt. /// /// @param[in] clear_thread_plans /// If true, when the process stops, clear all thread plans. /// /// @param[in] use_run_lock /// Whether to release the run lock after the stop. /// /// @return /// Returns an error object. If the error is empty, the process is /// halted. /// otherwise the halt has failed. //------------------------------------------------------------------ Error Halt(bool clear_thread_plans = false, bool use_run_lock = true); //------------------------------------------------------------------ /// Detaches from a running or stopped process. /// /// This function is not meant to be overridden by Process /// subclasses. /// /// @param[in] keep_stopped /// If true, don't resume the process on detach. /// /// @return /// Returns an error object. //------------------------------------------------------------------ Error Detach(bool keep_stopped); //------------------------------------------------------------------ /// Kills the process and shuts down all threads that were spawned /// to track and monitor the process. /// /// This function is not meant to be overridden by Process /// subclasses. /// /// @param[in] force_kill /// Whether lldb should force a kill (instead of a detach) from /// the inferior process. Normally if lldb launched a binary and /// Destory is called, lldb kills it. If lldb attached to a /// running process and Destory is called, lldb detaches. If /// this behavior needs to be over-ridden, this is the bool that /// can be used. /// /// @return /// Returns an error object. //------------------------------------------------------------------ Error Destroy(bool force_kill); //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// This function is not meant to be overridden by Process /// subclasses. /// /// @return /// Returns an error object. //------------------------------------------------------------------ Error Signal(int signal); void SetUnixSignals(lldb::UnixSignalsSP &&signals_sp); const lldb::UnixSignalsSP &GetUnixSignals(); //================================================================== // Plug-in Process Control Overrides //================================================================== //------------------------------------------------------------------ /// Called before attaching to a process. /// /// Allow Process plug-ins to execute some code before attaching a /// process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillAttachToProcessWithID(lldb::pid_t pid) { return Error(); } //------------------------------------------------------------------ /// Called before attaching to a process. /// /// Allow Process plug-ins to execute some code before attaching a /// process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillAttachToProcessWithName(const char *process_name, bool wait_for_launch) { return Error(); } //------------------------------------------------------------------ /// Attach to a remote system via a URL /// /// @param[in] strm /// A stream where output intended for the user /// (if the driver has a way to display that) generated during /// the connection. This may be nullptr if no output is needed.A /// /// @param[in] remote_url /// The URL format that we are connecting to. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error DoConnectRemote(Stream *strm, llvm::StringRef remote_url) { Error error; error.SetErrorString("remote connections are not supported"); return error; } //------------------------------------------------------------------ /// Attach to an existing process using a process ID. /// /// @param[in] pid /// The process ID that we should attempt to attach to. /// /// @param[in] attach_info /// Information on how to do the attach. For example, GetUserID() /// will return the uid to attach as. /// /// @return /// Returns a successful Error attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. /// hanming : need flag //------------------------------------------------------------------ virtual Error DoAttachToProcessWithID(lldb::pid_t pid, const ProcessAttachInfo &attach_info) { Error error; error.SetErrorStringWithFormat( "error: %s does not support attaching to a process by pid", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Attach to an existing process using a partial process name. /// /// @param[in] process_name /// The name of the process to attach to. /// /// @param[in] attach_info /// Information on how to do the attach. For example, GetUserID() /// will return the uid to attach as. /// /// @return /// Returns a successful Error attaching was successful, or /// an appropriate (possibly platform-specific) error code if /// attaching fails. //------------------------------------------------------------------ virtual Error DoAttachToProcessWithName(const char *process_name, const ProcessAttachInfo &attach_info) { Error error; error.SetErrorString("attach by name is not supported"); return error; } //------------------------------------------------------------------ /// Called after attaching a process. /// /// @param[in] process_arch /// If you can figure out the process architecture after attach, fill it /// in here. /// /// Allow Process plug-ins to execute some code after attaching to /// a process. //------------------------------------------------------------------ virtual void DidAttach(ArchSpec &process_arch) { process_arch.Clear(); } //------------------------------------------------------------------ /// Called after a process re-execs itself. /// /// Allow Process plug-ins to execute some code after a process has /// exec'ed itself. Subclasses typically should override DoDidExec() /// as the lldb_private::Process class needs to remove its dynamic /// loader, runtime, ABI and other plug-ins, as well as unload all /// shared libraries. //------------------------------------------------------------------ virtual void DidExec(); //------------------------------------------------------------------ /// Subclasses of Process should implement this function if they /// need to do anything after a process exec's itself. //------------------------------------------------------------------ virtual void DoDidExec() {} //------------------------------------------------------------------ /// Called before launching to a process. /// /// Allow Process plug-ins to execute some code before launching a /// process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillLaunch(Module *module) { return Error(); } //------------------------------------------------------------------ /// Launch a new process. /// /// Launch a new process by spawning a new process using /// \a exe_module's file as the file to launch. Launch details are /// provided in \a launch_info. /// /// @param[in] exe_module /// The module from which to extract the file specification and /// launch. /// /// @param[in] launch_info /// Details (e.g. arguments, stdio redirection, etc.) for the /// requested launch. /// /// @return /// An Error instance indicating success or failure of the /// operation. //------------------------------------------------------------------ virtual Error DoLaunch(Module *exe_module, ProcessLaunchInfo &launch_info) { Error error; error.SetErrorStringWithFormat( "error: %s does not support launching processes", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow Process plug-ins to execute some code after launching /// a process. //------------------------------------------------------------------ virtual void DidLaunch() {} //------------------------------------------------------------------ /// Called before resuming to a process. /// /// Allow Process plug-ins to execute some code before resuming a /// process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillResume() { return Error(); } //------------------------------------------------------------------ /// Resumes all of a process's threads as configured using the /// Thread run control functions. /// /// Threads for a process should be updated with one of the run /// control actions (resume, step, or suspend) that they should take /// when the process is resumed. If no run control action is given /// to a thread it will be resumed by default. /// /// @return /// Returns \b true if the process successfully resumes using /// the thread run control actions, \b false otherwise. /// /// @see Thread:Resume() /// @see Thread:Step() /// @see Thread:Suspend() //------------------------------------------------------------------ virtual Error DoResume() { Error error; error.SetErrorStringWithFormat( "error: %s does not support resuming processes", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Called after resuming a process. /// /// Allow Process plug-ins to execute some code after resuming /// a process. //------------------------------------------------------------------ virtual void DidResume() {} //------------------------------------------------------------------ /// Called before halting to a process. /// /// Allow Process plug-ins to execute some code before halting a /// process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillHalt() { return Error(); } //------------------------------------------------------------------ /// Halts a running process. /// /// DoHalt must produce one and only one stop StateChanged event if it /// actually /// stops the process. If the stop happens through some natural event (for /// instance a SIGSTOP), then forwarding that event will do. Otherwise, you /// must /// generate the event manually. This function is called from the context of /// the /// private state thread. /// /// @param[out] caused_stop /// If true, then this Halt caused the stop, otherwise, the /// process was already stopped. /// /// @return /// Returns \b true if the process successfully halts, \b false /// otherwise. //------------------------------------------------------------------ virtual Error DoHalt(bool &caused_stop) { Error error; error.SetErrorStringWithFormat( "error: %s does not support halting processes", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Called after halting a process. /// /// Allow Process plug-ins to execute some code after halting /// a process. //------------------------------------------------------------------ virtual void DidHalt() {} //------------------------------------------------------------------ /// Called before detaching from a process. /// /// Allow Process plug-ins to execute some code before detaching /// from a process. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error WillDetach() { return Error(); } //------------------------------------------------------------------ /// Detaches from a running or stopped process. /// /// @return /// Returns \b true if the process successfully detaches, \b /// false otherwise. //------------------------------------------------------------------ virtual Error DoDetach(bool keep_stopped) { Error error; error.SetErrorStringWithFormat( "error: %s does not support detaching from processes", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// Called after detaching from a process. /// /// Allow Process plug-ins to execute some code after detaching /// from a process. //------------------------------------------------------------------ virtual void DidDetach() {} virtual bool DetachRequiresHalt() { return false; } //------------------------------------------------------------------ /// Called before sending a signal to a process. /// /// Allow Process plug-ins to execute some code before sending a /// signal to a process. /// /// @return /// Returns no error if it is safe to proceed with a call to /// Process::DoSignal(int), otherwise an error describing what /// prevents the signal from being sent. //------------------------------------------------------------------ virtual Error WillSignal() { return Error(); } //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error DoSignal(int signal) { Error error; error.SetErrorStringWithFormat( "error: %s does not support sending signals to processes", GetPluginName().GetCString()); return error; } virtual Error WillDestroy() { return Error(); } virtual Error DoDestroy() = 0; virtual void DidDestroy() {} virtual bool DestroyRequiresHalt() { return true; } //------------------------------------------------------------------ /// Called after sending a signal to a process. /// /// Allow Process plug-ins to execute some code after sending a /// signal to a process. //------------------------------------------------------------------ virtual void DidSignal() {} //------------------------------------------------------------------ /// Currently called as part of ShouldStop. /// FIXME: Should really happen when the target stops before the /// event is taken from the queue... /// /// This callback is called as the event /// is about to be queued up to allow Process plug-ins to execute /// some code prior to clients being notified that a process was /// stopped. Common operations include updating the thread list, /// invalidating any thread state (registers, stack, etc) prior to /// letting the notification go out. /// //------------------------------------------------------------------ virtual void RefreshStateAfterStop() = 0; //------------------------------------------------------------------ /// Sometimes the connection to a process can detect the host OS /// version that the process is running on. The current platform /// should be checked first in case the platform is connected, but /// clients can fall back onto this function if the platform fails /// to identify the host OS version. The platform should be checked /// first in case you are running a simulator platform that might /// itself be running natively, but have different heuristics for /// figuring out which OS is is emulating. /// /// @param[out] major /// The major OS version, or UINT32_MAX if it can't be determined /// /// @param[out] minor /// The minor OS version, or UINT32_MAX if it can't be determined /// /// @param[out] update /// The update OS version, or UINT32_MAX if it can't be determined /// /// @return /// Returns \b true if the host OS version info was filled in /// and \b false otherwise. //------------------------------------------------------------------ virtual bool GetHostOSVersion(uint32_t &major, uint32_t &minor, uint32_t &update) { major = UINT32_MAX; minor = UINT32_MAX; update = UINT32_MAX; return false; } //------------------------------------------------------------------ /// Get the target object pointer for this module. /// /// @return /// A Target object pointer to the target that owns this /// module. //------------------------------------------------------------------ Target &GetTarget() { return *m_target_sp.lock(); } //------------------------------------------------------------------ /// Get the const target object pointer for this module. /// /// @return /// A const Target object pointer to the target that owns this /// module. //------------------------------------------------------------------ const Target &GetTarget() const { return *m_target_sp.lock(); } //------------------------------------------------------------------ /// Flush all data in the process. /// /// Flush the memory caches, all threads, and any other cached data /// in the process. /// /// This function can be called after a world changing event like /// adding a new symbol file, or after the process makes a large /// context switch (from boot ROM to booted into an OS). //------------------------------------------------------------------ void Flush(); //------------------------------------------------------------------ /// Get accessor for the current process state. /// /// @return /// The current state of the process. /// /// @see lldb::StateType //------------------------------------------------------------------ lldb::StateType GetState(); lldb::ExpressionResults RunThreadPlan(ExecutionContext &exe_ctx, lldb::ThreadPlanSP &thread_plan_sp, const EvaluateExpressionOptions &options, DiagnosticManager &diagnostic_manager); static const char *ExecutionResultAsCString(lldb::ExpressionResults result); void GetStatus(Stream &ostrm); size_t GetThreadStatus(Stream &ostrm, bool only_threads_with_stop_reason, uint32_t start_frame, uint32_t num_frames, uint32_t num_frames_with_source, bool stop_format); void SendAsyncInterrupt(); //------------------------------------------------------------------ // Notify this process class that modules got loaded. // // If subclasses override this method, they must call this version // before doing anything in the subclass version of the function. //------------------------------------------------------------------ virtual void ModulesDidLoad(ModuleList &module_list); //------------------------------------------------------------------ /// Retrieve the list of shared libraries that are loaded for this process /// This method is used on pre-macOS 10.12, pre-iOS 10, pre-tvOS 10, /// pre-watchOS 3 systems. The following two methods are for newer versions /// of those OSes. /// /// For certain platforms, the time it takes for the DynamicLoader plugin to /// read all of the shared libraries out of memory over a slow communication /// channel may be too long. In that instance, the gdb-remote stub may be /// able to retrieve the necessary information about the solibs out of memory /// and return a concise summary sufficient for the DynamicLoader plugin. /// /// @param [in] image_list_address /// The address where the table of shared libraries is stored in memory, /// if that is appropriate for this platform. Else this may be /// passed as LLDB_INVALID_ADDRESS. /// /// @param [in] image_count /// The number of shared libraries that are present in this process, if /// that is appropriate for this platofrm Else this may be passed as /// LLDB_INVALID_ADDRESS. /// /// @return /// A StructureDataSP object which, if non-empty, will contain the /// information the DynamicLoader needs to get the initial scan of /// solibs resolved. //------------------------------------------------------------------ virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos(lldb::addr_t image_list_address, lldb::addr_t image_count) { return StructuredData::ObjectSP(); } // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can // return // the full list of loaded shared libraries without needing any input. virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos() { return StructuredData::ObjectSP(); } // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can // return // information about binaries given their load addresses. virtual lldb_private::StructuredData::ObjectSP GetLoadedDynamicLibrariesInfos( const std::vector<lldb::addr_t> &load_addresses) { return StructuredData::ObjectSP(); } //------------------------------------------------------------------ // Get information about the library shared cache, if that exists // // On macOS 10.12, tvOS 10, iOS 10, watchOS 3 and newer, debugserver can // return // information about the library shared cache (a set of standard libraries // that are // loaded at the same location for all processes on a system) in use. //------------------------------------------------------------------ virtual lldb_private::StructuredData::ObjectSP GetSharedCacheInfo() { return StructuredData::ObjectSP(); } //------------------------------------------------------------------ /// Print a user-visible warning about a module being built with optimization /// /// Prints a async warning message to the user one time per Module /// where a function is found that was compiled with optimization, per /// Process. /// /// @param [in] sc /// A SymbolContext with eSymbolContextFunction and eSymbolContextModule /// pre-computed. //------------------------------------------------------------------ void PrintWarningOptimization(const SymbolContext &sc); //------------------------------------------------------------------ /// Print a user-visible warning about a module having Swift settings /// incompatible with the current system /// /// Prints a async warning message to the user one time per Process for a /// Module /// whose Swift AST sections couldn't be loaded because they aren't buildable /// on /// the current machine. /// /// @param [in] module /// The affected Module. //------------------------------------------------------------------ void PrintWarningCantLoadSwift(const Module &module); virtual bool GetProcessInfo(ProcessInstanceInfo &info); public: //------------------------------------------------------------------ /// Get the exit status for a process. /// /// @return /// The process's return code, or -1 if the current process /// state is not eStateExited. //------------------------------------------------------------------ int GetExitStatus(); //------------------------------------------------------------------ /// Get a textual description of what the process exited. /// /// @return /// The textual description of why the process exited, or nullptr /// if there is no description available. //------------------------------------------------------------------ const char *GetExitDescription(); virtual void DidExit() {} //------------------------------------------------------------------ /// Get the Modification ID of the process. /// /// @return /// The modification ID of the process. //------------------------------------------------------------------ ProcessModID GetModID() const { return m_mod_id; } const ProcessModID &GetModIDRef() const { return m_mod_id; } uint32_t GetStopID() const { return m_mod_id.GetStopID(); } uint32_t GetResumeID() const { return m_mod_id.GetResumeID(); } uint32_t GetLastUserExpressionResumeID() const { return m_mod_id.GetLastUserExpressionResumeID(); } uint32_t GetLastNaturalStopID() const { return m_mod_id.GetLastNaturalStopID(); } lldb::EventSP GetStopEventForStopID(uint32_t stop_id) const { return m_mod_id.GetStopEventForStopID(stop_id); } //------------------------------------------------------------------ /// Set accessor for the process exit status (return code). /// /// Sometimes a child exits and the exit can be detected by global /// functions (signal handler for SIGCHLD for example). This /// accessor allows the exit status to be set from an external /// source. /// /// Setting this will cause a eStateExited event to be posted to /// the process event queue. /// /// @param[in] exit_status /// The value for the process's return code. /// /// @see lldb::StateType //------------------------------------------------------------------ virtual bool SetExitStatus(int exit_status, const char *cstr); //------------------------------------------------------------------ /// Check if a process is still alive. /// /// @return /// Returns \b true if the process is still valid, \b false /// otherwise. //------------------------------------------------------------------ virtual bool IsAlive(); //------------------------------------------------------------------ /// Before lldb detaches from a process, it warns the user that they are about /// to lose their debug session. /// In some cases, this warning doesn't need to be emitted -- for instance, /// with core file debugging where /// the user can reconstruct the "state" by simply re-running the debugger on /// the core file. /// /// @return // true if the user should be warned about detaching from this process. //------------------------------------------------------------------ virtual bool WarnBeforeDetach() const { return true; } //------------------------------------------------------------------ /// Actually do the reading of memory from a process. /// /// Subclasses must override this function and can return fewer /// bytes than requested when memory requests are too large. This /// class will break up the memory requests and keep advancing the /// arguments along as needed. /// /// @param[in] vm_addr /// A virtual load address that indicates where to start reading /// memory from. /// /// @param[in] size /// The number of bytes to read. /// /// @param[out] buf /// A byte buffer that is at least \a size bytes long that /// will receive the memory bytes. /// /// @return /// The number of bytes that were actually read into \a buf. //------------------------------------------------------------------ virtual size_t DoReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Error &error) = 0; //------------------------------------------------------------------ /// Read of memory from a process. /// /// This function will read memory from the current process's /// address space and remove any traps that may have been inserted /// into the memory. /// /// This function is not meant to be overridden by Process /// subclasses, the subclasses should implement /// Process::DoReadMemory (lldb::addr_t, size_t, void *). /// /// @param[in] vm_addr /// A virtual load address that indicates where to start reading /// memory from. /// /// @param[out] buf /// A byte buffer that is at least \a size bytes long that /// will receive the memory bytes. /// /// @param[in] size /// The number of bytes to read. /// /// @return /// The number of bytes that were actually read into \a buf. If /// the returned number is greater than zero, yet less than \a /// size, then this function will get called again with \a /// vm_addr, \a buf, and \a size updated appropriately. Zero is /// returned to indicate an error. //------------------------------------------------------------------ virtual size_t ReadMemory(lldb::addr_t vm_addr, void *buf, size_t size, Error &error); //------------------------------------------------------------------ /// Read a NULL terminated string from memory /// /// This function will read a cache page at a time until a NULL /// string terminator is found. It will stop reading if an aligned /// sequence of NULL termination \a type_width bytes is not found /// before reading \a cstr_max_len bytes. The results are always /// guaranteed to be NULL terminated, and that no more than /// (max_bytes - type_width) bytes will be read. /// /// @param[in] vm_addr /// The virtual load address to start the memory read. /// /// @param[in] str /// A character buffer containing at least max_bytes. /// /// @param[in] max_bytes /// The maximum number of bytes to read. /// /// @param[in] error /// The error status of the read operation. /// /// @param[in] type_width /// The size of the null terminator (1 to 4 bytes per /// character). Defaults to 1. /// /// @return /// The error status or the number of bytes prior to the null terminator. //------------------------------------------------------------------ size_t ReadStringFromMemory(lldb::addr_t vm_addr, char *str, size_t max_bytes, Error &error, size_t type_width = 1); //------------------------------------------------------------------ /// Read a NULL terminated C string from memory /// /// This function will read a cache page at a time until the NULL /// C string terminator is found. It will stop reading if the NULL /// termination byte isn't found before reading \a cstr_max_len /// bytes, and the results are always guaranteed to be NULL /// terminated (at most cstr_max_len - 1 bytes will be read). //------------------------------------------------------------------ size_t ReadCStringFromMemory(lldb::addr_t vm_addr, char *cstr, size_t cstr_max_len, Error &error); size_t ReadCStringFromMemory(lldb::addr_t vm_addr, std::string &out_str, Error &error); size_t ReadMemoryFromInferior(lldb::addr_t vm_addr, void *buf, size_t size, Error &error); //------------------------------------------------------------------ /// Reads an unsigned integer of the specified byte size from /// process memory. /// /// @param[in] load_addr /// A load address of the integer to read. /// /// @param[in] byte_size /// The size in byte of the integer to read. /// /// @param[in] fail_value /// The value to return if we fail to read an integer. /// /// @param[out] error /// An error that indicates the success or failure of this /// operation. If error indicates success (error.Success()), /// then the value returned can be trusted, otherwise zero /// will be returned. /// /// @return /// The unsigned integer that was read from the process memory /// space. If the integer was smaller than a uint64_t, any /// unused upper bytes will be zero filled. If the process /// byte order differs from the host byte order, the integer /// value will be appropriately byte swapped into host byte /// order. //------------------------------------------------------------------ uint64_t ReadUnsignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, uint64_t fail_value, Error &error); int64_t ReadSignedIntegerFromMemory(lldb::addr_t load_addr, size_t byte_size, int64_t fail_value, Error &error); lldb::addr_t ReadPointerFromMemory(lldb::addr_t vm_addr, Error &error); bool WritePointerToMemory(lldb::addr_t vm_addr, lldb::addr_t ptr_value, Error &error); //------------------------------------------------------------------ /// Actually do the writing of memory to a process. /// /// @param[in] vm_addr /// A virtual load address that indicates where to start writing /// memory to. /// /// @param[in] buf /// A byte buffer that is at least \a size bytes long that /// contains the data to write. /// /// @param[in] size /// The number of bytes to write. /// /// @param[out] error /// An error value in case the memory write fails. /// /// @return /// The number of bytes that were actually written. //------------------------------------------------------------------ virtual size_t DoWriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Error &error) { error.SetErrorStringWithFormat( "error: %s does not support writing to processes", GetPluginName().GetCString()); return 0; } //------------------------------------------------------------------ /// Write all or part of a scalar value to memory. /// /// The value contained in \a scalar will be swapped to match the /// byte order of the process that is being debugged. If \a size is /// less than the size of scalar, the least significant \a size bytes /// from scalar will be written. If \a size is larger than the byte /// size of scalar, then the extra space will be padded with zeros /// and the scalar value will be placed in the least significant /// bytes in memory. /// /// @param[in] vm_addr /// A virtual load address that indicates where to start writing /// memory to. /// /// @param[in] scalar /// The scalar to write to the debugged process. /// /// @param[in] size /// This value can be smaller or larger than the scalar value /// itself. If \a size is smaller than the size of \a scalar, /// the least significant bytes in \a scalar will be used. If /// \a size is larger than the byte size of \a scalar, then /// the extra space will be padded with zeros. If \a size is /// set to UINT32_MAX, then the size of \a scalar will be used. /// /// @param[out] error /// An error value in case the memory write fails. /// /// @return /// The number of bytes that were actually written. //------------------------------------------------------------------ size_t WriteScalarToMemory(lldb::addr_t vm_addr, const Scalar &scalar, size_t size, Error &error); size_t ReadScalarIntegerFromMemory(lldb::addr_t addr, uint32_t byte_size, bool is_signed, Scalar &scalar, Error &error); //------------------------------------------------------------------ /// Write memory to a process. /// /// This function will write memory to the current process's /// address space and maintain any traps that might be present due /// to software breakpoints. /// /// This function is not meant to be overridden by Process /// subclasses, the subclasses should implement /// Process::DoWriteMemory (lldb::addr_t, size_t, void *). /// /// @param[in] vm_addr /// A virtual load address that indicates where to start writing /// memory to. /// /// @param[in] buf /// A byte buffer that is at least \a size bytes long that /// contains the data to write. /// /// @param[in] size /// The number of bytes to write. /// /// @return /// The number of bytes that were actually written. //------------------------------------------------------------------ // TODO: change this to take an ArrayRef<uint8_t> size_t WriteMemory(lldb::addr_t vm_addr, const void *buf, size_t size, Error &error); //------------------------------------------------------------------ /// Actually allocate memory in the process. /// /// This function will allocate memory in the process's address /// space. This can't rely on the generic function calling mechanism, /// since that requires this function. /// /// @param[in] size /// The size of the allocation requested. /// /// @return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ virtual lldb::addr_t DoAllocateMemory(size_t size, uint32_t permissions, Error &error) { error.SetErrorStringWithFormat( "error: %s does not support allocating in the debug process", GetPluginName().GetCString()); return LLDB_INVALID_ADDRESS; } //------------------------------------------------------------------ /// The public interface to allocating memory in the process. /// /// This function will allocate memory in the process's address /// space. This can't rely on the generic function calling mechanism, /// since that requires this function. /// /// @param[in] size /// The size of the allocation requested. /// /// @param[in] permissions /// Or together any of the lldb::Permissions bits. The permissions on /// a given memory allocation can't be changed after allocation. Note /// that a block that isn't set writable can still be written on from /// lldb, /// just not by the process itself. /// /// @param[in,out] error /// An error object to fill in if things go wrong. /// @return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ lldb::addr_t AllocateMemory(size_t size, uint32_t permissions, Error &error); //------------------------------------------------------------------ /// The public interface to allocating memory in the process, this also /// clears the allocated memory. /// /// This function will allocate memory in the process's address /// space. This can't rely on the generic function calling mechanism, /// since that requires this function. /// /// @param[in] size /// The size of the allocation requested. /// /// @param[in] permissions /// Or together any of the lldb::Permissions bits. The permissions on /// a given memory allocation can't be changed after allocation. Note /// that a block that isn't set writable can still be written on from /// lldb, /// just not by the process itself. /// /// @param[in/out] error /// An error object to fill in if things go wrong. /// @return /// The address of the allocated buffer in the process, or /// LLDB_INVALID_ADDRESS if the allocation failed. //------------------------------------------------------------------ lldb::addr_t CallocateMemory(size_t size, uint32_t permissions, Error &error); //------------------------------------------------------------------ /// Resolve dynamically loaded indirect functions. /// /// @param[in] address /// The load address of the indirect function to resolve. /// /// @param[out] error /// An error value in case the resolve fails. /// /// @return /// The address of the resolved function. /// LLDB_INVALID_ADDRESS if the resolution failed. //------------------------------------------------------------------ virtual lldb::addr_t ResolveIndirectFunction(const Address *address, Error &error); //------------------------------------------------------------------ /// Locate the memory region that contains load_addr. /// /// If load_addr is within the address space the process has mapped /// range_info will be filled in with the start and end of that range /// as well as the permissions for that range and range_info.GetMapped /// will return true. /// /// If load_addr is outside any mapped region then range_info will /// have its start address set to load_addr and the end of the /// range will indicate the start of the next mapped range or be /// set to LLDB_INVALID_ADDRESS if there are no valid mapped ranges /// between load_addr and the end of the process address space. /// /// GetMemoryRegionInfo will only return an error if it is /// unimplemented for the current process. /// /// @param[in] load_addr /// The load address to query the range_info for. /// /// @param[out] range_info /// An range_info value containing the details of the range. /// /// @return /// An error value. //------------------------------------------------------------------ virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info) { Error error; error.SetErrorString("Process::GetMemoryRegionInfo() not supported"); return error; } //------------------------------------------------------------------ /// Obtain all the mapped memory regions within this process. /// /// @param[out] region_list /// A vector to contain MemoryRegionInfo objects for all mapped /// ranges. /// /// @return /// An error value. //------------------------------------------------------------------ virtual Error GetMemoryRegions(std::vector<lldb::MemoryRegionInfoSP> &region_list); virtual Error GetWatchpointSupportInfo(uint32_t &num) { Error error; num = 0; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); return error; } virtual Error GetWatchpointSupportInfo(uint32_t &num, bool &after) { Error error; num = 0; after = true; error.SetErrorString("Process::GetWatchpointSupportInfo() not supported"); return error; } lldb::ModuleSP ReadModuleFromMemory(const FileSpec &file_spec, lldb::addr_t header_addr, size_t size_to_read = 512); //------------------------------------------------------------------ /// Attempt to get the attributes for a region of memory in the process. /// /// It may be possible for the remote debug server to inspect attributes /// for a region of memory in the process, such as whether there is a /// valid page of memory at a given address or whether that page is /// readable/writable/executable by the process. /// /// @param[in] load_addr /// The address of interest in the process. /// /// @param[out] permissions /// If this call returns successfully, this bitmask will have /// its Permissions bits set to indicate whether the region is /// readable/writable/executable. If this call fails, the /// bitmask values are undefined. /// /// @return /// Returns true if it was able to determine the attributes of the /// memory region. False if not. //------------------------------------------------------------------ virtual bool GetLoadAddressPermissions(lldb::addr_t load_addr, uint32_t &permissions); //------------------------------------------------------------------ /// Determines whether executing JIT-compiled code in this process /// is possible. /// /// @return /// True if execution of JIT code is possible; false otherwise. //------------------------------------------------------------------ bool CanJIT(); //------------------------------------------------------------------ /// Sets whether executing JIT-compiled code in this process /// is possible. /// /// @param[in] can_jit /// True if execution of JIT code is possible; false otherwise. //------------------------------------------------------------------ void SetCanJIT(bool can_jit); //------------------------------------------------------------------ /// Determines whether executing function calls using the interpreter /// is possible for this process. /// /// @return /// True if possible; false otherwise. //------------------------------------------------------------------ bool CanInterpretFunctionCalls() { return m_can_interpret_function_calls; } //------------------------------------------------------------------ /// Sets whether executing function calls using the interpreter /// is possible for this process. /// /// @param[in] can_interpret_function_calls /// True if possible; false otherwise. //------------------------------------------------------------------ void SetCanInterpretFunctionCalls(bool can_interpret_function_calls) { m_can_interpret_function_calls = can_interpret_function_calls; } //------------------------------------------------------------------ /// Sets whether executing code in this process is possible. /// This could be either through JIT or interpreting. /// /// @param[in] can_run_code /// True if execution of code is possible; false otherwise. //------------------------------------------------------------------ void SetCanRunCode(bool can_run_code); //------------------------------------------------------------------ /// Actually deallocate memory in the process. /// /// This function will deallocate memory in the process's address /// space that was allocated with AllocateMemory. /// /// @param[in] ptr /// A return value from AllocateMemory, pointing to the memory you /// want to deallocate. /// /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ virtual Error DoDeallocateMemory(lldb::addr_t ptr) { Error error; error.SetErrorStringWithFormat( "error: %s does not support deallocating in the debug process", GetPluginName().GetCString()); return error; } //------------------------------------------------------------------ /// The public interface to deallocating memory in the process. /// /// This function will deallocate memory in the process's address /// space that was allocated with AllocateMemory. /// /// @param[in] ptr /// A return value from AllocateMemory, pointing to the memory you /// want to deallocate. /// /// @return /// \btrue if the memory was deallocated, \bfalse otherwise. //------------------------------------------------------------------ Error DeallocateMemory(lldb::addr_t ptr); //------------------------------------------------------------------ /// Get any available STDOUT. /// /// Calling this method is a valid operation only if all of the /// following conditions are true: /// 1) The process was launched, and not attached to. /// 2) The process was not launched with eLaunchFlagDisableSTDIO. /// 3) The process was launched without supplying a valid file path /// for STDOUT. /// /// Note that the implementation will probably need to start a read /// thread in the background to make sure that the pipe is drained /// and the STDOUT buffered appropriately, to prevent the process /// from deadlocking trying to write to a full buffer. /// /// Events will be queued indicating that there is STDOUT available /// that can be retrieved using this function. /// /// @param[out] buf /// A buffer that will receive any STDOUT bytes that are /// currently available. /// /// @param[in] buf_size /// The size in bytes for the buffer \a buf. /// /// @return /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDOUT data. //------------------------------------------------------------------ virtual size_t GetSTDOUT(char *buf, size_t buf_size, Error &error); //------------------------------------------------------------------ /// Get any available STDERR. /// /// Calling this method is a valid operation only if all of the /// following conditions are true: /// 1) The process was launched, and not attached to. /// 2) The process was not launched with eLaunchFlagDisableSTDIO. /// 3) The process was launched without supplying a valid file path /// for STDERR. /// /// Note that the implementation will probably need to start a read /// thread in the background to make sure that the pipe is drained /// and the STDERR buffered appropriately, to prevent the process /// from deadlocking trying to write to a full buffer. /// /// Events will be queued indicating that there is STDERR available /// that can be retrieved using this function. /// /// @param[in] buf /// A buffer that will receive any STDERR bytes that are /// currently available. /// /// @param[out] buf_size /// The size in bytes for the buffer \a buf. /// /// @return /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more STDERR data. //------------------------------------------------------------------ virtual size_t GetSTDERR(char *buf, size_t buf_size, Error &error); //------------------------------------------------------------------ /// Puts data into this process's STDIN. /// /// Calling this method is a valid operation only if all of the /// following conditions are true: /// 1) The process was launched, and not attached to. /// 2) The process was not launched with eLaunchFlagDisableSTDIO. /// 3) The process was launched without supplying a valid file path /// for STDIN. /// /// @param[in] buf /// A buffer that contains the data to write to the process's STDIN. /// /// @param[in] buf_size /// The size in bytes for the buffer \a buf. /// /// @return /// The number of bytes written into \a buf. If this value is /// less than \a buf_size, another call to this function should /// be made to write the rest of the data. //------------------------------------------------------------------ virtual size_t PutSTDIN(const char *buf, size_t buf_size, Error &error) { error.SetErrorString("stdin unsupported"); return 0; } //------------------------------------------------------------------ /// Get any available profile data. /// /// @param[out] buf /// A buffer that will receive any profile data bytes that are /// currently available. /// /// @param[out] buf_size /// The size in bytes for the buffer \a buf. /// /// @return /// The number of bytes written into \a buf. If this value is /// equal to \a buf_size, another call to this function should /// be made to retrieve more profile data. //------------------------------------------------------------------ virtual size_t GetAsyncProfileData(char *buf, size_t buf_size, Error &error); //---------------------------------------------------------------------- // Process Breakpoints //---------------------------------------------------------------------- size_t GetSoftwareBreakpointTrapOpcode(BreakpointSite *bp_site); virtual Error EnableBreakpointSite(BreakpointSite *bp_site) { Error error; error.SetErrorStringWithFormat( "error: %s does not support enabling breakpoints", GetPluginName().GetCString()); return error; } virtual Error DisableBreakpointSite(BreakpointSite *bp_site) { Error error; error.SetErrorStringWithFormat( "error: %s does not support disabling breakpoints", GetPluginName().GetCString()); return error; } // This is implemented completely using the lldb::Process API. Subclasses // don't need to implement this function unless the standard flow of // read existing opcode, write breakpoint opcode, verify breakpoint opcode // doesn't work for a specific process plug-in. virtual Error EnableSoftwareBreakpoint(BreakpointSite *bp_site); // This is implemented completely using the lldb::Process API. Subclasses // don't need to implement this function unless the standard flow of // restoring original opcode in memory and verifying the restored opcode // doesn't work for a specific process plug-in. virtual Error DisableSoftwareBreakpoint(BreakpointSite *bp_site); BreakpointSiteList &GetBreakpointSiteList(); const BreakpointSiteList &GetBreakpointSiteList() const; void DisableAllBreakpointSites(); Error ClearBreakpointSiteByID(lldb::user_id_t break_id); lldb::break_id_t CreateBreakpointSite(const lldb::BreakpointLocationSP &owner, bool use_hardware); Error DisableBreakpointSiteByID(lldb::user_id_t break_id); Error EnableBreakpointSiteByID(lldb::user_id_t break_id); // BreakpointLocations use RemoveOwnerFromBreakpointSite to remove // themselves from the owner's list of this breakpoint sites. void RemoveOwnerFromBreakpointSite(lldb::user_id_t owner_id, lldb::user_id_t owner_loc_id, lldb::BreakpointSiteSP &bp_site_sp); //---------------------------------------------------------------------- // Process Watchpoints (optional) //---------------------------------------------------------------------- virtual Error EnableWatchpoint(Watchpoint *wp, bool notify = true); virtual Error DisableWatchpoint(Watchpoint *wp, bool notify = true); //------------------------------------------------------------------ // Thread Queries //------------------------------------------------------------------ virtual bool UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) = 0; void UpdateThreadListIfNeeded(); ThreadList &GetThreadList() { return m_thread_list; } // When ExtendedBacktraces are requested, the HistoryThreads that are // created need an owner -- they're saved here in the Process. The // threads in this list are not iterated over - driver programs need to // request the extended backtrace calls starting from a root concrete // thread one by one. ThreadList &GetExtendedThreadList() { return m_extended_thread_list; } ThreadList::ThreadIterable Threads() { return m_thread_list.Threads(); } uint32_t GetNextThreadIndexID(uint64_t thread_id); lldb::ThreadSP CreateOSPluginThread(lldb::tid_t tid, lldb::addr_t context); // Returns true if an index id has been assigned to a thread. bool HasAssignedIndexIDToThread(uint64_t sb_thread_id); // Given a thread_id, it will assign a more reasonable index id for display to // the user. // If the thread_id has previously been assigned, the same index id will be // used. uint32_t AssignIndexIDToThread(uint64_t thread_id); //------------------------------------------------------------------ // Queue Queries //------------------------------------------------------------------ void UpdateQueueListIfNeeded(); QueueList &GetQueueList() { UpdateQueueListIfNeeded(); return m_queue_list; } QueueList::QueueIterable Queues() { UpdateQueueListIfNeeded(); return m_queue_list.Queues(); } //------------------------------------------------------------------ // Event Handling //------------------------------------------------------------------ lldb::StateType GetNextEvent(lldb::EventSP &event_sp); // Returns the process state when it is stopped. If specified, event_sp_ptr // is set to the event which triggered the stop. If wait_always = false, // and the process is already stopped, this function returns immediately. // If the process is hijacked and use_run_lock is true (the default), then // this // function releases the run lock after the stop. Setting use_run_lock to // false // will avoid this behavior. lldb::StateType WaitForProcessToStop(const Timeout<std::micro> &timeout, lldb::EventSP *event_sp_ptr = nullptr, bool wait_always = true, lldb::ListenerSP hijack_listener = lldb::ListenerSP(), Stream *stream = nullptr, bool use_run_lock = true); uint32_t GetIOHandlerID() const { return m_iohandler_sync.GetValue(); } //-------------------------------------------------------------------------------------- /// Waits for the process state to be running within a given msec timeout. /// /// The main purpose of this is to implement an interlock waiting for /// HandlePrivateEvent /// to push an IOHandler. /// /// @param[in] timeout_msec /// The maximum time length to wait for the process to transition to the /// eStateRunning state, specified in milliseconds. //-------------------------------------------------------------------------------------- void SyncIOHandler(uint32_t iohandler_id, uint64_t timeout_msec); lldb::StateType GetStateChangedEvents( lldb::EventSP &event_sp, const Timeout<std::micro> &timeout, lldb::ListenerSP hijack_listener); // Pass an empty ListenerSP to use builtin listener //-------------------------------------------------------------------------------------- /// Centralize the code that handles and prints descriptions for process state /// changes. /// /// @param[in] event_sp /// The process state changed event /// /// @param[in] stream /// The output stream to get the state change description /// /// @param[in,out] pop_process_io_handler /// If this value comes in set to \b true, then pop the Process IOHandler /// if needed. /// Else this variable will be set to \b true or \b false to indicate if /// the process /// needs to have its process IOHandler popped. /// /// @param[out] pop_command_interpreter /// This variable will be set to \b true or \b false ot indicate if the /// process needs /// to have its command interpreter popped. /// /// @return /// \b true if the event describes a process state changed event, \b false /// otherwise. //-------------------------------------------------------------------------------------- static bool HandleProcessStateChangedEvent(const lldb::EventSP &event_sp, Stream *stream, bool &pop_process_io_handler, bool &pop_command_interpreter); Event *PeekAtStateChangedEvents(); class ProcessEventHijacker { public: ProcessEventHijacker(Process &process, lldb::ListenerSP listener_sp) : m_process(process) { m_process.HijackProcessEvents(listener_sp); } ~ProcessEventHijacker() { m_process.RestoreProcessEvents(); } private: Process &m_process; }; friend class ProcessEventHijacker; friend class ProcessProperties; //------------------------------------------------------------------ /// If you need to ensure that you and only you will hear about some public /// event, then make a new listener, set to listen to process events, and /// then call this with that listener. Then you will have to wait on that /// listener explicitly for events (rather than using the GetNextEvent & /// WaitFor* /// calls above. Be sure to call RestoreProcessEvents when you are done. /// /// @param[in] listener /// This is the new listener to whom all process events will be delivered. /// /// @return /// Returns \b true if the new listener could be installed, /// \b false otherwise. //------------------------------------------------------------------ bool HijackProcessEvents(lldb::ListenerSP listener_sp); //------------------------------------------------------------------ /// Restores the process event broadcasting to its normal state. /// //------------------------------------------------------------------ void RestoreProcessEvents(); const lldb::ABISP &GetABI(); OperatingSystem *GetOperatingSystem() { return m_os_ap.get(); } ArchSpec::StopInfoOverrideCallbackType GetStopInfoOverrideCallback() const { return m_stop_info_override_callback; } virtual LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language, bool retry_if_null = true); virtual CPPLanguageRuntime *GetCPPLanguageRuntime(bool retry_if_null = true); virtual ObjCLanguageRuntime * GetObjCLanguageRuntime(bool retry_if_null = true); virtual SwiftLanguageRuntime * GetSwiftLanguageRuntime(bool retry_if_null = true); bool IsPossibleDynamicValue(ValueObject &in_value); bool IsRunning() const; DynamicCheckerFunctions *GetDynamicCheckers() { return m_dynamic_checkers_ap.get(); } void SetDynamicCheckers(DynamicCheckerFunctions *dynamic_checkers); //------------------------------------------------------------------ /// Call this to set the lldb in the mode where it breaks on new thread /// creations, and then auto-restarts. This is useful when you are trying /// to run only one thread, but either that thread or the kernel is creating /// new threads in the process. If you stop when the thread is created, you /// can immediately suspend it, and keep executing only the one thread you /// intend. /// /// @return /// Returns \b true if we were able to start up the notification /// \b false otherwise. //------------------------------------------------------------------ virtual bool StartNoticingNewThreads() { return true; } //------------------------------------------------------------------ /// Call this to turn off the stop & notice new threads mode. /// /// @return /// Returns \b true if we were able to start up the notification /// \b false otherwise. //------------------------------------------------------------------ virtual bool StopNoticingNewThreads() { return true; } void SetRunningUserExpression(bool on); //------------------------------------------------------------------ // lldb::ExecutionContextScope pure virtual functions //------------------------------------------------------------------ lldb::TargetSP CalculateTarget() override; lldb::ProcessSP CalculateProcess() override { return shared_from_this(); } lldb::ThreadSP CalculateThread() override { return lldb::ThreadSP(); } lldb::StackFrameSP CalculateStackFrame() override { return lldb::StackFrameSP(); } void CalculateExecutionContext(ExecutionContext &exe_ctx) override; void SetSTDIOFileDescriptor(int file_descriptor); //------------------------------------------------------------------ // Add a permanent region of memory that should never be read or // written to. This can be used to ensure that memory reads or writes // to certain areas of memory never end up being sent to the // DoReadMemory or DoWriteMemory functions which can improve // performance. //------------------------------------------------------------------ void AddInvalidMemoryRegion(const LoadRange &region); //------------------------------------------------------------------ // Remove a permanent region of memory that should never be read or // written to that was previously added with AddInvalidMemoryRegion. //------------------------------------------------------------------ bool RemoveInvalidMemoryRange(const LoadRange &region); //------------------------------------------------------------------ // If the setup code of a thread plan needs to do work that might involve // calling a function in the target, it should not do that work directly // in one of the thread plan functions (DidPush/WillResume) because // such work needs to be handled carefully. Instead, put that work in // a PreResumeAction callback, and register it with the process. It will // get done before the actual "DoResume" gets called. //------------------------------------------------------------------ typedef bool(PreResumeActionCallback)(void *); void AddPreResumeAction(PreResumeActionCallback callback, void *baton); bool RunPreResumeActions(); void ClearPreResumeActions(); void ClearPreResumeAction(PreResumeActionCallback callback, void *baton); ProcessRunLock &GetRunLock(); virtual Error SendEventData(const char *data) { Error return_error("Sending an event is not supported for this process."); return return_error; } lldb::ThreadCollectionSP GetHistoryThreads(lldb::addr_t addr); lldb::InstrumentationRuntimeSP GetInstrumentationRuntime(lldb::InstrumentationRuntimeType type); //------------------------------------------------------------------ /// Try to fetch the module specification for a module with the /// given file name and architecture. Process sub-classes have to /// override this method if they support platforms where the /// Platform object can't get the module spec for all module. /// /// @param[in] module_file_spec /// The file name of the module to get specification for. /// /// @param[in] arch /// The architecture of the module to get specification for. /// /// @param[out] module_spec /// The fetched module specification if the return value is /// \b true, unchanged otherwise. /// /// @return /// Returns \b true if the module spec fetched successfully, /// \b false otherwise. //------------------------------------------------------------------ virtual bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec); virtual void PrefetchModuleSpecs(llvm::ArrayRef<FileSpec> module_file_specs, const llvm::Triple &triple) {} //------------------------------------------------------------------ /// Try to find the load address of a file. /// The load address is defined as the address of the first memory /// region what contains data mapped from the specified file. /// /// @param[in] file /// The name of the file whose load address we are looking for /// /// @param[out] is_loaded /// \b True if the file is loaded into the memory and false /// otherwise. /// /// @param[out] load_addr /// The load address of the file if it is loaded into the /// processes address space, LLDB_INVALID_ADDRESS otherwise. //------------------------------------------------------------------ virtual Error GetFileLoadAddress(const FileSpec &file, bool &is_loaded, lldb::addr_t &load_addr) { return Error("Not supported"); } size_t AddImageToken(lldb::addr_t image_ptr); lldb::addr_t GetImagePtrFromToken(size_t token) const; void ResetImageToken(size_t token); //------------------------------------------------------------------ /// Find the next branch instruction to set a breakpoint on /// /// When instruction stepping through a source line, instead of /// stepping through each instruction, we can put a breakpoint on /// the next branch instruction (within the range of instructions /// we are stepping through) and continue the process to there, /// yielding significant performance benefits over instruction /// stepping. /// /// @param[in] default_stop_addr /// The address of the instruction where lldb would put a /// breakpoint normally. /// /// @param[in] range_bounds /// The range which the breakpoint must be contained within. /// Typically a source line. /// /// @return /// The address of the next branch instruction, or the end of /// the range provided in range_bounds. If there are any /// problems with the disassembly or getting the instructions, /// the original default_stop_addr will be returned. //------------------------------------------------------------------ Address AdvanceAddressToNextBranchInstruction(Address default_stop_addr, AddressRange range_bounds); //------------------------------------------------------------------ /// Configure asynchronous structured data feature. /// /// Each Process type that supports using an asynchronous StructuredData /// feature should implement this to enable/disable/configure the feature. /// The default implementation here will always return an error indiciating /// the feature is unsupported. /// /// StructuredDataPlugin implementations will call this to configure /// a feature that has been reported as being supported. /// /// @param[in] type_name /// The StructuredData type name as previously discovered by /// the Process-derived instance. /// /// @param[in] config /// Configuration data for the feature being enabled. This config /// data, which may be null, will be passed along to the feature /// to process. The feature will dictate whether this is a dictionary, /// an array or some other object. If the feature needs to be /// set up properly before it can be enabled, then the config should /// also take an enable/disable flag. /// /// @return /// Returns the result of attempting to configure the feature. //------------------------------------------------------------------ virtual Error ConfigureStructuredData(const ConstString &type_name, const StructuredData::ObjectSP &config_sp); //------------------------------------------------------------------ /// Broadcasts the given structured data object from the given /// plugin. /// /// StructuredDataPlugin instances can use this to optionally /// broadcast any of their data if they want to make it available /// for clients. The data will come in on the structured data /// event bit (eBroadcastBitStructuredData). /// /// @param[in] object_sp /// The structured data object to broadcast. /// /// @param[in] plugin_sp /// The plugin that will be reported in the event's plugin /// parameter. //------------------------------------------------------------------ void BroadcastStructuredData(const StructuredData::ObjectSP &object_sp, const lldb::StructuredDataPluginSP &plugin_sp); //------------------------------------------------------------------ /// Returns the StructuredDataPlugin associated with a given type /// name, if there is one. /// /// There will only be a plugin for a given StructuredDataType if the /// debugged process monitor claims that the feature is supported. /// This is one way to tell whether a feature is available. /// /// @return /// The plugin if one is available for the specified feature; /// otherwise, returns an empty shared pointer. //------------------------------------------------------------------ lldb::StructuredDataPluginSP GetStructuredDataPlugin(const ConstString &type_name) const; protected: void SetState(lldb::EventSP &event_sp); lldb::StateType GetPrivateState(); //------------------------------------------------------------------ /// The "private" side of resuming a process. This doesn't alter the /// state of m_run_lock, but just causes the process to resume. /// /// @return /// An Error object describing the success or failure of the resume. //------------------------------------------------------------------ Error PrivateResume(); //------------------------------------------------------------------ // Called internally //------------------------------------------------------------------ void CompleteAttach(); //------------------------------------------------------------------ /// Print a user-visible warning one time per Process /// /// A facility for printing a warning to the user once per repeat_key. /// /// warning_type is from the Process::Warnings enums. /// repeat_key is a pointer value that will be used to ensure that the /// warning message is not printed multiple times. For instance, with a /// warning about a function being optimized, you can pass the CompileUnit /// pointer to have the warning issued for only the first function in a /// CU, or the Function pointer to have it issued once for every function, /// or a Module pointer to have it issued once per Module. /// /// Classes outside Process should call a specific PrintWarning method /// so that the warning strings are all centralized in Process, instead of /// calling PrintWarning() directly. /// /// @param [in] warning_type /// One of the types defined in Process::Warnings. /// /// @param [in] repeat_key /// A pointer value used to ensure that the warning is only printed once. /// May be nullptr, indicating that the warning is printed unconditionally /// every time. /// /// @param [in] fmt /// printf style format string //------------------------------------------------------------------ void PrintWarning(uint64_t warning_type, const void *repeat_key, const char *fmt, ...) __attribute__((format(printf, 4, 5))); //------------------------------------------------------------------ // NextEventAction provides a way to register an action on the next // event that is delivered to this process. There is currently only // one next event action allowed in the process at one time. If a // new "NextEventAction" is added while one is already present, the // old action will be discarded (with HandleBeingUnshipped called // after it is discarded.) // // If you want to resume the process as a result of a resume action, // call RequestResume, don't call Resume directly. //------------------------------------------------------------------ class NextEventAction { public: typedef enum EventActionResult { eEventActionSuccess, eEventActionRetry, eEventActionExit } EventActionResult; NextEventAction(Process *process) : m_process(process) {} virtual ~NextEventAction() = default; virtual EventActionResult PerformAction(lldb::EventSP &event_sp) = 0; virtual void HandleBeingUnshipped() {} virtual EventActionResult HandleBeingInterrupted() = 0; virtual const char *GetExitString() = 0; void RequestResume() { m_process->m_resume_requested = true; } protected: Process *m_process; }; void SetNextEventAction(Process::NextEventAction *next_event_action) { if (m_next_event_action_ap.get()) m_next_event_action_ap->HandleBeingUnshipped(); m_next_event_action_ap.reset(next_event_action); } // This is the completer for Attaching: class AttachCompletionHandler : public NextEventAction { public: AttachCompletionHandler(Process *process, uint32_t exec_count); ~AttachCompletionHandler() override = default; EventActionResult PerformAction(lldb::EventSP &event_sp) override; EventActionResult HandleBeingInterrupted() override; const char *GetExitString() override; private: uint32_t m_exec_count; std::string m_exit_string; }; bool PrivateStateThreadIsValid() const { lldb::StateType state = m_private_state.GetValue(); return state != lldb::eStateInvalid && state != lldb::eStateDetached && state != lldb::eStateExited && m_private_state_thread.IsJoinable(); } void ForceNextEventDelivery() { m_force_next_event_delivery = true; } //------------------------------------------------------------------ /// Loads any plugins associated with asynchronous structured data /// and maps the relevant supported type name to the plugin. /// /// Processes can receive asynchronous structured data from the /// process monitor. This method will load and map any structured /// data plugins that support the given set of supported type names. /// Later, if any of these features are enabled, the process monitor /// is free to generate asynchronous structured data. The data must /// come in as a single \b StructuredData::Dictionary. That dictionary /// must have a string field named 'type', with a value that equals /// the relevant type name string (one of the values in /// \b supported_type_names). /// /// @param[in] supported_type_names /// An array of zero or more type names. Each must be unique. /// For each entry in the list, a StructuredDataPlugin will be /// searched for that supports the structured data type name. //------------------------------------------------------------------ void MapSupportedStructuredDataPlugins( const StructuredData::Array &supported_type_names); //------------------------------------------------------------------ /// Route the incoming structured data dictionary to the right plugin. /// /// The incoming structured data must be a dictionary, and it must /// have a key named 'type' that stores a string value. The string /// value must be the name of the structured data feature that /// knows how to handle it. /// /// @param[in] object_sp /// When non-null and pointing to a dictionary, the 'type' /// key's string value is used to look up the plugin that /// was registered for that structured data type. It then /// calls the following method on the StructuredDataPlugin /// instance: /// /// virtual void /// HandleArrivalOfStructuredData(Process &process, /// const ConstString &type_name, /// const StructuredData::ObjectSP /// &object_sp) /// /// @return /// True if the structured data was routed to a plugin; otherwise, /// false. //------------------------------------------------------------------ bool RouteAsyncStructuredData(const StructuredData::ObjectSP object_sp); //------------------------------------------------------------------ // Type definitions //------------------------------------------------------------------ typedef std::map<lldb::LanguageType, lldb::LanguageRuntimeSP> LanguageRuntimeCollection; typedef std::unordered_set<const void *> WarningsPointerSet; typedef std::map<uint64_t, WarningsPointerSet> WarningsCollection; struct PreResumeCallbackAndBaton { bool (*callback)(void *); void *baton; PreResumeCallbackAndBaton(PreResumeActionCallback in_callback, void *in_baton) : callback(in_callback), baton(in_baton) {} bool operator== (const PreResumeCallbackAndBaton &rhs) { return callback == rhs.callback && baton == rhs.baton; } }; using StructuredDataPluginMap = std::map<ConstString, lldb::StructuredDataPluginSP>; //------------------------------------------------------------------ // Member variables //------------------------------------------------------------------ std::weak_ptr<Target> m_target_sp; ///< The target that owns this process. ThreadSafeValue<lldb::StateType> m_public_state; ThreadSafeValue<lldb::StateType> m_private_state; // The actual state of our process Broadcaster m_private_state_broadcaster; // This broadcaster feeds state // changed events into the private // state thread's listener. Broadcaster m_private_state_control_broadcaster; // This is the control // broadcaster, used to // pause, resume & stop the // private state thread. lldb::ListenerSP m_private_state_listener_sp; // This is the listener for the // private state thread. HostThread m_private_state_thread; ///< Thread ID for the thread that watches ///internal state events ProcessModID m_mod_id; ///< Tracks the state of the process over stops and ///other alterations. uint32_t m_process_unique_id; ///< Each lldb_private::Process class that is ///created gets a unique integer ID that ///increments with each new instance uint32_t m_thread_index_id; ///< Each thread is created with a 1 based index ///that won't get re-used. std::map<uint64_t, uint32_t> m_thread_id_to_index_id_map; int m_exit_status; ///< The exit status of the process, or -1 if not set. std::string m_exit_string; ///< A textual description of why a process exited. std::mutex m_exit_status_mutex; ///< Mutex so m_exit_status m_exit_string can ///be safely accessed from multiple threads std::recursive_mutex m_thread_mutex; ThreadList m_thread_list_real; ///< The threads for this process as are known ///to the protocol we are debugging with ThreadList m_thread_list; ///< The threads for this process as the user will ///see them. This is usually the same as ///< m_thread_list_real, but might be different if there is an OS plug-in ///creating memory threads ThreadList m_extended_thread_list; ///< Owner for extended threads that may be ///generated, cleared on natural stops uint32_t m_extended_thread_stop_id; ///< The natural stop id when ///extended_thread_list was last updated QueueList m_queue_list; ///< The list of libdispatch queues at a given stop point uint32_t m_queue_list_stop_id; ///< The natural stop id when queue list was ///last fetched std::vector<Notifications> m_notifications; ///< The list of notifications ///that this process can deliver. std::vector<lldb::addr_t> m_image_tokens; lldb::ListenerSP m_listener_sp; ///< Shared pointer to the listener used for ///public events. Can not be empty. BreakpointSiteList m_breakpoint_site_list; ///< This is the list of breakpoint ///locations we intend to insert in ///the target. lldb::DynamicLoaderUP m_dyld_ap; lldb::JITLoaderListUP m_jit_loaders_ap; lldb::DynamicCheckerFunctionsUP m_dynamic_checkers_ap; ///< The functions used ///by the expression ///parser to validate ///data that ///expressions use. lldb::OperatingSystemUP m_os_ap; lldb::SystemRuntimeUP m_system_runtime_ap; lldb::UnixSignalsSP m_unix_signals_sp; /// This is the current signal set for this process. lldb::ABISP m_abi_sp; lldb::IOHandlerSP m_process_input_reader; Communication m_stdio_communication; std::recursive_mutex m_stdio_communication_mutex; bool m_stdin_forward; /// Remember if stdin must be forwarded to remote debug /// server std::string m_stdout_data; std::string m_stderr_data; std::recursive_mutex m_profile_data_comm_mutex; std::vector<std::string> m_profile_data; Predicate<uint32_t> m_iohandler_sync; MemoryCache m_memory_cache; AllocatedMemoryCache m_allocated_memory_cache; bool m_should_detach; /// Should we detach if the process object goes away /// with an explicit call to Kill or Detach? LanguageRuntimeCollection m_language_runtimes; InstrumentationRuntimeCollection m_instrumentation_runtimes; std::unique_ptr<NextEventAction> m_next_event_action_ap; std::vector<PreResumeCallbackAndBaton> m_pre_resume_actions; ProcessRunLock m_public_run_lock; ProcessRunLock m_private_run_lock; ArchSpec::StopInfoOverrideCallbackType m_stop_info_override_callback; bool m_currently_handling_do_on_removals; bool m_resume_requested; // If m_currently_handling_event or // m_currently_handling_do_on_removals are true, // Resume will only request a resume, using this flag // to check. bool m_finalizing; // This is set at the beginning of Process::Finalize() to // stop functions from looking up or creating things during // a finalize call bool m_finalize_called; // This is set at the end of Process::Finalize() bool m_clear_thread_plans_on_stop; bool m_force_next_event_delivery; bool m_destroy_in_process; bool m_destroy_complete; lldb::StateType m_last_broadcast_state; /// This helps with the Public event /// coalescing in /// ShouldBroadcastEvent. std::map<lldb::addr_t, lldb::addr_t> m_resolved_indirect_addresses; bool m_can_interpret_function_calls; // Some targets, e.g the OSX kernel, // don't support the ability to modify // the stack. WarningsCollection m_warnings_issued; // A set of object pointers which have // already had warnings printed std::mutex m_run_thread_plan_lock; StructuredDataPluginMap m_structured_data_plugin_map; enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit; size_t RemoveBreakpointOpcodesFromBuffer(lldb::addr_t addr, size_t size, uint8_t *buf) const; void SynchronouslyNotifyStateChanged(lldb::StateType state); void SetPublicState(lldb::StateType new_state, bool restarted); void SetPrivateState(lldb::StateType state); bool StartPrivateStateThread(bool is_secondary_thread = false); void StopPrivateStateThread(); void PausePrivateStateThread(); void ResumePrivateStateThread(); private: struct PrivateStateThreadArgs { PrivateStateThreadArgs(Process *p, bool s) : process(p), is_secondary_thread(s){}; Process *process; bool is_secondary_thread; }; // arg is a pointer to a new'ed PrivateStateThreadArgs structure. // PrivateStateThread will free it for you. static lldb::thread_result_t PrivateStateThread(void *arg); // The starts up the private state thread that will watch for events from the // debugee. // Pass true for is_secondary_thread in the case where you have to temporarily // spin up a // secondary state thread to handle events from a hand-called function on the // primary // private state thread. lldb::thread_result_t RunPrivateStateThread(bool is_secondary_thread); protected: void HandlePrivateEvent(lldb::EventSP &event_sp); Error HaltPrivate(); lldb::StateType WaitForProcessStopPrivate(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout); // This waits for both the state change broadcaster, and the control // broadcaster. // If control_only, it only waits for the control broadcaster. bool GetEventsPrivate(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout, bool control_only); lldb::StateType GetStateChangedEventsPrivate(lldb::EventSP &event_sp, const Timeout<std::micro> &timeout); size_t WriteMemoryPrivate(lldb::addr_t addr, const void *buf, size_t size, Error &error); void AppendSTDOUT(const char *s, size_t len); void AppendSTDERR(const char *s, size_t len); void BroadcastAsyncProfileData(const std::string &one_profile_data); static void STDIOReadThreadBytesReceived(void *baton, const void *src, size_t src_len); bool PushProcessIOHandler(); bool PopProcessIOHandler(bool pop_command_interpreter); bool ProcessIOHandlerIsActive(); bool ProcessIOHandlerExists() const { return static_cast<bool>(m_process_input_reader); } Error StopForDestroyOrDetach(lldb::EventSP &exit_event_sp); bool StateChangedIsExternallyHijacked(); void LoadOperatingSystemPlugin(bool flush); private: //------------------------------------------------------------------ /// This is the part of the event handling that for a process event. /// It decides what to do with the event and returns true if the /// event needs to be propagated to the user, and false otherwise. /// If the event is not propagated, this call will most likely set /// the target to executing again. /// There is only one place where this call should be called, /// HandlePrivateEvent. /// Don't call it from anywhere else... /// /// @param[in] event_ptr /// This is the event we are handling. /// /// @return /// Returns \b true if the event should be reported to the /// user, \b false otherwise. //------------------------------------------------------------------ bool ShouldBroadcastEvent(Event *event_ptr); void ControlPrivateStateThread(uint32_t signal); DISALLOW_COPY_AND_ASSIGN(Process); }; } // namespace lldb_private #endif // liblldb_Process_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/OptionGroupWatchpoint.h //===-- OptionGroupWatchpoint.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_OptionGroupWatchpoint_h_ #define liblldb_OptionGroupWatchpoint_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Interpreter/Options.h" namespace lldb_private { //------------------------------------------------------------------------- // OptionGroupWatchpoint //------------------------------------------------------------------------- class OptionGroupWatchpoint : public OptionGroup { public: OptionGroupWatchpoint(); ~OptionGroupWatchpoint() override; static bool IsWatchSizeSupported(uint32_t watch_size); llvm::ArrayRef<OptionDefinition> GetDefinitions() override; Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_value, ExecutionContext *execution_context) override; Error SetOptionValue(uint32_t, const char *, ExecutionContext *) = delete; void OptionParsingStarting(ExecutionContext *execution_context) override; // Note: // eWatchRead == LLDB_WATCH_TYPE_READ; and // eWatchWrite == LLDB_WATCH_TYPE_WRITE typedef enum WatchType { eWatchInvalid = 0, eWatchRead, eWatchWrite, eWatchReadWrite } WatchType; WatchType watch_type; uint32_t watch_size; bool watch_type_specified; private: DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint); }; } // namespace lldb_private #endif // liblldb_OptionGroupWatchpoint_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Symbol/Symbol.h
//===-- Symbol.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Symbol_h_ #define liblldb_Symbol_h_ #include "lldb/Core/AddressRange.h" #include "lldb/Core/Mangled.h" #include "lldb/Core/UserID.h" #include "lldb/Symbol/SymbolContextScope.h" #include "lldb/lldb-private.h" namespace lldb_private { class Symbol : public SymbolContextScope { public: // ObjectFile readers can classify their symbol table entries and searches can // be made // on specific types where the symbol values will have drastically different // meanings // and sorting requirements. Symbol(); Symbol(uint32_t symID, const char *name, bool name_is_mangled, lldb::SymbolType type, bool external, bool is_debug, bool is_trampoline, bool is_artificial, const lldb::SectionSP &section_sp, lldb::addr_t value, lldb::addr_t size, bool size_is_valid, bool contains_linker_annotations, uint32_t flags); Symbol(uint32_t symID, const Mangled &mangled, lldb::SymbolType type, bool external, bool is_debug, bool is_trampoline, bool is_artificial, const AddressRange &range, bool size_is_valid, bool contains_linker_annotations, uint32_t flags); Symbol(const Symbol &rhs); const Symbol &operator=(const Symbol &rhs); void Clear(); bool Compare(const ConstString &name, lldb::SymbolType type) const; void Dump(Stream *s, Target *target, uint32_t index, Mangled::NamePreference name_preference = Mangled::ePreferDemangled) const; bool ValueIsAddress() const; //------------------------------------------------------------------ // The GetAddressRef() accessor functions should only be called if // you previously call ValueIsAddress() otherwise you might get an // reference to an Address object that contains an constant integer // value in m_addr_range.m_base_addr.m_offset which could be // incorrectly used to represent an absolute address since it has // no section. //------------------------------------------------------------------ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); } const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); } //------------------------------------------------------------------ // Makes sure the symbol's value is an address and returns the file // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't // an address. //------------------------------------------------------------------ lldb::addr_t GetFileAddress() const; //------------------------------------------------------------------ // Makes sure the symbol's value is an address and gets the load // address using \a target if it is. Returns LLDB_INVALID_ADDRESS // if the symbol's value isn't an address or if the section isn't // loaded in \a target. //------------------------------------------------------------------ lldb::addr_t GetLoadAddress(Target *target) const; //------------------------------------------------------------------ // Access the address value. Do NOT hand out the AddressRange as an // object as the byte size of the address range may not be filled in // and it should be accessed via GetByteSize(). //------------------------------------------------------------------ Address GetAddress() const { // Make sure the our value is an address before we hand a copy out. // We use the Address inside m_addr_range to contain the value for // symbols that are not address based symbols so we are using it // for more than just addresses. For example undefined symbols on // MacOSX have a nlist.n_value of 0 (zero) and this will get placed // into m_addr_range.m_base_addr.m_offset and it will have no section. // So in the GetAddress() accessor, we need to hand out an invalid // address if the symbol's value isn't an address. if (ValueIsAddress()) return m_addr_range.GetBaseAddress(); else return Address(); } // When a symbol's value isn't an address, we need to access the raw // value. This function will ensure this symbol's value isn't an address // and return the integer value if this checks out, otherwise it will // return "fail_value" if the symbol is an address value. uint64_t GetIntegerValue(uint64_t fail_value = 0) const { if (ValueIsAddress()) { // This symbol's value is an address. Use Symbol::GetAddress() to get the // address. return fail_value; } else { // The value is stored in the base address' offset return m_addr_range.GetBaseAddress().GetOffset(); } } lldb::addr_t ResolveCallableAddress(Target &target) const; ConstString GetName() const; ConstString GetNameNoArguments() const; ConstString GetDisplayName() const; uint32_t GetID() const { return m_uid; } lldb::LanguageType GetLanguage() const { // TODO: See if there is a way to determine the language for a symbol // somehow, for now just return our best guess return m_mangled.GuessLanguage(); } void SetID(uint32_t uid) { m_uid = uid; } Mangled &GetMangled() { return m_mangled; } const Mangled &GetMangled() const { return m_mangled; } ConstString GetReExportedSymbolName() const; FileSpec GetReExportedSymbolSharedLibrary() const; void SetReExportedSymbolName(const ConstString &name); bool SetReExportedSymbolSharedLibrary(const FileSpec &fspec); Symbol *ResolveReExportedSymbol(Target &target) const; uint32_t GetSiblingIndex() const; lldb::SymbolType GetType() const { return (lldb::SymbolType)m_type; } void SetType(lldb::SymbolType type) { m_type = (lldb::SymbolType)type; } const char *GetTypeAsString() const; uint32_t GetFlags() const { return m_flags; } void SetFlags(uint32_t flags) { m_flags = flags; } void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target) const; bool IsSynthetic() const { return m_is_synthetic; } void SetIsSynthetic(bool b) { m_is_synthetic = b; } bool GetSizeIsSynthesized() const { return m_size_is_synthesized; } void SetSizeIsSynthesized(bool b) { m_size_is_synthesized = b; } bool IsDebug() const { return m_is_debug; } void SetDebug(bool b) { m_is_debug = b; } bool IsExternal() const { return m_is_external; } void SetExternal(bool b) { m_is_external = b; } bool IsTrampoline() const; bool IsIndirect() const; bool GetByteSizeIsValid() const { return m_size_is_valid; } lldb::addr_t GetByteSize() const; void SetByteSize(lldb::addr_t size) { m_size_is_valid = size > 0; m_addr_range.SetByteSize(size); } bool GetSizeIsSibling() const { return m_size_is_sibling; } void SetSizeIsSibling(bool b) { m_size_is_sibling = b; } // If m_type is "Code" or "Function" then this will return the prologue size // in bytes, else it will return zero. uint32_t GetPrologueByteSize(); bool GetDemangledNameIsSynthesized() const { return m_demangled_is_synthesized; } void SetDemangledNameIsSynthesized(bool b) { m_demangled_is_synthesized = b; } bool ContainsLinkerAnnotations() const { return m_contains_linker_annotations; } void SetContainsLinkerAnnotations(bool b) { m_contains_linker_annotations = b; } //------------------------------------------------------------------ /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*) /// /// @see SymbolContextScope //------------------------------------------------------------------ void CalculateSymbolContext(SymbolContext *sc) override; lldb::ModuleSP CalculateSymbolContextModule() override; Symbol *CalculateSymbolContextSymbol() override; //------------------------------------------------------------------ /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*) /// /// @see SymbolContextScope //------------------------------------------------------------------ void DumpSymbolContext(Stream *s) override; lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx, const char *flavor, bool prefer_file_cache); bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor, bool prefer_file_cache, Stream &strm); bool ContainsFileAddress(lldb::addr_t file_addr) const; protected: // This is the internal guts of ResolveReExportedSymbol, it assumes // reexport_name is not null, and that module_spec // is valid. We track the modules we've already seen to make sure we don't // get caught in a cycle. Symbol *ResolveReExportedSymbolInModuleSpec( Target &target, ConstString &reexport_name, lldb_private::ModuleSpec &module_spec, lldb_private::ModuleList &seen_modules) const; uint32_t m_uid; // User ID (usually the original symbol table index) uint16_t m_type_data; // data specific to m_type uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has // already been calculated m_is_synthetic : 1, // non-zero if this symbol is not actually in the // symbol table, but synthesized from other info in // the object file. m_is_debug : 1, // non-zero if this symbol is debug information in a // symbol m_is_external : 1, // non-zero if this symbol is globally visible m_size_is_sibling : 1, // m_size contains the index of this symbol's // sibling m_size_is_synthesized : 1, // non-zero if this symbol's size was // calculated using a delta between this symbol // and the next m_size_is_valid : 1, m_demangled_is_synthesized : 1, // The demangled name was created should // not be used for expressions or other // lookups m_contains_linker_annotations : 1, // The symbol name contains linker // annotations, which are optional when // doing name lookups m_type : 7; Mangled m_mangled; // uniqued symbol name/mangled name pair AddressRange m_addr_range; // Contains the value, or the section offset // address when the value is an address in a // section, and the size (if any) uint32_t m_flags; // A copy of the flags from the original symbol table, the // ObjectFile plug-in can interpret these }; } // namespace lldb_private #endif // liblldb_Symbol_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/tools/driver/Driver.h
//===-- Driver.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_Driver_h_ #define lldb_Driver_h_ #include "Platform.h" #include "lldb/Utility/PseudoTerminal.h" #include <bitset> #include <set> #include <string> #include <vector> #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBDebugger.h" #include "lldb/API/SBDefines.h" #include "lldb/API/SBError.h" class IOChannel; class Driver : public lldb::SBBroadcaster { public: typedef enum CommandPlacement { eCommandPlacementBeforeFile, eCommandPlacementAfterFile, eCommandPlacementAfterCrash, } CommandPlacement; Driver(); virtual ~Driver(); void MainLoop(); lldb::SBError ParseArgs(int argc, const char *argv[], FILE *out_fh, bool &do_exit); const char *GetFilename() const; const char *GetCrashLogFilename() const; const char *GetArchName() const; lldb::ScriptLanguage GetScriptLanguage() const; void WriteCommandsForSourcing(CommandPlacement placement, lldb::SBStream &strm); bool GetDebugMode() const; class OptionData { public: OptionData(); ~OptionData(); void Clear(); void AddInitialCommand(const char *command, CommandPlacement placement, bool is_file, lldb::SBError &error); // static OptionDefinition m_cmd_option_table[]; struct InitialCmdEntry { InitialCmdEntry(const char *in_contents, bool in_is_file, bool is_cwd_lldbinit_file_read, bool in_quiet = false) : contents(in_contents), is_file(in_is_file), is_cwd_lldbinit_file_read(is_cwd_lldbinit_file_read), source_quietly(in_quiet) {} std::string contents; bool is_file; bool is_cwd_lldbinit_file_read; // if this is reading ./.lldbinit - so we // may skip if not permitted bool source_quietly; }; std::vector<std::string> m_args; lldb::ScriptLanguage m_script_lang; std::string m_core_file; std::string m_crash_log; std::vector<InitialCmdEntry> m_initial_commands; std::vector<InitialCmdEntry> m_after_file_commands; std::vector<InitialCmdEntry> m_after_crash_commands; bool m_debug_mode; bool m_source_quietly; bool m_print_version; bool m_print_python_path; bool m_print_help; bool m_wait_for; bool m_repl; lldb::LanguageType m_repl_lang; std::string m_repl_options; std::string m_process_name; lldb::pid_t m_process_pid; bool m_use_external_editor; // FIXME: When we have set/show variables we can // remove this from here. bool m_batch; typedef std::set<char> OptionSet; OptionSet m_seen_options; }; static lldb::SBError SetOptionValue(int option_idx, const char *option_arg, Driver::OptionData &data); lldb::SBDebugger &GetDebugger() { return m_debugger; } void ResizeWindow(unsigned short col); private: lldb::SBDebugger m_debugger; OptionData m_option_data; void ResetOptionValues(); void ReadyForCommand(); }; #endif // lldb_Driver_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/llbuild/include/llbuild/BuildSystem/BuildKey.h
<gh_stars>100-1000 //===- BuildKey.h -----------------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef LLBUILD_BUILDSYSTEM_BUILDKEY_H #define LLBUILD_BUILDSYSTEM_BUILDKEY_H #include "llbuild/Basic/Compiler.h" #include "llbuild/Basic/LLVM.h" #include "llbuild/Core/BuildEngine.h" #include "llbuild/BuildSystem/BuildDescription.h" #include "llvm/ADT/StringRef.h" namespace llbuild { namespace buildsystem { /// The BuildKey encodes the key space used by the BuildSystem when using the /// core BuildEngine. class BuildKey { using KeyType = core::KeyType; public: enum class Kind { /// A key used to identify a command. Command, /// A key used to identify a custom task. CustomTask, /// A key used to identify directory contents. DirectoryContents, /// A key used to identify the signature of a complete directory tree. DirectoryTreeSignature, /// A key used to identify a node. Node, /// A key used to identify a target. Target, /// An invalid key kind. Unknown, }; static StringRef stringForKind(Kind); private: /// The actual key data. KeyType key; private: BuildKey(const KeyType& key) : key(key) {} BuildKey(char kindCode, StringRef str) { key.reserve(1 + str.size()); key.push_back(kindCode); key.append(str.begin(), str.end()); } BuildKey(char kindCode, StringRef name, StringRef data) { // FIXME: We need good support infrastructure for binary encoding. uint32_t nameSize = name.size(); uint32_t dataSize = data.size(); key.resize(1 + sizeof(uint32_t) + nameSize + dataSize); uint32_t pos = 0; key[pos] = kindCode; pos += 1; memcpy(&key[pos], &nameSize, sizeof(uint32_t)); pos += sizeof(uint32_t); memcpy(&key[pos], name.data(), nameSize); pos += nameSize; memcpy(&key[pos], data.data(), dataSize); pos += dataSize; assert(key.size() == pos); } public: /// @name Construction Functions /// @{ /// Create a key for computing a command result. static BuildKey makeCommand(StringRef name) { return BuildKey('C', name); } /// Create a key for computing a custom task (manged by a particular command). static BuildKey makeCustomTask(StringRef name, StringRef taskData) { return BuildKey('X', name, taskData); } /// Create a key for computing the contents of a directory. static BuildKey makeDirectoryContents(StringRef path) { return BuildKey('D', path); } /// Create a key for computing the contents of a directory. static BuildKey makeDirectoryTreeSignature(StringRef path) { return BuildKey('S', path); } /// Create a key for computing a node result. static BuildKey makeNode(StringRef path) { return BuildKey('N', path); } /// Create a key for computing a node result. static BuildKey makeNode(const Node* node) { return BuildKey('N', node->getName()); } /// Createa a key for computing a target. static BuildKey makeTarget(StringRef name) { return BuildKey('T', name); } /// @} /// @name Accessors /// @{ const KeyType& getKeyData() const { return key; } Kind getKind() const { switch (key[0]) { case 'C': return Kind::Command; case 'D': return Kind::DirectoryContents; case 'N': return Kind::Node; case 'S': return Kind::DirectoryTreeSignature; case 'T': return Kind::Target; case 'X': return Kind::CustomTask; default: return Kind::Unknown; } } bool isCommand() const { return getKind() == Kind::Command; } bool isCustomTask() const { return getKind() == Kind::CustomTask; } bool isDirectoryContents() const { return getKind() == Kind::DirectoryContents; } bool isDirectoryTreeSignature() const { return getKind() == Kind::DirectoryTreeSignature; } bool isNode() const { return getKind() == Kind::Node; } bool isTarget() const { return getKind() == Kind::Target; } StringRef getCommandName() const { assert(isCommand()); return StringRef(key.data()+1, key.size()-1); } StringRef getCustomTaskName() const { assert(isCustomTask()); uint32_t nameSize; memcpy(&nameSize, &key[1], sizeof(uint32_t)); return StringRef(&key[1 + sizeof(uint32_t)], nameSize); } StringRef getCustomTaskData() const { assert(isCustomTask()); uint32_t nameSize; memcpy(&nameSize, &key[1], sizeof(uint32_t)); uint32_t dataSize = key.size() - 1 - sizeof(uint32_t) - nameSize; return StringRef(&key[1 + sizeof(uint32_t) + nameSize], dataSize); } StringRef getDirectoryContentsPath() const { assert(isDirectoryContents()); return StringRef(key.data()+1, key.size()-1); } StringRef getDirectoryTreeSignaturePath() const { assert(isDirectoryTreeSignature()); return StringRef(key.data()+1, key.size()-1); } StringRef getNodeName() const { assert(isNode()); return StringRef(key.data()+1, key.size()-1); } StringRef getTargetName() const { assert(isTarget()); return StringRef(key.data()+1, key.size()-1); } /// @} /// @name Conversion to core ValueType. /// @{ static BuildKey fromData(const KeyType& key) { auto result = BuildKey(key); assert(result.getKind() != Kind::Unknown && "invalid key"); return result; } const core::KeyType toData() const { return getKeyData(); } /// @} /// @name Debug Support /// @{ void dump(raw_ostream& OS) const; /// @} }; } } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/CommandObject.h
<reponame>Polidea/SiriusObfuscator //===-- CommandObject.h -----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_CommandObject_h_ #define liblldb_CommandObject_h_ // C Includes // C++ Includes #include <map> #include <string> #include <vector> // Other libraries and framework includes // Project includes #include "lldb/Core/Flags.h" #include "lldb/Core/StringList.h" #include "lldb/Interpreter/Args.h" #include "lldb/Interpreter/CommandCompletions.h" #include "lldb/Target/ExecutionContext.h" #include "lldb/lldb-private.h" namespace lldb_private { // This function really deals with CommandObjectLists, but we didn't make a // CommandObjectList class, so I'm sticking it here. But we really should have // such a class. Anyway, it looks up the commands in the map that match the // partial // string cmd_str, inserts the matches into matches, and returns the number // added. template <typename ValueType> int AddNamesMatchingPartialString(const std::map<std::string, ValueType> &in_map, llvm::StringRef cmd_str, StringList &matches) { int number_added = 0; const bool add_all = cmd_str.empty(); for (auto iter = in_map.begin(), end = in_map.end(); iter != end; iter++) { if (add_all || (iter->first.find(cmd_str, 0) == 0)) { ++number_added; matches.AppendString(iter->first.c_str()); } } return number_added; } template <typename ValueType> size_t FindLongestCommandWord(std::map<std::string, ValueType> &dict) { auto end = dict.end(); size_t max_len = 0; for (auto pos = dict.begin(); pos != end; ++pos) { size_t len = pos->first.size(); if (max_len < len) max_len = len; } return max_len; } class CommandObject { public: typedef llvm::StringRef(ArgumentHelpCallbackFunction)(); struct ArgumentHelpCallback { ArgumentHelpCallbackFunction *help_callback; bool self_formatting; llvm::StringRef operator()() const { return (*help_callback)(); } explicit operator bool() const { return (help_callback != nullptr); } }; struct ArgumentTableEntry // Entries in the main argument information table { lldb::CommandArgumentType arg_type; const char *arg_name; CommandCompletions::CommonCompletionTypes completion_type; ArgumentHelpCallback help_function; const char *help_text; }; struct CommandArgumentData // Used to build individual command argument lists { lldb::CommandArgumentType arg_type; ArgumentRepetitionType arg_repetition; uint32_t arg_opt_set_association; // This arg might be associated only with // some particular option set(s). CommandArgumentData() : arg_type(lldb::eArgTypeNone), arg_repetition(eArgRepeatPlain), arg_opt_set_association(LLDB_OPT_SET_ALL) // By default, the arg // associates to all option // sets. {} }; typedef std::vector<CommandArgumentData> CommandArgumentEntry; // Used to build individual command argument lists static ArgumentTableEntry g_arguments_data [lldb::eArgTypeLastArg]; // Main argument information table typedef std::map<std::string, lldb::CommandObjectSP> CommandMap; CommandObject(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help = "", llvm::StringRef syntax = "", uint32_t flags = 0); virtual ~CommandObject(); static const char * GetArgumentTypeAsCString(const lldb::CommandArgumentType arg_type); static const char * GetArgumentDescriptionAsCString(const lldb::CommandArgumentType arg_type); CommandInterpreter &GetCommandInterpreter() { return m_interpreter; } virtual llvm::StringRef GetHelp(); virtual llvm::StringRef GetHelpLong(); virtual llvm::StringRef GetSyntax(); llvm::StringRef GetCommandName() const; virtual void SetHelp(llvm::StringRef str); virtual void SetHelpLong(llvm::StringRef str); void SetSyntax(llvm::StringRef str); // override this to return true if you want to enable the user to delete // the Command object from the Command dictionary (aliases have their own // deletion scheme, so they do not need to care about this) virtual bool IsRemovable() const { return false; } virtual bool IsMultiwordObject() { return false; } virtual CommandObjectMultiword *GetAsMultiwordCommand() { return nullptr; } virtual bool IsAlias() { return false; } // override this to return true if your command is somehow a "dash-dash" // form of some other command (e.g. po is expr -O --); this is a powerful // hint to the help system that one cannot pass options to this command virtual bool IsDashDashCommand() { return false; } virtual lldb::CommandObjectSP GetSubcommandSP(llvm::StringRef sub_cmd, StringList *matches = nullptr) { return lldb::CommandObjectSP(); } virtual CommandObject *GetSubcommandObject(llvm::StringRef sub_cmd, StringList *matches = nullptr) { return nullptr; } virtual void AproposAllSubCommands(llvm::StringRef prefix, llvm::StringRef search_word, StringList &commands_found, StringList &commands_help) {} void FormatLongHelpText(Stream &output_strm, llvm::StringRef long_help); void GenerateHelpText(CommandReturnObject &result); virtual void GenerateHelpText(Stream &result); // this is needed in order to allow the SBCommand class to // transparently try and load subcommands - it will fail on // anything but a multiword command, but it avoids us doing // type checkings and casts virtual bool LoadSubCommand(llvm::StringRef cmd_name, const lldb::CommandObjectSP &command_obj) { return false; } virtual bool WantsRawCommandString() = 0; // By default, WantsCompletion = !WantsRawCommandString. // Subclasses who want raw command string but desire, for example, // argument completion should override this method to return true. virtual bool WantsCompletion() { return !WantsRawCommandString(); } virtual Options *GetOptions(); static const ArgumentTableEntry *GetArgumentTable(); static lldb::CommandArgumentType LookupArgumentName(llvm::StringRef arg_name); static const ArgumentTableEntry * FindArgumentDataByType(lldb::CommandArgumentType arg_type); int GetNumArgumentEntries(); CommandArgumentEntry *GetArgumentEntryAtIndex(int idx); static void GetArgumentHelp(Stream &str, lldb::CommandArgumentType arg_type, CommandInterpreter &interpreter); static const char *GetArgumentName(lldb::CommandArgumentType arg_type); // Generates a nicely formatted command args string for help command output. // By default, all possible args are taken into account, for example, // '<expr | variable-name>'. This can be refined by passing a second arg // specifying which option set(s) we are interested, which could then, for // example, produce either '<expr>' or '<variable-name>'. void GetFormattedCommandArguments(Stream &str, uint32_t opt_set_mask = LLDB_OPT_SET_ALL); bool IsPairType(ArgumentRepetitionType arg_repeat_type); bool ParseOptions(Args &args, CommandReturnObject &result); void SetCommandName(llvm::StringRef name); //------------------------------------------------------------------ /// The input array contains a parsed version of the line. The insertion /// point is given by cursor_index (the index in input of the word containing /// the cursor) and cursor_char_position (the position of the cursor in that /// word.) /// This default version handles calling option argument completions and then /// calls /// HandleArgumentCompletion if the cursor is on an argument, not an option. /// Don't override this method, override HandleArgumentCompletion instead /// unless /// you have special reasons. /// /// @param[in] interpreter /// The command interpreter doing the completion. /// /// @param[in] input /// The command line parsed into words /// /// @param[in] cursor_index /// The index in \ainput of the word in which the cursor lies. /// /// @param[in] cursor_char_pos /// The character position of the cursor in its argument word. /// /// @param[in] match_start_point /// @param[in] match_return_elements /// FIXME: Not yet implemented... If there is a match that is expensive /// to compute, these are /// here to allow you to compute the completions in batches. Start the /// completion from \amatch_start_point, /// and return \amatch_return_elements elements. /// /// @param[out] word_complete /// \btrue if this is a complete option value (a space will be inserted /// after the /// completion.) \bfalse otherwise. /// /// @param[out] matches /// The array of matches returned. /// /// FIXME: This is the wrong return value, since we also need to make a /// distinction between /// total number of matches, and the window the user wants returned. /// /// @return /// \btrue if we were in an option, \bfalse otherwise. //------------------------------------------------------------------ virtual int HandleCompletion(Args &input, int &cursor_index, int &cursor_char_position, int match_start_point, int max_return_elements, bool &word_complete, StringList &matches); //------------------------------------------------------------------ /// The input array contains a parsed version of the line. The insertion /// point is given by cursor_index (the index in input of the word containing /// the cursor) and cursor_char_position (the position of the cursor in that /// word.) /// We've constructed the map of options and their arguments as well if that /// is /// helpful for the completion. /// /// @param[in] interpreter /// The command interpreter doing the completion. /// /// @param[in] input /// The command line parsed into words /// /// @param[in] cursor_index /// The index in \ainput of the word in which the cursor lies. /// /// @param[in] cursor_char_pos /// The character position of the cursor in its argument word. /// /// @param[in] opt_element_vector /// The results of the options parse of \a input. /// /// @param[in] match_start_point /// @param[in] match_return_elements /// See CommandObject::HandleCompletions for a description of how these /// work. /// /// @param[out] word_complete /// \btrue if this is a complete option value (a space will be inserted /// after the /// completion.) \bfalse otherwise. /// /// @param[out] matches /// The array of matches returned. /// /// FIXME: This is the wrong return value, since we also need to make a /// distinction between /// total number of matches, and the window the user wants returned. /// /// @return /// The number of completions. //------------------------------------------------------------------ virtual int HandleArgumentCompletion( Args &input, int &cursor_index, int &cursor_char_position, OptionElementVector &opt_element_vector, int match_start_point, int max_return_elements, bool &word_complete, StringList &matches) { return 0; } bool HelpTextContainsWord(llvm::StringRef search_word, bool search_short_help = true, bool search_long_help = true, bool search_syntax = true, bool search_options = true); //------------------------------------------------------------------ /// The flags accessor. /// /// @return /// A reference to the Flags member variable. //------------------------------------------------------------------ Flags &GetFlags() { return m_flags; } //------------------------------------------------------------------ /// The flags const accessor. /// /// @return /// A const reference to the Flags member variable. //------------------------------------------------------------------ const Flags &GetFlags() const { return m_flags; } //------------------------------------------------------------------ /// Get the command that appropriate for a "repeat" of the current command. /// /// @param[in] current_command_line /// The complete current command line. /// /// @return /// nullptr if there is no special repeat command - it will use the /// current command line. /// Otherwise a pointer to the command to be repeated. /// If the returned string is the empty string, the command won't be /// repeated. //------------------------------------------------------------------ virtual const char *GetRepeatCommand(Args &current_command_args, uint32_t index) { return nullptr; } bool HasOverrideCallback() const { return m_command_override_callback || m_deprecated_command_override_callback; } void SetOverrideCallback(lldb::CommandOverrideCallback callback, void *baton) { m_deprecated_command_override_callback = callback; m_command_override_baton = baton; } void SetOverrideCallback(lldb::CommandOverrideCallbackWithResult callback, void *baton) { m_command_override_callback = callback; m_command_override_baton = baton; } bool InvokeOverrideCallback(const char **argv, CommandReturnObject &result) { if (m_command_override_callback) return m_command_override_callback(m_command_override_baton, argv, result); else if (m_deprecated_command_override_callback) return m_deprecated_command_override_callback(m_command_override_baton, argv); else return false; } virtual bool Execute(const char *args_string, CommandReturnObject &result) = 0; protected: virtual const char *GetInvalidTargetDescription() { return "invalid target, create a target using the 'target create' command"; } virtual const char *GetInvalidProcessDescription() { return "invalid process"; } virtual const char *GetInvalidThreadDescription() { return "invalid thread"; } virtual const char *GetInvalidFrameDescription() { return "invalid frame"; } virtual const char *GetInvalidRegContextDescription() { return "invalid frame, no registers"; } // This is for use in the command interpreter, when you either want the // selected target, or if no target // is present you want to prime the dummy target with entities that will be // copied over to new targets. Target *GetSelectedOrDummyTarget(bool prefer_dummy = false); Target *GetDummyTarget(); // If a command needs to use the "current" thread, use this call. // Command objects will have an ExecutionContext to use, and that may or may // not have a thread in it. If it // does, you should use that by default, if not, then use the // ExecutionContext's target's selected thread, etc... // This call insulates you from the details of this calculation. Thread *GetDefaultThread(); //------------------------------------------------------------------ /// Check the command to make sure anything required by this /// command is available. /// /// @param[out] result /// A command result object, if it is not okay to run the command /// this will be filled in with a suitable error. /// /// @return /// \b true if it is okay to run this command, \b false otherwise. //------------------------------------------------------------------ bool CheckRequirements(CommandReturnObject &result); void Cleanup(); CommandInterpreter &m_interpreter; ExecutionContext m_exe_ctx; std::unique_lock<std::recursive_mutex> m_api_locker; std::string m_cmd_name; std::string m_cmd_help_short; std::string m_cmd_help_long; std::string m_cmd_syntax; Flags m_flags; std::vector<CommandArgumentEntry> m_arguments; lldb::CommandOverrideCallback m_deprecated_command_override_callback; lldb::CommandOverrideCallbackWithResult m_command_override_callback; void *m_command_override_baton; // Helper function to populate IDs or ID ranges as the command argument data // to the specified command argument entry. static void AddIDsArgumentData(CommandArgumentEntry &arg, lldb::CommandArgumentType ID, lldb::CommandArgumentType IDRange); }; class CommandObjectParsed : public CommandObject { public: CommandObjectParsed(CommandInterpreter &interpreter, const char *name, const char *help = nullptr, const char *syntax = nullptr, uint32_t flags = 0) : CommandObject(interpreter, name, help, syntax, flags) {} ~CommandObjectParsed() override = default; bool Execute(const char *args_string, CommandReturnObject &result) override; protected: virtual bool DoExecute(Args &command, CommandReturnObject &result) = 0; bool WantsRawCommandString() override { return false; } }; class CommandObjectRaw : public CommandObject { public: CommandObjectRaw(CommandInterpreter &interpreter, llvm::StringRef name, llvm::StringRef help = "", llvm::StringRef syntax = "", uint32_t flags = 0) : CommandObject(interpreter, name, help, syntax, flags) {} ~CommandObjectRaw() override = default; bool Execute(const char *args_string, CommandReturnObject &result) override; protected: virtual bool DoExecute(const char *command, CommandReturnObject &result) = 0; bool WantsRawCommandString() override { return true; } }; } // namespace lldb_private #endif // liblldb_CommandObject_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Target/StructuredDataPlugin.h
//===-- StructuredDataPlugin.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef StructuredDataPlugin_h #define StructuredDataPlugin_h #include "lldb/Core/PluginInterface.h" #include "lldb/Core/StructuredData.h" namespace lldb_private { class CommandObjectMultiword; // ----------------------------------------------------------------------------- /// Plugin that supports process-related structured data sent asynchronously /// from the debug monitor (e.g. debugserver, lldb-server, etc.) /// /// This plugin type is activated by a Process-derived instance when that /// instance detects that a given structured data feature is available. /// /// StructuredDataPlugin instances are inherently tied to a process. The /// main functionality they support is the ability to consume asynchronously- /// delivered structured data from the process monitor, and do something /// reasonable with it. Something reasonable can include broadcasting a /// StructuredData event, which other parts of the system can then do with /// as they please. An IDE could use this facility to retrieve CPU usage, /// memory usage, and other run-time aspects of the process. That data /// can then be displayed meaningfully to the user through the IDE. /// For command-line LLDB, the Debugger instance listens for the structured /// data events raised by the plugin, and give the plugin both the output /// and error streams such that the plugin can display something about the /// event, at a time when the debugger ensures it is safe to write to the /// output or error streams. // ----------------------------------------------------------------------------- class StructuredDataPlugin : public PluginInterface, public std::enable_shared_from_this<StructuredDataPlugin> { public: virtual ~StructuredDataPlugin(); lldb::ProcessSP GetProcess() const; // ------------------------------------------------------------------------- // Public instance API // ------------------------------------------------------------------------- // ------------------------------------------------------------------------- /// Return whether this plugin supports the given StructuredData feature. /// /// When Process is informed of a list of process-monitor-supported /// structured data features, Process will go through the list of plugins, /// one at a time, and have the first plugin that supports a given feature /// be the plugin instantiated to handle that feature. There is a 1-1 /// correspondence between a Process instance and a StructuredDataPlugin /// mapped to that process. A plugin can support handling multiple /// features, and if that happens, there is a single plugin instance /// created covering all of the mapped features for a given process. /// /// @param[in] type_name /// The name of the feature tag supported by a process. /// e.g. "darwin-log". /// /// @return /// true if the plugin supports the feature; otherwise, false. // ------------------------------------------------------------------------- virtual bool SupportsStructuredDataType(const ConstString &type_name) = 0; // ------------------------------------------------------------------------- /// Handle the arrival of asynchronous structured data from the process. /// /// When asynchronous structured data arrives from the process monitor, /// it is immediately delivered to the plugin mapped for that feature /// if one exists. The structured data that arrives from a process /// monitor must be a dictionary, and it must have a string field named /// "type" that must contain the StructuredData feature name set as the /// value. This is the manner in which the data is routed to the proper /// plugin instance. /// /// @param[in] process /// The process instance that just received the structured data. /// This will always be the same process for a given instance of /// a plugin. /// /// @param[in] type_name /// The name of the feature tag for the asynchronous structured data. /// Note this data will also be present in the \b object_sp dictionary /// under the string value with key "type". /// /// @param[in] object_sp /// A shared pointer to the structured data that arrived. This must /// be a dictionary. The only key required is the aforementioned /// key named "type" that must be a string value containing the /// structured data type name. // ------------------------------------------------------------------------- virtual void HandleArrivalOfStructuredData(Process &process, const ConstString &type_name, const StructuredData::ObjectSP &object_sp) = 0; // ------------------------------------------------------------------------- /// Get a human-readable description of the contents of the data. /// /// In command-line LLDB, this method will be called by the Debugger /// instance for each structured data event generated, and the output /// will be printed to the LLDB console. If nothing is added to the stream, /// nothing will be printed; otherwise, a newline will be added to the end /// when displayed. /// /// @param[in] object_sp /// A shared pointer to the structured data to format. /// /// @param[in] stream /// The stream where the structured data should be pretty printed. /// /// @return /// The error if formatting the object contents failed; otherwise, /// success. // ------------------------------------------------------------------------- virtual Error GetDescription(const StructuredData::ObjectSP &object_sp, lldb_private::Stream &stream) = 0; // ------------------------------------------------------------------------- /// Returns whether the plugin's features are enabled. /// /// This is a convenience method for plugins that can enable or disable /// their functionality. It allows retrieval of this state without /// requiring a cast. /// /// @param[in] type_name /// The name of the feature tag for the asynchronous structured data. /// This is needed for plugins that support more than one feature. // ------------------------------------------------------------------------- virtual bool GetEnabled(const ConstString &type_name) const; // ------------------------------------------------------------------------- /// Allow the plugin to do work related to modules that loaded in the /// the corresponding process. /// /// This method defaults to doing nothing. Plugins can override it /// if they have any behavior they want to enable/modify based on loaded /// modules. /// /// @param[in] process /// The process that just was notified of modules having been loaded. /// This will always be the same process for a given instance of /// a plugin. /// /// @param[in] module_list /// The list of modules that the process registered as having just /// loaded. See \b Process::ModulesDidLoad(...). // ------------------------------------------------------------------------- virtual void ModulesDidLoad(Process &process, ModuleList &module_list); protected: // ------------------------------------------------------------------------- // Derived-class API // ------------------------------------------------------------------------- StructuredDataPlugin(const lldb::ProcessWP &process_wp); // ------------------------------------------------------------------------- /// Derived classes must call this before attempting to hook up commands /// to the 'plugin structured-data' tree. /// /// This ensures the relevant command and options hook points for all /// StructuredDataPlugin derived classes are available for this debugger. /// If this has already happened, this call is a no-op. /// /// @param[in] debugger /// The Debugger instance for which we're creating the required shared /// components for the StructuredDataPlugin derived classes. // ------------------------------------------------------------------------- static void InitializeBasePluginForDebugger(Debugger &debugger); private: lldb::ProcessWP m_process_wp; DISALLOW_COPY_AND_ASSIGN(StructuredDataPlugin); }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/cmark/src/utf8.h
#ifndef CMARK_UTF8_H #define CMARK_UTF8_H #include <stdint.h> #include "buffer.h" #ifdef __cplusplus extern "C" { #endif void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, bufsize_t len); void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf); int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst); void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line, bufsize_t size); int cmark_utf8proc_is_space(int32_t uc); int cmark_utf8proc_is_punctuation(int32_t uc); #ifdef __cplusplus } #endif #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h<gh_stars>100-1000 //===-- ClangExpressionVariable.h -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ClangExpressionVariable_h_ #define liblldb_ClangExpressionVariable_h_ // C Includes #include <signal.h> #include <stdint.h> #include <string.h> // C++ Includes #include <map> #include <string> #include <vector> // Other libraries and framework includes #include "llvm/Support/Casting.h" // Project includes #include "lldb/Core/ClangForward.h" #include "lldb/Core/ConstString.h" #include "lldb/Core/Value.h" #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Symbol/TaggedASTType.h" #include "lldb/lldb-public.h" namespace llvm { class Value; } namespace lldb_private { class ValueObjectConstResult; //---------------------------------------------------------------------- /// @class ClangExpressionVariable ClangExpressionVariable.h /// "lldb/Expression/ClangExpressionVariable.h" /// @brief Encapsulates one variable for the expression parser. /// /// The expression parser uses variables in three different contexts: /// /// First, it stores persistent variables along with the process for use /// in expressions. These persistent variables contain their own data /// and are typed. /// /// Second, in an interpreted expression, it stores the local variables /// for the expression along with the expression. These variables /// contain their own data and are typed. /// /// Third, in a JIT-compiled expression, it stores the variables that /// the expression needs to have materialized and dematerialized at each /// execution. These do not contain their own data but are named and /// typed. /// /// This class supports all of these use cases using simple type /// polymorphism, and provides necessary support methods. Its interface /// is RTTI-neutral. //---------------------------------------------------------------------- class ClangExpressionVariable : public ExpressionVariable { public: ClangExpressionVariable(ExecutionContextScope *exe_scope, lldb::ByteOrder byte_order, uint32_t addr_byte_size); ClangExpressionVariable(ExecutionContextScope *exe_scope, Value &value, const ConstString &name, uint16_t flags = EVNone); ClangExpressionVariable(const lldb::ValueObjectSP &valobj_sp); ClangExpressionVariable(ExecutionContextScope *exe_scope, const ConstString &name, const TypeFromUser &user_type, lldb::ByteOrder byte_order, uint32_t addr_byte_size); //---------------------------------------------------------------------- /// Utility functions for dealing with ExpressionVariableLists in /// Clang-specific ways //---------------------------------------------------------------------- //---------------------------------------------------------------------- /// Finds a variable by NamedDecl in the list. /// /// @param[in] name /// The name of the requested variable. /// /// @return /// The variable requested, or NULL if that variable is not in the list. //---------------------------------------------------------------------- static ClangExpressionVariable * FindVariableInList(ExpressionVariableList &list, const clang::NamedDecl *decl, uint64_t parser_id) { lldb::ExpressionVariableSP var_sp; for (size_t index = 0, size = list.GetSize(); index < size; ++index) { var_sp = list.GetVariableAtIndex(index); if (ClangExpressionVariable *clang_var = llvm::dyn_cast<ClangExpressionVariable>(var_sp.get())) { ClangExpressionVariable::ParserVars *parser_vars = clang_var->GetParserVars(parser_id); if (parser_vars && parser_vars->m_named_decl == decl) return clang_var; } } return nullptr; } //---------------------------------------------------------------------- /// If the variable contains its own data, make a Value point at it. /// If \a exe_ctx in not NULL, the value will be resolved in with /// that execution context. /// /// @param[in] value /// The value to point at the data. /// /// @param[in] exe_ctx /// The execution context to use to resolve \a value. /// /// @return /// True on success; false otherwise (in particular, if this variable /// does not contain its own data). //---------------------------------------------------------------------- bool PointValueAtData(Value &value, ExecutionContext *exe_ctx); //---------------------------------------------------------------------- /// The following values should not live beyond parsing //---------------------------------------------------------------------- class ParserVars { public: ParserVars() : m_parser_type(), m_named_decl(NULL), m_llvm_value(NULL), m_lldb_value(), m_lldb_var(), m_lldb_sym(NULL) {} TypeFromParser m_parser_type; ///< The type of the variable according to the parser const clang::NamedDecl *m_named_decl; ///< The Decl corresponding to this variable llvm::Value *m_llvm_value; ///< The IR value corresponding to this variable; ///usually a GlobalValue lldb_private::Value m_lldb_value; ///< The value found in LLDB for this variable lldb::VariableSP m_lldb_var; ///< The original variable for this variable const lldb_private::Symbol *m_lldb_sym; ///< The original symbol for this ///variable, if it was a symbol }; private: typedef std::map<uint64_t, ParserVars> ParserVarMap; ParserVarMap m_parser_vars; public: //---------------------------------------------------------------------- /// Make this variable usable by the parser by allocating space for /// parser-specific variables //---------------------------------------------------------------------- void EnableParserVars(uint64_t parser_id) { m_parser_vars.insert(std::make_pair(parser_id, ParserVars())); } //---------------------------------------------------------------------- /// Deallocate parser-specific variables //---------------------------------------------------------------------- void DisableParserVars(uint64_t parser_id) { m_parser_vars.erase(parser_id); } //---------------------------------------------------------------------- /// Access parser-specific variables //---------------------------------------------------------------------- ParserVars *GetParserVars(uint64_t parser_id) { ParserVarMap::iterator i = m_parser_vars.find(parser_id); if (i == m_parser_vars.end()) return NULL; else return &i->second; } //---------------------------------------------------------------------- /// The following values are valid if the variable is used by JIT code //---------------------------------------------------------------------- struct JITVars { JITVars() : m_alignment(0), m_size(0), m_offset(0) {} lldb::offset_t m_alignment; ///< The required alignment of the variable, in bytes size_t m_size; ///< The space required for the variable, in bytes lldb::offset_t m_offset; ///< The offset of the variable in the struct, in bytes }; private: typedef std::map<uint64_t, JITVars> JITVarMap; JITVarMap m_jit_vars; public: //---------------------------------------------------------------------- /// Make this variable usable for materializing for the JIT by allocating /// space for JIT-specific variables //---------------------------------------------------------------------- void EnableJITVars(uint64_t parser_id) { m_jit_vars.insert(std::make_pair(parser_id, JITVars())); } //---------------------------------------------------------------------- /// Deallocate JIT-specific variables //---------------------------------------------------------------------- void DisableJITVars(uint64_t parser_id) { m_jit_vars.erase(parser_id); } JITVars *GetJITVars(uint64_t parser_id) { JITVarMap::iterator i = m_jit_vars.find(parser_id); if (i == m_jit_vars.end()) return NULL; else return &i->second; } TypeFromUser GetTypeFromUser(); //------------------------------------------------------------------ // llvm casting support //------------------------------------------------------------------ static bool classof(const ExpressionVariable *ev) { return ev->getKind() == ExpressionVariable::eKindClang; } //---------------------------------------------------------------------- /// Members //---------------------------------------------------------------------- DISALLOW_COPY_AND_ASSIGN(ClangExpressionVariable); }; } // namespace lldb_private #endif // liblldb_ClangExpressionVariable_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/DWARF/DWARFDefines.h
//===-- DWARFDefines.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SymbolFileDWARF_DWARFDefines_h_ #define SymbolFileDWARF_DWARFDefines_h_ #include "lldb/Core/dwarf.h" #include <stdint.h> namespace lldb_private { typedef uint32_t DRC_class; // Holds DRC_* class bitfields enum DW_TAG_Category { TagCategoryVariable, TagCategoryType, TagCategoryProgram, kNumTagCategories }; typedef enum DW_TAG_Category DW_TAG_CategoryEnum; const char *DW_TAG_value_to_name(uint32_t val); DW_TAG_CategoryEnum get_tag_category(uint16_t tag); const char *DW_CHILDREN_value_to_name(uint8_t val); const char *DW_AT_value_to_name(uint32_t val); const char *DW_FORM_value_to_name(uint32_t val); const char *DW_OP_value_to_name(uint32_t val); DRC_class DW_OP_value_to_class(uint32_t val); const char *DW_ATE_value_to_name(uint32_t val); const char *DW_ACCESS_value_to_name(uint32_t val); const char *DW_VIS_value_to_name(uint32_t val); const char *DW_VIRTUALITY_value_to_name(uint32_t val); const char *DW_LANG_value_to_name(uint32_t val); const char *DW_ID_value_to_name(uint32_t val); const char *DW_CC_value_to_name(uint32_t val); const char *DW_INL_value_to_name(uint32_t val); const char *DW_ORD_value_to_name(uint32_t val); const char *DW_DSC_value_to_name(uint32_t val); const char *DW_LNS_value_to_name(uint32_t val); const char *DW_LNE_value_to_name(uint32_t val); const char *DW_MACINFO_value_to_name(uint32_t val); const char *DW_CFA_value_to_name(uint32_t val); const char *DW_GNU_EH_PE_value_to_name(uint32_t val); /* These DRC are entirely our own construction, although they are derived from various comments in the DWARF standard. Most of these are not useful to the parser, but the DW_AT and DW_FORM classes should prove to be usable in some fashion. */ #define DRC_0x65 0x1 #define DRC_ADDRESS 0x2 #define DRC_BLOCK 0x4 #define DRC_CONSTANT 0x8 #define DRC_DWARFv3 0x10 #define DRC_FLAG 0x20 #define DRC_INDIRECT_SPECIAL 0x40 #define DRC_LINEPTR 0x80 #define DRC_LOCEXPR 0x100 #define DRC_LOCLISTPTR 0x200 #define DRC_MACPTR 0x400 #define DRC_ONEOPERAND 0x800 #define DRC_OPERANDONE_1BYTE_DELTA 0x1000 #define DRC_OPERANDONE_2BYTE_DELTA 0x2000 #define DRC_OPERANDONE_4BYTE_DELTA 0x4000 #define DRC_OPERANDONE_ADDRESS 0x8000 #define DRC_OPERANDONE_BLOCK 0x10000 #define DRC_OPERANDONE_SLEB128_OFFSET 0x20000 #define DRC_OPERANDONE_ULEB128_OFFSET 0x40000 #define DRC_OPERANDONE_ULEB128_REGISTER 0x80000 #define DRC_OPERANDTWO_BLOCK 0x100000 #define DRC_OPERANDTWO_SLEB128_OFFSET 0x200000 #define DRC_OPERANDTWO_ULEB128_OFFSET 0x400000 #define DRC_OPERANDTWO_ULEB128_REGISTER 0x800000 #define DRC_OPERNADONE_ULEB128_REGISTER 0x1000000 #define DRC_RANGELISTPTR 0x2000000 #define DRC_REFERENCE 0x4000000 #define DRC_STRING 0x8000000 #define DRC_TWOOPERANDS 0x10000000 #define DRC_VENDOR_GNU 0x20000000 #define DRC_VENDOR_MIPS 0x40000000 #define DRC_ZEROOPERANDS 0x80000000 } // namespace lldb_private #endif // SymbolFileDWARF_DWARFDefines_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Process/Linux/SingleStepCheck.h
//===-- SingleStepCheck.h ------------------------------------- -*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_SingleStepCheck_H_ #define liblldb_SingleStepCheck_H_ namespace lldb_private { namespace process_linux { namespace impl { extern bool SingleStepWorkaroundNeeded(); } // arm64 linux had a bug which prevented single-stepping and watchpoints from // working on non-boot // cpus, due to them being incorrectly initialized after coming out of suspend. // This issue is // particularly affecting android M, which uses suspend ("doze mode") quite // aggressively. This // code detects that situation and makes single-stepping work by doing all the // step operations on // the boot cpu. // // The underlying issue has been fixed in android N and linux 4.4. This code can // be removed once // these systems become obsolete. inline bool SingleStepWorkaroundNeeded() { static bool value = impl::SingleStepWorkaroundNeeded(); return value; } } // end namespace process_linux } // end namespace lldb_private #endif // #ifndef liblldb_SingleStepCheck_H_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/tools/lldb-mi/MICmnResources.h
<reponame>Polidea/SiriusObfuscator //===-- MICmnResources.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #pragma once // Third party headers #include <map> // In-house headers: #include "MICmnBase.h" #include "MIUtilSingletonBase.h" #include "MIUtilString.h" //++ //============================================================================ // Details: MI string test data resource definitions. These IDs match up with // actual string data in a map internal to CMICmnResources. // *** Be sure to update ms_pResourceId2TextData[] array **** enum { IDS_PROJNAME = 1, IDS_MI_VERSION_DESCRIPTION_DEBUG, IDS_MI_VERSION_DESCRIPTION, IDS_MI_APPNAME_SHORT, IDS_MI_APPNAME_LONG, IDS_MI_APP_FILEPATHNAME, IDS_MI_APP_ARGS, IDE_MI_VERSION_GDB, IDS_UTIL_FILE_ERR_INVALID_PATHNAME, IDS_UTIL_FILE_ERR_OPENING_FILE, IDS_UTIL_FILE_ERR_OPENING_FILE_UNKNOWN, IDE_UTIL_FILE_ERR_WRITING_FILE, IDE_UTIL_FILE_ERR_WRITING_NOTOPEN, IDS_RESOURCES_ERR_STRING_NOT_FOUND, IDS_RESOURCES_ERR_STRING_TABLE_INVALID, IDS_MI_CLIENT_MSG, IDS_LOG_MSG_CREATION_DATE, IDS_LOG_MSG_FILE_LOGGER_PATH, IDS_LOG_MSG_VERSION, IDS_LOG_ERR_FILE_LOGGER_DISABLED, IDS_LOG_MEDIUM_ERR_INIT, IDS_LOG_MEDIUM_ERR_WRITE_ANY, IDS_LOG_MEDIUM_ERR_WRITE_MEDIUMFAIL, IDS_MEDIUMFILE_NAME, IDS_MEDIUMFILE_ERR_INVALID_PATH, IDS_MEDIUMFILE_ERR_FILE_HEADER, IDS_MEDIUMFILE_NAME_LOG, IDE_OS_ERR_UNKNOWN, IDE_OS_ERR_RETRIEVING, IDS_DRIVERMGR_DRIVER_ERR_INIT, IDE_MEDIUMSTDERR_NAME, IDE_MEDIUMSTDOUT_NAME, IDE_MI_APP_DESCRIPTION, IDE_MI_APP_INFORMATION, IDE_MI_APP_ARG_USAGE, IDE_MI_APP_ARG_HELP, IDE_MI_APP_ARG_VERSION, IDE_MI_APP_ARG_VERSION_LONG, IDE_MI_APP_ARG_INTERPRETER, IDE_MI_APP_ARG_EXECUTEABLE, IDE_MI_APP_ARG_SOURCE, IDE_MI_APP_ARG_APP_LOG, IDE_MI_APP_ARG_APP_LOG_DIR, IDE_MI_APP_ARG_EXAMPLE, IDE_MI_APP_ARG_EXECUTABLE, IDS_STDIN_ERR_INVALID_PROMPT, IDS_STDIN_ERR_THREAD_CREATION_FAILED, IDS_STDIN_ERR_THREAD_DELETE, IDS_STDIN_ERR_CHKING_BYTE_AVAILABLE, IDS_STDIN_INPUT_CTRL_CHARS, IDS_CMD_QUIT_HELP, IDS_THREADMGR_ERR_THREAD_ID_INVALID, IDS_THREADMGR_ERR_THREAD_FAIL_CREATE, IDS_THREADMGR_ERR_THREAD_ID_NOT_FOUND, IDS_THREADMGR_ERR_THREAD_STILL_ALIVE, IDS_FALLTHRU_DRIVER_CMD_RECEIVED, IDS_CMDFACTORY_ERR_INVALID_CMD_NAME, IDS_CMDFACTORY_ERR_INVALID_CMD_CR8FN, IDS_CMDFACTORY_ERR_CMD_NOT_REGISTERED, IDS_CMDFACTORY_ERR_CMD_ALREADY_REGED, IDS_CMDMGR_ERR_CMD_FAILED_CREATE, IDS_CMDMGR_ERR_CMD_INVOKER, IDS_MI_INIT_ERR_LOG, IDS_MI_INIT_ERR_RESOURCES, IDS_MI_INIT_ERR_INIT, IDS_MI_INIT_ERR_STREAMSTDIN, IDS_MI_INIT_ERR_STREAMSTDIN_OSHANDLER, IDS_MI_INIT_ERR_OS_STDIN_HANDLER, IDS_MI_INIT_ERR_STREAMSTDOUT, IDS_MI_INIT_ERR_STREAMSTDERR, IDS_MI_INIT_ERR_FALLTHRUDRIVER, IDS_MI_INIT_ERR_THREADMGR, IDS_MI_INIT_ERR_CMDINTERPRETER, IDS_MI_INIT_ERR_CMDMGR, IDS_MI_INIT_ERR_CMDFACTORY, IDS_MI_INIT_ERR_CMDINVOKER, IDS_MI_INIT_ERR_CMDMONITOR, IDS_MI_INIT_ERR_LLDBDEBUGGER, IDS_MI_INIT_ERR_DRIVERMGR, IDS_MI_INIT_ERR_DRIVER, IDS_MI_INIT_ERR_OUTOFBANDHANDLER, IDS_MI_INIT_ERR_DEBUGSESSIONINFO, IDS_MI_INIT_ERR_THREADMANAGER, IDS_MI_INIT_ERR_CLIENT_USING_DRIVER, IDS_MI_INIT_ERR_LOCAL_DEBUG_SESSION, IDS_CODE_ERR_INVALID_PARAMETER_VALUE, IDS_CODE_ERR_INVALID_PARAM_NULL_POINTER, IDS_CODE_ERR_INVALID_ENUMERATION_VALUE, IDS_LLDBDEBUGGER_ERR_INVALIDLISTENER, IDS_LLDBDEBUGGER_ERR_INVALIDDEBUGGER, IDS_LLDBDEBUGGER_ERR_CLIENTDRIVER, IDS_LLDBDEBUGGER_ERR_STARTLISTENER, IDS_LLDBDEBUGGER_ERR_THREADCREATIONFAIL, IDS_LLDBDEBUGGER_ERR_THREAD_DELETE, IDS_LLDBDEBUGGER_ERR_INVALIDBROADCASTER, IDS_LLDBDEBUGGER_ERR_INVALIDCLIENTNAME, IDS_LLDBDEBUGGER_ERR_CLIENTNOTREGISTERED, IDS_LLDBDEBUGGER_ERR_STOPLISTENER, IDS_LLDBDEBUGGER_ERR_BROADCASTER_NAME, IDS_LLDBDEBUGGER_WRN_UNKNOWN_EVENT, IDS_LLDBOUTOFBAND_ERR_UNKNOWN_EVENT, IDS_LLDBOUTOFBAND_ERR_PROCESS_INVALID, IDS_LLDBOUTOFBAND_ERR_BRKPT_NOTFOUND, IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_GET, IDS_LLDBOUTOFBAND_ERR_BRKPT_INFO_SET, IDS_LLDBOUTOFBAND_ERR_FORM_MI_RESPONSE, IDS_LLDBOUTOFBAND_ERR_FRAME_INFO_GET, IDS_LLDBOUTOFBAND_ERR_SETNEWDRIVERSTATE, IDS_LLDBOUTOFBAND_ERR_BRKPT_CNT_EXCEEDED, IDS_DBGSESSION_ERR_SHARED_DATA_ADD, IDS_MI_SHTDWN_ERR_LOG, IDS_MI_SHUTDOWN_ERR, IDE_MI_SHTDWN_ERR_RESOURCES, IDE_MI_SHTDWN_ERR_STREAMSTDIN, IDS_MI_SHTDWN_ERR_OS_STDIN_HANDLER, IDS_MI_SHTDWN_ERR_STREAMSTDOUT, IDS_MI_SHTDWN_ERR_STREAMSTDERR, IDS_MI_SHTDWN_ERR_THREADMGR, IDS_MI_SHTDWN_ERR_CMDINTERPRETER, IDS_MI_SHTDWN_ERR_CMDMGR, IDS_MI_SHTDWN_ERR_CMDFACTORY, IDS_MI_SHTDWN_ERR_CMDINVOKER, IDS_MI_SHTDWN_ERR_CMDMONITOR, IDS_MI_SHTDWN_ERR_LLDBDEBUGGER, IDS_MI_SHTDWN_ERR_DRIVERMGR, IDS_MI_SHTDWN_ERR_DRIVER, IDS_MI_SHTDWN_ERR_OUTOFBANDHANDLER, IDS_MI_SHTDWN_ERR_DEBUGSESSIONINFO, IDE_MI_SHTDWN_ERR_THREADMANAGER, IDS_DRIVER_ERR_PARSE_ARGS, IDS_DRIVER_ERR_PARSE_ARGS_UNKNOWN, IDS_DRIVER_ERR_CURRENT_NOT_SET, IDS_DRIVER_ERR_NON_REGISTERED, IDS_DRIVER_SAY_DRIVER_USING, IDS_DRIVER_ERR_ID_INVALID, IDS_DRIVER_ERR_FALLTHRU_DRIVER_ERR, IDS_DRIVER_CMD_RECEIVED, IDS_DRIVER_CMD_NOT_IN_FACTORY, IDS_DRIVER_ERR_DRIVER_STATE_ERROR, IDS_DRIVER_ERR_MAINLOOP, IDS_DRIVER_ERR_LOCAL_DEBUG_NOT_IMPL, IDS_DRIVER_ERR_LOCAL_DEBUG_INIT, IDS_DRIVER_WAITING_STDIN_DATA, IDS_STDERR_ERR_NOT_ALL_DATA_WRITTEN, IDS_CMD_ARGS_ERR_OPTION_NOT_FOUND, IDS_CMD_ARGS_ERR_VALIDATION_MANDATORY, IDS_CMD_ARGS_ERR_VALIDATION_INVALID, IDS_CMD_ARGS_ERR_VALIDATION_MAN_INVALID, IDS_CMD_ARGS_ERR_VALIDATION_MISSING_INF, IDS_CMD_ARGS_ERR_CONTEXT_NOT_ALL_EATTEN, IDS_CMD_ARGS_ERR_PREFIX_MSG, IDS_VARIANT_ERR_USED_BASECLASS, IDS_VARIANT_ERR_MAP_KEY_INVALID, IDS_WORD_INVALIDBRKTS, IDS_WORD_NONE, IDS_WORD_NOT, IDS_WORD_INVALIDEMPTY, IDS_WORD_INVALIDNULLPTR, IDS_WORD_UNKNOWNBRKTS, IDS_WORD_NOT_IMPLEMENTED, IDS_WORD_NOT_IMPLEMENTED_BRKTS, IDS_WORD_UNKNOWNTYPE_BRKTS, IDS_WORD_ERR_MSG_NOT_IMPLEMENTED_BRKTS, IDS_CMD_ERR_N_OPTIONS_REQUIRED, IDS_CMD_ERR_OPTION_NOT_FOUND, IDS_CMD_ERR_ARGS, IDS_CMD_WRN_ARGS_NOT_HANDLED, IDS_CMD_ERR_FNFAILED, IDS_CMD_ERR_SHARED_DATA_NOT_FOUND, IDS_CMD_ERR_LLDBPROCESS_DETACH, IDS_CMD_ERR_LLDBPROCESS_DESTROY, IDS_CMD_ERR_SETWKDIR, IDS_CMD_ERR_INVALID_TARGET, IDS_CMD_ERR_INVALID_TARGET_CURRENT, IDS_CMD_ERR_INVALID_TARGET_TYPE, IDS_CMD_ERR_INVALID_TARGET_PLUGIN, IDS_CMD_ERR_CONNECT_TO_TARGET, IDS_CMD_ERR_INVALID_TARGETPLUGINCURRENT, IDS_CMD_ERR_NOT_IMPLEMENTED, IDS_CMD_ERR_NOT_IMPLEMENTED_DEPRECATED, IDS_CMD_ERR_CREATE_TARGET, IDS_CMD_ERR_BRKPT_LOCATION_FORMAT, IDS_CMD_ERR_BRKPT_LOCATION_NOT_FOUND, IDS_CMD_ERR_BRKPT_INVALID, IDS_CMD_ERR_BRKPT_CNT_EXCEEDED, IDS_CMD_ERR_SOME_ERROR, IDS_CMD_ERR_THREAD_INVALID, IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID, IDS_CMD_ERR_FRAME_INVALID, IDS_CMD_ERR_VARIABLE_DOESNOTEXIST, IDS_CMD_ERR_VARIABLE_ENUM_INVALID, IDS_CMD_ERR_VARIABLE_EXPRESSIONPATH, IDS_CMD_ERR_VARIABLE_CREATION_FAILED, IDS_CMD_ERR_VARIABLE_CHILD_RANGE_INVALID, IDS_CMD_ERR_CMD_RUN_BUT_NO_ACTION, IDS_CMD_ERR_EVENT_HANDLED_BUT_NO_ACTION, IDS_CMD_ERR_DISASM_ADDR_START_INVALID, IDS_CMD_ERR_DISASM_ADDR_END_INVALID, IDS_CMD_ERR_MEMORY_ALLOC_FAILURE, IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK, IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, IDS_CMD_ERR_INVALID_PROCESS, IDS_CMD_ERR_INVALID_PRINT_VALUES, IDS_CMD_ERR_INVALID_LOCATION_FORMAT, IDS_CMD_ERR_INVALID_FORMAT_TYPE, IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND, IDS_CMD_ERR_LLDB_ERR_WRITE_MEM_BYTES, IDS_CMD_ERR_LLDB_ERR_NOT_WRITE_WHOLEBLK, IDS_CMD_ERR_SET_NEW_DRIVER_STATE, IDS_CMD_ERR_INFO_PRINTFN_NOT_FOUND, IDS_CMD_ERR_INFO_PRINTFN_FAILED, IDS_CMD_ERR_GDBSET_OPT_TARGETASYNC, IDS_CMD_ERR_GDBSET_OPT_SOLIBSEARCHPATH, IDS_CMD_ERR_GDBSET_OPT_PRINT_BAD_ARGS, IDS_CMD_ERR_GDBSET_OPT_PRINT_UNKNOWN_OPTION, IDS_CMD_ERR_GDBSHOW_OPT_PRINT_BAD_ARGS, IDS_CMD_ERR_GDBSHOW_OPT_PRINT_UNKNOWN_OPTION, IDS_CMD_ERR_EXPR_INVALID, IDS_CMD_ERR_ATTACH_FAILED, IDS_CMD_ERR_ATTACH_BAD_ARGS }; //++ //============================================================================ // Details: MI common code implementation class. Handle application resources // and locality. // Singleton class. //-- class CMICmnResources : public CMICmnBase, public MI::ISingleton<CMICmnResources> { friend class MI::ISingleton<CMICmnResources>; // Methods: public: bool Initialize() override; bool Shutdown() override; CMIUtilString GetString(const MIuint vResourceId) const; bool HasString(const MIuint vResourceId) const; // Typedef: private: typedef std::map<MIuint, const char *> MapRscrIdToTextData_t; typedef std::pair<MIuint, const char *> MapPairRscrIdToTextData_t; // Enumerations: private: enum Buffer_e { eBufferSize = 2048 }; // Structs: private: struct SRsrcTextData { MIuint id; const char *pTextData; }; // Methods: private: /* ctor */ CMICmnResources(); /* ctor */ CMICmnResources(const CMICmnResources &); void operator=(const CMICmnResources &); bool GetStringFromResource(const MIuint vResourceId, CMIUtilString &vrwResourceString) const; bool ReadResourceStringData(); // Overridden: private: // From CMICmnBase /* dtor */ ~CMICmnResources() override; // Attributes: private: static const SRsrcTextData ms_pResourceId2TextData[]; // MIuint m_nResourceId2TextDataSize; MapRscrIdToTextData_t m_mapRscrIdToTextData; }; //++ ========================================================================= // Details: Macro short cut for retrieving a text data resource //-- #define MIRSRC(x) CMICmnResources::Instance().GetString(x).c_str()
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/CodeGen/builtins-ppc-error.c
// REQUIRES: powerpc-registered-target // RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ // RUN: -triple powerpc64-unknown-unknown -fsyntax-only \ // RUN: -Wall -Werror -verify %s // RUN: %clang_cc1 -faltivec -target-feature +power9-vector \ // RUN: -triple powerpc64le-unknown-unknown -fsyntax-only \ // RUN: -Wall -Werror -verify %s #include <altivec.h> extern vector signed int vsi; extern vector unsigned char vuc; void testInsertWord1(void) { int index = 5; vector unsigned char v1 = vec_insert4b(vsi, vuc, index); // expected-error {{argument to '__builtin_vsx_insertword' must be a constant integer}} vector unsigned long long v2 = vec_extract4b(vuc, index); // expected-error {{argument to '__builtin_vsx_extractuword' must be a constant integer}} }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Modules/Inputs/libc-libcxx/sysroot/usr/include/stddef.h
// stddef.h
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/Linux/PlatformLinux.h
<reponame>Polidea/SiriusObfuscator //===-- PlatformLinux.h -----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_PlatformLinux_h_ #define liblldb_PlatformLinux_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "Plugins/Platform/POSIX/PlatformPOSIX.h" namespace lldb_private { namespace platform_linux { class PlatformLinux : public PlatformPOSIX { public: PlatformLinux(bool is_host); ~PlatformLinux() override; static void DebuggerInitialize(Debugger &debugger); static void Initialize(); static void Terminate(); //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); static ConstString GetPluginNameStatic(bool is_host); static const char *GetPluginDescriptionStatic(bool is_host); ConstString GetPluginName() override; uint32_t GetPluginVersion() override { return 1; } //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ Error ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr) override; const char *GetDescription() override { return GetPluginDescriptionStatic(IsHost()); } void GetStatus(Stream &strm) override; Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, FileSpec &local_file) override; bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override; bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; int32_t GetResumeCountForLaunchInfo(ProcessLaunchInfo &launch_info) override; bool CanDebugProcess() override; lldb::ProcessSP DebugProcess(ProcessLaunchInfo &launch_info, Debugger &debugger, Target *target, Error &error) override; void CalculateTrapHandlerSymbolNames() override; uint64_t ConvertMmapFlagsToPlatform(const ArchSpec &arch, unsigned flags) override; ConstString GetFullNameForDylib(ConstString basename) override; private: DISALLOW_COPY_AND_ASSIGN(PlatformLinux); }; } // namespace platform_linux } // namespace lldb_private #endif // liblldb_PlatformLinux_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Process/Linux/ProcFileReader.h
<gh_stars>100-1000 //===-- ProcFileReader.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ProcFileReader_h_ #define liblldb_ProcFileReader_h_ #include <functional> #include "lldb/lldb-forward.h" #include "lldb/lldb-types.h" namespace lldb_private { namespace process_linux { class ProcFileReader { public: static lldb::DataBufferSP ReadIntoDataBuffer(lldb::pid_t pid, const char *name); /// Parse the /proc/{@a pid}/{@a name} file line by line, passing each line to /// line_parser, until /// either end of file or until line_parser returns false. static Error ProcessLineByLine(lldb::pid_t pid, const char *name, std::function<bool(const std::string &line)> line_parser); }; } // namespace process_linux } // namespace lldb_private #endif // #ifndef liblldb_ProcFileReader_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/crashinfo.c
/****************************************************************************** The LLVM Compiler Infrastructure This file is distributed under the University of Illinois Open Source License. See LICENSE.TXT for details. ****************************************************************************** * This C file vends a simple interface to set the Application Specific Info * on Mac OS X through Python. To use, compile as a dylib, import crashinfo * and call crashinfo.setCrashReporterDescription("hello world") * The testCrashReporterDescription() API is simply there to let you test that this * is doing what it is intended to do without having to actually cons up a crash ******************************************************************************/ #include <Python/Python.h> #include <stdlib.h> #include <string.h> #include <stdio.h> void *__crashreporter_info__ = NULL; asm(".desc ___crashreporter_info__, 0x10"); static PyObject* setCrashReporterDescription(PyObject* self, PyObject* string) { if (__crashreporter_info__) { free(__crashreporter_info__); __crashreporter_info__ = NULL; } if (string && PyString_Check(string)) { Py_ssize_t size = PyString_Size(string); char* data = PyString_AsString(string); if (size > 0 && data) { ++size; // Include the NULL terminateor in allocation and memcpy() __crashreporter_info__ = malloc(size); memcpy(__crashreporter_info__, data, size); return Py_True; } } return Py_False; } static PyObject* testCrashReporterDescription(PyObject*self, PyObject* arg) { int* ptr = 0; *ptr = 1; return Py_None; } static PyMethodDef crashinfo_methods[] = { {"setCrashReporterDescription", setCrashReporterDescription, METH_O}, {"testCrashReporterDescription", testCrashReporterDescription, METH_O}, {NULL, NULL} }; void initcrashinfo() { (void) Py_InitModule("crashinfo", crashinfo_methods); }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Coverage/ast-printing.c
<reponame>Polidea/SiriusObfuscator // RUN: %clang_cc1 -fsyntax-only %s // RUN: %clang_cc1 -ast-print %s -o %t.1.c // RUN: %clang_cc1 -ast-print %t.1.c -o %t.2.c // RUN: diff %t.1.c %t.2.c // RUN: %clang_cc1 -ast-dump %s // RUN: %clang_cc1 -print-decl-contexts %s #include "c-language-features.inc"
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/functionalities/swift-runtime-reporting/abi-v2/library.h
// library.h // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // // ----------------------------------------------------------------------------- // From swift's include/swift/Runtime/Debug.h file. struct RuntimeErrorDetails { uintptr_t version; const char *errorType; const char *currentStackDescription; uintptr_t framesToSkip; void *memoryAddress; struct Thread { const char *description; uint64_t threadID; uintptr_t numFrames; void **frames; }; uintptr_t numExtraThreads; Thread *threads; struct FixIt { const char *filename; uintptr_t startLine; uintptr_t startColumn; uintptr_t endLine; uintptr_t endColumn; const char *replacementText; }; struct Note { const char *description; uintptr_t numFixIts; FixIt *fixIts; }; uintptr_t numFixIts; FixIt *fixIts; uintptr_t numNotes; Note *notes; }; enum: uintptr_t { RuntimeErrorFlagNone = 0, RuntimeErrorFlagFatal = 1 << 0 }; extern "C" void _swift_runtime_on_report(uintptr_t flags, const char *message, RuntimeErrorDetails *details);
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Sema/attr-noescape.c
// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only #if !__has_attribute(noescape) # error "missing noescape attribute" #endif int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}} void foo(__attribute__((noescape)) int *int_ptr, __attribute__((noescape)) int (^block)(int), __attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute ignored on parameter of non-pointer type 'int'}} }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/cmark/src/latex.c
<gh_stars>100-1000 #include <stdlib.h> #include <stdio.h> #include <string.h> #include <assert.h> #include <ctype.h> #include "config.h" #include "cmark.h" #include "node.h" #include "buffer.h" #include "utf8.h" #include "scanners.h" #include "render.h" #define safe_strlen(s) cmark_strbuf_safe_strlen(s) #define OUT(s, wrap, escaping) renderer->out(renderer, s, wrap, escaping) #define LIT(s) renderer->out(renderer, s, false, LITERAL) #define CR() renderer->cr(renderer) #define BLANKLINE() renderer->blankline(renderer) static inline void outc(cmark_renderer *renderer, cmark_escaping escape, int32_t c, unsigned char nextc) { if (escape == LITERAL) { cmark_render_code_point(renderer, c); return; } switch (c) { case 123: // '{' case 125: // '}' case 35: // '#' case 37: // '%' case 38: // '&' cmark_render_ascii(renderer, "\\"); cmark_render_code_point(renderer, c); break; case 36: // '$' case 95: // '_' if (escape == NORMAL) { cmark_render_ascii(renderer, "\\"); } cmark_render_code_point(renderer, c); break; case 45: // '-' if (nextc == 45) { // prevent ligature cmark_render_ascii(renderer, "\\-"); } else { cmark_render_ascii(renderer, "-"); } break; case 126: // '~' if (escape == NORMAL) { cmark_render_ascii(renderer, "\\textasciitilde{}"); } else { cmark_render_code_point(renderer, c); } break; case 94: // '^' cmark_render_ascii(renderer, "\\^{}"); break; case 92: // '\\' if (escape == URL) { // / acts as path sep even on windows: cmark_render_ascii(renderer, "/"); } else { cmark_render_ascii(renderer, "\\textbackslash{}"); } break; case 124: // '|' cmark_render_ascii(renderer, "\\textbar{}"); break; case 60: // '<' cmark_render_ascii(renderer, "\\textless{}"); break; case 62: // '>' cmark_render_ascii(renderer, "\\textgreater{}"); break; case 91: // '[' case 93: // ']' cmark_render_ascii(renderer, "{"); cmark_render_code_point(renderer, c); cmark_render_ascii(renderer, "}"); break; case 34: // '"' cmark_render_ascii(renderer, "\\textquotedbl{}"); // requires \usepackage[T1]{fontenc} break; case 39: // '\'' cmark_render_ascii(renderer, "\\textquotesingle{}"); // requires \usepackage{textcomp} break; case 160: // nbsp cmark_render_ascii(renderer, "~"); break; case 8230: // hellip cmark_render_ascii(renderer, "\\ldots{}"); break; case 8216: // lsquo if (escape == NORMAL) { cmark_render_ascii(renderer, "`"); } else { cmark_render_code_point(renderer, c); } break; case 8217: // rsquo if (escape == NORMAL) { cmark_render_ascii(renderer, "\'"); } else { cmark_render_code_point(renderer, c); } break; case 8220: // ldquo if (escape == NORMAL) { cmark_render_ascii(renderer, "``"); } else { cmark_render_code_point(renderer, c); } break; case 8221: // rdquo if (escape == NORMAL) { cmark_render_ascii(renderer, "''"); } else { cmark_render_code_point(renderer, c); } break; case 8212: // emdash if (escape == NORMAL) { cmark_render_ascii(renderer, "---"); } else { cmark_render_code_point(renderer, c); } break; case 8211: // endash if (escape == NORMAL) { cmark_render_ascii(renderer, "--"); } else { cmark_render_code_point(renderer, c); } break; default: cmark_render_code_point(renderer, c); } } typedef enum { NO_LINK, URL_AUTOLINK, EMAIL_AUTOLINK, NORMAL_LINK } link_type; static link_type get_link_type(cmark_node *node) { size_t title_len, url_len; cmark_node *link_text; char *realurl; int realurllen; bool isemail = false; if (node->type != CMARK_NODE_LINK) { return NO_LINK; } const char *url = cmark_node_get_url(node); cmark_chunk url_chunk = cmark_chunk_literal(url); url_len = safe_strlen(url); if (url_len == 0 || scan_scheme(&url_chunk, 0) == 0) { return NO_LINK; } const char *title = cmark_node_get_title(node); title_len = safe_strlen(title); // if it has a title, we can't treat it as an autolink: if (title_len > 0) { return NORMAL_LINK; } link_text = node->first_child; cmark_consolidate_text_nodes(link_text); realurl = (char *)url; realurllen = url_len; if (strncmp(realurl, "mailto:", 7) == 0) { realurl += 7; realurllen -= 7; isemail = true; } if (realurllen == link_text->as.literal.len && strncmp(realurl, (char *)link_text->as.literal.data, link_text->as.literal.len) == 0) { if (isemail) { return EMAIL_AUTOLINK; } else { return URL_AUTOLINK; } } else { return NORMAL_LINK; } } static int S_get_enumlevel(cmark_node *node) { int enumlevel = 0; cmark_node *tmp = node; while (tmp) { if (tmp->type == CMARK_NODE_LIST && cmark_node_get_list_type(node) == CMARK_ORDERED_LIST) { enumlevel++; } tmp = tmp->parent; } return enumlevel; } static int S_render_node(cmark_renderer *renderer, cmark_node *node, cmark_event_type ev_type, int options) { int list_number; char list_number_string[20]; bool entering = (ev_type == CMARK_EVENT_ENTER); cmark_list_type list_type; const char *roman_numerals[] = {"", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix", "x"}; // avoid warning about unused parameter: (void)(options); switch (node->type) { case CMARK_NODE_DOCUMENT: break; case CMARK_NODE_BLOCK_QUOTE: if (entering) { LIT("\\begin{quote}"); CR(); } else { LIT("\\end{quote}"); BLANKLINE(); } break; case CMARK_NODE_LIST: list_type = cmark_node_get_list_type(node); if (entering) { LIT("\\begin{"); LIT(list_type == CMARK_ORDERED_LIST ? "enumerate" : "itemize"); LIT("}"); CR(); list_number = cmark_node_get_list_start(node); if (list_number > 1) { sprintf(list_number_string, "%d", list_number); LIT("\\setcounter{enum"); LIT((char *)roman_numerals[S_get_enumlevel(node)]); LIT("}{"); OUT(list_number_string, false, NORMAL); LIT("}"); CR(); } } else { LIT("\\end{"); LIT(list_type == CMARK_ORDERED_LIST ? "enumerate" : "itemize"); LIT("}"); BLANKLINE(); } break; case CMARK_NODE_ITEM: if (entering) { LIT("\\item "); } else { CR(); } break; case CMARK_NODE_HEADER: if (entering) { switch (cmark_node_get_header_level(node)) { case 1: LIT("\\section"); break; case 2: LIT("\\subsection"); break; case 3: LIT("\\subsubsection"); break; case 4: LIT("\\paragraph"); break; case 5: LIT("\\subparagraph"); break; } LIT("{"); } else { LIT("}"); BLANKLINE(); } break; case CMARK_NODE_CODE_BLOCK: CR(); LIT("\\begin{verbatim}"); CR(); OUT(cmark_node_get_literal(node), false, LITERAL); CR(); LIT("\\end{verbatim}"); BLANKLINE(); break; case CMARK_NODE_HTML: break; case CMARK_NODE_HRULE: BLANKLINE(); LIT("\\begin{center}\\rule{0.5\\linewidth}{\\linethickness}\\end{center}"); BLANKLINE(); break; case CMARK_NODE_PARAGRAPH: if (!entering) { BLANKLINE(); } break; case CMARK_NODE_TEXT: OUT(cmark_node_get_literal(node), true, NORMAL); break; case CMARK_NODE_LINEBREAK: LIT("\\\\"); CR(); break; case CMARK_NODE_SOFTBREAK: if (renderer->width == 0) { CR(); } else { OUT(" ", true, NORMAL); } break; case CMARK_NODE_CODE: LIT("\\texttt{"); OUT(cmark_node_get_literal(node), false, NORMAL); LIT("}"); break; case CMARK_NODE_INLINE_HTML: break; case CMARK_NODE_STRONG: if (entering) { LIT("\\textbf{"); } else { LIT("}"); } break; case CMARK_NODE_EMPH: if (entering) { LIT("\\emph{"); } else { LIT("}"); } break; case CMARK_NODE_LINK: if (entering) { const char *url = cmark_node_get_url(node); // requires \usepackage{hyperref} switch (get_link_type(node)) { case URL_AUTOLINK: LIT("\\url{"); OUT(url, false, URL); break; case EMAIL_AUTOLINK: LIT("\\href{"); OUT(url, false, URL); LIT("}\\nolinkurl{"); break; case NORMAL_LINK: LIT("\\href{"); OUT(url, false, URL); LIT("}{"); break; case NO_LINK: LIT("{"); // error? } } else { LIT("}"); } break; case CMARK_NODE_IMAGE: if (entering) { LIT("\\protect\\includegraphics{"); // requires \include{graphicx} OUT(cmark_node_get_url(node), false, URL); LIT("}"); return 0; } break; default: assert(false); break; } return 1; } char *cmark_render_latex(cmark_node *root, int options, int width) { return cmark_render(root, options, width, outc, S_render_node); }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/APINotes/yaml-parse-diags.c
// RUN: rm -rf %t // RUN: %clang_cc1 -fsyntax-only -fapinotes -fapinotes-cache-path=%t %s -I %S/Inputs/BrokenHeaders -verify #include "SomeBrokenLib.h" // expected-error@AP<EMAIL>:4{{unknown key 'Nu llabilityOfRet'}}
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserOCaml.h
//===-- DWARFASTParserOCaml.h -----------------------------------*- C++ -*-===// #ifndef SymbolFileDWARF_DWARFASTParserOCaml_h_ #define SymbolFileDWARF_DWARFASTParserOCaml_h_ #include "DWARFASTParser.h" #include "DWARFCompileUnit.h" #include "DWARFDIE.h" #include "DWARFDebugInfo.h" #include "DWARFDefines.h" #include "SymbolFileDWARF.h" #include "lldb/Symbol/OCamlASTContext.h" class DWARFDebugInfoEntry; class DWARFDIECollection; class DWARFASTParserOCaml : public DWARFASTParser { public: DWARFASTParserOCaml(lldb_private::OCamlASTContext &ast); virtual ~DWARFASTParserOCaml(); lldb::TypeSP ParseBaseTypeFromDIE(const DWARFDIE &die); lldb::TypeSP ParseTypeFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die, lldb_private::Log *log, bool *type_is_new_ptr) override; lldb_private::Function * ParseFunctionFromDWARF(const lldb_private::SymbolContext &sc, const DWARFDIE &die) override; bool CompleteTypeFromDWARF(const DWARFDIE &die, lldb_private::Type *type, lldb_private::CompilerType &compiler_type) override { return false; } lldb_private::CompilerDecl GetDeclForUIDFromDWARF(const DWARFDIE &die) override { return lldb_private::CompilerDecl(); } lldb_private::CompilerDeclContext GetDeclContextForUIDFromDWARF(const DWARFDIE &die) override; lldb_private::CompilerDeclContext GetDeclContextContainingUIDFromDWARF(const DWARFDIE &die) override; std::vector<DWARFDIE> GetDIEForDeclContext( lldb_private::CompilerDeclContext decl_context) override { return {}; } protected: lldb_private::OCamlASTContext &m_ast; }; #endif // SymbolFileDWARF_DWARFASTParserOCaml_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Includer.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Includer.h<gh_stars>100-1000 #ifndef Includer_h #define Includer_h #include "swift/Obfuscation/DataStructures.h" #include "swift/Obfuscation/Extractor.h" #include <vector> namespace swift { namespace obfuscation { class Includer { public: virtual ~Includer() = 0; virtual DeclsWithRangesOrErrors include(DeclWithRange &) = 0; }; class NominalTypeIncluder : public Includer { public: DeclsWithRangesOrErrors include(DeclWithRange &) override; }; class FunctionNameIncluder : public Includer { public: DeclsWithRangesOrErrors include(DeclWithRange &) override; }; class OperatorIncluder : public Includer { OperatorExtractor Extractor; public: OperatorIncluder(OperatorExtractor &); DeclsWithRangesOrErrors include(DeclWithRange &) override; }; class FunctionParametersIncluder : public Includer { private: ParameterExtractor Extractor; public: FunctionParametersIncluder(ParameterExtractor &); DeclsWithRangesOrErrors include(DeclWithRange &) override; }; class VariableIncluder : public Includer { private: VariableExtractor Extractor; public: VariableIncluder(VariableExtractor &); DeclsWithRangesOrErrors include(DeclWithRange &) override; }; } //namespace obfuscation } //namespace swift #endif /* Includer_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/include/clang/Index/IndexDataStore.h
//===--- IndexDataStore.h - Index data store info -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_INDEX_INDEXDATASTORE_H #define LLVM_CLANG_INDEX_INDEXDATASTORE_H #include "clang/Basic/LLVM.h" #include "llvm/ADT/ArrayRef.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/STLExtras.h" #include <functional> #include <memory> #include <string> #include <vector> namespace clang { namespace index { class AbstractDirectoryWatcher { public: enum class EventKind { /// A file was added. Added, /// A file was removed. Removed, /// A file was modified. Modified, /// The watched directory got deleted. No more events will follow. DirectoryDeleted, }; struct Event { EventKind Kind; std::string Filename; timespec ModTime; }; typedef std::function<void(ArrayRef<Event> Events, bool isInitial)> EventReceiver; typedef std::unique_ptr<AbstractDirectoryWatcher>(CreateFnTy) (StringRef Path, EventReceiver Receiver, bool waitInitialSync, std::string &Error); virtual ~AbstractDirectoryWatcher() {} }; class IndexDataStore { public: ~IndexDataStore(); static std::unique_ptr<IndexDataStore> create(StringRef IndexStorePath, std::string &Error); StringRef getFilePath() const; bool foreachUnitName(bool sorted, llvm::function_ref<bool(StringRef unitName)> receiver); static unsigned getFormatVersion(); enum class UnitEventKind { Added, Removed, Modified, /// The directory got deleted. No more events will follow. DirectoryDeleted, }; struct UnitEvent { UnitEventKind Kind; StringRef UnitName; timespec ModTime; }; struct UnitEventNotification { bool IsInitial; ArrayRef<UnitEvent> Events; }; typedef std::function<void(UnitEventNotification)> UnitEventHandler; void setUnitEventHandler(UnitEventHandler Handler); /// \returns true if an error occurred. bool startEventListening(llvm::function_ref<AbstractDirectoryWatcher::CreateFnTy> createFn, bool waitInitialSync, std::string &Error); void stopEventListening(); void discardUnit(StringRef UnitName); void discardRecord(StringRef RecordName); void purgeStaleData(); private: IndexDataStore(void *Impl) : Impl(Impl) {} void *Impl; // An IndexDataStoreImpl. }; } // namespace index } // namespace clang #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/windows/LockFileWindows.h
//===-- LockFileWindows.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Host_posix_LockFileWindows_h_ #define liblldb_Host_posix_LockFileWindows_h_ #include "lldb/Host/LockFileBase.h" #include "lldb/Host/windows/windows.h" namespace lldb_private { class LockFileWindows : public LockFileBase { public: explicit LockFileWindows(int fd); ~LockFileWindows(); protected: Error DoWriteLock(const uint64_t start, const uint64_t len) override; Error DoTryWriteLock(const uint64_t start, const uint64_t len) override; Error DoReadLock(const uint64_t start, const uint64_t len) override; Error DoTryReadLock(const uint64_t start, const uint64_t len) override; Error DoUnlock() override; bool IsValidFile() const override; private: HANDLE m_file; }; } // namespace lldb_private #endif // liblldb_Host_posix_LockFileWindows_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/include/clang/APINotes/APINotesYAMLCompiler.h
//=== APINotesYAMLCompiler.h - API Notes YAML to binary compiler *- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This file reads sidecar API notes specified in YAML format. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_API_NOTES_YAML_COMPILER_H #define LLVM_CLANG_API_NOTES_YAML_COMPILER_H #include "llvm/ADT/StringRef.h" #include "llvm/Support/SourceMgr.h" #include <memory> namespace llvm { class raw_ostream; class MemoryBuffer; } namespace clang { class FileEntry; namespace api_notes { enum class ActionType { None, YAMLToBinary, BinaryToYAML, Dump, }; enum class OSType { OSX, IOS, TvOS, WatchOS, Absent }; /// Converts API notes from YAML format to binary format. bool compileAPINotes(llvm::StringRef yamlInput, const FileEntry *sourceFile, llvm::raw_ostream &os, OSType targetOS, llvm::SourceMgr::DiagHandlerTy diagHandler = nullptr, void *diagHandlerCtxt = nullptr); bool parseAndDumpAPINotes(llvm::StringRef yamlInput); /// Converts API notes from the compiled binary format to the YAML format. bool decompileAPINotes(std::unique_ptr<llvm::MemoryBuffer> input, llvm::raw_ostream &os); } // end namespace api_notes } // end namespace clang #endif // LLVM_CLANG_API_NOTES_YAML_COMPILER_H
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/StreamCallback.h
//===-- StreamCallback.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_StreamCallback_h_ #define liblldb_StreamCallback_h_ #include <mutex> #include <string> #include "lldb/Core/Stream.h" #include "lldb/Core/StreamString.h" namespace lldb_private { class StreamCallback : public Stream { public: StreamCallback(lldb::LogOutputCallback callback, void *baton); ~StreamCallback() override; void Flush() override; size_t Write(const void *src, size_t src_len) override; private: typedef std::map<lldb::tid_t, StreamString> collection; lldb::LogOutputCallback m_callback; void *m_baton; collection m_accumulated_data; std::mutex m_collection_mutex; StreamString &FindStreamForThread(lldb::tid_t cur_tid); }; } // namespace lldb_private #endif // liblldb_StreamCallback_h
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/linux/Uio.h
//===-- Uio.h ---------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Host_linux_Uio_h_ #define liblldb_Host_linux_Uio_h_ #include <sys/uio.h> // We shall provide our own implementation of process_vm_readv if it is not // present #ifndef HAVE_PROCESS_VM_READV ssize_t process_vm_readv(::pid_t pid, const struct iovec *local_iov, unsigned long liovcnt, const struct iovec *remote_iov, unsigned long riovcnt, unsigned long flags); #endif #endif // liblldb_Host_linux_Uio_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Symbol/UnwindTable.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Symbol/UnwindTable.h //===-- Symtab.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_UnwindTable_h #define liblldb_UnwindTable_h #include <map> #include <mutex> #include "lldb/lldb-private.h" namespace lldb_private { // A class which holds all the FuncUnwinders objects for a given ObjectFile. // The UnwindTable is populated with FuncUnwinders objects lazily during // the debug session. class UnwindTable { public: UnwindTable(ObjectFile &objfile); ~UnwindTable(); lldb_private::DWARFCallFrameInfo *GetEHFrameInfo(); lldb_private::CompactUnwindInfo *GetCompactUnwindInfo(); ArmUnwindInfo *GetArmUnwindInfo(); lldb::FuncUnwindersSP GetFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc); bool GetAllowAssemblyEmulationUnwindPlans(); // Normally when we create a new FuncUnwinders object we track it in this // UnwindTable so it can // be reused later. But for the target modules show-unwind we want to create // brand new // UnwindPlans for the function of interest - so ignore any existing // FuncUnwinders for that // function and don't add this new one to our UnwindTable. // This FuncUnwinders object does have a reference to the UnwindTable but the // lifetime of this // uncached FuncUnwinders is expected to be short so in practice this will not // be a problem. lldb::FuncUnwindersSP GetUncachedFuncUnwindersContainingAddress(const Address &addr, SymbolContext &sc); bool GetArchitecture(lldb_private::ArchSpec &arch); private: void Dump(Stream &s); void Initialize(); typedef std::map<lldb::addr_t, lldb::FuncUnwindersSP> collection; typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; ObjectFile &m_object_file; collection m_unwinds; bool m_initialized; // delay some initialization until ObjectFile is set up std::mutex m_mutex; std::unique_ptr<DWARFCallFrameInfo> m_eh_frame_up; std::unique_ptr<CompactUnwindInfo> m_compact_unwind_up; std::unique_ptr<ArmUnwindInfo> m_arm_unwind_up; DISALLOW_COPY_AND_ASSIGN(UnwindTable); }; } // namespace lldb_private #endif // liblldb_UnwindTable_h
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Target/DynamicLoader.h
//===-- DynamicLoader.h -----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_DynamicLoader_h_ #define liblldb_DynamicLoader_h_ // Project includes #include "lldb/Core/Error.h" #include "lldb/Core/PluginInterface.h" #include "lldb/Core/UUID.h" #include "lldb/lldb-private.h" namespace lldb_private { //---------------------------------------------------------------------- /// @class DynamicLoader DynamicLoader.h "lldb/Target/DynamicLoader.h" /// @brief A plug-in interface definition class for dynamic loaders. /// /// Dynamic loader plug-ins track image (shared library) loading and /// unloading. The class is initialized given a live process that is /// halted at its entry point or just after attaching. /// /// Dynamic loader plug-ins can track the process by registering /// callbacks using the: /// Process::RegisterNotificationCallbacks (const Notifications&) /// function. /// /// Breakpoints can also be set in the process which can register /// functions that get called using: /// Process::BreakpointSetCallback (lldb::user_id_t, BreakpointHitCallback, void /// *). /// These breakpoint callbacks return a boolean value that indicates if /// the process should continue or halt and should return the global /// setting for this using: /// DynamicLoader::StopWhenImagesChange() const. //---------------------------------------------------------------------- class DynamicLoader : public PluginInterface { public: //------------------------------------------------------------------ /// Find a dynamic loader plugin for a given process. /// /// Scans the installed DynamicLoader plug-ins and tries to find /// an instance that can be used to track image changes in \a /// process. /// /// @param[in] process /// The process for which to try and locate a dynamic loader /// plug-in instance. /// /// @param[in] plugin_name /// An optional name of a specific dynamic loader plug-in that /// should be used. If NULL, pick the best plug-in. //------------------------------------------------------------------ static DynamicLoader *FindPlugin(Process *process, const char *plugin_name); //------------------------------------------------------------------ /// Construct with a process. //------------------------------------------------------------------ DynamicLoader(Process *process); //------------------------------------------------------------------ /// Destructor. /// /// The destructor is virtual since this class is designed to be /// inherited from by the plug-in instance. //------------------------------------------------------------------ virtual ~DynamicLoader() override; //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ virtual void DidAttach() = 0; //------------------------------------------------------------------ /// Called after launching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// the process has stopped for the first time on launch. //------------------------------------------------------------------ virtual void DidLaunch() = 0; //------------------------------------------------------------------ /// Helper function that can be used to detect when a process has /// called exec and is now a new and different process. This can /// be called when necessary to try and detect the exec. The process /// might be able to answer this question, but sometimes it might /// not be able and the dynamic loader often knows what the program /// entry point is. So the process and the dynamic loader can work /// together to detect this. //------------------------------------------------------------------ virtual bool ProcessDidExec() { return false; } //------------------------------------------------------------------ /// Get whether the process should stop when images change. /// /// When images (executables and shared libraries) get loaded or /// unloaded, often debug sessions will want to try and resolve or /// unresolve breakpoints that are set in these images. Any /// breakpoints set by DynamicLoader plug-in instances should /// return this value to ensure consistent debug session behaviour. /// /// @return /// Returns \b true if the process should stop when images /// change, \b false if the process should resume. //------------------------------------------------------------------ bool GetStopWhenImagesChange() const; //------------------------------------------------------------------ /// Set whether the process should stop when images change. /// /// When images (executables and shared libraries) get loaded or /// unloaded, often debug sessions will want to try and resolve or /// unresolve breakpoints that are set in these images. The default /// is set so that the process stops when images change, but this /// can be overridden using this function callback. /// /// @param[in] stop /// Boolean value that indicates whether the process should stop /// when images change. //------------------------------------------------------------------ void SetStopWhenImagesChange(bool stop); //------------------------------------------------------------------ /// Provides a plan to step through the dynamic loader trampoline /// for the current state of \a thread. /// /// /// @param[in] stop_others /// Whether the plan should be set to stop other threads. /// /// @return /// A pointer to the plan (caller owned) or NULL if we are not at such /// a trampoline. //------------------------------------------------------------------ virtual lldb::ThreadPlanSP GetStepThroughTrampolinePlan(Thread &thread, bool stop_others) = 0; //------------------------------------------------------------------ /// Some dynamic loaders provide features where there are a group of symbols /// "equivalent to" /// a given symbol one of which will be chosen when the symbol is bound. If /// you want to /// set a breakpoint on one of these symbols, you really need to set it on all /// the /// equivalent symbols. /// /// /// @param[in] original_symbol /// The symbol for which we are finding equivalences. /// /// @param[in] module_list /// The set of modules in which to search. /// /// @param[out] equivalent_symbols /// The equivalent symbol list - any equivalent symbols found are appended /// to this list. /// /// @return /// Number of equivalent symbols found. //------------------------------------------------------------------ virtual size_t FindEquivalentSymbols(Symbol *original_symbol, ModuleList &module_list, SymbolContextList &equivalent_symbols) { return 0; } //------------------------------------------------------------------ /// Ask if it is ok to try and load or unload an shared library /// (image). /// /// The dynamic loader often knows when it would be ok to try and /// load or unload a shared library. This function call allows the /// dynamic loader plug-ins to check any current dyld state to make /// sure it is an ok time to load a shared library. /// /// @return /// \b true if it is currently ok to try and load a shared /// library into the process, \b false otherwise. //------------------------------------------------------------------ virtual Error CanLoadImage() = 0; //------------------------------------------------------------------ /// Ask if the eh_frame information for the given SymbolContext should /// be relied on even when it's the first frame in a stack unwind. /// /// The CFI instructions from the eh_frame section are normally only /// valid at call sites -- places where a program could throw an /// exception and need to unwind out. But some Modules may be known /// to the system as having reliable eh_frame information at all call /// sites. This would be the case if the Module's contents are largely /// hand-written assembly with hand-written eh_frame information. /// Normally when unwinding from a function at the beginning of a stack /// unwind lldb will examine the assembly instructions to understand /// how the stack frame is set up and where saved registers are stored. /// But with hand-written assembly this is not reliable enough -- we need /// to consult those function's hand-written eh_frame information. /// /// @return /// \b True if the symbol context should use eh_frame instructions /// unconditionally when unwinding from this frame. Else \b false, /// the normal lldb unwind behavior of only using eh_frame when the /// function appears in the middle of the stack. //------------------------------------------------------------------ virtual bool AlwaysRelyOnEHUnwindInfo(SymbolContext &sym_ctx) { return false; } //------------------------------------------------------------------ /// Retrieves the per-module TLS block for a given thread. /// /// @param[in] module /// The module to query TLS data for. /// /// @param[in] thread /// The specific thread to query TLS data for. /// /// @return /// If the given thread has TLS data allocated for the /// module, the address of the TLS block. Otherwise /// LLDB_INVALID_ADDRESS is returned. //------------------------------------------------------------------ virtual lldb::addr_t GetThreadLocalData(const lldb::ModuleSP module, const lldb::ThreadSP thread, lldb::addr_t tls_file_addr) { return LLDB_INVALID_ADDRESS; } /// Locates or creates a module given by @p file and updates/loads the /// resulting module at the virtual base address @p base_addr. virtual lldb::ModuleSP LoadModuleAtAddress(const lldb_private::FileSpec &file, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset); //------------------------------------------------------------------ /// Get information about the shared cache for a process, if possible. /// /// On some systems (e.g. Darwin based systems), a set of libraries /// that are common to most processes may be put in a single region /// of memory and mapped into every process, this is called the /// shared cache, as a performance optimization. /// /// Many targets will not have the concept of a shared cache. /// /// Depending on how the DynamicLoader gathers information about the /// shared cache, it may be able to only return basic information - /// like the UUID of the cache - or it may be able to return additional /// information about the cache. /// /// @param[out] base_address /// The base address (load address) of the shared cache. /// LLDB_INVALID_ADDRESS if it cannot be determined. /// /// @param[out] uuid /// The UUID of the shared cache, if it can be determined. /// If the UUID cannot be fetched, IsValid() will be false. /// /// @param[out] using_shared_cache /// If this process is using a shared cache. /// If unknown, eLazyBoolCalculate is returned. /// /// @param[out] private_shared_cache /// A LazyBool indicating whether this process is using a /// private shared cache. /// If this information cannot be fetched, eLazyBoolCalculate. /// /// @return /// Returns false if this DynamicLoader cannot gather information /// about the shared cache / has no concept of a shared cache. //------------------------------------------------------------------ virtual bool GetSharedCacheInformation(lldb::addr_t &base_address, UUID &uuid, LazyBool &using_shared_cache, LazyBool &private_shared_cache) { base_address = LLDB_INVALID_ADDRESS; uuid.Clear(); using_shared_cache = eLazyBoolCalculate; private_shared_cache = eLazyBoolCalculate; return false; } protected: //------------------------------------------------------------------ // Utility methods for derived classes //------------------------------------------------------------------ /// Checks to see if the target module has changed, updates the target /// accordingly and returns the target executable module. lldb::ModuleSP GetTargetExecutable(); /// Updates the load address of every allocatable section in @p module. /// /// @param module The module to traverse. /// /// @param link_map_addr The virtual address of the link map for the @p /// module. /// /// @param base_addr The virtual base address @p module is loaded at. virtual void UpdateLoadedSections(lldb::ModuleSP module, lldb::addr_t link_map_addr, lldb::addr_t base_addr, bool base_addr_is_offset); // Utility method so base classes can share implementation of // UpdateLoadedSections void UpdateLoadedSectionsCommon(lldb::ModuleSP module, lldb::addr_t base_addr, bool base_addr_is_offset); /// Removes the loaded sections from the target in @p module. /// /// @param module The module to traverse. virtual void UnloadSections(const lldb::ModuleSP module); // Utility method so base classes can share implementation of UnloadSections void UnloadSectionsCommon(const lldb::ModuleSP module); const lldb_private::SectionList * GetSectionListFromModule(const lldb::ModuleSP module) const; // Read an unsigned int of the given size from memory at the given addr. // Return -1 if the read fails, otherwise return the result as an int64_t. int64_t ReadUnsignedIntWithSizeInBytes(lldb::addr_t addr, int size_in_bytes); // Read a pointer from memory at the given addr. // Return LLDB_INVALID_ADDRESS if the read fails. lldb::addr_t ReadPointer(lldb::addr_t addr); // Calls into the Process protected method LoadOperatingSystemPlugin: void LoadOperatingSystemPlugin(bool flush); //------------------------------------------------------------------ // Member variables. //------------------------------------------------------------------ Process *m_process; ///< The process that this dynamic loader plug-in is tracking. private: DISALLOW_COPY_AND_ASSIGN(DynamicLoader); }; } // namespace lldb_private #endif // liblldb_DynamicLoader_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/SymbolsWalkerAndCollector.h
#ifndef SourceFileWalker_h #define SourceFileWalker_h #include "swift/Frontend/Frontend.h" #include "swift/Obfuscation/DataStructures.h" #include "swift/Obfuscation/Collector.h" #include "swift/Obfuscation/Excluder.h" #include "swift/Obfuscation/GlobalCollectedSymbolsUpdater.h" #include "swift/Obfuscation/Processor.h" #include <set> namespace swift { namespace obfuscation { class SymbolsWalkerAndCollector : public SourceEntityWalker { private: static int SymbolIndex; GlobalCollectedSymbols Symbols; std::set<std::unique_ptr<Processor>> &Processors; std::vector<std::unique_ptr<Collector>> &Collectors; std::set<std::unique_ptr<Excluder>> &Excluders; std::set<std::unique_ptr<GlobalCollectedSymbolsUpdater>> &Updaters; bool walkToExprPre(Expr *) override; void identifyExcludedSymbols(DeclWithSymbolWithRange &); void handleDeclWithRange(DeclWithRange &); bool walkToDeclPre(Decl *, CharSourceRange) override; void handleWhereClausesIfNeeded(const std::vector<Decl*> &&); bool visitDeclReference(ValueDecl *, CharSourceRange, TypeDecl *, ExtensionDecl *, Type, ReferenceMetaData) override; void handleSymbol(const DeclWithSymbolWithRange &); GlobalCollectedSymbols collectSymbols(); protected: SymbolsWalkerAndCollector(std::set<std::unique_ptr<Processor>> &, std::vector<std::unique_ptr<Collector>> &, std::set<std::unique_ptr<Excluder>> &, std::set<std::unique_ptr<GlobalCollectedSymbolsUpdater>> &); friend class SymbolsWalkerAndCollectorFactory; public: GlobalCollectedSymbols walkAndCollectSymbols(SourceFile &SourceFile); }; class SymbolsWalkerAndCollectorFactory { private: std::set<std::unique_ptr<Processor>> Processors; std::vector<std::unique_ptr<Collector>> Collectors; NominalTypeExtractor NominalTypeExtractor; std::set<std::unique_ptr<Excluder>> Excluders; std::set<std::unique_ptr<GlobalCollectedSymbolsUpdater>> Updaters; public: SymbolsWalkerAndCollectorFactory(); SymbolsWalkerAndCollectorFactory(ObfuscationConfiguration &&); SymbolsWalkerAndCollector symbolsWalkerAndCollector(); }; } //namespace obfuscation } //namespace swift #endif /* SourceFileWalker_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/AddressResolverFileLine.h
<gh_stars>100-1000 //===-- AddressResolverFileLine.h -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_AddressResolverFileLine_h_ #define liblldb_AddressResolverFileLine_h_ // Project includes #include "lldb/Core/AddressResolver.h" namespace lldb_private { //---------------------------------------------------------------------- /// @class AddressResolverFileLine AddressResolverFileLine.h /// "lldb/Core/AddressResolverFileLine.h" /// @brief This class finds address for source file and line. Optionally, it /// will look for inlined /// instances of the file and line specification. //---------------------------------------------------------------------- class AddressResolverFileLine : public AddressResolver { public: AddressResolverFileLine(const FileSpec &resolver, uint32_t line_no, bool check_inlines); ~AddressResolverFileLine() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, SymbolContext &context, Address *addr, bool containing) override; Searcher::Depth GetDepth() override; void GetDescription(Stream *s) override; protected: FileSpec m_file_spec; // This is the file spec we are looking for. uint32_t m_line_number; // This is the line number that we are looking for. bool m_inlines; // This determines whether the resolver looks for inlined // functions or not. private: DISALLOW_COPY_AND_ASSIGN(AddressResolverFileLine); }; } // namespace lldb_private #endif // liblldb_AddressResolverFileLine_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/common/NativeBreakpointList.h
//===-- NativeBreakpointList.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_NativeBreakpointList_h_ #define liblldb_NativeBreakpointList_h_ #include "lldb/Core/Error.h" #include "lldb/lldb-private-forward.h" // #include "lldb/Host/NativeBreakpoint.h" #include <functional> #include <map> #include <mutex> namespace lldb_private { class NativeBreakpointList { public: typedef std::function<Error(lldb::addr_t addr, size_t size_hint, bool hardware, NativeBreakpointSP &breakpoint_sp)> CreateBreakpointFunc; NativeBreakpointList(); Error AddRef(lldb::addr_t addr, size_t size_hint, bool hardware, CreateBreakpointFunc create_func); Error DecRef(lldb::addr_t addr); Error EnableBreakpoint(lldb::addr_t addr); Error DisableBreakpoint(lldb::addr_t addr); Error GetBreakpoint(lldb::addr_t addr, NativeBreakpointSP &breakpoint_sp); Error RemoveTrapsFromBuffer(lldb::addr_t addr, void *buf, size_t size) const; private: typedef std::map<lldb::addr_t, NativeBreakpointSP> BreakpointMap; std::recursive_mutex m_mutex; BreakpointMap m_breakpoints; }; } #endif // ifndef liblldb_NativeBreakpointList_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/swift/repl_in_c/main.c
<gh_stars>100-1000 // main.c // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // // ----------------------------------------------------------------------------- int main() { return 0; //% self.expect("repl", error=True, substrs=["Swift standard library"]) //% self.runCmd("kill") //% self.expect("repl", error=True, substrs=["running process"]) }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/Extractor.h
#ifndef Extractor_h #define Extractor_h #include "swift/Frontend/Frontend.h" #include "swift/Obfuscation/DataStructures.h" #include <string> #include <vector> namespace swift { namespace obfuscation { using ModuleNameAndParts = std::pair<std::string, std::vector<std::string>>; using ClassDeclarationsWithModules = std::vector<std::pair<const ClassDecl*, std::string>>; using ProtocolDeclarationsWithModules = std::set<std::pair<const ProtocolDecl*, std::string>>; class Extractor { private: template<class T> const T* findRecursivelyBaseOverridenDeclarationWithModules(const T *Declaration, std::set<std::string> &Modules); protected: template<class T> std::pair<const T*, std::set<std::string>> getBaseOverridenDeclarationWithModules(const T *Declaration); public: virtual ~Extractor() = 0; virtual std::string moduleName(const Decl *); virtual ModuleNameAndParts moduleNameAndIdentifierParts(const Decl *); std::string declarationName(const ValueDecl* Declaration); llvm::Expected<std::string> enclosingTypeName(const Decl* Declaration); std::string typeName(const NominalTypeDecl *); bool isOverriddenMethodFromTheSameModule(const std::set<std::string> &Modules, const std::string &OriginModuleName); llvm::Expected<std::vector<std::string>> nominalTypeIdentifierParts(const NominalTypeDecl *, const std::string &); }; class NominalTypeExtractor : public Extractor { private: ClassDeclarationsWithModules findRecursivelySuperClassDeclarationsWithModules(const ClassDecl *, ClassDeclarationsWithModules &); void findRecursivelyConformingProtocolDeclarationsWithModules(const NominalTypeDecl *, ProtocolDeclarationsWithModules &); public: ProtocolDeclarationsWithModules getConformingProtocolDeclarationsWithModules(const NominalTypeDecl *); ClassDeclarationsWithModules getSuperClassDeclarationsWithModules(const ClassDecl *); std::string symbolName(const NominalTypeDecl *); }; class FunctionExtractor : public Extractor { private: void extractSignaturePart(const Type &Result, llvm::raw_string_ostream &StringStream, std::string Fallback); std::string extractSignature(const AbstractFunctionDecl *Declaration, std::string Fallback); public: ModuleNameAndParts functionIdentifierParts(const AbstractFunctionDecl *Declaration); std::vector<ValueDecl*> satisfiedProtocolOptionalRequirements(const AbstractFunctionDecl* Declaration); std::vector<ValueDecl*> satisfiedProtocolRequirements(const AbstractFunctionDecl* Declaration); std::string functionName(const AbstractFunctionDecl *); std::string functionSignature(const AbstractFunctionDecl *Declaration); std::pair<const FuncDecl*, std::set<std::string>> getBaseOverridenDeclarationWithModules(const FuncDecl *Declaration); }; class OperatorExtractor : public Extractor { public: std::string operatorName(const OperatorDecl *); }; class ParameterExtractor : public Extractor { private: bool isMemberwiseConstructor(const ConstructorDecl*); public: bool isMemberwiseConstructorParameter(const ParamDecl*); std::string externalParameterName(const ParamDecl *); std::string internalParameterName(const ParamDecl *); std::pair<const AbstractFunctionDecl*, std::set<std::string>> getBaseOverridenDeclarationWithModules(const AbstractFunctionDecl *); std::vector<DeclWithRange> parametersFrom(const AbstractFunctionDecl *); llvm::Expected<std::string> parameterNameForCallSite(ParamDecl *); }; class VariableExtractor : public Extractor { public: std::pair<const VarDecl*, std::set<std::string>> getBaseOverridenDeclarationWithModules(const VarDecl *Declaration); llvm::Expected<ModuleNameAndParts> variableIdentifierPartsFromContext(const VarDecl *Declaration); }; class TypeRepresentationExtractor : public Extractor { private: llvm::Optional<DeclWithRange> handleComponent(ComponentIdentTypeRepr *Component); void handleTypeRepresentationRecursively(std::vector<llvm::Optional<DeclWithRange>> &Declarations, TypeRepr *ParentOfTypeRepresentation, TypeRepr *TypeRepresentation); public: std::vector<DeclWithRange> declarationsFromTypeRepresentation(TypeRepr *); }; } //namespace obfuscation } //namespace swift #endif /* Extractor_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/common/NativeProcessProtocol.h
<reponame>Polidea/SiriusObfuscator //===-- NativeProcessProtocol.h ---------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_NativeProcessProtocol_h_ #define liblldb_NativeProcessProtocol_h_ #include <mutex> #include <vector> #include "lldb/Core/Error.h" #include "lldb/Host/MainLoop.h" #include "lldb/lldb-private-forward.h" #include "lldb/lldb-types.h" #include "llvm/ADT/StringRef.h" #include "NativeBreakpointList.h" #include "NativeWatchpointList.h" namespace lldb_private { class MemoryRegionInfo; class ResumeActionList; //------------------------------------------------------------------ // NativeProcessProtocol //------------------------------------------------------------------ class NativeProcessProtocol : public std::enable_shared_from_this<NativeProcessProtocol> { friend class SoftwareBreakpoint; public: virtual ~NativeProcessProtocol() {} virtual Error Resume(const ResumeActionList &resume_actions) = 0; virtual Error Halt() = 0; virtual Error Detach() = 0; //------------------------------------------------------------------ /// Sends a process a UNIX signal \a signal. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error Signal(int signo) = 0; //------------------------------------------------------------------ /// Tells a process to interrupt all operations as if by a Ctrl-C. /// /// The default implementation will send a local host's equivalent of /// a SIGSTOP to the process via the NativeProcessProtocol::Signal() /// operation. /// /// @return /// Returns an error object. //------------------------------------------------------------------ virtual Error Interrupt(); virtual Error Kill() = 0; //---------------------------------------------------------------------- // Memory and memory region functions //---------------------------------------------------------------------- virtual Error GetMemoryRegionInfo(lldb::addr_t load_addr, MemoryRegionInfo &range_info); virtual Error ReadMemory(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0; virtual Error ReadMemoryWithoutTrap(lldb::addr_t addr, void *buf, size_t size, size_t &bytes_read) = 0; virtual Error WriteMemory(lldb::addr_t addr, const void *buf, size_t size, size_t &bytes_written) = 0; virtual Error AllocateMemory(size_t size, uint32_t permissions, lldb::addr_t &addr) = 0; virtual Error DeallocateMemory(lldb::addr_t addr) = 0; virtual lldb::addr_t GetSharedLibraryInfoAddress() = 0; virtual bool IsAlive() const; virtual size_t UpdateThreads() = 0; virtual bool GetArchitecture(ArchSpec &arch) const = 0; //---------------------------------------------------------------------- // Breakpoint functions //---------------------------------------------------------------------- virtual Error SetBreakpoint(lldb::addr_t addr, uint32_t size, bool hardware) = 0; virtual Error RemoveBreakpoint(lldb::addr_t addr); virtual Error EnableBreakpoint(lldb::addr_t addr); virtual Error DisableBreakpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Watchpoint functions //---------------------------------------------------------------------- virtual const NativeWatchpointList::WatchpointMap &GetWatchpointMap() const; virtual uint32_t GetMaxWatchpoints() const; virtual Error SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware); virtual Error RemoveWatchpoint(lldb::addr_t addr); //---------------------------------------------------------------------- // Accessors //---------------------------------------------------------------------- lldb::pid_t GetID() const { return m_pid; } lldb::StateType GetState() const; bool IsRunning() const { return m_state == lldb::eStateRunning || IsStepping(); } bool IsStepping() const { return m_state == lldb::eStateStepping; } bool CanResume() const { return m_state == lldb::eStateStopped; } bool GetByteOrder(lldb::ByteOrder &byte_order) const; //---------------------------------------------------------------------- // Exit Status //---------------------------------------------------------------------- virtual bool GetExitStatus(lldb_private::ExitType *exit_type, int *status, std::string &exit_description); virtual bool SetExitStatus(lldb_private::ExitType exit_type, int status, const char *exit_description, bool bNotifyStateChange); //---------------------------------------------------------------------- // Access to threads //---------------------------------------------------------------------- NativeThreadProtocolSP GetThreadAtIndex(uint32_t idx); NativeThreadProtocolSP GetThreadByID(lldb::tid_t tid); void SetCurrentThreadID(lldb::tid_t tid) { m_current_thread_id = tid; } lldb::tid_t GetCurrentThreadID() { return m_current_thread_id; } NativeThreadProtocolSP GetCurrentThread() { return GetThreadByID(m_current_thread_id); } //---------------------------------------------------------------------- // Access to inferior stdio //---------------------------------------------------------------------- virtual int GetTerminalFileDescriptor() { return m_terminal_fd; } //---------------------------------------------------------------------- // Stop id interface //---------------------------------------------------------------------- uint32_t GetStopID() const; // --------------------------------------------------------------------- // Callbacks for low-level process state changes // --------------------------------------------------------------------- class NativeDelegate { public: virtual ~NativeDelegate() {} virtual void InitializeDelegate(NativeProcessProtocol *process) = 0; virtual void ProcessStateChanged(NativeProcessProtocol *process, lldb::StateType state) = 0; virtual void DidExec(NativeProcessProtocol *process) = 0; }; //------------------------------------------------------------------ /// Register a native delegate. /// /// Clients can register nofication callbacks by passing in a /// NativeDelegate impl and passing it into this function. /// /// Note: it is required that the lifetime of the /// native_delegate outlive the NativeProcessProtocol. /// /// @param[in] native_delegate /// A NativeDelegate impl to be called when certain events /// happen within the NativeProcessProtocol or related threads. /// /// @return /// true if the delegate was registered successfully; /// false if the delegate was already registered. /// /// @see NativeProcessProtocol::NativeDelegate. //------------------------------------------------------------------ bool RegisterNativeDelegate(NativeDelegate &native_delegate); //------------------------------------------------------------------ /// Unregister a native delegate previously registered. /// /// @param[in] native_delegate /// A NativeDelegate impl previously registered with this process. /// /// @return Returns \b true if the NativeDelegate was /// successfully removed from the process, \b false otherwise. /// /// @see NativeProcessProtocol::NativeDelegate //------------------------------------------------------------------ bool UnregisterNativeDelegate(NativeDelegate &native_delegate); virtual Error GetLoadedModuleFileSpec(const char *module_path, FileSpec &file_spec) = 0; virtual Error GetFileLoadAddress(const llvm::StringRef &file_name, lldb::addr_t &load_addr) = 0; //------------------------------------------------------------------ /// Launch a process for debugging. This method will create an concrete /// instance of NativeProcessProtocol, based on the host platform. /// (e.g. NativeProcessLinux on linux, etc.) /// /// @param[in] launch_info /// Information required to launch the process. /// /// @param[in] native_delegate /// The delegate that will receive messages regarding the /// inferior. Must outlive the NativeProcessProtocol /// instance. /// /// @param[in] mainloop /// The mainloop instance with which the process can register /// callbacks. Must outlive the NativeProcessProtocol /// instance. /// /// @param[out] process_sp /// On successful return from the method, this parameter /// contains the shared pointer to the /// NativeProcessProtocol that can be used to manipulate /// the native process. /// /// @return /// An error object indicating if the operation succeeded, /// and if not, what error occurred. //------------------------------------------------------------------ static Error Launch(ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); //------------------------------------------------------------------ /// Attach to an existing process. This method will create an concrete /// instance of NativeProcessProtocol, based on the host platform. /// (e.g. NativeProcessLinux on linux, etc.) /// /// @param[in] pid /// pid of the process locatable /// /// @param[in] native_delegate /// The delegate that will receive messages regarding the /// inferior. Must outlive the NativeProcessProtocol /// instance. /// /// @param[in] mainloop /// The mainloop instance with which the process can register /// callbacks. Must outlive the NativeProcessProtocol /// instance. /// /// @param[out] process_sp /// On successful return from the method, this parameter /// contains the shared pointer to the /// NativeProcessProtocol that can be used to manipulate /// the native process. /// /// @return /// An error object indicating if the operation succeeded, /// and if not, what error occurred. //------------------------------------------------------------------ static Error Attach(lldb::pid_t pid, NativeDelegate &native_delegate, MainLoop &mainloop, NativeProcessProtocolSP &process_sp); protected: lldb::pid_t m_pid; std::vector<NativeThreadProtocolSP> m_threads; lldb::tid_t m_current_thread_id; mutable std::recursive_mutex m_threads_mutex; lldb::StateType m_state; mutable std::recursive_mutex m_state_mutex; lldb_private::ExitType m_exit_type; int m_exit_status; std::string m_exit_description; std::recursive_mutex m_delegates_mutex; std::vector<NativeDelegate *> m_delegates; NativeBreakpointList m_breakpoint_list; NativeWatchpointList m_watchpoint_list; int m_terminal_fd; uint32_t m_stop_id; // lldb_private::Host calls should be used to launch a process for debugging, // and // then the process should be attached to. When attaching to a process // lldb_private::Host calls should be used to locate the process to attach to, // and then this function should be called. NativeProcessProtocol(lldb::pid_t pid); // ----------------------------------------------------------- // Internal interface for state handling // ----------------------------------------------------------- void SetState(lldb::StateType state, bool notify_delegates = true); // Derived classes need not implement this. It can be used as a // hook to clear internal caches that should be invalidated when // stop ids change. // // Note this function is called with the state mutex obtained // by the caller. virtual void DoStopIDBumped(uint32_t newBumpId); // ----------------------------------------------------------- // Internal interface for software breakpoints // ----------------------------------------------------------- Error SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint); virtual Error GetSoftwareBreakpointTrapOpcode(size_t trap_opcode_size_hint, size_t &actual_opcode_size, const uint8_t *&trap_opcode_bytes) = 0; // ----------------------------------------------------------- /// Notify the delegate that an exec occurred. /// /// Provide a mechanism for a delegate to clear out any exec- /// sensitive data. // ----------------------------------------------------------- void NotifyDidExec(); NativeThreadProtocolSP GetThreadByIDUnlocked(lldb::tid_t tid); // ----------------------------------------------------------- // Static helper methods for derived classes. // ----------------------------------------------------------- static Error ResolveProcessArchitecture(lldb::pid_t pid, ArchSpec &arch); private: void SynchronouslyNotifyProcessStateChanged(lldb::StateType state); }; } #endif // #ifndef liblldb_NativeProcessProtocol_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Symbol/Symtab.h
<reponame>Polidea/SiriusObfuscator //===-- Symtab.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Symtab_h_ #define liblldb_Symtab_h_ #include <mutex> #include <vector> #include "lldb/Core/RangeMap.h" #include "lldb/Core/UniqueCStringMap.h" #include "lldb/Symbol/Symbol.h" #include "lldb/lldb-private.h" namespace lldb_private { class Symtab { public: typedef std::vector<uint32_t> IndexCollection; typedef UniqueCStringMap<uint32_t> NameToIndexMap; typedef enum Debug { eDebugNo, // Not a debug symbol eDebugYes, // A debug symbol eDebugAny } Debug; typedef enum Visibility { eVisibilityAny, eVisibilityExtern, eVisibilityPrivate } Visibility; Symtab(ObjectFile *objfile); ~Symtab(); void Reserve(size_t count); Symbol *Resize(size_t count); uint32_t AddSymbol(const Symbol &symbol); size_t GetNumSymbols() const; void Dump(Stream *s, Target *target, SortOrder sort_type, Mangled::NamePreference name_preference = Mangled::ePreferDemangled); void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes, Mangled::NamePreference name_preference = Mangled::ePreferDemangled) const; void SectionFileAddressesChanged(); uint32_t GetIndexForSymbol(const Symbol *symbol) const; std::recursive_mutex &GetMutex() { return m_mutex; } Symbol *FindSymbolByID(lldb::user_id_t uid) const; Symbol *SymbolAtIndex(size_t idx); const Symbol *SymbolAtIndex(size_t idx) const; Symbol *FindSymbolWithType(lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx); //---------------------------------------------------------------------- /// Get the parent symbol for the given symbol. /// /// Many symbols in symbol tables are scoped by other symbols that /// contain one or more symbol. This function will look for such a /// containing symbol and return it if there is one. //---------------------------------------------------------------------- const Symbol *GetParent(Symbol *symbol) const; uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, std::vector<uint32_t> &indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const; uint32_t AppendSymbolIndexesWithTypeAndFlagsValue( lldb::SymbolType symbol_type, uint32_t flags_value, std::vector<uint32_t> &indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const; uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &matches, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const; uint32_t AppendSymbolIndexesWithName(const ConstString &symbol_name, std::vector<uint32_t> &matches); uint32_t AppendSymbolIndexesWithName(const ConstString &symbol_name, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &matches); uint32_t AppendSymbolIndexesWithNameAndType(const ConstString &symbol_name, lldb::SymbolType symbol_type, std::vector<uint32_t> &matches); uint32_t AppendSymbolIndexesWithNameAndType(const ConstString &symbol_name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &matches); uint32_t AppendSymbolIndexesMatchingRegExAndType(const RegularExpression &regex, lldb::SymbolType symbol_type, std::vector<uint32_t> &indexes); uint32_t AppendSymbolIndexesMatchingRegExAndType( const RegularExpression &regex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &indexes); size_t FindAllSymbolsWithNameAndType(const ConstString &name, lldb::SymbolType symbol_type, std::vector<uint32_t> &symbol_indexes); size_t FindAllSymbolsWithNameAndType(const ConstString &name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes); size_t FindAllSymbolsMatchingRexExAndType( const RegularExpression &regex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes); Symbol *FindFirstSymbolWithNameAndType(const ConstString &name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility); Symbol *FindSymbolAtFileAddress(lldb::addr_t file_addr); Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr); void ForEachSymbolContainingFileAddress( lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback); size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask, SymbolContextList &sc_list); void CalculateSymbolSizes(); void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes, bool remove_duplicates) const; static void DumpSymbolHeader(Stream *s); void Finalize() { // Shrink to fit the symbols so we don't waste memory if (m_symbols.capacity() > m_symbols.size()) { collection new_symbols(m_symbols.begin(), m_symbols.end()); m_symbols.swap(new_symbols); } } void AppendSymbolNamesToMap(const IndexCollection &indexes, bool add_demangled, bool add_mangled, NameToIndexMap &name_to_index_map) const; ObjectFile *GetObjectFile() { return m_objfile; } protected: typedef std::vector<Symbol> collection; typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t> FileRangeToIndexMap; void InitNameIndexes(); void InitAddressIndexes(); ObjectFile *m_objfile; collection m_symbols; FileRangeToIndexMap m_file_addr_to_index; UniqueCStringMap<uint32_t> m_name_to_index; UniqueCStringMap<uint32_t> m_basename_to_index; UniqueCStringMap<uint32_t> m_method_to_index; UniqueCStringMap<uint32_t> m_selector_to_index; mutable std::recursive_mutex m_mutex; // Provide thread safety for this symbol table bool m_file_addr_to_index_computed : 1, m_name_indexes_computed : 1; private: bool CheckSymbolAtIndex(size_t idx, Debug symbol_debug_type, Visibility symbol_visibility) const { switch (symbol_debug_type) { case eDebugNo: if (m_symbols[idx].IsDebug() == true) return false; break; case eDebugYes: if (m_symbols[idx].IsDebug() == false) return false; break; case eDebugAny: break; } switch (symbol_visibility) { case eVisibilityAny: return true; case eVisibilityExtern: return m_symbols[idx].IsExternal(); case eVisibilityPrivate: return !m_symbols[idx].IsExternal(); } return false; } void SymbolIndicesToSymbolContextList(std::vector<uint32_t> &symbol_indexes, SymbolContextList &sc_list); DISALLOW_COPY_AND_ASSIGN(Symtab); }; } // namespace lldb_private #endif // liblldb_Symtab_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/CxaDemangle.h
<gh_stars>100-1000 //===-- CxaDemangle.h -------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_CxaDemangle_h_ #define liblldb_CxaDemangle_h_ namespace lldb_private { char *__cxa_demangle(const char *mangled_name, char *buf, size_t *n, int *status); } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Driver/fuchsia.c
<filename>SymbolExtractorAndRenamer/clang/test/Driver/fuchsia.c // RUN: %clang %s -### -no-canonical-prefixes --target=x86_64-unknown-fuchsia \ // RUN: --sysroot=%S/platform -fuse-ld=ld 2>&1 | FileCheck %s // CHECK: {{.*}}clang{{.*}}" "-cc1" // CHECK: "-fuse-init-array" // CHECK: "-isysroot" "[[SYSROOT:[^"]+]]" // CHECK: "-internal-externc-isystem" "[[SYSROOT]]{{/|\\\\}}include" // CHECK: {{.*}}lld{{.*}}" "-flavor" "gnu" // CHECK: "--sysroot=[[SYSROOT]]" // CHECK: "-pie" // CHECK: "--build-id" // CHECK: "-dynamic-linker" "ld.so.1" // CHECK: Scrt1.o // CHECK-NOT: crti.o // CHECK-NOT: crtbegin.o // CHECK: "-L[[SYSROOT]]/lib" // CHECK: "{{.*[/\\]}}libclang_rt.builtins-x86_64.a" // CHECK: "-lc" // CHECK-NOT: crtend.o // CHECK-NOT: crtn.o // RUN: %clang %s -### --target=x86_64-unknown-fuchsia -rtlib=libgcc 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-RTLIB // CHECK-RTLIB: error: invalid runtime library name in argument '-rtlib=libgcc' // RUN: %clang %s -### --target=x86_64-unknown-fuchsia -static 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-STATIC // CHECK-STATIC: "-Bstatic" // CHECK-STATIC: "-Bdynamic" // CHECK-STATIC: "-lc" // RUN: %clang %s -### --target=x86_64-unknown-fuchsia -shared 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-SHARED // CHECK-SHARED-NOT: "-pie" // CHECK-SHARED: "-shared" // RUN: %clang %s -### --target=x86_64-unknown-fuchsia -r 2>&1 \ // RUN: | FileCheck %s -check-prefix=CHECK-RELOCATABLE // CHECK-RELOCATABLE-NOT: "-pie" // CHECK-RELOCATABLE-NOT: "--build-id" // CHECK-RELOCATABLE: "-r"
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/CommandHistory.h
//===-- CommandHistory.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_CommandHistory_h_ #define liblldb_CommandHistory_h_ // C Includes // C++ Includes #include <mutex> #include <string> #include <vector> // Other libraries and framework includes // Project includes #include "lldb/Core/Stream.h" #include "lldb/lldb-private.h" namespace lldb_private { class CommandHistory { public: CommandHistory(); ~CommandHistory(); size_t GetSize() const; bool IsEmpty() const; llvm::Optional<llvm::StringRef> FindString(llvm::StringRef input_str) const; llvm::StringRef GetStringAtIndex(size_t idx) const; llvm::StringRef operator[](size_t idx) const; llvm::StringRef GetRecentmostString() const; void AppendString(llvm::StringRef str, bool reject_if_dupe = true); void Clear(); void Dump(Stream &stream, size_t start_idx = 0, size_t stop_idx = SIZE_MAX) const; static const char g_repeat_char = '!'; private: DISALLOW_COPY_AND_ASSIGN(CommandHistory); typedef std::vector<std::string> History; mutable std::recursive_mutex m_mutex; History m_history; }; } // namespace lldb_private #endif // liblldb_CommandHistory_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/GlobalCollectedSymbolsUpdater.h
#ifndef Updater_h #define Updater_h #include "swift/Obfuscation/DataStructures.h" #include "swift/Obfuscation/Extractor.h" namespace swift { namespace obfuscation { enum GlobalCollectedSymbolsUpdaterKind { ProtocolFunction, ExcludedSymbols, ExtensionSymbols }; class GlobalCollectedSymbolsUpdater { protected: std::vector<DeclWithSymbolWithRange> LoadedSymbols; public: virtual ~GlobalCollectedSymbolsUpdater() = 0; virtual void load(std::vector<DeclWithSymbolWithRange> &) = 0; virtual void updateUsingLoadedSymbols(GlobalCollectedSymbols &) = 0; virtual GlobalCollectedSymbolsUpdaterKind getKind() = 0; }; class ProtocolFunctionUpdater : public GlobalCollectedSymbolsUpdater { private: FunctionExtractor FuncExtractor; ParameterExtractor ParamExtractor; void handleRequirement(const ValueDecl* Requirement, GlobalCollectedSymbols &CollectedSymbols, SymbolWithRange FunctionNameSymbol, const FuncDecl* Declaration); void handleSatisfiedProtocolRequirements(GlobalCollectedSymbols &CollectedSymbols, SymbolWithRange FunctionNameSymbol, const FuncDecl* Declaration); public: ProtocolFunctionUpdater(FunctionExtractor &, ParameterExtractor &); void load(std::vector<DeclWithSymbolWithRange> &) override; void updateUsingLoadedSymbols(GlobalCollectedSymbols &) override; GlobalCollectedSymbolsUpdaterKind getKind() override; }; class ExcludedSymbolsUpdater : public GlobalCollectedSymbolsUpdater { public: void load(std::vector<DeclWithSymbolWithRange> &) override; void updateUsingLoadedSymbols(GlobalCollectedSymbols &) override; GlobalCollectedSymbolsUpdaterKind getKind() override; }; class ExtensionSymbolsUpdater : public GlobalCollectedSymbolsUpdater { private: FunctionExtractor FuncExtractor; ParameterExtractor ParamExtractor; public: ExtensionSymbolsUpdater(FunctionExtractor &, ParameterExtractor &); void load(std::vector<DeclWithSymbolWithRange> &) override; void updateUsingLoadedSymbols(GlobalCollectedSymbols &) override; GlobalCollectedSymbolsUpdaterKind getKind() override; }; } //namespace obfuscation } //namespace swift #endif /* Updater_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.h
//===-- EmulateInstructionMIPS.h ------------------------------------*- C++ //-*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef EmulateInstructionMIPS_h_ #define EmulateInstructionMIPS_h_ namespace llvm { class MCDisassembler; class MCSubtargetInfo; class MCRegisterInfo; class MCAsmInfo; class MCContext; class MCInstrInfo; class MCInst; } #include "lldb/Core/EmulateInstruction.h" #include "lldb/Core/Error.h" #include "lldb/Interpreter/OptionValue.h" class EmulateInstructionMIPS : public lldb_private::EmulateInstruction { public: static void Initialize(); static void Terminate(); static lldb_private::ConstString GetPluginNameStatic(); static const char *GetPluginDescriptionStatic(); static lldb_private::EmulateInstruction * CreateInstance(const lldb_private::ArchSpec &arch, lldb_private::InstructionType inst_type); static bool SupportsEmulatingInstructionsOfTypeStatic( lldb_private::InstructionType inst_type) { switch (inst_type) { case lldb_private::eInstructionTypeAny: case lldb_private::eInstructionTypePrologueEpilogue: case lldb_private::eInstructionTypePCModifying: return true; case lldb_private::eInstructionTypeAll: return false; } return false; } lldb_private::ConstString GetPluginName() override; uint32_t GetPluginVersion() override { return 1; } bool SetTargetTriple(const lldb_private::ArchSpec &arch) override; EmulateInstructionMIPS(const lldb_private::ArchSpec &arch); bool SupportsEmulatingInstructionsOfType( lldb_private::InstructionType inst_type) override { return SupportsEmulatingInstructionsOfTypeStatic(inst_type); } bool ReadInstruction() override; bool EvaluateInstruction(uint32_t evaluate_options) override; bool SetInstruction(const lldb_private::Opcode &insn_opcode, const lldb_private::Address &inst_addr, lldb_private::Target *target) override; bool TestEmulation(lldb_private::Stream *out_stream, lldb_private::ArchSpec &arch, lldb_private::OptionValueDictionary *test_data) override { return false; } bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num, lldb_private::RegisterInfo &reg_info) override; bool CreateFunctionEntryUnwind(lldb_private::UnwindPlan &unwind_plan) override; protected: typedef struct { const char *op_name; bool (EmulateInstructionMIPS::*callback)(llvm::MCInst &insn); const char *insn_name; } MipsOpcode; static MipsOpcode *GetOpcodeForInstruction(const char *op_name); uint32_t GetSizeOfInstruction(lldb_private::DataExtractor &data, uint64_t inst_addr); bool Emulate_ADDiu(llvm::MCInst &insn); bool Emulate_SUBU_ADDU(llvm::MCInst &insn); bool Emulate_LUI(llvm::MCInst &insn); bool Emulate_SW(llvm::MCInst &insn); bool Emulate_LW(llvm::MCInst &insn); bool Emulate_ADDIUSP(llvm::MCInst &insn); bool Emulate_ADDIUS5(llvm::MCInst &insn); bool Emulate_SWSP(llvm::MCInst &insn); bool Emulate_SWM16_32(llvm::MCInst &insn); bool Emulate_LWSP(llvm::MCInst &insn); bool Emulate_LWM16_32(llvm::MCInst &insn); bool Emulate_JRADDIUSP(llvm::MCInst &insn); bool Emulate_LDST_Imm(llvm::MCInst &insn); bool Emulate_LDST_Reg(llvm::MCInst &insn); bool Emulate_BXX_3ops(llvm::MCInst &insn); bool Emulate_BXX_3ops_C(llvm::MCInst &insn); bool Emulate_BXX_2ops(llvm::MCInst &insn); bool Emulate_BXX_2ops_C(llvm::MCInst &insn); bool Emulate_Bcond_Link_C(llvm::MCInst &insn); bool Emulate_Bcond_Link(llvm::MCInst &insn); bool Emulate_FP_branch(llvm::MCInst &insn); bool Emulate_3D_branch(llvm::MCInst &insn); bool Emulate_BAL(llvm::MCInst &insn); bool Emulate_BALC(llvm::MCInst &insn); bool Emulate_BC(llvm::MCInst &insn); bool Emulate_J(llvm::MCInst &insn); bool Emulate_JAL(llvm::MCInst &insn); bool Emulate_JALR(llvm::MCInst &insn); bool Emulate_JIALC(llvm::MCInst &insn); bool Emulate_JIC(llvm::MCInst &insn); bool Emulate_JR(llvm::MCInst &insn); bool Emulate_BC1EQZ(llvm::MCInst &insn); bool Emulate_BC1NEZ(llvm::MCInst &insn); bool Emulate_BNZB(llvm::MCInst &insn); bool Emulate_BNZH(llvm::MCInst &insn); bool Emulate_BNZW(llvm::MCInst &insn); bool Emulate_BNZD(llvm::MCInst &insn); bool Emulate_BZB(llvm::MCInst &insn); bool Emulate_BZH(llvm::MCInst &insn); bool Emulate_BZW(llvm::MCInst &insn); bool Emulate_BZD(llvm::MCInst &insn); bool Emulate_MSA_Branch_DF(llvm::MCInst &insn, int element_byte_size, bool bnz); bool Emulate_BNZV(llvm::MCInst &insn); bool Emulate_BZV(llvm::MCInst &insn); bool Emulate_MSA_Branch_V(llvm::MCInst &insn, bool bnz); bool Emulate_B16_MM(llvm::MCInst &insn); bool Emulate_Branch_MM(llvm::MCInst &insn); bool Emulate_JALRx16_MM(llvm::MCInst &insn); bool Emulate_JALx(llvm::MCInst &insn); bool Emulate_JALRS(llvm::MCInst &insn); bool nonvolatile_reg_p(uint32_t regnum); const char *GetRegisterName(unsigned reg_num, bool altnernate_name); private: std::unique_ptr<llvm::MCDisassembler> m_disasm; std::unique_ptr<llvm::MCDisassembler> m_alt_disasm; std::unique_ptr<llvm::MCSubtargetInfo> m_subtype_info; std::unique_ptr<llvm::MCSubtargetInfo> m_alt_subtype_info; std::unique_ptr<llvm::MCRegisterInfo> m_reg_info; std::unique_ptr<llvm::MCAsmInfo> m_asm_info; std::unique_ptr<llvm::MCContext> m_context; std::unique_ptr<llvm::MCInstrInfo> m_insn_info; uint32_t m_next_inst_size; bool m_use_alt_disaasm; }; #endif // EmulateInstructionMIPS_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Expression/ExpressionParser.h
//===-- ExpressionParser.h --------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ExpressionParser_h_ #define liblldb_ExpressionParser_h_ #include "lldb/Core/Error.h" #include "lldb/lldb-public.h" namespace lldb_private { class IRExecutionUnit; //---------------------------------------------------------------------- /// @class ExpressionParser ExpressionParser.h /// "lldb/Expression/ExpressionParser.h" /// @brief Encapsulates an instance of a compiler that can parse expressions. /// /// ExpressionParser is the base class for llvm based Expression parsers. //---------------------------------------------------------------------- class ExpressionParser { public: //------------------------------------------------------------------ /// Constructor /// /// Initializes class variables. /// /// @param[in] exe_scope, /// If non-NULL, an execution context scope that can help to /// correctly create an expression with a valid process for /// optional tuning Objective-C runtime support. Can be NULL. /// /// @param[in] expr /// The expression to be parsed. //------------------------------------------------------------------ ExpressionParser(ExecutionContextScope *exe_scope, Expression &expr, bool generate_debug_info) : m_expr(expr), m_generate_debug_info(generate_debug_info) {} //------------------------------------------------------------------ /// Destructor //------------------------------------------------------------------ virtual ~ExpressionParser(){}; //------------------------------------------------------------------ /// Parse a single expression and convert it to IR using Clang. Don't /// wrap the expression in anything at all. /// /// @param[in] diagnostic_manager /// The diagnostic manager in which to store the errors and warnings. /// /// @return /// The number of errors encountered during parsing. 0 means /// success. //------------------------------------------------------------------ virtual unsigned Parse(DiagnosticManager &diagnostic_manager, uint32_t first_line = 0, uint32_t last_line = UINT32_MAX, uint32_t line_offset = 0) = 0; //------------------------------------------------------------------ /// Try to use the FixIts in the diagnostic_manager to rewrite the /// expression. If successful, the rewritten expression is stored /// in the diagnostic_manager, get it out with GetFixedExpression. /// /// @param[in] diagnostic_manager /// The diagnostic manager containing fixit's to apply. /// /// @return /// \b true if the rewrite was successful, \b false otherwise. //------------------------------------------------------------------ virtual bool RewriteExpression(DiagnosticManager &diagnostic_manager) { return false; } //------------------------------------------------------------------ /// Ready an already-parsed expression for execution, possibly /// evaluating it statically. /// /// @param[out] func_addr /// The address to which the function has been written. /// /// @param[out] func_end /// The end of the function's allocated memory region. (func_addr /// and func_end do not delimit an allocated region; the allocated /// region may begin before func_addr.) /// /// @param[in] execution_unit_sp /// After parsing, ownership of the execution unit for /// for the expression is handed to this shared pointer. /// /// @param[in] exe_ctx /// The execution context to write the function into. /// /// @param[out] can_interpret /// Set to true if the expression could be interpreted statically; /// untouched otherwise. /// /// @param[in] execution_policy /// Determines whether the expression must be JIT-compiled, must be /// evaluated statically, or whether this decision may be made /// opportunistically. /// /// @return /// An error code indicating the success or failure of the operation. /// Test with Success(). //------------------------------------------------------------------ virtual Error PrepareForExecution(lldb::addr_t &func_addr, lldb::addr_t &func_end, std::shared_ptr<IRExecutionUnit> &execution_unit_sp, ExecutionContext &exe_ctx, bool &can_interpret, lldb_private::ExecutionPolicy execution_policy) = 0; bool GetGenerateDebugInfo() const { return m_generate_debug_info; } protected: Expression &m_expr; ///< The expression to be parsed bool m_generate_debug_info; }; } #endif // liblldb_ExpressionParser_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Target/QueueList.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Target/QueueList.h //===-- QueueList.h --------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_QueueList_h_ #define liblldb_QueueList_h_ #include <mutex> #include <vector> #include "lldb/Core/UserID.h" #include "lldb/Utility/Iterable.h" #include "lldb/lldb-private.h" namespace lldb_private { //------------------------------------------------------------------ // QueueList: // This is the container for libdispatch aka Grand Central Dispatch // Queue objects. // // Each Process will have a QueueList. When the process execution is // paused, the QueueList may be populated with Queues by the // SystemRuntime. //------------------------------------------------------------------ class QueueList { friend class Process; public: QueueList(Process *process); ~QueueList(); //------------------------------------------------------------------ /// Get the number of libdispatch queues that are available /// /// @return /// The number of queues that are stored in the QueueList. //------------------------------------------------------------------ uint32_t GetSize(); //------------------------------------------------------------------ /// Get the Queue at a given index number /// /// @param [in] idx /// The index number (0-based) of the queue. /// @return /// The Queue at that index number. //------------------------------------------------------------------ lldb::QueueSP GetQueueAtIndex(uint32_t idx); typedef std::vector<lldb::QueueSP> collection; typedef LockingAdaptedIterable<collection, lldb::QueueSP, vector_adapter, std::mutex> QueueIterable; //------------------------------------------------------------------ /// Iterate over the list of queues /// /// @return /// An Iterable object which can be used to loop over the queues /// that exist. //------------------------------------------------------------------ QueueIterable Queues() { return QueueIterable(m_queues, m_mutex); } //------------------------------------------------------------------ /// Clear out the list of queues from the QueueList //------------------------------------------------------------------ void Clear(); //------------------------------------------------------------------ /// Add a Queue to the QueueList /// /// @param [in] queue /// Used by the SystemRuntime to populate the QueueList //------------------------------------------------------------------ void AddQueue(lldb::QueueSP queue); //------------------------------------------------------------------ /// Find a queue in the QueueList by QueueID /// /// @param [in] qid /// The QueueID (same as returned by Thread::GetQueueID()) to find. /// /// @return /// A QueueSP to the queue requested, if it is present in the QueueList. /// An empty QueueSP will be returned if this queue was not found. //------------------------------------------------------------------ lldb::QueueSP FindQueueByID(lldb::queue_id_t qid); //------------------------------------------------------------------ /// Find a queue in the QueueList by IndexID /// /// @param [in] index_id /// Find a queue by IndexID. This is an integer associated with each /// unique queue seen during a debug session and will not be reused /// for a different queue. Unlike the QueueID, a 64-bit value, this /// will tend to be an integral value like 1 or 7. /// /// @return /// A QueueSP to the queue requested, if it is present in the QueueList. /// An empty QueueSP will be returned if this queue was not found. //------------------------------------------------------------------ lldb::QueueSP FindQueueByIndexID(uint32_t index_id); std::mutex &GetMutex(); protected: //------------------------------------------------------------------ // Classes that inherit from Process can see and modify these //------------------------------------------------------------------ Process *m_process; ///< The process that manages this queue list. uint32_t m_stop_id; ///< The process stop ID that this queue list is valid for. collection m_queues; ///< The queues for this process. std::mutex m_mutex; private: QueueList(); }; } // namespace lldb_private #endif // liblldb_QueueList_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Commands/CommandObjectArgs.h
<gh_stars>100-1000 //===-- CommandObjectArgs.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_CommandObjectArgs_h_ #define liblldb_CommandObjectArgs_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Interpreter/CommandObject.h" #include "lldb/Interpreter/Options.h" namespace lldb_private { class CommandObjectArgs : public CommandObjectParsed { public: class CommandOptions : public Options { public: CommandOptions(CommandInterpreter &interpreter); ~CommandOptions() override; Error SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg, ExecutionContext *execution_context) override; void OptionParsingStarting(ExecutionContext *execution_context) override; llvm::ArrayRef<OptionDefinition> GetDefinitions() override; }; CommandObjectArgs(CommandInterpreter &interpreter); ~CommandObjectArgs() override; Options *GetOptions() override; protected: CommandOptions m_options; bool DoExecute(Args &command, CommandReturnObject &result) override; }; } // namespace lldb_private #endif // liblldb_CommandObjectArgs_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h //===-- ClangUtilityFunction.h ----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_ClangUtilityFunction_h_ #define liblldb_ClangUtilityFunction_h_ // C Includes // C++ Includes #include <map> #include <string> #include <vector> // Other libraries and framework includes // Project includes #include "ClangExpressionHelper.h" #include "lldb/Core/ClangForward.h" #include "lldb/Expression/UtilityFunction.h" #include "lldb/lldb-forward.h" #include "lldb/lldb-private.h" namespace lldb_private { //---------------------------------------------------------------------- /// @class ClangUtilityFunction ClangUtilityFunction.h /// "lldb/Expression/ClangUtilityFunction.h" /// @brief Encapsulates a single expression for use with Clang /// /// LLDB uses expressions for various purposes, notably to call functions /// and as a backend for the expr command. ClangUtilityFunction encapsulates /// a self-contained function meant to be used from other code. Utility /// functions can perform error-checking for ClangUserExpressions, or can /// simply provide a way to push a function into the target for the debugger to /// call later on. //---------------------------------------------------------------------- class ClangUtilityFunction : public UtilityFunction { public: class ClangUtilityFunctionHelper : public ClangExpressionHelper { public: ClangUtilityFunctionHelper() {} ~ClangUtilityFunctionHelper() override {} //------------------------------------------------------------------ /// Return the object that the parser should use when resolving external /// values. May be NULL if everything should be self-contained. //------------------------------------------------------------------ ClangExpressionDeclMap *DeclMap() override { return m_expr_decl_map_up.get(); } void ResetDeclMap() { m_expr_decl_map_up.reset(); } void ResetDeclMap(ExecutionContext &exe_ctx, bool keep_result_in_memory); //------------------------------------------------------------------ /// Return the object that the parser should allow to access ASTs. /// May be NULL if the ASTs do not need to be transformed. /// /// @param[in] passthrough /// The ASTConsumer that the returned transformer should send /// the ASTs to after transformation. //------------------------------------------------------------------ clang::ASTConsumer * ASTTransformer(clang::ASTConsumer *passthrough) override { return nullptr; } private: std::unique_ptr<ClangExpressionDeclMap> m_expr_decl_map_up; }; //------------------------------------------------------------------ /// Constructor /// /// @param[in] text /// The text of the function. Must be a full translation unit. /// /// @param[in] name /// The name of the function, as used in the text. //------------------------------------------------------------------ ClangUtilityFunction(ExecutionContextScope &exe_scope, const char *text, const char *name); ~ClangUtilityFunction() override; ExpressionTypeSystemHelper *GetTypeSystemHelper() override { return &m_type_system_helper; } ClangExpressionDeclMap *DeclMap() { return m_type_system_helper.DeclMap(); } void ResetDeclMap() { m_type_system_helper.ResetDeclMap(); } void ResetDeclMap(ExecutionContext &exe_ctx, bool keep_result_in_memory) { m_type_system_helper.ResetDeclMap(exe_ctx, keep_result_in_memory); } bool Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) override; private: ClangUtilityFunctionHelper m_type_system_helper; ///< The map to use when ///parsing and materializing ///the expression. }; } // namespace lldb_private #endif // liblldb_ClangUtilityFunction_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/tools/lldb-mi/MICmdCmdData.h
<filename>SymbolExtractorAndRenamer/lldb/tools/lldb-mi/MICmdCmdData.h<gh_stars>100-1000 //===-- MICmdCmdData.h ------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // Overview: CMICmdCmdDataEvaluateExpression interface. // CMICmdCmdDataDisassemble interface. // CMICmdCmdDataReadMemoryBytes interface. // CMICmdCmdDataReadMemory interface. // CMICmdCmdDataListRegisterNames interface. // CMICmdCmdDataListRegisterValues interface. // CMICmdCmdDataListRegisterChanged interface. // CMICmdCmdDataWriteMemoryBytes interface. // CMICmdCmdDataWriteMemory interface. // CMICmdCmdDataInfoLine interface. // // To implement new MI commands derive a new command class from the // command base // class. To enable the new command for interpretation add the new // command class // to the command factory. The files of relevance are: // MICmdCommands.cpp // MICmdBase.h / .cpp // MICmdCmd.h / .cpp // For an introduction to adding a new command see // CMICmdCmdSupportInfoMiCmdQuery // command class as an example. // #pragma once // Third party headers: #include "lldb/API/SBCommandReturnObject.h" #include "lldb/API/SBError.h" // In-house headers: #include "MICmdBase.h" #include "MICmnLLDBDebugSessionInfoVarObj.h" #include "MICmnMIValueList.h" #include "MICmnMIValueTuple.h" //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-evaluate-expression". //-- class CMICmdCmdDataEvaluateExpression : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataEvaluateExpression(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataEvaluateExpression() override; // Methods: private: bool HaveInvalidCharacterInExpression(const CMIUtilString &vrExpr, char &vrwInvalidChar); // Attributes: private: bool m_bExpressionValid; // True = yes is valid, false = not valid bool m_bEvaluatedExpression; // True = yes is expression evaluated, false = // failed lldb::SBError m_Error; // Error object, which is examined when // m_bEvaluatedExpression is false CMIUtilString m_strValue; CMICmnMIValueTuple m_miValueTuple; bool m_bFoundInvalidChar; // True = yes found unexpected character in the // expression, false = all ok char m_cExpressionInvalidChar; const CMIUtilString m_constStrArgExpr; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-disassemble". //-- class CMICmdCmdDataDisassemble : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataDisassemble(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataDisassemble() override; // Attributes: private: const CMIUtilString m_constStrArgAddrStart; // MI spec non mandatory, *this command mandatory const CMIUtilString m_constStrArgAddrEnd; // MI spec non mandatory, *this command mandatory const CMIUtilString m_constStrArgMode; CMICmnMIValueList m_miValueList; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-read-memory-bytes". //-- class CMICmdCmdDataReadMemoryBytes : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataReadMemoryBytes(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataReadMemoryBytes() override; // Attributes: private: const CMIUtilString m_constStrArgByteOffset; const CMIUtilString m_constStrArgAddrExpr; const CMIUtilString m_constStrArgNumBytes; unsigned char *m_pBufferMemory; MIuint64 m_nAddrStart; MIuint64 m_nAddrNumBytesToRead; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-read-memory". //-- class CMICmdCmdDataReadMemory : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataReadMemory(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataReadMemory() override; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-list-register-names". //-- class CMICmdCmdDataListRegisterNames : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataListRegisterNames(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataListRegisterNames() override; // Methods: private: lldb::SBValue GetRegister(const MIuint vRegisterIndex) const; // Attributes: private: const CMIUtilString m_constStrArgRegNo; // Not handled by *this command CMICmnMIValueList m_miValueList; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-list-register-values". //-- class CMICmdCmdDataListRegisterValues : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataListRegisterValues(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataListRegisterValues() override; // Methods: private: lldb::SBValue GetRegister(const MIuint vRegisterIndex) const; void AddToOutput(const MIuint vnIndex, const lldb::SBValue &vrValue, CMICmnLLDBDebugSessionInfoVarObj::varFormat_e veVarFormat); // Attributes: private: const CMIUtilString m_constStrArgSkip; // Not handled by *this command const CMIUtilString m_constStrArgFormat; const CMIUtilString m_constStrArgRegNo; CMICmnMIValueList m_miValueList; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-list-changed-registers". //-- class CMICmdCmdDataListRegisterChanged : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataListRegisterChanged(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataListRegisterChanged() override; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-read-memory-bytes". //-- class CMICmdCmdDataWriteMemoryBytes : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataWriteMemoryBytes(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataWriteMemoryBytes() override; // Attributes: private: const CMIUtilString m_constStrArgAddr; const CMIUtilString m_constStrArgContents; const CMIUtilString m_constStrArgCount; CMIUtilString m_strContents; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-read-memory". // Not specified in MI spec but Eclipse gives *this command. //-- class CMICmdCmdDataWriteMemory : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataWriteMemory(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataWriteMemory() override; // Attributes: private: const CMIUtilString m_constStrArgOffset; // Not specified in MI spec but // Eclipse gives this option. const CMIUtilString m_constStrArgAddr; // Not specified in MI spec but Eclipse // gives this option. const CMIUtilString m_constStrArgD; // Not specified in MI spec but Eclipse gives this option. const CMIUtilString m_constStrArgNumber; // Not specified in MI spec but // Eclipse gives this option. const CMIUtilString m_constStrArgContents; // Not specified in MI spec but // Eclipse gives this option. MIuint64 m_nAddr; CMIUtilString m_strContents; MIuint64 m_nCount; unsigned char *m_pBufferMemory; }; //++ //============================================================================ // Details: MI command class. MI commands derived from the command base class. // *this class implements MI command "data-info-line". // See MIExtensions.txt for details. //-- class CMICmdCmdDataInfoLine : public CMICmdBase { // Statics: public: // Required by the CMICmdFactory when registering *this command static CMICmdBase *CreateSelf(); // Methods: public: /* ctor */ CMICmdCmdDataInfoLine(); // Overridden: public: // From CMICmdInvoker::ICmd bool Execute() override; bool Acknowledge() override; bool ParseArgs() override; // From CMICmnBase /* dtor */ ~CMICmdCmdDataInfoLine() override; // Attributes: private: lldb::SBCommandReturnObject m_lldbResult; const CMIUtilString m_constStrArgLocation; };
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
<gh_stars>100-1000 //===-- PlatformNetBSD.h ----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_PlatformNetBSD_h_ #define liblldb_PlatformNetBSD_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Target/Platform.h" namespace lldb_private { namespace platform_netbsd { class PlatformNetBSD : public Platform { public: PlatformNetBSD(bool is_host); ~PlatformNetBSD() override = default; //------------------------------------------------------------ // Class functions //------------------------------------------------------------ static lldb::PlatformSP CreateInstance(bool force, const ArchSpec *arch); static void Initialize(); static void Terminate(); static ConstString GetPluginNameStatic(bool is_host); static const char *GetDescriptionStatic(bool is_host); //------------------------------------------------------------ // lldb_private::PluginInterface functions //------------------------------------------------------------ ConstString GetPluginName() override { return GetPluginNameStatic(IsHost()); } uint32_t GetPluginVersion() override { return 1; } const char *GetDescription() override { return GetDescriptionStatic(IsHost()); } //------------------------------------------------------------ // lldb_private::Platform functions //------------------------------------------------------------ bool GetModuleSpec(const FileSpec &module_file_spec, const ArchSpec &arch, ModuleSpec &module_spec) override; Error RunShellCommand(const char *command, const FileSpec &working_dir, int *status_ptr, int *signo_ptr, std::string *command_output, uint32_t timeout_sec) override; Error ResolveExecutable(const ModuleSpec &module_spec, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr) override; bool GetRemoteOSVersion() override; bool GetRemoteOSBuildString(std::string &s) override; bool GetRemoteOSKernelDescription(std::string &s) override; // Remote Platform subclasses need to override this function ArchSpec GetRemoteSystemArchitecture() override; bool IsConnected() const override; Error ConnectRemote(Args &args) override; Error DisconnectRemote() override; const char *GetHostname() override; const char *GetUserName(uint32_t uid) override; const char *GetGroupName(uint32_t gid) override; bool GetProcessInfo(lldb::pid_t pid, ProcessInstanceInfo &proc_info) override; uint32_t FindProcesses(const ProcessInstanceInfoMatch &match_info, ProcessInstanceInfoList &process_infos) override; Error LaunchProcess(ProcessLaunchInfo &launch_info) override; lldb::ProcessSP Attach(ProcessAttachInfo &attach_info, Debugger &debugger, Target *target, Error &error) override; // NetBSD processes can not be launched by spawning and attaching. bool CanDebugProcess() override { return false; } // Only on PlatformMacOSX: Error GetFileWithUUID(const FileSpec &platform_file, const UUID *uuid, FileSpec &local_file) override; Error GetSharedModule(const ModuleSpec &module_spec, Process *process, lldb::ModuleSP &module_sp, const FileSpecList *module_search_paths_ptr, lldb::ModuleSP *old_module_sp_ptr, bool *did_create_ptr) override; bool GetSupportedArchitectureAtIndex(uint32_t idx, ArchSpec &arch) override; void GetStatus(Stream &strm) override; void CalculateTrapHandlerSymbolNames() override; protected: lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a // remote netbsd OS private: DISALLOW_COPY_AND_ASSIGN(PlatformNetBSD); }; } // namespace platform_netbsd } // namespace lldb_private #endif // liblldb_PlatformNetBSD_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Sema/diagnose_if.c
// RUN: %clang_cc1 %s -verify -fno-builtin #define _diagnose_if(...) __attribute__((diagnose_if(__VA_ARGS__))) void failure() _diagnose_if(); // expected-error{{exactly 3 arguments}} void failure() _diagnose_if(0); // expected-error{{exactly 3 arguments}} void failure() _diagnose_if(0, ""); // expected-error{{exactly 3 arguments}} void failure() _diagnose_if(0, "", "error", 1); // expected-error{{exactly 3 arguments}} void failure() _diagnose_if(0, 0, "error"); // expected-error{{requires a string}} void failure() _diagnose_if(0, "", "invalid"); // expected-error{{invalid diagnostic type for 'diagnose_if'; use "error" or "warning" instead}} void failure() _diagnose_if(0, "", "ERROR"); // expected-error{{invalid diagnostic type}} void failure(int a) _diagnose_if(a, "", ""); // expected-error{{invalid diagnostic type}} void failure() _diagnose_if(a, "", ""); // expected-error{{undeclared identifier 'a'}} int globalVar; void never_constant() _diagnose_if(globalVar, "", "error"); // expected-error{{'diagnose_if' attribute expression never produces a constant expression}} expected-note{{subexpression not valid}} void never_constant() _diagnose_if(globalVar, "", "warning"); // expected-error{{'diagnose_if' attribute expression never produces a constant expression}} expected-note{{subexpression not valid}} int alwaysok(int q) _diagnose_if(0, "", "error"); int neverok(int q) _diagnose_if(1, "oh no", "error"); // expected-note 5{{from 'diagnose_if' attribute on 'neverok'}} int alwayswarn(int q) _diagnose_if(1, "oh no", "warning"); // expected-note 5{{from 'diagnose_if' attribute}} int neverwarn(int q) _diagnose_if(0, "", "warning"); void runConstant() { int m; alwaysok(0); alwaysok(1); alwaysok(m); { int (*pok)(int) = alwaysok; pok = &alwaysok; } neverok(0); // expected-error{{oh no}} neverok(1); // expected-error{{oh no}} neverok(m); // expected-error{{oh no}} { int (*pok)(int) = neverok; // expected-error{{oh no}} pok = &neverok; // expected-error{{oh no}} } alwayswarn(0); // expected-warning{{oh no}} alwayswarn(1); // expected-warning{{oh no}} alwayswarn(m); // expected-warning{{oh no}} { int (*pok)(int) = alwayswarn; // expected-warning{{oh no}} pok = &alwayswarn; // expected-warning{{oh no}} } neverwarn(0); neverwarn(1); neverwarn(m); { int (*pok)(int) = neverwarn; pok = &neverwarn; } } int abs(int q) _diagnose_if(q >= 0, "redundant abs call", "error"); //expected-note{{from 'diagnose_if'}} void runVariable() { int m; abs(-1); abs(1); // expected-error{{redundant abs call}} abs(m); int (*pabs)(int) = abs; pabs = &abs; } #define _overloadable __attribute__((overloadable)) int ovl1(const char *n) _overloadable _diagnose_if(n, "oh no", "error"); // expected-note{{from 'diagnose_if'}} int ovl1(void *m) _overloadable; int ovl2(const char *n) _overloadable _diagnose_if(n, "oh no", "error"); // expected-note{{candidate function}} int ovl2(char *m) _overloadable; // expected-note{{candidate function}} void overloadsYay() { ovl1((void *)0); ovl1(""); // expected-error{{oh no}} ovl2((void *)0); // expected-error{{ambiguous}} } void errorWarnDiagnose1() _diagnose_if(1, "oh no", "error") // expected-note{{from 'diagnose_if'}} _diagnose_if(1, "nop", "warning"); void errorWarnDiagnose2() _diagnose_if(1, "oh no", "error") // expected-note{{from 'diagnose_if'}} _diagnose_if(1, "nop", "error"); void errorWarnDiagnose3() _diagnose_if(1, "nop", "warning") _diagnose_if(1, "oh no", "error"); // expected-note{{from 'diagnose_if'}} void errorWarnDiagnoseArg1(int a) _diagnose_if(a == 1, "oh no", "error") // expected-note{{from 'diagnose_if'}} _diagnose_if(a == 1, "nop", "warning"); void errorWarnDiagnoseArg2(int a) _diagnose_if(a == 1, "oh no", "error") // expected-note{{from 'diagnose_if'}} _diagnose_if(a == 1, "nop", "error"); void errorWarnDiagnoseArg3(int a) _diagnose_if(a == 1, "nop", "warning") _diagnose_if(a == 1, "oh no", "error"); // expected-note{{from 'diagnose_if'}} void runErrorWarnDiagnose() { errorWarnDiagnose1(); // expected-error{{oh no}} errorWarnDiagnose2(); // expected-error{{oh no}} errorWarnDiagnose3(); // expected-error{{oh no}} errorWarnDiagnoseArg1(1); // expected-error{{oh no}} errorWarnDiagnoseArg2(1); // expected-error{{oh no}} errorWarnDiagnoseArg3(1); // expected-error{{oh no}} } void warnWarnDiagnose() _diagnose_if(1, "oh no!", "warning") _diagnose_if(1, "foo", "warning"); // expected-note 2{{from 'diagnose_if'}} void runWarnWarnDiagnose() { warnWarnDiagnose(); // expected-warning{{oh no!}} expected-warning{{foo}} } void declsStackErr1(int a) _diagnose_if(a & 1, "decl1", "error"); // expected-note 2{{from 'diagnose_if'}} void declsStackErr1(int a) _diagnose_if(a & 2, "decl2", "error"); // expected-note{{from 'diagnose_if'}} void declsStackErr2(); void declsStackErr2() _diagnose_if(1, "complaint", "error"); // expected-note{{from 'diagnose_if'}} void declsStackErr3() _diagnose_if(1, "complaint", "error"); // expected-note{{from 'diagnose_if'}} void declsStackErr3(); void runDeclsStackErr() { declsStackErr1(0); declsStackErr1(1); // expected-error{{decl1}} declsStackErr1(2); // expected-error{{decl2}} declsStackErr1(3); // expected-error{{decl1}} declsStackErr2(); // expected-error{{complaint}} declsStackErr3(); // expected-error{{complaint}} } void declsStackWarn1(int a) _diagnose_if(a & 1, "decl1", "warning"); // expected-note 2{{from 'diagnose_if'}} void declsStackWarn1(int a) _diagnose_if(a & 2, "decl2", "warning"); // expected-note 2{{from 'diagnose_if'}} void declsStackWarn2(); void declsStackWarn2() _diagnose_if(1, "complaint", "warning"); // expected-note{{from 'diagnose_if'}} void declsStackWarn3() _diagnose_if(1, "complaint", "warning"); // expected-note{{from 'diagnose_if'}} void declsStackWarn3(); void runDeclsStackWarn() { declsStackWarn1(0); declsStackWarn1(1); // expected-warning{{decl1}} declsStackWarn1(2); // expected-warning{{decl2}} declsStackWarn1(3); // expected-warning{{decl1}} expected-warning{{decl2}} declsStackWarn2(); // expected-warning{{complaint}} declsStackWarn3(); // expected-warning{{complaint}} } void noMsg(int n) _diagnose_if(n, "", "warning"); // expected-note{{from 'diagnose_if'}} void runNoMsg() { noMsg(1); // expected-warning{{<no message provided>}} } void alwaysWarnWithArg(int a) _diagnose_if(1 || a, "alwaysWarn", "warning"); // expected-note{{from 'diagnose_if'}} void runAlwaysWarnWithArg(int a) { alwaysWarnWithArg(a); // expected-warning{{alwaysWarn}} } // Test that diagnose_if warnings generated in system headers are not ignored. #include "Inputs/diagnose-if-warn-system-header.h"
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Platform/Android/AdbClient.h
<reponame>Polidea/SiriusObfuscator //===-- AdbClient.h ---------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_AdbClient_h_ #define liblldb_AdbClient_h_ #include "lldb/Core/Error.h" #include <chrono> #include <functional> #include <list> #include <memory> #include <string> #include <vector> namespace lldb_private { class FileSpec; namespace platform_android { class AdbClient { public: enum UnixSocketNamespace { UnixSocketNamespaceAbstract, UnixSocketNamespaceFileSystem, }; using DeviceIDList = std::list<std::string>; class SyncService { friend class AdbClient; public: ~SyncService(); Error PullFile(const FileSpec &remote_file, const FileSpec &local_file); Error PushFile(const FileSpec &local_file, const FileSpec &remote_file); Error Stat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, uint32_t &mtime); bool IsConnected() const; private: explicit SyncService(std::unique_ptr<Connection> &&conn); Error SendSyncRequest(const char *request_id, const uint32_t data_len, const void *data); Error ReadSyncHeader(std::string &response_id, uint32_t &data_len); Error PullFileChunk(std::vector<char> &buffer, bool &eof); Error ReadAllBytes(void *buffer, size_t size); Error internalPullFile(const FileSpec &remote_file, const FileSpec &local_file); Error internalPushFile(const FileSpec &local_file, const FileSpec &remote_file); Error internalStat(const FileSpec &remote_file, uint32_t &mode, uint32_t &size, uint32_t &mtime); Error executeCommand(const std::function<Error()> &cmd); std::unique_ptr<Connection> m_conn; }; static Error CreateByDeviceID(const std::string &device_id, AdbClient &adb); AdbClient(); explicit AdbClient(const std::string &device_id); ~AdbClient(); const std::string &GetDeviceID() const; Error GetDevices(DeviceIDList &device_list); Error SetPortForwarding(const uint16_t local_port, const uint16_t remote_port); Error SetPortForwarding(const uint16_t local_port, llvm::StringRef remote_socket_name, const UnixSocketNamespace socket_namespace); Error DeletePortForwarding(const uint16_t local_port); Error Shell(const char *command, std::chrono::milliseconds timeout, std::string *output); Error ShellToFile(const char *command, std::chrono::milliseconds timeout, const FileSpec &output_file_spec); std::unique_ptr<SyncService> GetSyncService(Error &error); Error SwitchDeviceTransport(); private: Error Connect(); void SetDeviceID(const std::string &device_id); Error SendMessage(const std::string &packet, const bool reconnect = true); Error SendDeviceMessage(const std::string &packet); Error ReadMessage(std::vector<char> &message); Error ReadMessageStream(std::vector<char> &message, std::chrono::milliseconds timeout); Error GetResponseError(const char *response_id); Error ReadResponseStatus(); Error Sync(); Error StartSync(); Error internalShell(const char *command, std::chrono::milliseconds timeout, std::vector<char> &output_buf); Error ReadAllBytes(void *buffer, size_t size); std::string m_device_id; std::unique_ptr<Connection> m_conn; }; } // namespace platform_android } // namespace lldb_private #endif // liblldb_AdbClient_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/SocketAddress.h
<gh_stars>100-1000 //===-- SocketAddress.h -----------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_SocketAddress_h_ #define liblldb_SocketAddress_h_ // C Includes #include <stdint.h> #ifdef _WIN32 #include "lldb/Host/windows/windows.h" #include <winsock2.h> #include <ws2tcpip.h> typedef ADDRESS_FAMILY sa_family_t; #else #include <netdb.h> #include <netinet/in.h> #include <sys/socket.h> #endif #if defined(__FreeBSD__) #include <sys/types.h> #endif // C++ Includes // Other libraries and framework includes // Project includes #include <string> namespace lldb_private { class SocketAddress { public: //------------------------------------------------------------------ // Constructors and Destructors //------------------------------------------------------------------ SocketAddress(); SocketAddress(const struct sockaddr &s); SocketAddress(const struct sockaddr_in &s); SocketAddress(const struct sockaddr_in6 &s); SocketAddress(const struct sockaddr_storage &s); SocketAddress(const SocketAddress &rhs); ~SocketAddress(); //------------------------------------------------------------------ // Operators //------------------------------------------------------------------ const SocketAddress &operator=(const SocketAddress &rhs); const SocketAddress &operator=(const struct addrinfo *addr_info); const SocketAddress &operator=(const struct sockaddr &s); const SocketAddress &operator=(const struct sockaddr_in &s); const SocketAddress &operator=(const struct sockaddr_in6 &s); const SocketAddress &operator=(const struct sockaddr_storage &s); //------------------------------------------------------------------ // Clear the contents of this socket address //------------------------------------------------------------------ void Clear(); //------------------------------------------------------------------ // Get the length for the current socket address family //------------------------------------------------------------------ socklen_t GetLength() const; //------------------------------------------------------------------ // Get the max length for the largest socket address supported. //------------------------------------------------------------------ static socklen_t GetMaxLength(); //------------------------------------------------------------------ // Get the socket address family //------------------------------------------------------------------ sa_family_t GetFamily() const; //------------------------------------------------------------------ // Set the socket address family //------------------------------------------------------------------ void SetFamily(sa_family_t family); //------------------------------------------------------------------ // Get the address //------------------------------------------------------------------ std::string GetIPAddress() const; //------------------------------------------------------------------ // Get the port if the socket address for the family has a port //------------------------------------------------------------------ uint16_t GetPort() const; //------------------------------------------------------------------ // Set the port if the socket address for the family has a port. // The family must be set correctly prior to calling this function. //------------------------------------------------------------------ bool SetPort(uint16_t port); //------------------------------------------------------------------ // Set the socket address according to the first match from a call // to getaddrinfo() (or equivalent functions for systems that don't // have getaddrinfo(). If "addr_info_ptr" is not NULL, it will get // filled in with the match that was used to populate this socket // address. //------------------------------------------------------------------ bool getaddrinfo(const char *host, // Hostname ("foo.bar.com" or "foo" or IP // address string ("172.16.58.3" or // "2001:0db8:85a3:0000:0000:8a2e:0370:7334") const char *service, // Protocol name ("tcp", "http", etc) or a // raw port number string ("81") int ai_family = PF_UNSPEC, int ai_socktype = 0, int ai_protocol = 0, int ai_flags = 0); //------------------------------------------------------------------ // Quick way to set the SocketAddress to localhost given the family. // Returns true if successful, false if "family" doesn't support // localhost or if "family" is not supported by this class. //------------------------------------------------------------------ bool SetToLocalhost(sa_family_t family, uint16_t port); bool SetToAnyAddress(sa_family_t family, uint16_t port); //------------------------------------------------------------------ // Returns true if there is a valid socket address in this object. //------------------------------------------------------------------ bool IsValid() const; //------------------------------------------------------------------ // Direct access to all of the sockaddr structures //------------------------------------------------------------------ struct sockaddr &sockaddr() { return m_socket_addr.sa; } const struct sockaddr &sockaddr() const { return m_socket_addr.sa; } struct sockaddr_in &sockaddr_in() { return m_socket_addr.sa_ipv4; } const struct sockaddr_in &sockaddr_in() const { return m_socket_addr.sa_ipv4; } struct sockaddr_in6 &sockaddr_in6() { return m_socket_addr.sa_ipv6; } const struct sockaddr_in6 &sockaddr_in6() const { return m_socket_addr.sa_ipv6; } struct sockaddr_storage &sockaddr_storage() { return m_socket_addr.sa_storage; } const struct sockaddr_storage &sockaddr_storage() const { return m_socket_addr.sa_storage; } //------------------------------------------------------------------ // Conversion operators to allow getting the contents of this class // as a pointer to the appropriate structure. This allows an instance // of this class to be used in calls that take one of the sockaddr // structure variants without having to manually use the correct // accessor function. //------------------------------------------------------------------ operator struct sockaddr *() { return &m_socket_addr.sa; } operator const struct sockaddr *() const { return &m_socket_addr.sa; } operator struct sockaddr_in *() { return &m_socket_addr.sa_ipv4; } operator const struct sockaddr_in *() const { return &m_socket_addr.sa_ipv4; } operator struct sockaddr_in6 *() { return &m_socket_addr.sa_ipv6; } operator const struct sockaddr_in6 *() const { return &m_socket_addr.sa_ipv6; } operator const struct sockaddr_storage *() const { return &m_socket_addr.sa_storage; } operator struct sockaddr_storage *() { return &m_socket_addr.sa_storage; } protected: typedef union sockaddr_tag { struct sockaddr sa; struct sockaddr_in sa_ipv4; struct sockaddr_in6 sa_ipv6; struct sockaddr_storage sa_storage; } sockaddr_t; //------------------------------------------------------------------ // Classes that inherit from SocketAddress can see and modify these //------------------------------------------------------------------ sockaddr_t m_socket_addr; }; } // namespace lldb_private #endif // liblldb_SocketAddress_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/c/conflicting-symbol/Two/Two.h
#ifndef TWO_H #define TWO_H void two(); #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/PipeBase.h
//===-- PipeBase.h -----------------------------------------------*- C++ //-*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Host_PipeBase_h_ #define liblldb_Host_PipeBase_h_ #include <chrono> #include <string> #include "lldb/Core/Error.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" namespace lldb_private { class PipeBase { public: virtual ~PipeBase(); virtual Error CreateNew(bool child_process_inherit) = 0; virtual Error CreateNew(llvm::StringRef name, bool child_process_inherit) = 0; virtual Error CreateWithUniqueName(llvm::StringRef prefix, bool child_process_inherit, llvm::SmallVectorImpl<char> &name) = 0; virtual Error OpenAsReader(llvm::StringRef name, bool child_process_inherit) = 0; Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit); virtual Error OpenAsWriterWithTimeout(llvm::StringRef name, bool child_process_inherit, const std::chrono::microseconds &timeout) = 0; virtual bool CanRead() const = 0; virtual bool CanWrite() const = 0; virtual int GetReadFileDescriptor() const = 0; virtual int GetWriteFileDescriptor() const = 0; virtual int ReleaseReadFileDescriptor() = 0; virtual int ReleaseWriteFileDescriptor() = 0; virtual void CloseReadFileDescriptor() = 0; virtual void CloseWriteFileDescriptor() = 0; // Close both descriptors virtual void Close() = 0; // Delete named pipe. virtual Error Delete(llvm::StringRef name) = 0; virtual Error Write(const void *buf, size_t size, size_t &bytes_written) = 0; virtual Error ReadWithTimeout(void *buf, size_t size, const std::chrono::microseconds &timeout, size_t &bytes_read) = 0; Error Read(void *buf, size_t size, size_t &bytes_read); }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/include/clang/Index/IndexingAction.h
<filename>SymbolExtractorAndRenamer/clang/include/clang/Index/IndexingAction.h<gh_stars>100-1000 //===--- IndexingAction.h - Frontend index action -------------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_INDEX_INDEXINGACTION_H #define LLVM_CLANG_INDEX_INDEXINGACTION_H #include "clang/Basic/LLVM.h" #include <memory> #include <string> namespace clang { class ASTReader; class ASTUnit; class CompilerInstance; class FrontendAction; class FrontendOptions; class Module; namespace serialization { class ModuleFile; } namespace index { class IndexDataConsumer; class IndexUnitWriter; struct IndexingOptions { enum class SystemSymbolFilterKind { None, DeclarationsOnly, All, }; SystemSymbolFilterKind SystemSymbolFilter = SystemSymbolFilterKind::DeclarationsOnly; bool IndexFunctionLocals = false; }; struct RecordingOptions { enum class IncludesRecordingKind { None, UserOnly, // only record includes inside non-system files. All, }; std::string DataDirPath; bool RecordSymbolCodeGenName = false; bool RecordSystemDependencies = true; IncludesRecordingKind RecordIncludes = IncludesRecordingKind::UserOnly; }; /// \param WrappedAction another frontend action to wrap over or null. std::unique_ptr<FrontendAction> createIndexingAction(std::shared_ptr<IndexDataConsumer> DataConsumer, IndexingOptions Opts, std::unique_ptr<FrontendAction> WrappedAction); void indexASTUnit(ASTUnit &Unit, std::shared_ptr<IndexDataConsumer> DataConsumer, IndexingOptions Opts); void indexModuleFile(serialization::ModuleFile &Mod, ASTReader &Reader, std::shared_ptr<IndexDataConsumer> DataConsumer, IndexingOptions Opts); /// \param WrappedAction another frontend action to wrap over or null. std::unique_ptr<FrontendAction> createIndexDataRecordingAction(const FrontendOptions &FEOpts, std::unique_ptr<FrontendAction> WrappedAction); /// Checks if the unit file exists for the module file, if it doesn't it /// generates index data for it. /// /// \returns true if the index data were generated, false otherwise. bool emitIndexDataForModuleFile(const Module *Mod, const CompilerInstance &CI, IndexUnitWriter &ParentUnitWriter); } // namespace index } // namespace clang #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/DynamicLoader/Static/DynamicLoaderStatic.h<gh_stars>100-1000 //===-- DynamicLoaderStatic.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_DynamicLoaderStatic_h_ #define liblldb_DynamicLoaderStatic_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Core/UUID.h" #include "lldb/Host/FileSpec.h" #include "lldb/Target/DynamicLoader.h" #include "lldb/Target/Process.h" class DynamicLoaderStatic : public lldb_private::DynamicLoader { public: DynamicLoaderStatic(lldb_private::Process *process); ~DynamicLoaderStatic() override; //------------------------------------------------------------------ // Static Functions //------------------------------------------------------------------ static void Initialize(); static void Terminate(); static lldb_private::ConstString GetPluginNameStatic(); static const char *GetPluginDescriptionStatic(); static lldb_private::DynamicLoader * CreateInstance(lldb_private::Process *process, bool force); //------------------------------------------------------------------ /// Called after attaching a process. /// /// Allow DynamicLoader plug-ins to execute some code after /// attaching to a process. //------------------------------------------------------------------ void DidAttach() override; void DidLaunch() override; lldb::ThreadPlanSP GetStepThroughTrampolinePlan(lldb_private::Thread &thread, bool stop_others) override; lldb_private::Error CanLoadImage() override; //------------------------------------------------------------------ // PluginInterface protocol //------------------------------------------------------------------ lldb_private::ConstString GetPluginName() override; uint32_t GetPluginVersion() override; private: void LoadAllImagesAtFileAddresses(); DISALLOW_COPY_AND_ASSIGN(DynamicLoaderStatic); }; #endif // liblldb_DynamicLoaderStatic_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/llvm/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.h
<gh_stars>100-1000 //===-- AMDGPUTargetStreamer.h - AMDGPU Target Streamer --------*- C++ -*--===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H #define LLVM_LIB_TARGET_AMDGPU_MCTARGETDESC_AMDGPUTARGETSTREAMER_H #include "AMDKernelCodeT.h" #include "llvm/MC/MCStreamer.h" namespace llvm { #include "AMDGPUPTNote.h" class DataLayout; class Function; class MCELFStreamer; class MCSymbol; class MDNode; class Module; class Type; class AMDGPUTargetStreamer : public MCTargetStreamer { protected: MCContext &getContext() const { return Streamer.getContext(); } public: AMDGPUTargetStreamer(MCStreamer &S); virtual void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor) = 0; virtual void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName) = 0; virtual void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) = 0; virtual void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) = 0; virtual void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) = 0; virtual void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) = 0; virtual void EmitRuntimeMetadata(Module &M) = 0; virtual void EmitRuntimeMetadata(StringRef Metadata) = 0; }; class AMDGPUTargetAsmStreamer : public AMDGPUTargetStreamer { formatted_raw_ostream &OS; public: AMDGPUTargetAsmStreamer(MCStreamer &S, formatted_raw_ostream &OS); void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor) override; void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName) override; void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override; void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override; void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override; void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override; void EmitRuntimeMetadata(Module &M) override; void EmitRuntimeMetadata(StringRef Metadata) override; }; class AMDGPUTargetELFStreamer : public AMDGPUTargetStreamer { MCStreamer &Streamer; void EmitAMDGPUNote(const MCExpr *DescSize, AMDGPU::PT_NOTE::NoteType Type, function_ref<void(MCELFStreamer &)> EmitDesc); public: AMDGPUTargetELFStreamer(MCStreamer &S); MCELFStreamer &getStreamer(); void EmitDirectiveHSACodeObjectVersion(uint32_t Major, uint32_t Minor) override; void EmitDirectiveHSACodeObjectISA(uint32_t Major, uint32_t Minor, uint32_t Stepping, StringRef VendorName, StringRef ArchName) override; void EmitAMDKernelCodeT(const amd_kernel_code_t &Header) override; void EmitAMDGPUSymbolType(StringRef SymbolName, unsigned Type) override; void EmitAMDGPUHsaModuleScopeGlobal(StringRef GlobalName) override; void EmitAMDGPUHsaProgramScopeGlobal(StringRef GlobalName) override; void EmitRuntimeMetadata(Module &M) override; void EmitRuntimeMetadata(StringRef Metadata) override; }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/FileIO.h
#ifndef FileIO_h #define FileIO_h #include "llvm/Support/Error.h" #include "llvm/Support/MemoryBuffer.h" #include <string> namespace swift { namespace obfuscation { struct MemoryBufferProvider { virtual ~MemoryBufferProvider() = default; /// Provides memory buffer for given path. /// /// In case of failing during execution returns Error. /// /// Typical usage: /// \code /// auto Buffer = BufferProvider.getBuffer(PathToJson); /// \endcode /// /// \param Path - string containing path to file. /// /// \returns llvm::ErrorOr object containing either the memory buffer /// or llvm::Error object with the information. It's llvm::ErrorOr, /// not llvm::Expected, because this is the error format that /// the underlying API returns. virtual llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer>> getBuffer(std::string Path) const; }; /// Creates the file streams to write to. /// /// \tparam FileType - the type of the file stream with the possibility /// to write to it and close it. template <typename FileType> struct FileFactory { virtual ~FileFactory() = default; /// Provides file for given path. /// /// In case of failing during execution returns Error. /// /// Typical usage: /// \code /// auto File = Factory.getFile(PathToOutput); /// \endcode /// /// \param Path - string containing path to file. /// /// \returns llvm::ErrorOr object containing either the file /// or llvm::Error object with error information. It's llvm::ErrorOr, /// not llvm::Expected, because this is the error format that /// the underlying API returns. virtual llvm::ErrorOr<std::unique_ptr<FileType>> getFile(std::string Path); }; /// Given path to file containing json, parses file and returns object /// of type T. /// /// In case of failing reading file or failing parsing json, returns Error. /// /// Typical usage: /// \code /// auto FilesJsonOrError = parseJson<FilesJson>(PathToJson); /// if (auto Error = FilesJsonOrError.takeError()) { /// ExitOnError(std::move(Error)); /// } /// \endcode /// /// \param PathToJson - string containing path to file with json. /// /// \param BufferProvider - optional parameter with object providing memory /// buffer used during parsing. /// /// \returns llvm::Expected object containing either the object of type T /// read from file provided in \p PathToJson or llvm::Error object with /// the information. template<typename T> llvm::Expected<T> parseJson(std::string PathToJson, const MemoryBufferProvider &BufferProvider = MemoryBufferProvider()); } //namespace obfuscation } //namespace swift #include "FileIO-Template.h" #endif /* FileIO_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Language/Swift/SwiftOptional.h
<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/Language/Swift/SwiftOptional.h //===-- SwiftOptional.h -----------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef liblldb_SwiftOptional_h_ #define liblldb_SwiftOptional_h_ #include "lldb/lldb-forward.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/DataFormatters/TypeSynthetic.h" #include <cstddef> namespace lldb_private { namespace formatters { // ExtractSomeIfAny() can return EITHER a child member or some other long-lived // ValueObject // OR an entirely consed-up ValueObject // The lifetime of these two is radically different, and there is no trivial way // to do the right // thing for both cases - except have a class that can wrap either and is safe // to store and pass around class PointerOrSP { public: PointerOrSP(std::nullptr_t) : m_raw_ptr(nullptr), m_shared_ptr(nullptr) {} PointerOrSP(ValueObject *valobj) : m_raw_ptr(valobj), m_shared_ptr(nullptr) {} PointerOrSP(lldb::ValueObjectSP valobj_sp) : m_raw_ptr(nullptr), m_shared_ptr(valobj_sp) {} ValueObject *operator->() { if (m_shared_ptr) return m_shared_ptr.get(); return m_raw_ptr; } ValueObject &operator*() { return *(this->operator->()); } operator ValueObject *() { return this->operator->(); } explicit operator bool() const { return (m_shared_ptr.get() != nullptr) || (m_raw_ptr != nullptr); } bool operator==(std::nullptr_t) const { return !(this->operator bool()); } protected: ValueObject *m_raw_ptr; lldb::ValueObjectSP m_shared_ptr; }; namespace swift { struct SwiftOptionalSummaryProvider : public TypeSummaryImpl { SwiftOptionalSummaryProvider(const TypeSummaryImpl::Flags &flags) : TypeSummaryImpl(TypeSummaryImpl::Kind::eInternal, TypeSummaryImpl::Flags()) {} virtual ~SwiftOptionalSummaryProvider() {} virtual bool FormatObject(ValueObject *valobj, std::string &dest, const TypeSummaryOptions &options); virtual std::string GetDescription(); virtual bool IsScripted() { return false; } virtual bool DoesPrintChildren(ValueObject *valobj) const; virtual bool DoesPrintValue(ValueObject *valobj) const; private: DISALLOW_COPY_AND_ASSIGN(SwiftOptionalSummaryProvider); }; bool SwiftOptional_SummaryProvider(ValueObject &valobj, Stream &stream); class SwiftOptionalSyntheticFrontEnd : public SyntheticChildrenFrontEnd { public: SwiftOptionalSyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); virtual size_t CalculateNumChildren(); virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx); virtual bool Update(); virtual bool MightHaveChildren(); virtual size_t GetIndexOfChildWithName(const ConstString &name); virtual lldb::ValueObjectSP GetSyntheticValue(); virtual ~SwiftOptionalSyntheticFrontEnd() = default; private: bool m_is_none; bool m_children; PointerOrSP m_some; bool IsEmpty() const; }; SyntheticChildrenFrontEnd * SwiftOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP); SyntheticChildrenFrontEnd * SwiftUncheckedOptionalSyntheticFrontEndCreator(CXXSyntheticChildren *, lldb::ValueObjectSP); } } } #endif // liblldb_SwiftOptional_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/APINotes/yaml-reader-test.c
# RUN: %clang -cc1apinotes -dump %s | FileCheck %s --- Name: UIKit Availability: iOS AvailabilityMsg: iOSOnly Classes: - Name: UIFont Availability: iOS AvailabilityMsg: iOSOnly Methods: - Selector: 'fontWithName:size:' MethodKind: Instance Nullability: [ N ] NullabilityOfRet: O Availability: iOS AvailabilityMsg: iOSOnly DesignatedInit: true Properties: - Name: familyName Nullability: N Availability: iOS AvailabilityMsg: iOSOnly - Name: fontName Nullability: N Availability: iOS AvailabilityMsg: iOSOnly Protocols: - Name: MyProto AuditedForNullability: true - Name: MyProto2 AuditedForNullability: true Functions: - Name: 'globalFoo' Nullability: [ N, N, O, S ] NullabilityOfRet: O Availability: iOS AvailabilityMsg: iOSOnly - Name: 'globalFoo2' Nullability: [ N, N, O, S ] NullabilityOfRet: O Globals: - Name: globalVar Nullability: O Availability: iOS AvailabilityMsg: iOSOnly - Name: globalVar2 Nullability: O # CHECK: Name: UIKit # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: Classes: # CHECK: - Name: UIFont # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: Methods: # CHECK: - Selector: 'fontWithName:size:' # CHECK: MethodKind: Instance # CHECK: Nullability: [ N ] # CHECK: NullabilityOfRet: O # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: DesignatedInit: true # CHECK: Properties: # CHECK: - Name: familyName # CHECK: Nullability: N # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: - Name: fontName # CHECK: Nullability: N # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK:Protocols: # CHECK: - Name: MyProto # CHECK: AuditedForNullability: true # CHECK: Availability: available # CHECK: AvailabilityMsg: '' # CHECK: - Name: MyProto2 # CHECK: AuditedForNullability: true # CHECK: Availability: available # CHECK: AvailabilityMsg: '' # CHECK:Functions: # CHECK: - Name: globalFoo # CHECK: Nullability: [ N, N, O, U ] # CHECK: NullabilityOfRet: O # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: - Name: globalFoo2 # CHECK: Nullability: [ N, N, O, U ] # CHECK: NullabilityOfRet: O # CHECK: Availability: available # CHECK: AvailabilityMsg: '' # CHECK:Globals: # CHECK: - Name: globalVar # CHECK: Nullability: O # CHECK: Availability: iOS # CHECK: AvailabilityMsg: iOSOnly # CHECK: - Name: globalVar2 # CHECK: Nullability: O # CHECK: Availability: available # CHECK: AvailabilityMsg:
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/HostNativeThreadForward.h
<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Host/HostNativeThreadForward.h //===-- HostNativeThreadForward.h -------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_Host_HostNativeThreadForward_h_ #define lldb_Host_HostNativeThreadForward_h_ namespace lldb_private { #if defined(_WIN32) class HostThreadWindows; typedef HostThreadWindows HostNativeThread; #elif defined(__linux__) class HostThreadLinux; typedef HostThreadLinux HostNativeThread; #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) class HostThreadFreeBSD; typedef HostThreadFreeBSD HostNativeThread; #elif defined(__NetBSD__) class HostThreadNetBSD; typedef HostThreadNetBSD HostNativeThread; #elif defined(__APPLE__) class HostThreadMacOSX; typedef HostThreadMacOSX HostNativeThread; #endif } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/packages/Python/lldbsuite/test/lang/swift/unit-tests/xctest.c
<reponame>Polidea/SiriusObfuscator //===-- XCTest.c ------------------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #include <dlfcn.h> #include <stdio.h> int main() { void *test_case = dlopen("UnitTest.xctest/Contents/MacOS/test", RTLD_NOW); printf("%p\n", test_case); // Set breakpoint here return 0; }
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Index/Store/print-unit.c
<reponame>Polidea/SiriusObfuscator // XFAIL: linux #include "print-unit.h" #include "syshead.h" void foo(int i); // RUN: rm -rf %t // RUN: %clang_cc1 -I %S/Inputs -isystem %S/Inputs/sys -index-store-path %t/idx %s -triple x86_64-apple-macosx10.8 // RUN: c-index-test core -print-unit %t/idx | FileCheck %s // RUN: %clang_cc1 -I %S/Inputs -isystem %S/Inputs/sys -index-store-path %t/idx_opt1 %s -triple x86_64-apple-macosx10.8 -O2 // RUN: c-index-test core -print-unit %t/idx_opt1 | FileCheck %s -check-prefix=OPT // RUN: %clang_cc1 -I %S/Inputs -isystem %S/Inputs/sys -index-store-path %t/idx_opt2 %s -triple x86_64-apple-macosx10.8 -Os // RUN: c-index-test core -print-unit %t/idx_opt2 | FileCheck %s -check-prefix=OPT // CHECK: print-unit.c.o // CHECK: provider: clang- // CHECK: is-system: 0 // CHECK: has-main: 1 // CHECK: main-path: {{.*}}/print-unit.c // CHECK: out-file: {{.*}}/print-unit.c.o // CHECK: target: x86_64-apple-macosx10.8 // CHECK: is-debug: 1 // CHECK: DEPEND START // CHECK: Record | user | {{.*}}/print-unit.c | print-unit.c- // CHECK: Record | user | {{.*}}/Inputs/head.h | head.h- // CHECK: Record | user | {{.*}}/Inputs/using-overlay.h | using-overlay.h- // CHECK: Record | system | {{.*}}/Inputs/sys/syshead.h | syshead.h- // CHECK: Record | system | {{.*}}/Inputs/sys/another.h | another.h- // CHECK: File | user | {{.*}}/Inputs/print-unit.h | | {{[0-9]*$}} // CHECK: DEPEND END (6) // CHECK: INCLUDE START // CHECK: {{.*}}/print-unit.c:3 | {{.*}}/Inputs/print-unit.h // CHECK: {{.*}}/print-unit.c:4 | {{.*}}/Inputs/sys/syshead.h // CHECK: {{.*}}/Inputs/print-unit.h:1 | {{.*}}/Inputs/head.h // CHECK: {{.*}}/Inputs/print-unit.h:2 | {{.*}}/Inputs/using-overlay.h // CHECK: INCLUDE END (4) // OPT: is-debug: 0
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Process/Windows/Common/TargetThreadWindows.h
<reponame>Polidea/SiriusObfuscator<gh_stars>100-1000 //===-- TargetThreadWindows.h -----------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Plugins_Process_Windows_TargetThreadWindows_H_ #define liblldb_Plugins_Process_Windows_TargetThreadWindows_H_ //#include "ForwardDecl.h" #include "lldb/Host/HostThread.h" #include "lldb/Target/Thread.h" #include "lldb/lldb-forward.h" #include "RegisterContextWindows.h" namespace lldb_private { class ProcessWindows; class HostThread; class StackFrame; class TargetThreadWindows : public lldb_private::Thread { public: TargetThreadWindows(ProcessWindows &process, const HostThread &thread); virtual ~TargetThreadWindows(); // lldb_private::Thread overrides void RefreshStateAfterStop() override; void WillResume(lldb::StateType resume_state) override; void DidStop() override; lldb::RegisterContextSP GetRegisterContext() override; lldb::RegisterContextSP CreateRegisterContextForFrame(StackFrame *frame) override; bool CalculateStopInfo() override; Unwind *GetUnwinder() override; bool DoResume(); HostThread GetHostThread() const { return m_host_thread; } private: lldb::RegisterContextSP CreateRegisterContextForFrameIndex(uint32_t idx); HostThread m_host_thread; }; } #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/Endian.h
<gh_stars>100-1000 //===-- Endian.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_host_endian_h_ #define liblldb_host_endian_h_ #include "lldb/lldb-enumerations.h" namespace lldb_private { namespace endian { static union EndianTest { uint32_t num; uint8_t bytes[sizeof(uint32_t)]; } const endianTest = {0x01020304}; inline lldb::ByteOrder InlHostByteOrder() { return (lldb::ByteOrder)endianTest.bytes[0]; } // ByteOrder const InlHostByteOrder = (ByteOrder)endianTest.bytes[0]; } } #endif // liblldb_host_endian_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Sema/attr-availability-swift.c
// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -fblocks -verify %s // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fsyntax-only -ast-dump %s | FileCheck %s // #if !__has_feature(attribute_availability_with_message) # error "Missing __has_feature" #endif #if __has_feature(attribute_availability_swift) # warning "okay" // expected-warning@-1{{okay}} #else # error "Missing __has_feature" #endif extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable))); // CHECK: AvailabilityAttr {{.*}}swift 0 0 0 Unavailable "" "" extern int noSwiftGlobal1 __attribute__((availability(macosx, introduced=10.1))); // okay // CHECK: AvailabilityAttr {{.*}}macos 10.1 0 0 "" "" // CHECK: AvailabilityAttr {{.*}}Inherited swift 0 0 0 Unavailable "" "" extern int noSwiftGlobal1 __attribute__((availability(swift, unavailable, message="and this one has a message"))); // okay // CHECK: AvailabilityAttr {{.*}}swift 0 0 0 Unavailable "and this one has a message" "" // CHECK: AvailabilityAttr {{.*}}Inherited macos 10.1 0 0 "" "" extern int noSwiftGlobal2 __attribute__((availability(swift, introduced=5))); // expected-warning{{only 'unavailable' and 'deprecated' are supported for Swift availability}} // CHECK: VarDecl // CHECK-NOT: AvailabilityAttr extern int noSwiftGlobal3 __attribute__((availability(swift, deprecated, message="t"))); // CHECK: VarDecl // CHECK: AvailabilityAttr {{.*}}swift 0 1 0 "t" ""
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Index/Store/print-units-with-pch.c
// RUN: rm -rf %t.idx // RUN: %clang -arch x86_64 -mmacosx-version-min=10.7 -x c-header %S/Inputs/head.h -o %t.h.pch -index-store-path %t.idx // RUN: %clang -arch x86_64 -mmacosx-version-min=10.7 -c %s -o %t.o -index-store-path %t.idx -include %t.h -Werror // RUN: c-index-test core -print-unit %t.idx | FileCheck %s // XFAIL: linux int main() { test1_func(); } // CHECK: print-units-with-pch.c.tmp.h.pch // CHECK: is-system: 0 // CHECK: has-main: 0 // CHECK: main-path: {{$}} // CHECK: out-file: {{.*}}/print-units-with-pch.c.tmp.h.pch // CHECK: DEPEND START // CHECK: Record | user | {{.*}}/Inputs/head.h | head.h // CHECK: DEPEND END (1) // CHECK: print-units-with-pch.c.tmp.o // CHECK: is-system: 0 // CHECK: has-main: 1 // CHECK: main-path: {{.*}}/print-units-with-pch.c // CHECK: out-file: {{.*}}/print-units-with-pch.c.tmp.o // CHECK: DEPEND START // CHECK: Unit | user | {{.*}}/print-units-with-pch.c.tmp.h.pch | print-units-with-pch.c.tmp.h.pch // CHECK: Record | user | {{.*}}/print-units-with-pch.c | print-units-with-pch.c // CHECK: DEPEND END (2)
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/swift/include/swift/Obfuscation/SymbolExtracting.h
<reponame>Polidea/SiriusObfuscator #ifndef SymbolExtracting_h #define SymbolExtracting_h #include "swift/Obfuscation/DataStructures.h" #include "llvm/Support/Error.h" #include <string> namespace swift { namespace obfuscation { /// Performs the symbol extraction from the Swift source code files included /// in the FilesJson structure. /// /// It utilizes the Swift compiler to perform the semantic analysis of /// the Swift source files. Using the information encoded in FilesJson, /// it creates the compiler invocation for the files, then it asks for /// semantic analysis, and then it uses the results of the analysis (AST tree) /// to identify the symbols in the Swift source code that should be obfuscated. /// /// It's designed to be called from the Swift compiler command line tool. /// /// Typical usage: /// \code /// std::string MainExecutablePath = llvm::sys::fs::getMainExecutable( /// argv[0], reinterpret_cast<void *>(&anchorForGetMainExecutable)); /// auto SymbolsOrError = extractSymbols(FilesJson, /// MainExecutablePath, /// DiagnosticStream); /// \endcode /// /// \param FilesJson It's the structure containing information necessary for /// the compiler to perform analysis (such as list of Swift source /// files, list of libraries to link, path to SDK containing /// the system libraries etc.). /// \param MainExecutablePath Path to the directory containing the tool calling /// this function. This is required for the compiler to use the relative /// paths for it's inner workings (such as finding the necessary /// libraries to dynamically link). /// \param DiagnosticStream Stream for writing the diagnostic information into. /// /// \returns llvm::Expected object containing either the extracted symbols /// in the SymbolJson structure or the llvm::Error object with /// the information on the failure cause. llvm::Expected<SymbolsJson> extractSymbols(const FilesJson &FilesJson, std::string MainExecutablePath, llvm::raw_ostream &DiagnosticStream); } //namespace obfuscation } //namespace swift #endif /* SymbolExtracting_h */
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/ExpressionParser/Swift/SwiftREPL.h
<gh_stars>100-1000 //===-- SwiftREPL.h ---------------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See https://swift.org/LICENSE.txt for license information // See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// #ifndef liblldb_SwiftREPL_h_ #define liblldb_SwiftREPL_h_ #include "lldb/Core/Error.h" #include "lldb/Expression/REPL.h" #include "lldb/lldb-public.h" #include <string> #include <vector> namespace lldb_private { class IRExecutionUnit; //---------------------------------------------------------------------- /// @class SwiftREPL SwiftREPL.h "lldb/Expression/SwiftREPL.h" /// @brief Encapsulates a swift REPL session. //---------------------------------------------------------------------- class SwiftREPL : public REPL { public: SwiftREPL(Target &target); ~SwiftREPL(); static void Initialize(); static void Terminate(); protected: static lldb::REPLSP CreateInstance(Error &error, lldb::LanguageType language, Debugger *debugger, Target *target, const char *repl_options); static void EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages); Error DoInitialization() override; ConstString GetSourceFileBasename() override; const char *GetAutoIndentCharacters() override { return "}:"; } bool SourceIsComplete(const std::string &source) override; lldb::offset_t GetDesiredIndentation(const StringList &lines, int cursor_position, int tab_size) override; lldb::LanguageType GetLanguage() override; bool PrintOneVariable(Debugger &debugger, lldb::StreamFileSP &output_sp, lldb::ValueObjectSP &valobj_sp, ExpressionVariable *var = nullptr) override; int CompleteCode(const std::string &current_code, StringList &matches) override; public: //------------------------------------------------------------------ // llvm casting support //------------------------------------------------------------------ static bool classof(const REPL *repl) { return repl->getKind() == LLVMCastKind::eKindSwift; } private: lldb::SwiftASTContextSP m_swift_ast_sp; }; } #endif // liblldb_SwiftREPL_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/OptionValueString.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/lldb/include/lldb/Interpreter/OptionValueString.h<gh_stars>100-1000 //===-- OptionValueString.h -------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_OptionValueString_h_ #define liblldb_OptionValueString_h_ // C Includes // C++ Includes #include <string> // Other libraries and framework includes // Project includes #include "lldb/Core/Flags.h" #include "lldb/Interpreter/OptionValue.h" namespace lldb_private { class OptionValueString : public OptionValue { public: typedef Error (*ValidatorCallback)(const char *string, void *baton); enum Options { eOptionEncodeCharacterEscapeSequences = (1u << 0) }; OptionValueString() : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(), m_validator_baton() {} OptionValueString(ValidatorCallback validator, void *baton = nullptr) : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(validator), m_validator_baton(baton) {} OptionValueString(const char *value) : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(), m_validator_baton() { if (value && value[0]) { m_current_value.assign(value); m_default_value.assign(value); } } OptionValueString(const char *current_value, const char *default_value) : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(), m_validator_baton() { if (current_value && current_value[0]) m_current_value.assign(current_value); if (default_value && default_value[0]) m_default_value.assign(default_value); } OptionValueString(const char *value, ValidatorCallback validator, void *baton = nullptr) : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(validator), m_validator_baton(baton) { if (value && value[0]) { m_current_value.assign(value); m_default_value.assign(value); } } OptionValueString(const char *current_value, const char *default_value, ValidatorCallback validator, void *baton = nullptr) : OptionValue(), m_current_value(), m_default_value(), m_options(), m_validator(validator), m_validator_baton(baton) { if (current_value && current_value[0]) m_current_value.assign(current_value); if (default_value && default_value[0]) m_default_value.assign(default_value); } ~OptionValueString() override = default; //--------------------------------------------------------------------- // Virtual subclass pure virtual overrides //--------------------------------------------------------------------- OptionValue::Type GetType() const override { return eTypeString; } void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; Error SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; Error SetValueFromString(const char *, VarSetOperationType = eVarSetOperationAssign) = delete; bool Clear() override { m_current_value = m_default_value; m_value_was_set = false; return true; } lldb::OptionValueSP DeepCopy() const override; //--------------------------------------------------------------------- // Subclass specific functions //--------------------------------------------------------------------- Flags &GetOptions() { return m_options; } const Flags &GetOptions() const { return m_options; } const char *operator=(const char *value) { SetCurrentValue(llvm::StringRef::withNullAsEmpty(value)); return m_current_value.c_str(); } const char *GetCurrentValue() const { return m_current_value.c_str(); } llvm::StringRef GetCurrentValueAsRef() const { return m_current_value; } const char *GetDefaultValue() const { return m_default_value.c_str(); } llvm::StringRef GetDefaultValueAsRef() const { return m_default_value; } Error SetCurrentValue(const char *) = delete; Error SetCurrentValue(llvm::StringRef value); Error AppendToCurrentValue(const char *value); void SetDefaultValue(const char *value) { if (value && value[0]) m_default_value.assign(value); else m_default_value.clear(); } bool IsCurrentValueEmpty() const { return m_current_value.empty(); } bool IsDefaultValueEmpty() const { return m_default_value.empty(); } protected: std::string m_current_value; std::string m_default_value; Flags m_options; ValidatorCallback m_validator; void *m_validator_baton; }; } // namespace lldb_private #endif // liblldb_OptionValueString_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/SymbolFile/DWARF/LogChannelDWARF.h
<gh_stars>100-1000 //===-- LogChannelDWARF.h ---------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef SymbolFileDWARF_LogChannelDWARF_h_ #define SymbolFileDWARF_LogChannelDWARF_h_ // C Includes // C++ Includes // Other libraries and framework includes // Project includes #include "lldb/Core/Log.h" #define DWARF_LOG_VERBOSE (1u << 0) #define DWARF_LOG_DEBUG_INFO (1u << 1) #define DWARF_LOG_DEBUG_LINE (1u << 2) #define DWARF_LOG_DEBUG_PUBNAMES (1u << 3) #define DWARF_LOG_DEBUG_PUBTYPES (1u << 4) #define DWARF_LOG_DEBUG_ARANGES (1u << 5) #define DWARF_LOG_LOOKUPS (1u << 6) #define DWARF_LOG_TYPE_COMPLETION (1u << 7) #define DWARF_LOG_DEBUG_MAP (1u << 8) #define DWARF_LOG_ALL (UINT32_MAX) #define DWARF_LOG_DEFAULT (DWARF_LOG_DEBUG_INFO) class LogChannelDWARF : public lldb_private::LogChannel { public: LogChannelDWARF(); ~LogChannelDWARF() override; static void Initialize(); static void Terminate(); static lldb_private::ConstString GetPluginNameStatic(); static const char *GetPluginDescriptionStatic(); static lldb_private::LogChannel *CreateInstance(); lldb_private::ConstString GetPluginName() override; uint32_t GetPluginVersion() override; void Disable(const char **categories, lldb_private::Stream *feedback_strm) override; void Delete(); bool Enable(lldb::StreamSP &log_stream_sp, uint32_t log_options, lldb_private::Stream *feedback_strm, // Feedback stream for argument errors etc const char **categories) override; // The categories to enable // within this logging stream, // if empty, enable default set void ListCategories(lldb_private::Stream *strm) override; static lldb_private::Log *GetLog(); static lldb_private::Log *GetLogIfAll(uint32_t mask); static lldb_private::Log *GetLogIfAny(uint32_t mask); static void LogIf(uint32_t mask, const char *format, ...); }; #endif // SymbolFileDWARF_LogChannelDWARF_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h
<filename>SymbolExtractorAndRenamer/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux.h //===-- NativeRegisterContextLinux.h ----------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_NativeRegisterContextLinux_h #define lldb_NativeRegisterContextLinux_h #include "lldb/Host/common/NativeRegisterContextRegisterInfo.h" #include "lldb/Host/common/NativeThreadProtocol.h" #include "Plugins/Process/Linux/NativeProcessLinux.h" namespace lldb_private { namespace process_linux { class NativeRegisterContextLinux : public NativeRegisterContextRegisterInfo { public: NativeRegisterContextLinux(NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx, RegisterInfoInterface *reg_info_interface_p); // This function is implemented in the NativeRegisterContextLinux_* subclasses // to create a new // instance of the host specific NativeRegisterContextLinux. The // implementations can't collide // as only one NativeRegisterContextLinux_* variant should be compiled into // the final // executable. static NativeRegisterContextLinux * CreateHostNativeRegisterContextLinux(const ArchSpec &target_arch, NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx); protected: lldb::ByteOrder GetByteOrder() const; virtual Error ReadRegisterRaw(uint32_t reg_index, RegisterValue &reg_value); virtual Error WriteRegisterRaw(uint32_t reg_index, const RegisterValue &reg_value); virtual Error ReadRegisterSet(void *buf, size_t buf_size, unsigned int regset); virtual Error WriteRegisterSet(void *buf, size_t buf_size, unsigned int regset); virtual Error ReadGPR(); virtual Error WriteGPR(); virtual Error ReadFPR(); virtual Error WriteFPR(); virtual void *GetGPRBuffer() { return nullptr; } virtual size_t GetGPRSize() { return GetRegisterInfoInterface().GetGPRSize(); } virtual void *GetFPRBuffer() { return nullptr; } virtual size_t GetFPRSize() { return 0; } // The Do*** functions are executed on the privileged thread and can perform // ptrace // operations directly. virtual Error DoReadRegisterValue(uint32_t offset, const char *reg_name, uint32_t size, RegisterValue &value); virtual Error DoWriteRegisterValue(uint32_t offset, const char *reg_name, const RegisterValue &value); virtual Error DoReadGPR(void *buf, size_t buf_size); virtual Error DoWriteGPR(void *buf, size_t buf_size); virtual Error DoReadFPR(void *buf, size_t buf_size); virtual Error DoWriteFPR(void *buf, size_t buf_size); }; } // namespace process_linux } // namespace lldb_private #endif // #ifndef lldb_NativeRegisterContextLinux_h
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/Config.h
<gh_stars>100-1000 //===-- Config.h ------------------------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_Config_h_ #define liblldb_Config_h_ #if defined(__APPLE__) #include "lldb/Host/macosx/Config.h" #elif defined(__ANDROID__) #include "lldb/Host/android/Config.h" #elif defined(__linux__) || defined(__GNU__) #include "lldb/Host/linux/Config.h" #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || \ defined(__OpenBSD__) #include "lldb/Host/freebsd/Config.h" #elif defined(__NetBSD__) #include "lldb/Host/netbsd/Config.h" #elif defined(__MINGW__) || defined(__MINGW32__) #include "lldb/Host/mingw/Config.h" #elif defined(_MSC_VER) #include "lldb/Host/msvc/Config.h" #else #error undefined platform #endif #endif // #ifndef liblldb_Config_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Host/linux/ProcessLauncherLinux.h
<reponame>Polidea/SiriusObfuscator //===-- ProcessLauncherAndroid.h --------------------------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef lldb_Host_android_ProcessLauncherAndroid_h_ #define lldb_Host_android_ProcessLauncherAndroid_h_ #include "lldb/Host/ProcessLauncher.h" namespace lldb_private { class ProcessLauncherLinux : public ProcessLauncher { public: virtual HostProcess LaunchProcess(const ProcessLaunchInfo &launch_info, Error &error); }; } // end of namespace lldb_private #endif
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/clang/test/Modules/Inputs/system-out-of-date/Z.h
<filename>SymbolExtractorAndRenamer/clang/test/Modules/Inputs/system-out-of-date/Z.h #import <Y.h>
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/lldb/include/lldb/Core/UserSettingsController.h
//====-- UserSettingsController.h --------------------------------*- C++-*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// #ifndef liblldb_UserSettingsController_h_ #define liblldb_UserSettingsController_h_ // C Includes // C++ Includes #include <string> #include <vector> // Other libraries and framework includes // Project includes #include "lldb/Core/ConstString.h" #include "lldb/Core/Stream.h" #include "lldb/Core/StreamString.h" #include "lldb/Core/StringList.h" #include "lldb/Interpreter/OptionValue.h" #include "lldb/lldb-private.h" namespace lldb_private { class Properties { public: Properties() : m_collection_sp() {} Properties(const lldb::OptionValuePropertiesSP &collection_sp) : m_collection_sp(collection_sp) {} virtual ~Properties() {} virtual lldb::OptionValuePropertiesSP GetValueProperties() const { // This function is virtual in case subclasses want to lazily // implement creating the properties. return m_collection_sp; } virtual lldb::OptionValueSP GetPropertyValue(const ExecutionContext *exe_ctx, llvm::StringRef property_path, bool will_modify, Error &error) const; virtual Error SetPropertyValue(const ExecutionContext *exe_ctx, VarSetOperationType op, llvm::StringRef property_path, llvm::StringRef value); virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm, llvm::StringRef property_path, uint32_t dump_mask); virtual void DumpAllPropertyValues(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask); virtual void DumpAllDescriptions(CommandInterpreter &interpreter, Stream &strm) const; size_t Apropos(llvm::StringRef keyword, std::vector<const Property *> &matching_properties) const; lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx, const ConstString &name); // We sometimes need to introduce a setting to enable experimental features, // but then we don't want the setting for these to cause errors when the // setting // goes away. Add a sub-topic of the settings using this experimental name, // and // two things will happen. One is that settings that don't find the name will // not // be treated as errors. Also, if you decide to keep the settings just move // them into // the containing properties, and we will auto-forward the experimental // settings to the // real one. static const char *GetExperimentalSettingsName(); static bool IsSettingExperimental(llvm::StringRef setting); protected: lldb::OptionValuePropertiesSP m_collection_sp; }; } // namespace lldb_private #endif // liblldb_UserSettingsController_h_
Polidea/SiriusObfuscator
SymbolExtractorAndRenamer/llvm/lib/Target/AArch64/AArch64InstructionSelector.h
<reponame>Polidea/SiriusObfuscator<filename>SymbolExtractorAndRenamer/llvm/lib/Target/AArch64/AArch64InstructionSelector.h //===- AArch64InstructionSelector --------------------------------*- C++ -*-==// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// \file /// This file declares the targeting of the InstructionSelector class for /// AArch64. //===----------------------------------------------------------------------===// #ifdef LLVM_BUILD_GLOBAL_ISEL #ifndef LLVM_LIB_TARGET_AARCH64_AARCH64INSTRUCTIONSELECTOR_H #define LLVM_LIB_TARGET_AARCH64_AARCH64INSTRUCTIONSELECTOR_H #include "llvm/CodeGen/GlobalISel/InstructionSelector.h" #include "llvm/CodeGen/MachineOperand.h" namespace llvm { class AArch64InstrInfo; class AArch64RegisterBankInfo; class AArch64RegisterInfo; class AArch64Subtarget; class AArch64TargetMachine; class MachineOperand; class MachineFunction; class MachineRegisterInfo; class AArch64InstructionSelector : public InstructionSelector { public: AArch64InstructionSelector(const AArch64TargetMachine &TM, const AArch64Subtarget &STI, const AArch64RegisterBankInfo &RBI); bool select(MachineInstr &I) const override; private: /// tblgen-erated 'select' implementation, used as the initial selector for /// the patterns that don't require complex C++. bool selectImpl(MachineInstr &I) const; bool selectVaStartAAPCS(MachineInstr &I, MachineFunction &MF, MachineRegisterInfo &MRI) const; bool selectVaStartDarwin(MachineInstr &I, MachineFunction &MF, MachineRegisterInfo &MRI) const; bool selectCompareBranch(MachineInstr &I, MachineFunction &MF, MachineRegisterInfo &MRI) const; bool selectArithImmed(MachineOperand &Root, MachineOperand &Result1, MachineOperand &Result2) const; const AArch64TargetMachine &TM; const AArch64Subtarget &STI; const AArch64InstrInfo &TII; const AArch64RegisterInfo &TRI; const AArch64RegisterBankInfo &RBI; // We declare the temporaries used by selectImpl() in the class to minimize the // cost of constructing placeholder values. #define GET_GLOBALISEL_TEMPORARIES_DECL #include "AArch64GenGlobalISel.inc" #undef GET_GLOBALISEL_TEMPORARIES_DECL }; } // end namespace llvm #endif // LLVM_LIB_TARGET_AARCH64_AARCH64INSTRUCTIONSELECTOR_H #endif // LLVM_BUILD_GLOBAL_ISEL