diff options
Diffstat (limited to 'contrib/llvm-project/lldb/include')
138 files changed, 1290 insertions, 2444 deletions
diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpoint.h b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpoint.h index 75c0e69a4821..a5ce91d95089 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpoint.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpoint.h @@ -94,6 +94,9 @@ public: void SetScriptCallbackFunction(const char *callback_function_name); + SBError SetScriptCallbackFunction(const char *callback_function_name, + SBStructuredData &extra_args); + void SetCommandLineCommands(SBStringList &commands); bool GetCommandLineCommands(SBStringList &commands); diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointLocation.h b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointLocation.h index 085bed9399b9..a9e2ef1dd1b8 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointLocation.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointLocation.h @@ -55,11 +55,14 @@ public: void SetScriptCallbackFunction(const char *callback_function_name); + SBError SetScriptCallbackFunction(const char *callback_function_name, + lldb::SBStructuredData &extra_args); + SBError SetScriptCallbackBody(const char *script_body_text); - void SetCommandLineCommands(SBStringList &commands); + void SetCommandLineCommands(lldb::SBStringList &commands); - bool GetCommandLineCommands(SBStringList &commands); + bool GetCommandLineCommands(lldb::SBStringList &commands); void SetThreadID(lldb::tid_t sb_thread_id); diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointName.h b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointName.h index 018238bcd074..3a5f1acf3e4a 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointName.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBBreakpointName.h @@ -85,9 +85,12 @@ public: void SetScriptCallbackFunction(const char *callback_function_name); - void SetCommandLineCommands(SBStringList &commands); + SBError SetScriptCallbackFunction(const char *callback_function_name, + SBStructuredData &extra_args); - bool GetCommandLineCommands(SBStringList &commands); + void SetCommandLineCommands(lldb::SBStringList &commands); + + bool GetCommandLineCommands(lldb::SBStringList &commands); SBError SetScriptCallbackBody(const char *script_body_text); diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBReproducer.h b/contrib/llvm-project/lldb/include/lldb/API/SBReproducer.h index 0f1739d0c5bd..93d78f55fd76 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBReproducer.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBReproducer.h @@ -21,6 +21,9 @@ public: static const char *Capture(); static const char *Capture(const char *path); static const char *Replay(const char *path); + static const char *Replay(const char *path, bool skip_version_check); + static const char *GetPath(); + static bool Generate(); }; } // namespace lldb diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBStructuredData.h b/contrib/llvm-project/lldb/include/lldb/API/SBStructuredData.h index a090272e45ac..785e91047fdf 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBStructuredData.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBStructuredData.h @@ -93,6 +93,9 @@ protected: friend class SBTarget; friend class SBThread; friend class SBThreadPlan; + friend class SBBreakpoint; + friend class SBBreakpointLocation; + friend class SBBreakpointName; StructuredDataImplUP m_impl_up; }; diff --git a/contrib/llvm-project/lldb/include/lldb/API/SBValue.h b/contrib/llvm-project/lldb/include/lldb/API/SBValue.h index c36ba20297f0..5f8d17f8642f 100644 --- a/contrib/llvm-project/lldb/include/lldb/API/SBValue.h +++ b/contrib/llvm-project/lldb/include/lldb/API/SBValue.h @@ -75,8 +75,6 @@ public: const char *GetObjectDescription(); - const char *GetTypeValidatorResult(); - lldb::SBValue GetDynamicValue(lldb::DynamicValueType use_dynamic); lldb::SBValue GetStaticValue(); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/Breakpoint.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/Breakpoint.h index f561b6d900a1..94411bd57a67 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/Breakpoint.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/Breakpoint.h @@ -193,7 +193,7 @@ public: /// Tell this breakpoint to scan a given module list and resolve any new /// locations that match the breakpoint's specifications. /// - /// \param[in] changed_modules + /// \param[in] module_list /// The list of modules to look in for new locations. /// /// \param[in] new_locations @@ -205,7 +205,7 @@ public: /// which case we will remove any locations that are in modules that got /// unloaded. /// - /// \param[in] changedModules + /// \param[in] changed_modules /// The list of modules to look in for new locations. /// \param[in] load_event /// If \b true then the modules were loaded, if \b false, unloaded. @@ -372,10 +372,6 @@ public: /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. - /// - /// \return - /// \b true if the process should stop when you hit the breakpoint. - /// \b false if it should continue. void SetCallback(BreakpointHitCallback callback, void *baton, bool is_synchronous = false); @@ -522,7 +518,7 @@ private: // The target needs to manage adding & removing names. It will do the if (name_to_remove) m_name_list.erase(name_to_remove); } - + public: bool MatchesName(const char *name) { return m_name_list.find(name) != m_name_list.end(); @@ -554,14 +550,14 @@ public: lldb::BreakpointPreconditionSP GetPrecondition() { return m_precondition_sp; } // Produces the OR'ed values for all the names assigned to this breakpoint. - const BreakpointName::Permissions &GetPermissions() const { - return m_permissions; + const BreakpointName::Permissions &GetPermissions() const { + return m_permissions; } - BreakpointName::Permissions &GetPermissions() { - return m_permissions; + BreakpointName::Permissions &GetPermissions() { + return m_permissions; } - + bool AllowList() const { return GetPermissions().GetAllowList(); } diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointID.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointID.h index 095132988eb2..9daa5b6c5e8d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointID.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointID.h @@ -65,7 +65,7 @@ public: /// If it is a mal-formed breakpoint name, error will be set to an appropriate /// error string. /// - /// \param[in] input + /// \param[in] str /// A string containing JUST the breakpoint description. /// \param[out] error /// If the name is a well-formed breakpoint name, set to success, diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointList.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointList.h index fe10adbda8a6..ad68151fefc7 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointList.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointList.h @@ -67,8 +67,10 @@ public: /// The breakpoint name for which to search. /// /// \result - /// \bfalse if the input name was not a legal breakpoint name. - bool FindBreakpointsByName(const char *name, BreakpointList &matching_bps); + /// error if the input name was not a legal breakpoint name, vector + /// of breakpoints otherwise. + llvm::Expected<std::vector<lldb::BreakpointSP>> + FindBreakpointsByName(const char *name); /// Returns the number of elements in this breakpoint list. /// @@ -138,7 +140,7 @@ public: /// Sets the passed in Locker to hold the Breakpoint List mutex. /// - /// \param[in] locker + /// \param[in] lock /// The locker object that is set. void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocation.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocation.h index aadd52288485..86bb164162c1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocation.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocation.h @@ -93,7 +93,7 @@ public: /// Set the breakpoint to ignore the next \a count breakpoint hits. /// - /// \param[in] count + /// \param[in] n /// The number of breakpoint hits to ignore. void SetIgnoreCount(uint32_t n); @@ -224,9 +224,6 @@ public: /// \param[in] context /// Described the breakpoint event. /// - /// \param[in] bp_loc_id - /// Which breakpoint location hit this breakpoint. - /// /// \return /// \b true if the target should stop at this breakpoint and \b /// false not. diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h index 3da52eb7962a..be400636877e 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationCollection.h @@ -22,17 +22,14 @@ public: BreakpointLocationCollection(); ~BreakpointLocationCollection(); - + BreakpointLocationCollection &operator=(const BreakpointLocationCollection &rhs); /// Add the breakpoint \a bp_loc_sp to the list. /// - /// \param[in] bp_sp + /// \param[in] bp_loc_sp /// Shared pointer to the breakpoint location that will get added /// to the list. - /// - /// \result - /// Returns breakpoint location id. void Add(const lldb::BreakpointLocationSP &bp_loc_sp); /// Removes the breakpoint location given by \b breakID from this @@ -66,7 +63,7 @@ public: /// Returns a shared pointer to the breakpoint location with id \a /// breakID, const version. /// - /// \param[in] breakID + /// \param[in] break_id /// The breakpoint location ID to seek for. /// /// \param[in] break_loc_id @@ -112,9 +109,6 @@ public: /// \param[in] context /// This contains the information about this stop. /// - /// \param[in] breakID - /// This break ID that we hit. - /// /// \return /// \b true if we should stop, \b false otherwise. bool ShouldStop(StoppointCallbackContext *context); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationList.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationList.h index b7e0e49cff83..89ad2f54c923 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationList.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointLocationList.h @@ -75,7 +75,7 @@ public: /// \param[in] module /// The module to seek in. /// - /// \param[in] + /// \param[in] bp_loc_list /// A breakpoint collection that gets any breakpoint locations /// that match \a module appended to. /// @@ -166,14 +166,6 @@ protected: /// list. BreakpointLocationList(Breakpoint &owner); - /// Add the breakpoint \a bp_loc_sp to the list. - /// - /// \param[in] bp_sp - /// Shared pointer to the breakpoint location that will get - /// added to the list. - /// - /// \result - /// Returns breakpoint location id. lldb::BreakpointLocationSP Create(const Address &addr, bool resolve_indirect_symbols); @@ -189,7 +181,7 @@ protected: lldb::BreakpointLocationSP from_location_sp); bool RemoveLocation(const lldb::BreakpointLocationSP &bp_loc_sp); - + void RemoveLocationByIndex(size_t idx); void RemoveInvalidLocations(const ArchSpec &arch); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointOptions.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointOptions.h index 55a4be2d19c1..2c52170eb9f6 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointOptions.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointOptions.h @@ -88,7 +88,8 @@ public: explicit CommandBaton(std::unique_ptr<CommandData> Data) : TypedBaton(std::move(Data)) {} - void GetDescription(Stream *s, lldb::DescriptionLevel level) const override; + void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const override; }; typedef std::shared_ptr<CommandBaton> CommandBatonSP; @@ -135,7 +136,7 @@ public: // Operators const BreakpointOptions &operator=(const BreakpointOptions &rhs); - + /// Copy over only the options set in the incoming BreakpointOptions. void CopyOverSetOptions(const BreakpointOptions &rhs); @@ -267,7 +268,7 @@ public: bool IsEnabled() const { return m_enabled; } /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - void SetEnabled(bool enabled) { + void SetEnabled(bool enabled) { m_enabled = enabled; m_set_flags.Set(eEnabled); } @@ -278,7 +279,7 @@ public: bool IsAutoContinue() const { return m_auto_continue; } /// Set the auto-continue state. - void SetAutoContinue(bool auto_continue) { + void SetAutoContinue(bool auto_continue) { m_auto_continue = auto_continue; m_set_flags.Set(eAutoContinue); } @@ -289,17 +290,16 @@ public: bool IsOneShot() const { return m_one_shot; } /// If \a enable is \b true, enable the breakpoint, if \b false disable it. - void SetOneShot(bool one_shot) { - m_one_shot = one_shot; - m_set_flags.Set(eOneShot); + void SetOneShot(bool one_shot) { + m_one_shot = one_shot; + m_set_flags.Set(eOneShot); } /// Set the breakpoint to ignore the next \a count breakpoint hits. - /// \param[in] count + /// \param[in] n /// The number of breakpoint hits to ignore. - - void SetIgnoreCount(uint32_t n) { - m_ignore_count = n; + void SetIgnoreCount(uint32_t n) { + m_ignore_count = n; m_set_flags.Set(eIgnoreCount); } @@ -341,13 +341,13 @@ public: /// A UP holding the new'ed CommandData object. /// The breakpoint will take ownership of pointer held by this object. void SetCommandDataCallback(std::unique_ptr<CommandData> &cmd_data); - + void Clear(); - + bool AnySet() const { return m_set_flags.AnySet(eAllOptions); } - + protected: // Classes that inherit from BreakpointOptions can see and modify these bool IsOptionSet(OptionKind kind) @@ -377,7 +377,7 @@ protected: private: /// For BreakpointOptions only - + /// This is the callback function pointer BreakpointHitCallback m_callback; /// This is the client data for the callback diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointResolver.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointResolver.h index 11e183b33482..c1dbf9ac0aee 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointResolver.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointResolver.h @@ -44,9 +44,6 @@ public: /// The breakpoint that owns this resolver. /// \param[in] resolverType /// The concrete breakpoint resolver type for this breakpoint. - /// - /// \result - /// Returns breakpoint location id. BreakpointResolver(Breakpoint *bkpt, unsigned char resolverType, lldb::addr_t offset = 0); @@ -186,7 +183,7 @@ protected: }; static const char *g_option_names[static_cast<uint32_t>(OptionNames::LastOptionName)]; - + virtual void NotifyBreakpointSet() {}; public: diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointSite.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointSite.h index 51ed84f7bf2d..5c9f79a9ab1c 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointSite.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/BreakpointSite.h @@ -99,15 +99,12 @@ public: bool ShouldStop(StoppointCallbackContext *context) override; /// Standard Dump method - /// - /// \param[in] context - /// The stream to dump this output. void Dump(Stream *s) const override; /// The "Owners" are the breakpoint locations that share this breakpoint /// site. The method adds the \a owner to this breakpoint site's owner list. /// - /// \param[in] context + /// \param[in] owner /// \a owner is the Breakpoint Location to add. void AddOwner(const lldb::BreakpointLocationSP &owner); @@ -123,8 +120,9 @@ public: /// GetNumberOfOwners() - 1 so you can use this method to iterate over the /// owners /// - /// \param[in] index + /// \param[in] idx /// The index in the list of owners for which you wish the owner location. + /// /// \return /// A shared pointer to the breakpoint location at that index. lldb::BreakpointLocationSP GetOwnerAtIndex(size_t idx); @@ -201,9 +199,6 @@ private: /// The method removes the owner at \a break_loc_id from this breakpoint /// list. - /// - /// \param[in] context - /// \a break_loc_id is the Breakpoint Location to remove. size_t RemoveOwner(lldb::break_id_t break_id, lldb::break_id_t break_loc_id); BreakpointSite::Type m_type; ///< The type of this breakpoint site. diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/Watchpoint.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/Watchpoint.h index e71f89b3e384..2cc74bb4c632 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/Watchpoint.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/Watchpoint.h @@ -69,7 +69,6 @@ public: // This doesn't really enable/disable the watchpoint. It is currently just // for use in the Process plugin's {Enable,Disable}Watchpoint, which should // be used instead. - void SetEnabled(bool enabled, bool notify = true); bool IsHardware() const override; @@ -113,10 +112,6 @@ public: /// If \b true the callback will be run on the private event thread /// before the stop event gets reported. If false, the callback will get /// handled on the public event thread after the stop has been posted. - /// - /// \return - /// \b true if the process should stop when you hit the watchpoint. - /// \b false if it should continue. void SetCallback(WatchpointHitCallback callback, void *callback_baton, bool is_synchronous = false); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointList.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointList.h index 98c64832d46d..bb73d4ab75da 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointList.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointList.h @@ -180,7 +180,7 @@ public: /// Sets the passed in Locker to hold the Watchpoint List mutex. /// - /// \param[in] locker + /// \param[in] lock /// The locker object that is set. void GetListMutex(std::unique_lock<std::recursive_mutex> &lock); diff --git a/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointOptions.h b/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointOptions.h index b395dde21901..0dc34d4ebef7 100644 --- a/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointOptions.h +++ b/contrib/llvm-project/lldb/include/lldb/Breakpoint/WatchpointOptions.h @@ -180,7 +180,8 @@ public: CommandBaton(std::unique_ptr<CommandData> Data) : TypedBaton(std::move(Data)) {} - void GetDescription(Stream *s, lldb::DescriptionLevel level) const override; + void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const override; }; protected: diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Address.h b/contrib/llvm-project/lldb/include/lldb/Core/Address.h index 07bb450d6092..70a7f790e40d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Address.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Address.h @@ -61,45 +61,55 @@ public: /// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function /// to display Address contents in a variety of ways. enum DumpStyle { - DumpStyleInvalid, ///< Invalid dump style - DumpStyleSectionNameOffset, ///< Display as the section name + offset. - ///< \code + /// Invalid dump style. + DumpStyleInvalid, + /// Display as the section name + offset. + /// \code /// // address for printf in libSystem.B.dylib as a section name + offset - /// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf \endcode - DumpStyleSectionPointerOffset, ///< Display as the section pointer + offset - ///(debug output). - ///< \code + /// libSystem.B.dylib.__TEXT.__text + 0x0005cfdf + /// \endcode + DumpStyleSectionNameOffset, + /// Display as the section pointer + offset (debug output). + /// \code /// // address for printf in libSystem.B.dylib as a section pointer + - /// offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf \endcode - DumpStyleFileAddress, ///< Display as the file address (if any). - ///< \code + /// offset (lldb::Section *)0x35cc50 + 0x000000000005cfdf + /// \endcode + DumpStyleSectionPointerOffset, + /// Display as the file address (if any). + /// \code /// // address for printf in libSystem.B.dylib as a file address - /// 0x000000000005dcff \endcode - DumpStyleModuleWithFileAddress, ///< Display as the file address with the - /// module name prepended (if any). - ///< \code + /// 0x000000000005dcff + /// \endcode + /// + DumpStyleFileAddress, + /// Display as the file address with the module name prepended (if any). + /// \code /// // address for printf in libSystem.B.dylib as a file address - /// libSystem.B.dylib[0x000000000005dcff] \endcode - DumpStyleLoadAddress, ///< Display as the load address (if resolved). - ///< \code + /// libSystem.B.dylib[0x000000000005dcff] + /// \endcode + DumpStyleModuleWithFileAddress, + /// Display as the load address (if resolved). + /// \code /// // address for printf in libSystem.B.dylib as a load address - /// 0x00007fff8306bcff \endcode - DumpStyleResolvedDescription, ///< Display the details about what an address - /// resolves to. This can - ///< be anything from a symbol context summary (module, function/symbol, - ///< and file and line), to information about what the pointer points to - ///< if the address is in a section (section of pointers, c strings, etc). + /// 0x00007fff8306bcff + /// \endcode + DumpStyleLoadAddress, + /// Display the details about what an address resolves to. This can be + /// anything from a symbol context summary (module, function/symbol, and + /// file and line), to information about what the pointer points to if the + /// address is in a section (section of pointers, c strings, etc). + DumpStyleResolvedDescription, DumpStyleResolvedDescriptionNoModule, DumpStyleResolvedDescriptionNoFunctionArguments, - DumpStyleNoFunctionName, ///< Elide the function name; display an offset - /// into the current function. - ///< Used primarily in disassembly symbolication - DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for - /// an address for all symbol - ///< context members. - DumpStyleResolvedPointerDescription ///< Dereference a pointer at the - /// current address and then lookup the - ///< dereferenced address using DumpStyleResolvedDescription + /// Elide the function name; display an offset into the current function. + /// Used primarily in disassembly symbolication + DumpStyleNoFunctionName, + /// Detailed symbol context information for an address for all symbol + /// context members. + DumpStyleDetailedSymbolContext, + /// Dereference a pointer at the current address and then lookup the + /// dereferenced address using DumpStyleResolvedDescription + DumpStyleResolvedPointerDescription }; /// Default constructor. @@ -121,7 +131,7 @@ public: /// /// Initialize the address with the supplied \a section and \a offset. /// - /// \param[in] section + /// \param[in] section_sp /// A section pointer to a valid lldb::Section, or NULL if the /// address doesn't have a section or will get resolved later. /// @@ -179,9 +189,9 @@ public: /// The Right Hand Side const Address object reference. /// /// \return - /// \li -1 if lhs < rhs - /// \li 0 if lhs == rhs - /// \li 1 if lhs > rhs + /// -1 if lhs < rhs + /// 0 if lhs == rhs + /// 1 if lhs > rhs static int CompareFileAddress(const Address &lhs, const Address &rhs); static int CompareLoadAddress(const Address &lhs, const Address &rhs, @@ -433,7 +443,7 @@ public: /// Set accessor for the section. /// - /// \param[in] section + /// \param[in] section_sp /// A new lldb::Section pointer to use as the section base. Can /// be NULL for absolute addresses that are not relative to /// any section. diff --git a/contrib/llvm-project/lldb/include/lldb/Core/AddressRange.h b/contrib/llvm-project/lldb/include/lldb/Core/AddressRange.h index 4a019bfcfc3f..ac748713a182 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/AddressRange.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/AddressRange.h @@ -123,7 +123,7 @@ public: /// Check if the resolved file address \a file_addr is contained within this /// object's file address range. /// - /// \param[in] so_addr + /// \param[in] file_addr /// A section offset address object reference. /// /// \return @@ -147,9 +147,6 @@ public: /// Check if the resolved load address \a load_addr is contained within this /// object's load address range. /// - /// \param[in] so_addr - /// A section offset address object reference. - /// /// \return /// Returns \b true if both \a this has a resolvable load /// address value and \a so_addr is contained in the address diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ClangForward.h b/contrib/llvm-project/lldb/include/lldb/Core/ClangForward.h index 6b24b47c8a96..0bc331438e5c 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ClangForward.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ClangForward.h @@ -17,7 +17,6 @@ namespace Builtin { class Context; } -class Action; class ASTConsumer; class ASTContext; class ASTRecordLayout; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h b/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h index b2f696c22834..a8048427c8f1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Debugger.h @@ -151,7 +151,9 @@ public: return *m_command_interpreter_up; } - ScriptInterpreter *GetScriptInterpreter(bool can_create = true); + ScriptInterpreter * + GetScriptInterpreter(bool can_create = true, + llvm::Optional<lldb::ScriptLanguage> language = {}); lldb::ListenerSP GetListener() { return m_listener_sp; } @@ -396,8 +398,9 @@ protected: // source file cache. std::unique_ptr<CommandInterpreter> m_command_interpreter_up; - lldb::ScriptInterpreterSP m_script_interpreter_sp; std::recursive_mutex m_script_interpreter_mutex; + std::array<lldb::ScriptInterpreterSP, lldb::eScriptLanguageUnknown> + m_script_interpreters; IOHandlerStack m_input_reader_stack; llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Disassembler.h b/contrib/llvm-project/lldb/include/lldb/Core/Disassembler.h index ba9ca87832f6..7ece0eeb708c 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Disassembler.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Disassembler.h @@ -287,6 +287,10 @@ public: /// a function call (a branch that calls and returns to the next /// instruction). If false, find the instruction index of any /// branch in the list. + /// + /// @param[out] found_calls + /// If non-null, this will be set to true if any calls were found in + /// extending the range. /// /// @return /// The instruction index of the first branch that is at or past @@ -295,7 +299,8 @@ public: //------------------------------------------------------------------ uint32_t GetIndexOfNextBranchInstruction(uint32_t start, Target &target, - bool ignore_calls) const; + bool ignore_calls, + bool *found_calls) const; uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h b/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h index ae6c402a45be..8ee320b0ebb1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/FormatEntity.h @@ -85,6 +85,7 @@ public: FunctionName, FunctionNameWithArgs, FunctionNameNoArgs, + FunctionMangledName, FunctionAddrOffset, FunctionAddrOffsetConcrete, FunctionLineOffset, diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Highlighter.h b/contrib/llvm-project/lldb/include/lldb/Core/Highlighter.h index 88d3bb3a3cd1..8a268ec1d6b1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Highlighter.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Highlighter.h @@ -43,8 +43,6 @@ struct HighlightStyle { void Apply(Stream &s, llvm::StringRef value) const; /// Sets the prefix and suffix strings. - /// \param prefix - /// \param suffix void Set(llvm::StringRef prefix, llvm::StringRef suffix); }; @@ -100,6 +98,7 @@ public: /// Highlights the given line /// \param options + /// The highlight options. /// \param line /// The user supplied line that needs to be highlighted. /// \param cursor_pos diff --git a/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h b/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h index 37142a5a8396..9ab5eaaecb66 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/IOHandler.h @@ -10,6 +10,7 @@ #define liblldb_IOHandler_h_ #include "lldb/Core/ValueObjectList.h" +#include "lldb/Host/Config.h" #include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" @@ -51,6 +52,7 @@ public: REPL, ProcessIO, PythonInterpreter, + LuaInterpreter, PythonCode, Other }; @@ -406,7 +408,7 @@ public: void PrintAsync(Stream *stream, const char *s, size_t len) override; private: -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT static bool IsInputCompleteCallback(Editline *editline, StringList &lines, void *baton); @@ -417,7 +419,7 @@ private: #endif protected: -#ifndef LLDB_DISABLE_LIBEDIT +#if LLDB_ENABLE_LIBEDIT std::unique_ptr<Editline> m_editline_up; #endif IOHandlerDelegate &m_delegate; @@ -456,48 +458,9 @@ protected: bool m_user_response; }; -class IOHandlerCursesGUI : public IOHandler { -public: - IOHandlerCursesGUI(Debugger &debugger); - - ~IOHandlerCursesGUI() override; - - void Run() override; - - void Cancel() override; - - bool Interrupt() override; - - void GotEOF() override; - - void Activate() override; - - void Deactivate() override; - -protected: - curses::ApplicationAP m_app_ap; -}; - -class IOHandlerCursesValueObjectList : public IOHandler { -public: - IOHandlerCursesValueObjectList(Debugger &debugger, - ValueObjectList &valobj_list); - - ~IOHandlerCursesValueObjectList() override; - - void Run() override; - - void GotEOF() override; - -protected: - ValueObjectList m_valobj_list; -}; - class IOHandlerStack { public: - IOHandlerStack() : m_stack(), m_mutex(), m_top(nullptr) {} - - ~IOHandlerStack() = default; + IOHandlerStack() = default; size_t GetSize() const { std::lock_guard<std::recursive_mutex> guard(m_mutex); @@ -574,7 +537,7 @@ protected: typedef std::vector<lldb::IOHandlerSP> collection; collection m_stack; mutable std::recursive_mutex m_mutex; - IOHandler *m_top; + IOHandler *m_top = nullptr; private: DISALLOW_COPY_AND_ASSIGN(IOHandlerStack); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/IOHandlerCursesGUI.h b/contrib/llvm-project/lldb/include/lldb/Core/IOHandlerCursesGUI.h new file mode 100644 index 000000000000..afa435269725 --- /dev/null +++ b/contrib/llvm-project/lldb/include/lldb/Core/IOHandlerCursesGUI.h @@ -0,0 +1,40 @@ +//===-- IOHandlerCursesGUI.h ------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_IOHandlerCursesGUI_h_ +#define liblldb_IOHandlerCursesGUI_h_ + +#include "lldb/Core/IOHandler.h" + +namespace lldb_private { + +class IOHandlerCursesGUI : public IOHandler { +public: + IOHandlerCursesGUI(Debugger &debugger); + + ~IOHandlerCursesGUI() override; + + void Run() override; + + void Cancel() override; + + bool Interrupt() override; + + void GotEOF() override; + + void Activate() override; + + void Deactivate() override; + +protected: + curses::ApplicationAP m_app_ap; +}; + +} // namespace lldb_private + +#endif // liblldb_IOHandlerCursesGUI_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h b/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h index 63fa0f618dae..6af68c3f5857 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Mangled.h @@ -108,9 +108,9 @@ public: /// A const reference to the Right Hand Side object to compare. /// /// \return - /// \li -1 if \a lhs is less than \a rhs - /// \li 0 if \a lhs is equal to \a rhs - /// \li 1 if \a lhs is greater than \a rhs + /// -1 if \a lhs is less than \a rhs + /// 0 if \a lhs is equal to \a rhs + /// 1 if \a lhs is greater than \a rhs static int Compare(const Mangled &lhs, const Mangled &rhs); /// Dump a description of this object to a Stream \a s. @@ -261,6 +261,15 @@ public: bool DemangleWithRichManglingInfo(RichManglingContext &context, SkipMangledNameFn *skip_mangled_name); + /// Try to identify the mangling scheme used. + /// \param[in] name + /// The name we are attempting to identify the mangling scheme for. + /// + /// \return + /// eManglingSchemeNone if no known mangling scheme could be identified + /// for s, otherwise the enumerator for the mangling scheme detected. + static Mangled::ManglingScheme GetManglingScheme(llvm::StringRef const name); + private: /// Mangled member variables. ConstString m_mangled; ///< The mangled version of the name diff --git a/contrib/llvm-project/lldb/include/lldb/Core/Module.h b/contrib/llvm-project/lldb/include/lldb/Core/Module.h index 89b731427e3f..2af18c83f23a 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/Module.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/Module.h @@ -190,7 +190,7 @@ public: lldb::ModuleSP CalculateSymbolContextModule() override; void - GetDescription(Stream *s, + GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level = lldb::eDescriptionLevelFull); /// Get the module path and object name. @@ -291,9 +291,6 @@ public: /// \param[in] name /// The name of the compile unit we are looking for. /// - /// \param[in] namespace_decl - /// If valid, a namespace to search in. - /// /// \param[in] name_type_mask /// A bit mask of bits that indicate what kind of names should /// be used when doing the lookup. Bits include fully qualified @@ -317,10 +314,6 @@ public: /// \param[in] regex /// A regular expression to use when matching the name. /// - /// \param[in] append - /// If \b true, any matches will be appended to \a sc_list, else - /// matches replace the contents of \a sc_list. - /// /// \param[out] sc_list /// A symbol context list that gets filled in with all of the /// matches. @@ -416,7 +409,7 @@ public: /// omitted to make finding types that a user may type /// easier. /// - /// \param[out] type_list + /// \param[out] types /// A type list gets populated with any matches. /// void @@ -429,7 +422,11 @@ public: /// This behaves like the other FindTypes method but allows to /// specify a DeclContext and a language for the type being searched /// for. + /// + /// \param searched_symbol_files + /// Prevents one file from being visited multiple times. void FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap &types); lldb::TypeSP FindFirstType(const SymbolContext &sc, @@ -443,12 +440,8 @@ public: /// The name of a type within a namespace that should not include /// any qualifying namespaces (just a type basename). /// - /// \param[in] namespace_decl - /// The namespace declaration that this type must exist in. - /// /// \param[out] type_list /// A type list gets populated with any matches. - /// void FindTypesInNamespace(ConstString type_name, const CompilerDeclContext *parent_decl_ctx, size_t max_matches, TypeList &type_list); diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ModuleChild.h b/contrib/llvm-project/lldb/include/lldb/Core/ModuleChild.h index 8a81c1a6cf8a..0d59e4fb12ca 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ModuleChild.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ModuleChild.h @@ -20,7 +20,7 @@ class ModuleChild { public: /// Construct with owning module. /// - /// \param[in] module + /// \param[in] module_sp /// The module that owns the object that inherits from this /// class. ModuleChild(const lldb::ModuleSP &module_sp); @@ -46,15 +46,14 @@ public: /// Set accessor for the module pointer. /// - /// \param[in] module + /// \param[in] module_sp /// A new module that owns the object that inherits from this - /// class. + /// class. void SetModule(const lldb::ModuleSP &module_sp); protected: - // Member variables - lldb::ModuleWP m_module_wp; ///< The Module that owns the object that inherits - ///< from this class. + /// The Module that owns the object that inherits from this class. + lldb::ModuleWP m_module_wp; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h b/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h index e21655551b61..a6e80ed75c76 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ModuleList.h @@ -53,7 +53,7 @@ public: bool SetClangModulesCachePath(llvm::StringRef path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); -}; +}; /// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h" /// A collection class for Module objects. @@ -116,10 +116,10 @@ public: /// If true, and a notifier function is set, the notifier function /// will be called. Defaults to true. /// - /// When this ModuleList is the Target's ModuleList, the notifier - /// function is Target::ModulesDidLoad -- the call to - /// ModulesDidLoad may be deferred when adding multiple Modules - /// to the Target, but it must be called at the end, + /// When this ModuleList is the Target's ModuleList, the notifier + /// function is Target::ModulesDidLoad -- the call to + /// ModulesDidLoad may be deferred when adding multiple Modules + /// to the Target, but it must be called at the end, /// before resuming execution. void Append(const lldb::ModuleSP &module_sp, bool notify = true); @@ -135,16 +135,14 @@ public: /// Append a module to the module list, if it is not already there. /// - /// \param[in] module_sp - /// /// \param[in] notify /// If true, and a notifier function is set, the notifier function /// will be called. Defaults to true. /// - /// When this ModuleList is the Target's ModuleList, the notifier - /// function is Target::ModulesDidLoad -- the call to - /// ModulesDidLoad may be deferred when adding multiple Modules - /// to the Target, but it must be called at the end, + /// When this ModuleList is the Target's ModuleList, the notifier + /// function is Target::ModulesDidLoad -- the call to + /// ModulesDidLoad may be deferred when adding multiple Modules + /// to the Target, but it must be called at the end, /// before resuming execution. bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify = true); @@ -297,7 +295,7 @@ public: /// Finds the first module whose file specification matches \a file_spec. /// - /// \param[in] file_spec_ptr + /// \param[in] module_spec /// A file specification object to match against the Module's /// file specifications. If \a file_spec does not have /// directory information, matches will occur by matching only @@ -305,18 +303,6 @@ public: /// NULL, then file specifications won't be compared when /// searching for matching modules. /// - /// \param[in] arch_ptr - /// The architecture to search for if non-NULL. If this value - /// is NULL no architecture matching will be performed. - /// - /// \param[in] uuid_ptr - /// The uuid to search for if non-NULL. If this value is NULL - /// no uuid matching will be performed. - /// - /// \param[in] object_name - /// An optional object name that must match as well. This value - /// can be NULL. - /// /// \param[out] matching_module_list /// A module list that gets filled in with any modules that /// match the search criteria. @@ -351,24 +337,11 @@ public: /// \param[in] name /// The name of the type we are looking for. /// - /// \param[in] append - /// If \b true, any matches will be appended to \a - /// variable_list, else matches replace the contents of - /// \a variable_list. - /// /// \param[in] max_matches /// Allow the number of matches to be limited to \a /// max_matches. Specify UINT32_MAX to get all possible matches. /// - /// \param[in] encoding - /// Limit the search to specific types, or get all types if - /// set to Type::invalid. - /// - /// \param[in] udt_name - /// If the encoding is a user defined type, specify the name - /// of the user defined type ("struct", "union", "class", etc). - /// - /// \param[out] type_list + /// \param[out] types /// A type list gets populated with any matches. /// void FindTypes(Module *search_first, ConstString name, @@ -414,10 +387,10 @@ public: /// If true, and a notifier function is set, the notifier function /// will be called. Defaults to true. /// - /// When this ModuleList is the Target's ModuleList, the notifier - /// function is Target::ModulesDidUnload -- the call to - /// ModulesDidUnload may be deferred when removing multiple Modules - /// from the Target, but it must be called at the end, + /// When this ModuleList is the Target's ModuleList, the notifier + /// function is Target::ModulesDidUnload -- the call to + /// ModulesDidUnload may be deferred when removing multiple Modules + /// from the Target, but it must be called at the end, /// before resuming execution. bool Remove(const lldb::ModuleSP &module_sp, bool notify = true); @@ -477,7 +450,7 @@ public: static size_t RemoveOrphanSharedModules(bool mandatory); static bool RemoveSharedModuleIfOrphaned(const Module *module_ptr); - + void ForEach(std::function<bool(const lldb::ModuleSP &module_sp)> const &callback) const; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h b/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h index 651d0dc869bc..6d024fe3434b 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ModuleSpec.h @@ -207,7 +207,7 @@ public: if (dumped_something) strm.PutCString(", "); strm.Printf("arch = "); - m_arch.DumpTriple(strm); + m_arch.DumpTriple(strm.AsRawOstream()); dumped_something = true; } if (m_uuid.IsValid()) { @@ -251,24 +251,18 @@ public: if (match_module_spec.GetObjectName() && match_module_spec.GetObjectName() != GetObjectName()) return false; - if (match_module_spec.GetFileSpecPtr()) { - const FileSpec &fspec = match_module_spec.GetFileSpec(); - if (!FileSpec::Equal(fspec, GetFileSpec(), - !fspec.GetDirectory().IsEmpty())) - return false; - } - if (GetPlatformFileSpec() && match_module_spec.GetPlatformFileSpecPtr()) { - const FileSpec &fspec = match_module_spec.GetPlatformFileSpec(); - if (!FileSpec::Equal(fspec, GetPlatformFileSpec(), - !fspec.GetDirectory().IsEmpty())) - return false; + if (!FileSpec::Match(match_module_spec.GetFileSpec(), GetFileSpec())) + return false; + if (GetPlatformFileSpec() && + !FileSpec::Match(match_module_spec.GetPlatformFileSpec(), + GetPlatformFileSpec())) { + return false; } // Only match the symbol file spec if there is one in this ModuleSpec - if (GetSymbolFileSpec() && match_module_spec.GetSymbolFileSpecPtr()) { - const FileSpec &fspec = match_module_spec.GetSymbolFileSpec(); - if (!FileSpec::Equal(fspec, GetSymbolFileSpec(), - !fspec.GetDirectory().IsEmpty())) - return false; + if (GetSymbolFileSpec() && + !FileSpec::Match(match_module_spec.GetSymbolFileSpec(), + GetSymbolFileSpec())) { + return false; } if (match_module_spec.GetArchitecturePtr()) { if (exact_arch_match) { diff --git a/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td b/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td index be97d44ae8e4..6e95ceb779ba 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td +++ b/contrib/llvm-project/lldb/include/lldb/Core/PropertiesBase.td @@ -18,11 +18,13 @@ class Global { class DefaultTrue { int DefaultUnsignedValue = 1; bit HasDefaultUnsignedValue = 1; + bit HasDefaultBooleanValue = 1; } class DefaultFalse { int DefaultUnsignedValue = 0; bit HasDefaultUnsignedValue = 1; + bit HasDefaultBooleanValue = 1; } // Gives the property a default string value. diff --git a/contrib/llvm-project/lldb/include/lldb/Core/STLUtils.h b/contrib/llvm-project/lldb/include/lldb/Core/STLUtils.h deleted file mode 100644 index 830aca36a116..000000000000 --- a/contrib/llvm-project/lldb/include/lldb/Core/STLUtils.h +++ /dev/null @@ -1,74 +0,0 @@ -//===-- STLUtils.h ----------------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_STLUtils_h_ -#define liblldb_STLUtils_h_ - -#include <string.h> - -#include <map> -#include <ostream> -#include <vector> - - -// C string less than compare function object -struct CStringCompareFunctionObject { - bool operator()(const char *s1, const char *s2) const { - return strcmp(s1, s2) < 0; - } -}; - -// C string equality function object (binary predicate). -struct CStringEqualBinaryPredicate { - bool operator()(const char *s1, const char *s2) const { - return strcmp(s1, s2) == 0; - } -}; - -// Templated type for finding an entry in a std::map<F,S> whose value is equal -// to something -template <class F, class S> class ValueEquals { -public: - ValueEquals(const S &val) : second_value(val) {} - - // Compare the second item - bool operator()(std::pair<const F, S> elem) { - return elem.second == second_value; - } - -private: - S second_value; -}; - -template <class T> -inline void PrintAllCollectionElements(std::ostream &s, const T &coll, - const char *header_cstr = nullptr, - const char *separator_cstr = " ") { - typename T::const_iterator pos; - - if (header_cstr) - s << header_cstr; - for (pos = coll.begin(); pos != coll.end(); ++pos) { - s << *pos << separator_cstr; - } - s << std::endl; -} - -// The function object below can be used to delete a STL container that -// contains C++ object pointers. -// -// Usage: std::for_each(vector.begin(), vector.end(), for_each_delete()); - -struct for_each_cplusplus_delete { - template <typename T> void operator()(T *ptr) { delete ptr; } -}; - -typedef std::vector<std::string> STLStringArray; -typedef std::vector<const char *> CStringArray; - -#endif // liblldb_STLUtils_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h b/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h index 6823daf9e3ed..74c4f3162a1c 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/SearchFilter.h @@ -84,7 +84,7 @@ class SearchFilter { public: /// The basic constructor takes a Target, which gives the space to search. /// - /// \param[in] target + /// \param[in] target_sp /// The Target that provides the module list to search. SearchFilter(const lldb::TargetSP &target_sp); @@ -102,7 +102,7 @@ public: /// Call this method with a Module to see if that module passes the filter. /// - /// \param[in] module + /// \param[in] module_sp /// The Module to check against the filter. /// /// \return @@ -306,7 +306,7 @@ public: /// The basic constructor takes a Target, which gives the space to search, /// and the module to restrict the search to. /// - /// \param[in] target + /// \param[in] targetSP /// The Target that provides the module list to search. /// /// \param[in] module @@ -352,10 +352,10 @@ public: /// The basic constructor takes a Target, which gives the space to search, /// and the module list to restrict the search to. /// - /// \param[in] target + /// \param[in] targetSP /// The Target that provides the module list to search. /// - /// \param[in] module + /// \param[in] module_list /// The Module that limits the search. SearchFilterByModuleList(const lldb::TargetSP &targetSP, const FileSpecList &module_list); @@ -366,8 +366,6 @@ public: ~SearchFilterByModuleList() override; - SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs); - bool ModulePasses(const lldb::ModuleSP &module_sp) override; bool ModulePasses(const FileSpec &spec) override; @@ -406,23 +404,12 @@ class SearchFilterByModuleListAndCU : public SearchFilterByModuleList { public: /// The basic constructor takes a Target, which gives the space to search, /// and the module list to restrict the search to. - /// - /// \param[in] target - /// The Target that provides the module list to search. - /// - /// \param[in] module - /// The Module that limits the search. SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP, const FileSpecList &module_list, const FileSpecList &cu_list); - SearchFilterByModuleListAndCU(const SearchFilterByModuleListAndCU &rhs); - ~SearchFilterByModuleListAndCU() override; - SearchFilterByModuleListAndCU & - operator=(const SearchFilterByModuleListAndCU &rhs); - bool AddressPasses(Address &address) override; bool CompUnitPasses(FileSpec &fileSpec) override; diff --git a/contrib/llvm-project/lldb/include/lldb/Core/SourceManager.h b/contrib/llvm-project/lldb/include/lldb/Core/SourceManager.h index bca817750d8d..f1f56d0886c3 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/SourceManager.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/SourceManager.h @@ -54,8 +54,6 @@ public: bool LineIsValid(uint32_t line); - bool FileSpecMatches(const FileSpec &file_spec); - const FileSpec &GetFileSpec() { return m_file_spec; } uint32_t GetSourceMapModificationID() const { return m_source_map_mod_id; } diff --git a/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h b/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h index 712b289aa8d9..bd7d6e8e6ad3 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/StreamFile.h @@ -21,15 +21,10 @@ namespace lldb_private { class StreamFile : public Stream { public: - // Constructors and Destructors - StreamFile(); - StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order); StreamFile(int fd, bool transfer_ownership); - StreamFile(const char *path); - StreamFile(const char *path, File::OpenOptions options, uint32_t permissions = lldb::eFilePermissionsFileDefault); @@ -47,7 +42,6 @@ public: void Flush() override; - protected: // Classes that inherit from StreamFile can see and modify these std::shared_ptr<File> m_file_sp; // never NULL diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeDenseMap.h b/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeDenseMap.h index c485b91acb47..420cb5763586 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeDenseMap.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeDenseMap.h @@ -62,4 +62,4 @@ protected: } // namespace lldb_private -#endif // liblldb_ThreadSafeSTLMap_h_ +#endif // liblldb_ThreadSafeDenseMap_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLMap.h b/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLMap.h deleted file mode 100644 index df0208cd49b3..000000000000 --- a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLMap.h +++ /dev/null @@ -1,128 +0,0 @@ -//===-- ThreadSafeSTLMap.h --------------------------------------*- C++ -*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ThreadSafeSTLMap_h_ -#define liblldb_ThreadSafeSTLMap_h_ - -#include <map> -#include <mutex> - -#include "lldb/lldb-defines.h" - -namespace lldb_private { - -template <typename _Key, typename _Tp> class ThreadSafeSTLMap { -public: - typedef std::map<_Key, _Tp> collection; - typedef typename collection::iterator iterator; - typedef typename collection::const_iterator const_iterator; - // Constructors and Destructors - ThreadSafeSTLMap() : m_collection(), m_mutex() {} - - ~ThreadSafeSTLMap() {} - - bool IsEmpty() const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.empty(); - } - - void Clear() { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.clear(); - } - - size_t Erase(const _Key &key) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return EraseNoLock(key); - } - - size_t EraseNoLock(const _Key &key) { return m_collection.erase(key); } - - bool GetValueForKey(const _Key &key, _Tp &value) const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return GetValueForKeyNoLock(key, value); - } - - // Call this if you have already manually locked the mutex using the - // GetMutex() accessor - bool GetValueForKeyNoLock(const _Key &key, _Tp &value) const { - const_iterator pos = m_collection.find(key); - if (pos != m_collection.end()) { - value = pos->second; - return true; - } - return false; - } - - bool GetFirstKeyForValue(const _Tp &value, _Key &key) const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return GetFirstKeyForValueNoLock(value, key); - } - - bool GetFirstKeyForValueNoLock(const _Tp &value, _Key &key) const { - const_iterator pos, end = m_collection.end(); - for (pos = m_collection.begin(); pos != end; ++pos) { - if (pos->second == value) { - key = pos->first; - return true; - } - } - return false; - } - - bool LowerBound(const _Key &key, _Key &match_key, _Tp &match_value, - bool decrement_if_not_equal) const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return LowerBoundNoLock(key, match_key, match_value, - decrement_if_not_equal); - } - - bool LowerBoundNoLock(const _Key &key, _Key &match_key, _Tp &match_value, - bool decrement_if_not_equal) const { - const_iterator pos = m_collection.lower_bound(key); - if (pos != m_collection.end()) { - match_key = pos->first; - if (decrement_if_not_equal && key != match_key && - pos != m_collection.begin()) { - --pos; - match_key = pos->first; - } - match_value = pos->second; - return true; - } - return false; - } - - iterator lower_bound_unsafe(const _Key &key) { - return m_collection.lower_bound(key); - } - - void SetValueForKey(const _Key &key, const _Tp &value) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - SetValueForKeyNoLock(key, value); - } - - // Call this if you have already manually locked the mutex using the - // GetMutex() accessor - void SetValueForKeyNoLock(const _Key &key, const _Tp &value) { - m_collection[key] = value; - } - - std::recursive_mutex &GetMutex() { return m_mutex; } - -private: - collection m_collection; - mutable std::recursive_mutex m_mutex; - - // For ThreadSafeSTLMap only - DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap); -}; - -} // namespace lldb_private - -#endif // liblldb_ThreadSafeSTLMap_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLVector.h b/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLVector.h deleted file mode 100644 index e1666a69ef7e..000000000000 --- a/contrib/llvm-project/lldb/include/lldb/Core/ThreadSafeSTLVector.h +++ /dev/null @@ -1,72 +0,0 @@ -//===-- ThreadSafeSTLVector.h ------------------------------------*- C++ -//-*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef liblldb_ThreadSafeSTLVector_h_ -#define liblldb_ThreadSafeSTLVector_h_ - -#include <mutex> -#include <vector> - -#include "lldb/lldb-defines.h" - -namespace lldb_private { - -template <typename _Object> class ThreadSafeSTLVector { -public: - typedef std::vector<_Object> collection; - typedef typename collection::iterator iterator; - typedef typename collection::const_iterator const_iterator; - // Constructors and Destructors - ThreadSafeSTLVector() : m_collection(), m_mutex() {} - - ~ThreadSafeSTLVector() = default; - - bool IsEmpty() const { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.empty(); - } - - void Clear() { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.clear(); - } - - size_t GetCount() { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.size(); - } - - void AppendObject(_Object &object) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - m_collection.push_back(object); - } - - _Object GetObject(size_t index) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - return m_collection.at(index); - } - - void SetObject(size_t index, const _Object &object) { - std::lock_guard<std::recursive_mutex> guard(m_mutex); - m_collection.at(index) = object; - } - - std::recursive_mutex &GetMutex() { return m_mutex; } - -private: - collection m_collection; - mutable std::recursive_mutex m_mutex; - - // For ThreadSafeSTLVector only - DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector); -}; - -} // namespace lldb_private - -#endif // liblldb_ThreadSafeSTLVector_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h b/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h index 0808b86c67a1..1b000e617f0e 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ValueObject.h @@ -179,7 +179,6 @@ public: eClearUserVisibleDataItemsLocation = 1u << 3, eClearUserVisibleDataItemsDescription = 1u << 4, eClearUserVisibleDataItemsSyntheticChildren = 1u << 5, - eClearUserVisibleDataItemsValidator = 1u << 6, eClearUserVisibleDataItemsAllStrings = eClearUserVisibleDataItemsValue | eClearUserVisibleDataItemsSummary | eClearUserVisibleDataItemsLocation | @@ -510,8 +509,6 @@ public: std::string &destination, const TypeSummaryOptions &options); - std::pair<TypeValidatorResult, std::string> GetValidationStatus(); - const char *GetObjectDescription(); bool HasSpecialPrintableRepresentation( @@ -711,16 +708,6 @@ public: ClearUserVisibleData(eClearUserVisibleDataItemsSummary); } - lldb::TypeValidatorImplSP GetValidator() { - UpdateFormatsIfNeeded(); - return m_type_validator_sp; - } - - void SetValidator(lldb::TypeValidatorImplSP format) { - m_type_validator_sp = format; - ClearUserVisibleData(eClearUserVisibleDataItemsValidator); - } - void SetValueFormat(lldb::TypeFormatImplSP format) { m_type_format_sp = format; ClearUserVisibleData(eClearUserVisibleDataItemsValue); @@ -857,9 +844,6 @@ protected: // differs from the summary // in that the summary is consed up by us, the object_desc_string is builtin. - llvm::Optional<std::pair<TypeValidatorResult, std::string>> - m_validation_result; - CompilerType m_override_type; // If the type of the value object should be // overridden, the type to impose. @@ -888,7 +872,6 @@ protected: lldb::TypeSummaryImplSP m_type_summary_sp; lldb::TypeFormatImplSP m_type_format_sp; lldb::SyntheticChildrenSP m_synthetic_children_sp; - lldb::TypeValidatorImplSP m_type_validator_sp; ProcessModID m_user_id_of_forced_summary; AddressType m_address_type_of_ptr_or_ref_children; @@ -985,6 +968,7 @@ protected: private: virtual CompilerType MaybeCalculateCompleteType(); + void UpdateChildrenAddressType(); lldb::ValueObjectSP GetValueForExpressionPath_Impl( llvm::StringRef expression_cstr, diff --git a/contrib/llvm-project/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h b/contrib/llvm-project/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h index 3b14a3e9f388..ec395095351d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h +++ b/contrib/llvm-project/lldb/include/lldb/Core/ValueObjectSyntheticFilter.h @@ -9,8 +9,6 @@ #ifndef liblldb_ValueObjectSyntheticFilter_h_ #define liblldb_ValueObjectSyntheticFilter_h_ -#include "lldb/Core/ThreadSafeSTLMap.h" -#include "lldb/Core/ThreadSafeSTLVector.h" #include "lldb/Core/ValueObject.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Utility/ConstString.h" @@ -135,19 +133,24 @@ protected: lldb::SyntheticChildrenSP m_synth_sp; std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_up; - typedef ThreadSafeSTLMap<uint32_t, ValueObject *> ByIndexMap; - typedef ThreadSafeSTLMap<const char *, uint32_t> NameToIndexMap; - typedef ThreadSafeSTLVector<lldb::ValueObjectSP> SyntheticChildrenCache; + typedef std::map<uint32_t, ValueObject *> ByIndexMap; + typedef std::map<const char *, uint32_t> NameToIndexMap; + typedef std::vector<lldb::ValueObjectSP> SyntheticChildrenCache; typedef ByIndexMap::iterator ByIndexIterator; typedef NameToIndexMap::iterator NameToIndexIterator; + std::mutex m_child_mutex; + /// Guarded by m_child_mutex; ByIndexMap m_children_byindex; + /// Guarded by m_child_mutex; NameToIndexMap m_name_toindex; + /// Guarded by m_child_mutex; + SyntheticChildrenCache m_synthetic_children_cache; + uint32_t m_synthetic_children_count; // FIXME use the ValueObject's // ChildrenManager instead of a special // purpose solution - SyntheticChildrenCache m_synthetic_children_cache; ConstString m_parent_type_name; diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/DataVisualization.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/DataVisualization.h index cdb2eab995fc..f5c3487bcb3b 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/DataVisualization.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/DataVisualization.h @@ -51,12 +51,6 @@ public: static lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic); - static lldb::TypeValidatorImplSP - GetValidator(ValueObject &valobj, lldb::DynamicValueType use_dynamic); - - static lldb::TypeValidatorImplSP - GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp); - static bool AnyMatches(ConstString type_name, TypeCategoryImpl::FormatCategoryItems items = diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatCache.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatCache.h index 7a6774b7f837..f9dbe414640d 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatCache.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatCache.h @@ -24,45 +24,26 @@ private: bool m_format_cached : 1; bool m_summary_cached : 1; bool m_synthetic_cached : 1; - bool m_validator_cached : 1; lldb::TypeFormatImplSP m_format_sp; lldb::TypeSummaryImplSP m_summary_sp; lldb::SyntheticChildrenSP m_synthetic_sp; - lldb::TypeValidatorImplSP m_validator_sp; public: Entry(); - Entry(lldb::TypeFormatImplSP); - Entry(lldb::TypeSummaryImplSP); - Entry(lldb::SyntheticChildrenSP); - Entry(lldb::TypeValidatorImplSP); - Entry(lldb::TypeFormatImplSP, lldb::TypeSummaryImplSP, - lldb::SyntheticChildrenSP, lldb::TypeValidatorImplSP); + template<typename ImplSP> bool IsCached(); bool IsFormatCached(); - bool IsSummaryCached(); - bool IsSyntheticCached(); - bool IsValidatorCached(); - - lldb::TypeFormatImplSP GetFormat(); - - lldb::TypeSummaryImplSP GetSummary(); - - lldb::SyntheticChildrenSP GetSynthetic(); - - lldb::TypeValidatorImplSP GetValidator(); - - void SetFormat(lldb::TypeFormatImplSP); - - void SetSummary(lldb::TypeSummaryImplSP); - - void SetSynthetic(lldb::SyntheticChildrenSP); + void Get(lldb::TypeFormatImplSP &); + void Get(lldb::TypeSummaryImplSP &); + void Get(lldb::SyntheticChildrenSP &); - void SetValidator(lldb::TypeValidatorImplSP); + void Set(lldb::TypeFormatImplSP); + void Set(lldb::TypeSummaryImplSP); + void Set(lldb::SyntheticChildrenSP); }; typedef std::map<ConstString, Entry> CacheMap; CacheMap m_map; @@ -76,25 +57,10 @@ private: public: FormatCache(); - bool GetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp); - - bool GetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp); - - bool GetSynthetic(ConstString type, - lldb::SyntheticChildrenSP &synthetic_sp); - - bool GetValidator(ConstString type, - lldb::TypeValidatorImplSP &summary_sp); - - void SetFormat(ConstString type, lldb::TypeFormatImplSP &format_sp); - - void SetSummary(ConstString type, lldb::TypeSummaryImplSP &summary_sp); - - void SetSynthetic(ConstString type, - lldb::SyntheticChildrenSP &synthetic_sp); - - void SetValidator(ConstString type, - lldb::TypeValidatorImplSP &synthetic_sp); + template <typename ImplSP> bool Get(ConstString type, ImplSP &format_impl_sp); + void Set(ConstString type, lldb::TypeFormatImplSP &format_sp); + void Set(ConstString type, lldb::TypeSummaryImplSP &summary_sp); + void Set(ConstString type, lldb::SyntheticChildrenSP &synthetic_sp); void Clear(); @@ -102,6 +68,7 @@ public: uint64_t GetCacheMisses() { return m_cache_misses; } }; + } // namespace lldb_private #endif // lldb_FormatCache_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatClasses.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatClasses.h index 5144bc6079a9..91ce444244cc 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatClasses.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatClasses.h @@ -17,7 +17,6 @@ #include "lldb/DataFormatters/TypeFormat.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/DataFormatters/TypeSynthetic.h" -#include "lldb/DataFormatters/TypeValidator.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/Type.h" #include "lldb/lldb-enumerations.h" @@ -40,7 +39,6 @@ public: typedef HardcodedFormatterFinders<TypeFormatImpl> HardcodedFormatFinder; typedef HardcodedFormatterFinders<TypeSummaryImpl> HardcodedSummaryFinder; typedef HardcodedFormatterFinders<SyntheticChildren> HardcodedSyntheticFinder; - typedef HardcodedFormatterFinders<TypeValidatorImpl> HardcodedValidatorFinder; }; class FormattersMatchCandidate { diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatManager.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatManager.h index afaafda47e76..dd522c487c8f 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatManager.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormatManager.h @@ -52,24 +52,15 @@ public: void EnableCategory(ConstString category_name, TypeCategoryMap::Position pos = TypeCategoryMap::Default) { - EnableCategory(category_name, pos, - std::initializer_list<lldb::LanguageType>()); + EnableCategory(category_name, pos, {}); } void EnableCategory(ConstString category_name, TypeCategoryMap::Position pos, lldb::LanguageType lang) { - std::initializer_list<lldb::LanguageType> langs = {lang}; - EnableCategory(category_name, pos, langs); - } - - void EnableCategory(ConstString category_name, - TypeCategoryMap::Position pos = TypeCategoryMap::Default, - std::initializer_list<lldb::LanguageType> langs = {}) { TypeCategoryMap::ValueSP category_sp; if (m_categories_map.Get(category_name, category_sp) && category_sp) { m_categories_map.Enable(category_sp, pos); - for (const lldb::LanguageType lang : langs) - category_sp->AddLanguage(lang); + category_sp->AddLanguage(lang); } } @@ -127,9 +118,6 @@ public: lldb::ScriptedSyntheticChildrenSP GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp); - lldb::TypeValidatorImplSP - GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp); - lldb::TypeFormatImplSP GetFormat(ValueObject &valobj, lldb::DynamicValueType use_dynamic); @@ -139,9 +127,6 @@ public: lldb::SyntheticChildrenSP GetSyntheticChildren(ValueObject &valobj, lldb::DynamicValueType use_dynamic); - lldb::TypeValidatorImplSP GetValidator(ValueObject &valobj, - lldb::DynamicValueType use_dynamic); - bool AnyMatches(ConstString type_name, TypeCategoryImpl::FormatCategoryItems items = @@ -198,9 +183,6 @@ public: GetCandidateLanguages(lldb::LanguageType lang_type); private: - static std::vector<lldb::LanguageType> - GetCandidateLanguages(ValueObject &valobj); - static void GetPossibleMatches(ValueObject &valobj, CompilerType compiler_type, uint32_t reason, lldb::DynamicValueType use_dynamic, @@ -220,14 +202,10 @@ private: ConstString m_system_category_name; ConstString m_vectortypes_category_name; - lldb::TypeFormatImplSP GetHardcodedFormat(FormattersMatchData &); - - lldb::TypeSummaryImplSP GetHardcodedSummaryFormat(FormattersMatchData &); - - lldb::SyntheticChildrenSP - GetHardcodedSyntheticChildren(FormattersMatchData &); - - lldb::TypeValidatorImplSP GetHardcodedValidator(FormattersMatchData &); + template <typename ImplSP> + ImplSP Get(ValueObject &valobj, lldb::DynamicValueType use_dynamic); + template <typename ImplSP> ImplSP GetCached(FormattersMatchData &match_data); + template <typename ImplSP> ImplSP GetHardcoded(FormattersMatchData &); TypeCategoryMap &GetCategories() { return m_categories_map; } diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormattersContainer.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormattersContainer.h index de2edb103151..86023dd9bf0b 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormattersContainer.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/FormattersContainer.h @@ -22,7 +22,6 @@ #include "lldb/DataFormatters/TypeFormat.h" #include "lldb/DataFormatters/TypeSummary.h" #include "lldb/DataFormatters/TypeSynthetic.h" -#include "lldb/DataFormatters/TypeValidator.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Utility/RegularExpression.h" #include "lldb/Utility/StringLexer.h" diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/LanguageCategory.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/LanguageCategory.h index f109d46194ad..1cffff91c197 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/LanguageCategory.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/LanguageCategory.h @@ -25,27 +25,11 @@ public: LanguageCategory(lldb::LanguageType lang_type); - bool Get(FormattersMatchData &match_data, lldb::TypeFormatImplSP &format_sp); - - bool Get(FormattersMatchData &match_data, lldb::TypeSummaryImplSP &format_sp); - - bool Get(FormattersMatchData &match_data, - lldb::SyntheticChildrenSP &format_sp); - - bool Get(FormattersMatchData &match_data, - lldb::TypeValidatorImplSP &format_sp); - - bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data, - lldb::TypeFormatImplSP &format_sp); - + template <typename ImplSP> + bool Get(FormattersMatchData &match_data, ImplSP &format_sp); + template <typename ImplSP> bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data, - lldb::TypeSummaryImplSP &format_sp); - - bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data, - lldb::SyntheticChildrenSP &format_sp); - - bool GetHardcoded(FormatManager &fmt_mgr, FormattersMatchData &match_data, - lldb::TypeValidatorImplSP &format_sp); + ImplSP &format_sp); lldb::TypeCategoryImplSP GetCategory() const; @@ -63,7 +47,9 @@ private: HardcodedFormatters::HardcodedFormatFinder m_hardcoded_formats; HardcodedFormatters::HardcodedSummaryFinder m_hardcoded_summaries; HardcodedFormatters::HardcodedSyntheticFinder m_hardcoded_synthetics; - HardcodedFormatters::HardcodedValidatorFinder m_hardcoded_validators; + + template <typename ImplSP> + auto &GetHardcodedFinder(); lldb_private::FormatCache m_format_cache; diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h index a5438226bbbb..d5aab6dc3a52 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategory.h @@ -67,7 +67,6 @@ private: typedef FormatterContainerPair<TypeFormatImpl> FormatContainer; typedef FormatterContainerPair<TypeSummaryImpl> SummaryContainer; typedef FormatterContainerPair<TypeFilterImpl> FilterContainer; - typedef FormatterContainerPair<TypeValidatorImpl> ValidatorContainer; typedef FormatterContainerPair<SyntheticChildren> SynthContainer; public: @@ -86,9 +85,6 @@ public: typedef SynthContainer::ExactMatchContainerSP SynthContainerSP; typedef SynthContainer::RegexMatchContainerSP RegexSynthContainerSP; - typedef ValidatorContainer::ExactMatchContainerSP ValidatorContainerSP; - typedef ValidatorContainer::RegexMatchContainerSP RegexValidatorContainerSP; - template <typename T> class ForEachCallbacks { public: ForEachCallbacks() = default; @@ -145,18 +141,6 @@ public: m_synth_regex = callback; return *this; } - template <typename U = TypeValidatorImpl> - typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type - SetExact(ValidatorContainer::ExactMatchForEachCallback callback) { - m_validator_exact = callback; - return *this; - } - template <typename U = TypeValidatorImpl> - typename std::enable_if<std::is_same<U, T>::value, ForEachCallbacks &>::type - SetWithRegex(ValidatorContainer::RegexMatchForEachCallback callback) { - m_validator_regex = callback; - return *this; - } FormatContainer::ExactMatchForEachCallback GetFormatExactCallback() const { return m_format_exact; @@ -188,15 +172,6 @@ public: return m_synth_regex; } - ValidatorContainer::ExactMatchForEachCallback - GetValidatorExactCallback() const { - return m_validator_exact; - } - ValidatorContainer::RegexMatchForEachCallback - GetValidatorRegexCallback() const { - return m_validator_regex; - } - private: FormatContainer::ExactMatchForEachCallback m_format_exact; FormatContainer::RegexMatchForEachCallback m_format_regex; @@ -209,13 +184,9 @@ public: SynthContainer::ExactMatchForEachCallback m_synth_exact; SynthContainer::RegexMatchForEachCallback m_synth_regex; - - ValidatorContainer::ExactMatchForEachCallback m_validator_exact; - ValidatorContainer::RegexMatchForEachCallback m_validator_regex; }; - TypeCategoryImpl(IFormatChangeListener *clist, ConstString name, - std::initializer_list<lldb::LanguageType> langs = {}); + TypeCategoryImpl(IFormatChangeListener *clist, ConstString name); template <typename T> void ForEach(const ForEachCallbacks<T> &foreach) { GetTypeFormatsContainer()->ForEach(foreach.GetFormatExactCallback()); @@ -230,10 +201,6 @@ public: GetTypeSyntheticsContainer()->ForEach(foreach.GetSynthExactCallback()); GetRegexTypeSyntheticsContainer()->ForEach(foreach.GetSynthRegexCallback()); - - GetTypeValidatorsContainer()->ForEach(foreach.GetValidatorExactCallback()); - GetRegexTypeValidatorsContainer()->ForEach( - foreach.GetValidatorRegexCallback()); } FormatContainerSP GetTypeFormatsContainer() { @@ -278,9 +245,6 @@ public: SynthContainer::MapValueType GetSyntheticForType(lldb::TypeNameSpecifierImplSP type_sp); - ValidatorContainer::MapValueType - GetValidatorForType(lldb::TypeNameSpecifierImplSP type_sp); - lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForFormatAtIndex(size_t index); @@ -311,19 +275,6 @@ public: lldb::TypeNameSpecifierImplSP GetTypeNameSpecifierForSyntheticAtIndex(size_t index); - ValidatorContainerSP GetTypeValidatorsContainer() { - return m_validator_cont.GetExactMatch(); - } - - RegexValidatorContainerSP GetRegexTypeValidatorsContainer() { - return m_validator_cont.GetRegexMatch(); - } - - ValidatorContainer::MapValueType GetValidatorAtIndex(size_t index); - - lldb::TypeNameSpecifierImplSP - GetTypeNameSpecifierForValidatorAtIndex(size_t index); - bool IsEnabled() const { return m_enabled; } uint32_t GetEnabledPosition() { @@ -333,18 +284,15 @@ public: return m_enabled_position; } - bool Get(ValueObject &valobj, const FormattersMatchVector &candidates, + bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates, lldb::TypeFormatImplSP &entry, uint32_t *reason = nullptr); - bool Get(ValueObject &valobj, const FormattersMatchVector &candidates, + bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates, lldb::TypeSummaryImplSP &entry, uint32_t *reason = nullptr); - bool Get(ValueObject &valobj, const FormattersMatchVector &candidates, + bool Get(lldb::LanguageType lang, const FormattersMatchVector &candidates, lldb::SyntheticChildrenSP &entry, uint32_t *reason = nullptr); - bool Get(ValueObject &valobj, const FormattersMatchVector &candidates, - lldb::TypeValidatorImplSP &entry, uint32_t *reason = nullptr); - void Clear(FormatCategoryItems items = ALL_ITEM_TYPES); bool Delete(ConstString name, FormatCategoryItems items = ALL_ITEM_TYPES); @@ -359,8 +307,6 @@ public: void AddLanguage(lldb::LanguageType lang); - bool HasLanguage(lldb::LanguageType lang); - std::string GetDescription(); bool AnyMatches(ConstString type_name, @@ -376,7 +322,6 @@ private: SummaryContainer m_summary_cont; FilterContainer m_filter_cont; SynthContainer m_synth_cont; - ValidatorContainer m_validator_cont; bool m_enabled; @@ -394,7 +339,7 @@ private: void Disable() { Enable(false, UINT32_MAX); } - bool IsApplicable(ValueObject &valobj); + bool IsApplicable(lldb::LanguageType lang); uint32_t GetLastEnabledPosition() { return m_enabled_position; } @@ -417,9 +362,6 @@ private: friend class FormattersContainer<lldb::RegularExpressionSP, ScriptedSyntheticChildren>; - friend class FormattersContainer<ConstString, TypeValidatorImpl>; - friend class FormattersContainer<lldb::RegularExpressionSP, - TypeValidatorImpl>; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategoryMap.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategoryMap.h index 753b58cb465e..ae577a334014 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategoryMap.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeCategoryMap.h @@ -77,14 +77,7 @@ public: uint32_t GetCount() { return m_map.size(); } - lldb::TypeFormatImplSP GetFormat(FormattersMatchData &match_data); - - lldb::TypeSummaryImplSP GetSummaryFormat(FormattersMatchData &match_data); - - lldb::SyntheticChildrenSP - GetSyntheticChildren(FormattersMatchData &match_data); - - lldb::TypeValidatorImplSP GetValidator(FormattersMatchData &match_data); + template <typename ImplSP> void Get(FormattersMatchData &, ImplSP &); private: class delete_matching_categories { diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeValidator.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeValidator.h deleted file mode 100644 index 531812eeb056..000000000000 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/TypeValidator.h +++ /dev/null @@ -1,201 +0,0 @@ -//===-- TypeValidator.h ------------------------------------------*- C++ -//-*-===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#ifndef lldb_TypeValidator_h_ -#define lldb_TypeValidator_h_ - - -#include <functional> -#include <string> - - -#include "lldb/lldb-enumerations.h" -#include "lldb/lldb-private-enumerations.h" -#include "lldb/lldb-public.h" - -namespace lldb_private { - -class TypeValidatorImpl { -public: - class Flags { - public: - Flags() : m_flags(lldb::eTypeOptionCascade) {} - - Flags(const Flags &other) : m_flags(other.m_flags) {} - - Flags(uint32_t value) : m_flags(value) {} - - Flags &operator=(const Flags &rhs) { - if (&rhs != this) - m_flags = rhs.m_flags; - - return *this; - } - - Flags &operator=(const uint32_t &rhs) { - m_flags = rhs; - return *this; - } - - Flags &Clear() { - m_flags = 0; - return *this; - } - - bool GetCascades() const { - return (m_flags & lldb::eTypeOptionCascade) == lldb::eTypeOptionCascade; - } - - Flags &SetCascades(bool value = true) { - if (value) - m_flags |= lldb::eTypeOptionCascade; - else - m_flags &= ~lldb::eTypeOptionCascade; - return *this; - } - - bool GetSkipPointers() const { - return (m_flags & lldb::eTypeOptionSkipPointers) == - lldb::eTypeOptionSkipPointers; - } - - Flags &SetSkipPointers(bool value = true) { - if (value) - m_flags |= lldb::eTypeOptionSkipPointers; - else - m_flags &= ~lldb::eTypeOptionSkipPointers; - return *this; - } - - bool GetSkipReferences() const { - return (m_flags & lldb::eTypeOptionSkipReferences) == - lldb::eTypeOptionSkipReferences; - } - - Flags &SetSkipReferences(bool value = true) { - if (value) - m_flags |= lldb::eTypeOptionSkipReferences; - else - m_flags &= ~lldb::eTypeOptionSkipReferences; - return *this; - } - - bool GetNonCacheable() const { - return (m_flags & lldb::eTypeOptionNonCacheable) == - lldb::eTypeOptionNonCacheable; - } - - Flags &SetNonCacheable(bool value = true) { - if (value) - m_flags |= lldb::eTypeOptionNonCacheable; - else - m_flags &= ~lldb::eTypeOptionNonCacheable; - return *this; - } - - uint32_t GetValue() { return m_flags; } - - void SetValue(uint32_t value) { m_flags = value; } - - private: - uint32_t m_flags; - }; - - TypeValidatorImpl(const Flags &flags = Flags()); - - typedef std::shared_ptr<TypeValidatorImpl> SharedPointer; - - virtual ~TypeValidatorImpl(); - - bool Cascades() const { return m_flags.GetCascades(); } - bool SkipsPointers() const { return m_flags.GetSkipPointers(); } - bool SkipsReferences() const { return m_flags.GetSkipReferences(); } - bool NonCacheable() const { return m_flags.GetNonCacheable(); } - - void SetCascades(bool value) { m_flags.SetCascades(value); } - - void SetSkipsPointers(bool value) { m_flags.SetSkipPointers(value); } - - void SetSkipsReferences(bool value) { m_flags.SetSkipReferences(value); } - - void SetNonCacheable(bool value) { m_flags.SetNonCacheable(value); } - - uint32_t GetOptions() { return m_flags.GetValue(); } - - void SetOptions(uint32_t value) { m_flags.SetValue(value); } - - uint32_t &GetRevision() { return m_my_revision; } - - enum class Type { eTypeUnknown, eTypeCXX }; - - struct ValidationResult { - TypeValidatorResult m_result; - std::string m_message; - }; - - virtual Type GetType() { return Type::eTypeUnknown; } - - // we are using a ValueObject* instead of a ValueObjectSP because we do not - // need to hold on to this for extended periods of time and we trust the - // ValueObject to stay around for as long as it is required for us to - // generate its value - virtual ValidationResult FormatObject(ValueObject *valobj) const = 0; - - virtual std::string GetDescription() = 0; - - static ValidationResult Success(); - - static ValidationResult Failure(std::string message); - -protected: - Flags m_flags; - uint32_t m_my_revision; - -private: - DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl); -}; - -class TypeValidatorImpl_CXX : public TypeValidatorImpl { -public: - typedef std::function<TypeValidatorImpl::ValidationResult( - ValueObject *valobj)> - ValidatorFunction; - - TypeValidatorImpl_CXX(ValidatorFunction f, std::string d, - const TypeValidatorImpl::Flags &flags = Flags()); - - typedef std::shared_ptr<TypeValidatorImpl_CXX> SharedPointer; - - ~TypeValidatorImpl_CXX() override; - - ValidatorFunction GetValidatorFunction() const { - return m_validator_function; - } - - void SetValidatorFunction(ValidatorFunction f) { m_validator_function = f; } - - TypeValidatorImpl::Type GetType() override { - return TypeValidatorImpl::Type::eTypeCXX; - } - - ValidationResult FormatObject(ValueObject *valobj) const override; - - std::string GetDescription() override; - -protected: - std::string m_description; - ValidatorFunction m_validator_function; - -private: - DISALLOW_COPY_AND_ASSIGN(TypeValidatorImpl_CXX); -}; - -} // namespace lldb_private - -#endif // lldb_TypeValidator_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h b/contrib/llvm-project/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h index 41adc2d2b5b2..33813b38701c 100644 --- a/contrib/llvm-project/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h +++ b/contrib/llvm-project/lldb/include/lldb/DataFormatters/ValueObjectPrinter.h @@ -62,8 +62,6 @@ protected: bool ShouldPrintValueObject(); - bool ShouldPrintValidation(); - bool IsNil(); bool IsUninitialized(); @@ -76,10 +74,6 @@ protected: bool IsAggregate(); - bool PrintValidationMarkerIfNeeded(); - - bool PrintValidationErrorIfNeeded(); - bool PrintLocationIfNeeded(); void PrintDecl(); @@ -145,7 +139,6 @@ private: std::string m_summary; std::string m_error; bool m_val_summary_ok; - std::pair<TypeValidatorResult, std::string> m_validation; friend struct StringSummaryFormat; diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/DWARFExpression.h b/contrib/llvm-project/lldb/include/lldb/Expression/DWARFExpression.h index 44015b4e418f..bfae142d5e01 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/DWARFExpression.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/DWARFExpression.h @@ -34,15 +34,6 @@ namespace lldb_private { /// location expression or a location list and interprets it. class DWARFExpression { public: - enum LocationListFormat : uint8_t { - NonLocationList, // Not a location list - RegularLocationList, // Location list format used in non-split dwarf files - SplitDwarfLocationList, // Location list format used in pre-DWARF v5 split - // dwarf files (.debug_loc.dwo) - LocLists, // Location list format used in DWARF v5 - // (.debug_loclists/.debug_loclists.dwo). - }; - DWARFExpression(); /// Constructor @@ -85,8 +76,8 @@ public: /// Search for a load address in the location list /// - /// \param[in] process - /// The process to use when resolving the load address + /// \param[in] func_load_addr + /// The actual address of the function containing this location list. /// /// \param[in] addr /// The address to resolve @@ -98,7 +89,7 @@ public: // LocationListContainsLoadAddress (Process* process, const Address &addr) // const; // - bool LocationListContainsAddress(lldb::addr_t loclist_base_addr, + bool LocationListContainsAddress(lldb::addr_t func_load_addr, lldb::addr_t addr) const; /// If a location is not a location list, return true if the location @@ -138,13 +129,15 @@ public: /// Tells the expression that it refers to a location list. /// - /// \param[in] slide - /// This value should be a slide that is applied to any values - /// in the location list data so the values become zero based - /// offsets into the object that owns the location list. We need - /// to make location lists relative to the objects that own them - /// so we can relink addresses on the fly. - void SetLocationListSlide(lldb::addr_t slide); + /// \param[in] cu_file_addr + /// The base address to use for interpreting relative location list + /// entries. + /// \param[in] func_file_addr + /// The file address of the function containing this location list. This + /// address will be used to relocate the location list on the fly (in + /// conjuction with the func_load_addr arguments). + void SetLocationListAddresses(lldb::addr_t cu_file_addr, + lldb::addr_t func_file_addr); /// Return the call-frame-info style register kind int GetRegisterKind(); @@ -158,8 +151,7 @@ public: /// Wrapper for the static evaluate function that accepts an /// ExecutionContextScope instead of an ExecutionContext and uses member /// variables to populate many operands - bool Evaluate(ExecutionContextScope *exe_scope, - lldb::addr_t loclist_base_load_addr, + bool Evaluate(ExecutionContextScope *exe_scope, lldb::addr_t func_load_addr, const Value *initial_value_ptr, const Value *object_address_ptr, Value &result, Status *error_ptr) const; @@ -184,19 +176,6 @@ public: /// This is a static method so the opcodes need to be provided /// explicitly. /// - /// \param[in] expr_locals - /// If the location expression was produced by the expression parser, - /// the list of local variables referenced by the DWARF expression. - /// This list should already have been populated during parsing; - /// the DWARF expression refers to variables by index. Can be NULL if - /// the location expression uses no locals. - /// - /// \param[in] decl_map - /// If the location expression was produced by the expression parser, - /// the list of external variables referenced by the location - /// expression. Can be NULL if the location expression uses no - /// external variables. - /// /// \param[in] reg_ctx /// An optional parameter which provides a RegisterContext for use /// when evaluating the expression (i.e. for fetching register values). @@ -235,8 +214,8 @@ public: } bool DumpLocationForAddress(Stream *s, lldb::DescriptionLevel level, - lldb::addr_t loclist_base_load_addr, - lldb::addr_t address, ABI *abi); + lldb::addr_t func_load_addr, lldb::addr_t address, + ABI *abi); static bool PrintDWARFExpression(Stream &s, const DataExtractor &data, int address_size, int dwarf_ref_size, @@ -251,7 +230,7 @@ public: private: /// Pretty-prints the location expression to a stream /// - /// \param[in] stream + /// \param[in] s /// The stream to use for pretty-printing. /// /// \param[in] offset @@ -266,18 +245,12 @@ private: /// \param[in] abi /// An optional ABI plug-in that can be used to resolve register /// names. - void DumpLocation(Stream *s, lldb::offset_t offset, lldb::offset_t length, + void DumpLocation(Stream *s, const DataExtractor &data, lldb::DescriptionLevel level, ABI *abi) const; - bool GetLocation(lldb::addr_t base_addr, lldb::addr_t pc, - lldb::offset_t &offset, lldb::offset_t &len); - - static bool AddressRangeForLocationListEntry( - const DWARFUnit *dwarf_cu, const DataExtractor &debug_loc_data, - lldb::offset_t *offset_ptr, lldb::addr_t &low_pc, lldb::addr_t &high_pc); - - bool GetOpAndEndOffsets(StackFrame &frame, lldb::offset_t &op_offset, - lldb::offset_t &end_offset); + llvm::Optional<DataExtractor> + GetLocationExpression(lldb::addr_t load_function_start, + lldb::addr_t addr) const; /// Module which defined this expression. lldb::ModuleWP m_module_wp; @@ -293,10 +266,11 @@ private: /// One of the defines that starts with LLDB_REGKIND_ lldb::RegisterKind m_reg_kind; - /// A value used to slide the location list offsets so that m_c they are - /// relative to the object that owns the location list (the function for - /// frame base and variable location lists) - lldb::addr_t m_loclist_slide; + struct LoclistAddresses { + lldb::addr_t cu_file_addr; + lldb::addr_t func_file_addr; + }; + llvm::Optional<LoclistAddresses> m_loclist_addresses; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/Expression.h b/contrib/llvm-project/lldb/include/lldb/Expression/Expression.h index 2f0183cf269b..e0ea7e99f4f9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/Expression.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/Expression.h @@ -32,22 +32,11 @@ class RecordingMemoryManager; /// LLVM IR from the expression. class Expression { public: - /// Discriminator for LLVM-style RTTI (dyn_cast<> et al.) - enum ExpressionKind { - eKindFunctionCaller, - eKindClangFunctionCaller, - eKindUserExpression, - eKindLLVMUserExpression, - eKindClangUserExpression, - eKindUtilityFunction, - eKindClangUtilityFunction, - }; - enum ResultType { eResultTypeAny, eResultTypeId }; - Expression(Target &target, ExpressionKind kind); + Expression(Target &target); - Expression(ExecutionContextScope &exe_scope, ExpressionKind kind); + Expression(ExecutionContextScope &exe_scope); /// Destructor virtual ~Expression() {} @@ -64,6 +53,10 @@ public: /// default, return eLanguageTypeUnknown. virtual lldb::LanguageType Language() { return lldb::eLanguageTypeUnknown; } + /// Return the Materializer that the parser should use when registering + /// external values. + virtual Materializer *GetMaterializer() { return nullptr; } + /// Return the desired result type of the function, or eResultTypeAny if /// indifferent. virtual ResultType DesiredResultType() { return eResultTypeAny; } @@ -90,12 +83,9 @@ public: virtual ExpressionTypeSystemHelper *GetTypeSystemHelper() { return nullptr; } - /// LLVM-style RTTI support. - ExpressionKind getKind() const { return m_kind; } - -private: - /// LLVM-style RTTI support. - const ExpressionKind m_kind; + // LLVM RTTI support + virtual bool isA(const void *ClassID) const = 0; + protected: lldb::TargetWP m_target_wp; /// Expression's always have to have a target... lldb::ProcessWP m_jit_process_wp; /// An expression might have a process, but diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionParser.h b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionParser.h index 59f7c1592e83..2e7b3075d509 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionParser.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionParser.h @@ -29,7 +29,7 @@ public: /// /// Initializes class variables. /// - /// \param[in] exe_scope, + /// \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. @@ -76,17 +76,6 @@ public: virtual bool Complete(CompletionRequest &request, unsigned line, unsigned pos, unsigned typed_pos) = 0; - /// 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) = 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. diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionSourceCode.h b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionSourceCode.h index e7d39e7ca24a..db8ef967ab15 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionSourceCode.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionSourceCode.h @@ -11,6 +11,7 @@ #include "lldb/lldb-enumerations.h" #include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/StringRef.h" #include <string> diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionVariable.h b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionVariable.h index 08c987270bfe..c20c2301bb54 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionVariable.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/ExpressionVariable.h @@ -98,9 +98,7 @@ public: EVTypeIsReference = 1 << 6, ///< The original type of this variable is a ///reference, so materialize the value rather ///than the location - EVUnknownType = 1 << 7, ///< This is a symbol of unknown type, and the type - ///must be resolved after parsing is complete - EVBareRegister = 1 << 8 ///< This variable is a direct reference to $pc or + EVBareRegister = 1 << 7 ///< This variable is a direct reference to $pc or ///some other entity. }; diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/FunctionCaller.h b/contrib/llvm-project/lldb/include/lldb/Expression/FunctionCaller.h index ea9d0205bf86..1303655f449f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/FunctionCaller.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/FunctionCaller.h @@ -54,22 +54,20 @@ namespace lldb_private { /// Any of the methods that take arg_addr_ptr can be passed nullptr, and the /// argument space will be managed for you. class FunctionCaller : public Expression { + // LLVM RTTI support + static char ID; + public: - /// LLVM-style RTTI support. - static bool classof(const Expression *E) { - return E->getKind() == eKindFunctionCaller; - } - + bool isA(const void *ClassID) const override { return ClassID == &ID; } + static bool classof(const Expression *obj) { return obj->isA(&ID); } + /// Constructor /// /// \param[in] exe_scope /// An execution context scope that gets us at least a target and /// process. /// - /// \param[in] ast_context - /// The AST context to evaluate argument types in. - /// - /// \param[in] return_qualtype + /// \param[in] return_type /// An opaque Clang QualType for the function result. Should be /// defined in ast_context. /// @@ -223,21 +221,12 @@ public: /// The execution context to insert the function and its arguments /// into. /// - /// \param[in] func_addr - /// The address of the function in the target process. - /// /// \param[in] args_addr /// The address of the argument struct. /// /// \param[in] diagnostic_manager /// The diagnostic manager to report errors to. /// - /// \param[in] stop_others - /// True if other threads should pause during execution. - /// - /// \param[in] unwind_on_error - /// True if the thread plan may simply be discarded if an error occurs. - /// /// \return /// A ThreadPlan shared pointer for executing the function. lldb::ThreadPlanSP diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/IRExecutionUnit.h b/contrib/llvm-project/lldb/include/lldb/Expression/IRExecutionUnit.h index beff44db9d5e..05f2f8471ef8 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/IRExecutionUnit.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/IRExecutionUnit.h @@ -173,6 +173,8 @@ private: /// The address in the target process. lldb::addr_t GetRemoteAddressForLocal(lldb::addr_t local_address); + typedef std::pair<lldb::addr_t, uintptr_t> AddrRange; + /// Look up the object in m_address_map that contains a given address, find /// where it was copied to, and return its address range in the target /// process @@ -182,12 +184,11 @@ private: /// /// \return /// The range of the containing object in the target process. - typedef std::pair<lldb::addr_t, uintptr_t> AddrRange; AddrRange GetRemoteRangeForLocal(lldb::addr_t local_address); /// Commit all allocations to the process and record where they were stored. /// - /// \param[in] process + /// \param[in] process_sp /// The process to allocate memory in. /// /// \return @@ -204,7 +205,7 @@ private: /// Write the contents of all allocations to the process. /// - /// \param[in] local_address + /// \param[in] process_sp /// The process containing the allocations. /// /// \return @@ -298,16 +299,18 @@ private: return false; } + // Ignore any EHFrame registration. void registerEHFrames(uint8_t *Addr, uint64_t LoadAddr, size_t Size) override {} + void deregisterEHFrames() override {} uint64_t getSymbolAddress(const std::string &Name) override; - + // Find the address of the symbol Name. If Name is a missing weak symbol // then missing_weak will be true. - uint64_t GetSymbolAddressAndPresence(const std::string &Name, + uint64_t GetSymbolAddressAndPresence(const std::string &Name, bool &missing_weak); - + llvm::JITSymbol findSymbol(const std::string &Name) override; void *getPointerToNamedFunction(const std::string &Name, @@ -326,18 +329,16 @@ private: static const unsigned eSectionIDInvalid = (unsigned)-1; - /// \class AllocationRecord IRExecutionUnit.h - /// "lldb/Expression/IRExecutionUnit.h" Encapsulates a single allocation - /// request made by the JIT. - /// - /// Allocations made by the JIT are first queued up and then applied in bulk - /// to the underlying process. enum class AllocationKind { Stub, Code, Data, Global, Bytes }; static lldb::SectionType GetSectionTypeFromSectionName(const llvm::StringRef &name, AllocationKind alloc_kind); + /// Encapsulates a single allocation request made by the JIT. + /// + /// Allocations made by the JIT are first queued up and then applied in bulk + /// to the underlying process. struct AllocationRecord { std::string m_name; lldb::addr_t m_process_address; diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/LLVMUserExpression.h b/contrib/llvm-project/lldb/include/lldb/Expression/LLVMUserExpression.h index c3b8ed506f17..2679c01a4e00 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/LLVMUserExpression.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/LLVMUserExpression.h @@ -30,11 +30,14 @@ namespace lldb_private { /// implementations of LLVMUserExpression - which will be vended through the /// appropriate TypeSystem. class LLVMUserExpression : public UserExpression { + // LLVM RTTI support + static char ID; + public: - /// LLVM-style RTTI support. - static bool classof(const Expression *E) { - return E->getKind() == eKindLLVMUserExpression; + bool isA(const void *ClassID) const override { + return ClassID == &ID || UserExpression::isA(ClassID); } + static bool classof(const Expression *obj) { return obj->isA(&ID); } // The IRPasses struct is filled in by a runtime after an expression is // compiled and can be used to to run fixups/analysis passes as required. @@ -51,8 +54,7 @@ public: LLVMUserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, ResultType desired_type, - const EvaluateExpressionOptions &options, - ExpressionKind kind); + const EvaluateExpressionOptions &options); ~LLVMUserExpression() override; bool FinalizeJITExecution( @@ -63,6 +65,8 @@ public: bool CanInterpret() override { return m_can_interpret; } + Materializer *GetMaterializer() override { return m_materializer_up.get(); } + /// Return the string that the parser should parse. Must be a full /// translation unit. const char *Text() override { return m_transformed_text.c_str(); } diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/REPL.h b/contrib/llvm-project/lldb/include/lldb/Expression/REPL.h index d34a792f58f1..035ad63271e4 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/REPL.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/REPL.h @@ -32,7 +32,7 @@ public: /// Get a REPL with an existing target (or, failing that, a debugger to use), /// and (optional) extra arguments for the compiler. /// - /// \param[out] error + /// \param[out] Status /// If this language is supported but the REPL couldn't be created, this /// error is populated with the reason. /// diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/UserExpression.h b/contrib/llvm-project/lldb/include/lldb/Expression/UserExpression.h index b1d52f8ddd55..83122d8ba518 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/UserExpression.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/UserExpression.h @@ -33,12 +33,13 @@ namespace lldb_private { /// implementations of UserExpression - which will be vended through the /// appropriate TypeSystem. class UserExpression : public Expression { + /// LLVM RTTI support. + static char ID; + public: - /// LLVM-style RTTI support. - static bool classof(const Expression *E) { - return E->getKind() == eKindUserExpression; - } - + bool isA(const void *ClassID) const override { return ClassID == &ID; } + static bool classof(const Expression *obj) { return obj->isA(&ID); } + enum { kDefaultTimeout = 500000u }; /// Constructor @@ -46,10 +47,6 @@ public: /// \param[in] expr /// The expression to parse. /// - /// \param[in] expr_prefix - /// If non-nullptr, a C string containing translation-unit level - /// definitions to be included when the expression is parsed. - /// /// \param[in] language /// If not eLanguageTypeUnknown, a language to use when parsing /// the expression. Currently restricted to those languages @@ -61,8 +58,7 @@ public: UserExpression(ExecutionContextScope &exe_scope, llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, ResultType desired_type, - const EvaluateExpressionOptions &options, - ExpressionKind kind); + const EvaluateExpressionOptions &options); /// Destructor ~UserExpression() override; @@ -166,8 +162,14 @@ public: /// A pointer to direct at the persistent variable in which the /// expression's result is stored. /// - /// \param[in] function_stack_pointer - /// A pointer to the base of the function's stack frame. This + /// \param[in] function_stack_bottom + /// A pointer to the bottom of the function's stack frame. This + /// is used to determine whether the expression result resides in + /// memory that will still be valid, or whether it needs to be + /// treated as homeless for the purpose of future expressions. + /// + /// \param[in] function_stack_top + /// A pointer to the top of the function's stack frame. This /// is used to determine whether the expression result resides in /// memory that will still be valid, or whether it needs to be /// treated as homeless for the purpose of future expressions. diff --git a/contrib/llvm-project/lldb/include/lldb/Expression/UtilityFunction.h b/contrib/llvm-project/lldb/include/lldb/Expression/UtilityFunction.h index 26da081ddced..c3d185899b0f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Expression/UtilityFunction.h +++ b/contrib/llvm-project/lldb/include/lldb/Expression/UtilityFunction.h @@ -28,12 +28,13 @@ namespace lldb_private { /// self-contained function meant to be used from other code. Utility /// functions can perform error-checking for ClangUserExpressions, class UtilityFunction : public Expression { + // LLVM RTTI support + static char ID; + public: - /// LLVM-style RTTI support. - static bool classof(const Expression *E) { - return E->getKind() == eKindUtilityFunction; - } - + bool isA(const void *ClassID) const override { return ClassID == &ID; } + static bool classof(const Expression *obj) { return obj->isA(&ID); } + /// Constructor /// /// \param[in] text @@ -42,7 +43,7 @@ public: /// \param[in] name /// The name of the function, as used in the text. UtilityFunction(ExecutionContextScope &exe_scope, const char *text, - const char *name, ExpressionKind kind); + const char *name); ~UtilityFunction() override; @@ -59,16 +60,16 @@ public: virtual bool Install(DiagnosticManager &diagnostic_manager, ExecutionContext &exe_ctx) = 0; - /// Check whether the given PC is inside the function + /// Check whether the given address is inside the function /// /// Especially useful if the function dereferences nullptr to indicate a /// failed assert. /// - /// \param[in] pc - /// The program counter to check. + /// \param[in] address + /// The address to check. /// /// \return - /// True if the program counter falls within the function's bounds; + /// True if the address falls within the function's bounds; /// false if not (or the function is not JIT compiled) bool ContainsAddress(lldb::addr_t address) { // nothing is both >= LLDB_INVALID_ADDRESS and < LLDB_INVALID_ADDRESS, so diff --git a/contrib/llvm-project/lldb/include/lldb/Host/Config.h.cmake b/contrib/llvm-project/lldb/include/lldb/Host/Config.h.cmake index 662c07668d14..e9065ed04caa 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/Config.h.cmake +++ b/contrib/llvm-project/lldb/include/lldb/Host/Config.h.cmake @@ -9,15 +9,10 @@ #ifndef LLDB_HOST_CONFIG_H #define LLDB_HOST_CONFIG_H -#cmakedefine LLDB_CONFIG_TERMIOS_SUPPORTED - #cmakedefine01 LLDB_EDITLINE_USE_WCHAR #cmakedefine01 LLDB_HAVE_EL_RFUNC_T -#cmakedefine LLDB_DISABLE_POSIX - -#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" #cmakedefine01 HAVE_SYS_TYPES_H @@ -35,6 +30,24 @@ #cmakedefine HAVE_LIBCOMPRESSION #endif +#cmakedefine01 LLDB_ENABLE_POSIX + +#cmakedefine01 LLDB_ENABLE_TERMIOS + #cmakedefine01 LLDB_ENABLE_LZMA +#cmakedefine01 LLDB_ENABLE_CURSES + +#cmakedefine01 LLDB_ENABLE_LIBEDIT + +#cmakedefine01 LLDB_ENABLE_LIBXML2 + +#cmakedefine01 LLDB_ENABLE_LUA + +#cmakedefine01 LLDB_ENABLE_PYTHON + +#cmakedefine LLDB_PYTHON_HOME "${LLDB_PYTHON_HOME}" + +#define LLDB_LIBDIR_SUFFIX "${LLVM_LIBDIR_SUFFIX}" + #endif // #ifndef LLDB_HOST_CONFIG_H diff --git a/contrib/llvm-project/lldb/include/lldb/Host/Editline.h b/contrib/llvm-project/lldb/include/lldb/Host/Editline.h index 65bf15531bc4..db3d9e48cfbb 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/Editline.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/Editline.h @@ -32,6 +32,8 @@ #define liblldb_Editline_h_ #if defined(__cplusplus) +#include "lldb/Host/Config.h" + #if LLDB_EDITLINE_USE_WCHAR #include <codecvt> #endif @@ -133,6 +135,15 @@ enum class CursorLocation { /// session BlockEnd }; + +/// Operation for the history. +enum class HistoryOperation { + Oldest, + Older, + Current, + Newer, + Newest +}; } using namespace line_editor; @@ -258,11 +269,7 @@ private: StringList GetInputAsStringList(int line_count = UINT32_MAX); /// Replaces the current multi-line session with the next entry from history. - /// When the parameter is - /// true it will take the next earlier entry from history, when it is false it - /// takes the next most - /// recent. - unsigned char RecallHistory(bool earlier); + unsigned char RecallHistory(HistoryOperation op); /// Character reading implementation for EditLine that supports our multi-line /// editing trickery. diff --git a/contrib/llvm-project/lldb/include/lldb/Host/File.h b/contrib/llvm-project/lldb/include/lldb/Host/File.h index 0102beb141ee..9beb20556dcd 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/File.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/File.h @@ -76,9 +76,7 @@ public: /// that takes an "off_t &offset" to ensure correct operation in multi- /// threaded environments. /// - /// \param[out] buf - /// - /// \param[in,out] num_bytes. + /// \param[in,out] num_bytes /// Pass in the size of buf. Read will pass out the number /// of bytes read. Zero bytes read with no error indicates /// EOF. @@ -93,8 +91,6 @@ public: /// that takes an "off_t &offset" to ensure correct operation in multi- /// threaded environments. /// - /// \param[in] buf - /// /// \param[in,out] num_bytes /// Pass in the size of buf. Write will pass out the number /// of bytes written. Write will attempt write the full number diff --git a/contrib/llvm-project/lldb/include/lldb/Host/HostInfoBase.h b/contrib/llvm-project/lldb/include/lldb/Host/HostInfoBase.h index 6f6688941ac7..c59050cb34e9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/HostInfoBase.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/HostInfoBase.h @@ -33,17 +33,12 @@ public: static void Initialize(); static void Terminate(); - /// Gets the host target triple as a const string. + /// Gets the host target triple. /// /// \return - /// A const string object containing the host target triple. - static llvm::StringRef GetTargetTriple(); + /// The host target triple. + static llvm::Triple GetTargetTriple(); - /// Gets the host architecture. - /// - /// \return - /// A const architecture object that represents the host - /// architecture. enum ArchitectureKind { eArchKindDefault, // The overall default architecture that applications will // run on this host diff --git a/contrib/llvm-project/lldb/include/lldb/Host/HostProcess.h b/contrib/llvm-project/lldb/include/lldb/Host/HostProcess.h index d48ff1fc90ee..fcea52a284d9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/HostProcess.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/HostProcess.h @@ -12,7 +12,6 @@ #include "lldb/Host/Host.h" #include "lldb/lldb-types.h" -/// \class HostInfo HostInfo.h "lldb/Host/HostProcess.h" /// A class that represents a running process on the host machine. /// /// HostProcess allows querying and manipulation of processes running on the diff --git a/contrib/llvm-project/lldb/include/lldb/Host/PseudoTerminal.h b/contrib/llvm-project/lldb/include/lldb/Host/PseudoTerminal.h index 8b27890ddeeb..18679b6fcdd9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/PseudoTerminal.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/PseudoTerminal.h @@ -61,14 +61,14 @@ public: /// PseudoTerminal::ReleaseMasterFileDescriptor() @li /// PseudoTerminal::ReleaseSaveFileDescriptor() /// - /// \param[out] error + /// \param[out] error_str /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// /// \return - /// \li \b Parent process: a child process ID that is greater + /// \b Parent process: a child process ID that is greater /// than zero, or -1 if the fork fails. - /// \li \b Child process: zero. + /// \b Child process: zero. lldb::pid_t Fork(char *error_str, size_t error_len); /// The master file descriptor accessor. @@ -104,7 +104,7 @@ public: /// A master pseudo terminal should already be valid prior to /// calling this function. /// - /// \param[out] error + /// \param[out] error_str /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// @@ -136,14 +136,14 @@ public: /// Flags to use when calling \c posix_openpt(\a oflag). /// A value of "O_RDWR|O_NOCTTY" is suggested. /// - /// \param[out] error + /// \param[out] error_str /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// /// \return - /// \li \b true when the master files descriptor is + /// \b true when the master files descriptor is /// successfully opened. - /// \li \b false if anything goes wrong. + /// \b false if anything goes wrong. /// /// \see PseudoTerminal::GetMasterFileDescriptor() @see /// PseudoTerminal::ReleaseMasterFileDescriptor() @@ -165,14 +165,14 @@ public: /// \param[in] oflag /// Flags to use when calling \c open(\a oflag). /// - /// \param[out] error + /// \param[out] error_str /// An pointer to an error that can describe any errors that /// occur. This can be NULL if no error status is desired. /// /// \return - /// \li \b true when the master files descriptor is + /// \b true when the master files descriptor is /// successfully opened. - /// \li \b false if anything goes wrong. + /// \b false if anything goes wrong. /// /// \see PseudoTerminal::OpenFirstAvailableMaster() @see /// PseudoTerminal::GetSlaveFileDescriptor() @see diff --git a/contrib/llvm-project/lldb/include/lldb/Host/SocketAddress.h b/contrib/llvm-project/lldb/include/lldb/Host/SocketAddress.h index 620827ff6eb1..766303a3c1fd 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/SocketAddress.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/SocketAddress.h @@ -48,8 +48,6 @@ public: ~SocketAddress(); // Operators - const SocketAddress &operator=(const SocketAddress &rhs); - const SocketAddress &operator=(const struct addrinfo *addr_info); const SocketAddress &operator=(const struct sockaddr &s); diff --git a/contrib/llvm-project/lldb/include/lldb/Host/Terminal.h b/contrib/llvm-project/lldb/include/lldb/Host/Terminal.h index e5e96eeda3fe..671f8d63f89f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/Terminal.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/Terminal.h @@ -117,7 +117,7 @@ protected: // Member variables Terminal m_tty; ///< A terminal int m_tflags; ///< Cached tflags information. -#ifdef LLDB_CONFIG_TERMIOS_SUPPORTED +#if LLDB_ENABLE_TERMIOS std::unique_ptr<struct termios> m_termios_up; ///< Cached terminal state information. #endif diff --git a/contrib/llvm-project/lldb/include/lldb/Host/XML.h b/contrib/llvm-project/lldb/include/lldb/Host/XML.h index 625cf4381286..ca51d304dc8f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Host/XML.h +++ b/contrib/llvm-project/lldb/include/lldb/Host/XML.h @@ -9,7 +9,9 @@ #ifndef liblldb_XML_h_ #define liblldb_XML_h_ -#if defined(LIBXML2_DEFINED) +#include "lldb/Host/Config.h" + +#if LLDB_ENABLE_LIBXML2 #include <libxml/xmlreader.h> #endif @@ -25,7 +27,7 @@ namespace lldb_private { -#if defined(LIBXML2_DEFINED) +#if LLDB_ENABLE_LIBXML2 typedef xmlNodePtr XMLNodeImpl; typedef xmlDocPtr XMLDocumentImpl; #else diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandInterpreter.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandInterpreter.h index 3b98b2a521dd..d08951e608cb 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandInterpreter.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandInterpreter.h @@ -51,7 +51,7 @@ public: /// \param[in] echo_comments /// If \b true, echo command even if it is a pure comment line. If /// \b false, print no ouput in this case. This setting has an effect only - /// if \param echo_commands is \b true. + /// if echo_commands is \b true. /// \param[in] print_results /// If \b true and the command succeeds, print the results of the command /// after executing it. If \b false, execute silently. @@ -428,13 +428,14 @@ public: void RunCommandInterpreter(bool auto_handle_events, bool spawn_thread, CommandInterpreterRunOptions &options); + void GetLLDBCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, - bool asynchronously, void *baton); + void *baton = nullptr); void GetPythonCommandsFromIOHandler(const char *prompt, IOHandlerDelegate &delegate, - bool asynchronously, void *baton); + void *baton = nullptr); const char *GetCommandPrefix(); @@ -443,13 +444,13 @@ public: bool GetPromptOnQuit() const; - void SetPromptOnQuit(bool b); + void SetPromptOnQuit(bool enable); bool GetEchoCommands() const; - void SetEchoCommands(bool b); + void SetEchoCommands(bool enable); bool GetEchoCommentCommands() const; - void SetEchoCommentCommands(bool b); + void SetEchoCommentCommands(bool enable); /// Specify if the command interpreter should allow that the user can /// specify a custom exit code when calling 'quit'. diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandObject.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandObject.h index 2dad84f036c0..f4dc2d606dda 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandObject.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandObject.h @@ -226,7 +226,7 @@ public: /// option. Don't override this method, override HandleArgumentCompletion /// instead unless you have special reasons. /// - /// \param[in/out] request + /// \param[in,out] request /// The completion request that needs to be answered. virtual void HandleCompletion(CompletionRequest &request); @@ -235,7 +235,7 @@ public: /// We've constructed the map of options and their arguments as well if that /// is helpful for the completion. /// - /// \param[in/out] request + /// \param[in,out] request /// The completion request that needs to be answered. virtual void HandleArgumentCompletion(CompletionRequest &request, @@ -261,8 +261,8 @@ public: /// Get the command that appropriate for a "repeat" of the current command. /// - /// \param[in] current_command_line - /// The complete current command line. + /// \param[in] current_command_args + /// The command arguments. /// /// \return /// nullptr if there is no special repeat command - it will use the diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandReturnObject.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandReturnObject.h index 61e57fb798a1..8af76e07e5ae 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandReturnObject.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/CommandReturnObject.h @@ -9,7 +9,6 @@ #ifndef liblldb_CommandReturnObject_h_ #define liblldb_CommandReturnObject_h_ -#include "lldb/Core/STLUtils.h" #include "lldb/Core/StreamFile.h" #include "lldb/Utility/StreamString.h" #include "lldb/Utility/StreamTee.h" diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h index 6aec7eb0f0b8..2229c1aa08a2 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h @@ -24,13 +24,10 @@ namespace lldb_private { class OptionGroupPythonClassWithDict : public OptionGroup { public: OptionGroupPythonClassWithDict(const char *class_use, - int class_option = 'C', - int key_option = 'k', - int value_option = 'v', - const char *class_long_option = "python-class", - const char *key_long_option = "python-class-key", - const char *value_long_option = "python-class-value", - bool required = false); + bool is_class = true, + int class_option = 'C', + int key_option = 'k', + int value_option = 'v'); ~OptionGroupPythonClassWithDict() override; @@ -48,16 +45,17 @@ public: const StructuredData::DictionarySP GetStructuredData() { return m_dict_sp; } - const std::string &GetClassName() { - return m_class_name; + const std::string &GetName() { + return m_name; } protected: - std::string m_class_name; + std::string m_name; std::string m_current_key; StructuredData::DictionarySP m_dict_sp; std::string m_class_usage_text, m_key_usage_text, m_value_usage_text; - OptionDefinition m_option_definition[3]; + bool m_is_class; + OptionDefinition m_option_definition[4]; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValue.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValue.h index 9fc18551c26a..44c7f621a582 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValue.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValue.h @@ -58,12 +58,7 @@ public: eDumpGroupExport = (eDumpOptionCommand | eDumpOptionName | eDumpOptionValue) }; - OptionValue() - : m_callback(nullptr), m_baton(nullptr), m_value_was_set(false) {} - - OptionValue(const OptionValue &rhs) - : m_callback(rhs.m_callback), m_baton(rhs.m_baton), - m_value_was_set(rhs.m_value_was_set) {} + OptionValue() : m_value_was_set(false) {} virtual ~OptionValue() = default; @@ -308,22 +303,19 @@ public: m_parent_wp = parent_sp; } - void SetValueChangedCallback(OptionValueChangedCallback callback, - void *baton) { - assert(m_callback == nullptr); - m_callback = callback; - m_baton = baton; + void SetValueChangedCallback(std::function<void()> callback) { + assert(!m_callback); + m_callback = std::move(callback); } void NotifyValueChanged() { if (m_callback) - m_callback(m_baton, this); + m_callback(); } protected: lldb::OptionValueWP m_parent_wp; - OptionValueChangedCallback m_callback; - void *m_baton; + std::function<void()> m_callback; bool m_value_was_set; // This can be used to see if a value has been set // by a call to SetValueFromCString(). It is often // handy to know if an option value was set from the diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValueProperties.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValueProperties.h index bea2b3c91e00..980f01183ef5 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValueProperties.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/OptionValueProperties.h @@ -198,8 +198,7 @@ public: ConstString name); void SetValueChangedCallback(uint32_t property_idx, - OptionValueChangedCallback callback, - void *baton); + std::function<void()> callback); protected: Property *ProtectedGetPropertyAtIndex(uint32_t idx) { diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/Options.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/Options.h index b6c824d5a199..d07c2560ef2d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/Options.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/Options.h @@ -163,7 +163,7 @@ public: /// Handles the generic bits of figuring out whether we are in an option, /// and if so completing it. /// - /// \param[in/out] request + /// \param[in,out] request /// The completion request that we need to act upon. /// /// \param[in] interpreter @@ -182,7 +182,7 @@ public: /// Handles the generic bits of figuring out whether we are in an option, /// and if so completing it. /// - /// \param[in/out] request + /// \param[in,out] request /// The completion request that we need to act upon. /// /// \param[in] interpreter diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/Property.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/Property.h index 797aee4be815..76264832705b 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/Property.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/Property.h @@ -64,8 +64,7 @@ public: uint32_t output_width, bool display_qualified_name) const; - void SetValueChangedCallback(OptionValueChangedCallback callback, - void *baton); + void SetValueChangedCallback(std::function<void()> callback); protected: ConstString m_name; diff --git a/contrib/llvm-project/lldb/include/lldb/Interpreter/ScriptInterpreter.h b/contrib/llvm-project/lldb/include/lldb/Interpreter/ScriptInterpreter.h index 23fadf02e591..1784c93adbac 100644 --- a/contrib/llvm-project/lldb/include/lldb/Interpreter/ScriptInterpreter.h +++ b/contrib/llvm-project/lldb/include/lldb/Interpreter/ScriptInterpreter.h @@ -120,8 +120,10 @@ public: return error; } - virtual Status GenerateBreakpointCommandCallbackData(StringList &input, - std::string &output) { + virtual Status GenerateBreakpointCommandCallbackData( + StringList &input, + std::string &output, + bool has_extra_args) { Status error; error.SetErrorString("not implemented"); return error; @@ -311,14 +313,20 @@ public: return error; } - void SetBreakpointCommandCallbackFunction( + Status SetBreakpointCommandCallbackFunction( std::vector<BreakpointOptions *> &bp_options_vec, - const char *function_name); + const char *function_name, StructuredData::ObjectSP extra_args_sp); - /// Set a one-liner as the callback for the breakpoint. - virtual void - SetBreakpointCommandCallbackFunction(BreakpointOptions *bp_options, - const char *function_name) {} + /// Set a script function as the callback for the breakpoint. + virtual Status + SetBreakpointCommandCallbackFunction( + BreakpointOptions *bp_options, + const char *function_name, + StructuredData::ObjectSP extra_args_sp) { + Status error; + error.SetErrorString("unimplemented"); + return error; + } /// Set a one-liner as the callback for the watchpoint. virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options, @@ -449,12 +457,9 @@ public: virtual bool CheckObjectExists(const char *name) { return false; } virtual bool - LoadScriptingModule(const char *filename, bool can_reload, bool init_session, + LoadScriptingModule(const char *filename, bool init_session, lldb_private::Status &error, - StructuredData::ObjectSP *module_sp = nullptr) { - error.SetErrorString("loading unimplemented"); - return false; - } + StructuredData::ObjectSP *module_sp = nullptr); virtual bool IsReservedWord(const char *word) { return false; } @@ -464,6 +469,12 @@ public: int GetMasterFileDescriptor(); + virtual llvm::Expected<unsigned> + GetMaxPositionalArgumentsForCallable(const llvm::StringRef &callable_name) { + return llvm::createStringError( + llvm::inconvertibleErrorCode(), "Unimplemented function"); + } + static std::string LanguageToString(lldb::ScriptLanguage language); static lldb::ScriptLanguage StringToLanguage(const llvm::StringRef &string); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Block.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Block.h index 36d0944f12b0..c2760dddf45f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Block.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Block.h @@ -57,12 +57,6 @@ public: /// depth parsing. Common values would be the index into a /// table, or an offset into the debug information. /// - /// \param[in] depth - /// The integer depth of this block in the block list hierarchy. - /// - /// \param[in] block_list - /// The block list that this object belongs to. - /// /// \see BlockList Block(lldb::user_id_t uid); @@ -77,14 +71,6 @@ public: void AddChild(const lldb::BlockSP &child_block_sp); /// Add a new offset range to this block. - /// - /// \param[in] start_offset - /// An offset into this Function's address range that - /// describes the start address of a range for this block. - /// - /// \param[in] end_offset - /// An offset into this Function's address range that - /// describes the end address of a range for this block. void AddRange(const Range &range); void FinalizeRanges(); @@ -232,10 +218,6 @@ public: /// Get the variable list for this block and optionally all child blocks if /// \a get_child_variables is \b true. /// - /// \param[in] get_child_variables - /// If \b true, all variables from all child blocks will be - /// added to the variable list. - /// /// \param[in] can_create /// If \b true, the variables can be parsed if they already /// haven't been, else the current state of the block will be @@ -243,11 +225,9 @@ public: /// to see the current state of what has been parsed up to this /// point. /// - /// \param[in] add_inline_child_block_variables - /// If this is \b false, no child variables of child blocks - /// that are inlined functions will be gotten. If \b true then - /// all child variables will be added regardless of whether they - /// come from inlined functions or not. + /// \param[in] get_child_block_variables + /// If \b true, all variables from all child blocks will be + /// added to the variable list. /// /// \return /// A variable list shared pointer that contains all variables diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTContext.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTContext.h index c9fe013a6440..3719d816b4e6 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTContext.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTContext.h @@ -21,7 +21,6 @@ #include <vector> #include "clang/AST/ASTContext.h" -#include "clang/AST/ExternalASTMerger.h" #include "clang/AST/TemplateBase.h" #include "llvm/ADT/APSInt.h" #include "llvm/ADT/SmallVector.h" @@ -30,7 +29,10 @@ #include "lldb/Expression/ExpressionVariable.h" #include "lldb/Symbol/CompilerType.h" #include "lldb/Symbol/TypeSystem.h" +#include "lldb/Target/Target.h" #include "lldb/Utility/ConstString.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/Logging.h" #include "lldb/lldb-enumerations.h" class DWARFASTParserClang; @@ -43,19 +45,25 @@ namespace lldb_private { class Declaration; class ClangASTContext : public TypeSystem { + // LLVM RTTI support + static char ID; + public: typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *); typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *); // llvm casting support - static bool classof(const TypeSystem *ts) { - return ts->getKind() == TypeSystem::eKindClang; - } + bool isA(const void *ClassID) const override { return ClassID == &ID; } + static bool classof(const TypeSystem *ts) { return ts->isA(&ID); } - // Constructors and Destructors - explicit ClangASTContext(llvm::StringRef triple = ""); - explicit ClangASTContext(ArchSpec arch); + /// Constructs a ClangASTContext with an ASTContext using the given triple. + /// + /// \param triple The llvm::Triple used for the ASTContext. The triple defines + /// certain characteristics of the ASTContext and its types + /// (e.g., whether certain primitive types exist or what their + /// signedness is). + explicit ClangASTContext(llvm::Triple triple); /// Constructs a ClangASTContext that uses an existing ASTContext internally. /// Useful when having an existing ASTContext created by Clang. @@ -86,23 +94,19 @@ public: static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx); - clang::ASTContext *getASTContext(); - - clang::Builtin::Context *getBuiltinContext(); - - clang::IdentifierTable *getIdentifierTable(); - - clang::LangOptions *getLanguageOptions(); - - clang::SelectorTable *getSelectorTable(); - - clang::FileManager *getFileManager(); - - clang::SourceManager *getSourceManager(); - - clang::DiagnosticsEngine *getDiagnosticsEngine(); + static ClangASTContext *GetScratch(Target &target, + bool create_on_demand = true) { + auto type_system_or_err = target.GetScratchTypeSystemForLanguage( + lldb::eLanguageTypeC, create_on_demand); + if (auto err = type_system_or_err.takeError()) { + LLDB_LOG_ERROR(lldb_private::GetLogIfAnyCategoriesSet(LIBLLDB_LOG_TARGET), + std::move(err), "Couldn't get scratch ClangASTContext"); + return nullptr; + } + return llvm::dyn_cast<ClangASTContext>(&type_system_or_err.get()); + } - clang::DiagnosticConsumer *getDiagnosticConsumer(); + clang::ASTContext &getASTContext(); clang::MangleContext *getMangleContext(); @@ -119,7 +123,7 @@ public: llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_up); bool GetCompleteDecl(clang::Decl *decl) { - return ClangASTContext::GetCompleteDecl(getASTContext(), decl); + return ClangASTContext::GetCompleteDecl(&getASTContext(), decl); } static void DumpDeclHiearchy(clang::Decl *decl); @@ -130,75 +134,63 @@ public: static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl); - void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id); + void SetMetadataAsUserID(const clang::Decl *decl, lldb::user_id_t user_id); + void SetMetadataAsUserID(const clang::Type *type, lldb::user_id_t user_id); - void SetMetadata(const void *object, ClangASTMetadata &meta_data) { - SetMetadata(getASTContext(), object, meta_data); - } - - static void SetMetadata(clang::ASTContext *ast, const void *object, - ClangASTMetadata &meta_data); + void SetMetadata(const clang::Decl *object, ClangASTMetadata &meta_data); - ClangASTMetadata *GetMetadata(const void *object) { - return GetMetadata(getASTContext(), object); - } - - static ClangASTMetadata *GetMetadata(clang::ASTContext *ast, - const void *object); + void SetMetadata(const clang::Type *object, ClangASTMetadata &meta_data); + ClangASTMetadata *GetMetadata(const clang::Decl *object); + ClangASTMetadata *GetMetadata(const clang::Type *object); // Basic Types CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override; - static CompilerType GetBuiltinTypeForEncodingAndBitSize( - clang::ASTContext *ast, lldb::Encoding encoding, uint32_t bit_size); - CompilerType GetBasicType(lldb::BasicType type); - static CompilerType GetBasicType(clang::ASTContext *ast, - lldb::BasicType type); - - static CompilerType GetBasicType(clang::ASTContext *ast, - ConstString name); - static lldb::BasicType GetBasicTypeEnumeration(ConstString name); - CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(const char *type_name, - uint32_t dw_ate, - uint32_t bit_size); + CompilerType + GetBuiltinTypeForDWARFEncodingAndBitSize(llvm::StringRef type_name, + uint32_t dw_ate, uint32_t bit_size); CompilerType GetCStringType(bool is_const); - static CompilerType GetUnknownAnyType(clang::ASTContext *ast); - - CompilerType GetUnknownAnyType() { - return ClangASTContext::GetUnknownAnyType(getASTContext()); - } - static clang::DeclContext *GetDeclContextForType(clang::QualType type); static clang::DeclContext *GetDeclContextForType(const CompilerType &type); uint32_t GetPointerByteSize() override; - static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast); - - clang::DeclContext *GetTranslationUnitDecl() { - return GetTranslationUnitDecl(getASTContext()); + clang::TranslationUnitDecl *GetTranslationUnitDecl() { + return getASTContext().getTranslationUnitDecl(); } - static clang::Decl *CopyDecl(clang::ASTContext *dest_context, - clang::ASTContext *source_context, - clang::Decl *source_decl); - static bool AreTypesSame(CompilerType type1, CompilerType type2, bool ignore_qualifiers = false); - static CompilerType GetTypeForDecl(clang::NamedDecl *decl); + /// Creates a CompilerType form the given QualType with the current + /// ClangASTContext instance as the CompilerType's typesystem. + /// \param qt The QualType for a type that belongs to the ASTContext of this + /// ClangASTContext. + /// \return The CompilerType representing the given QualType. If the + /// QualType's type pointer is a nullptr then the function returns an + /// invalid CompilerType. + CompilerType GetType(clang::QualType qt) { + if (qt.getTypePtrOrNull() == nullptr) + return CompilerType(); + // Check that the type actually belongs to this ClangASTContext. + assert(qt->getAsTagDecl() == nullptr || + &qt->getAsTagDecl()->getASTContext() == &getASTContext()); + return CompilerType(this, qt.getAsOpaquePtr()); + } - static CompilerType GetTypeForDecl(clang::TagDecl *decl); + CompilerType GetTypeForDecl(clang::NamedDecl *decl); - static CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl); + CompilerType GetTypeForDecl(clang::TagDecl *decl); + + CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl); template <typename RecordDeclType> CompilerType @@ -207,27 +199,23 @@ public: CompilerType compiler_type; if (type_name.GetLength()) { - clang::ASTContext *ast = getASTContext(); - if (ast) { - if (!decl_context) - decl_context = ast->getTranslationUnitDecl(); - - clang::IdentifierInfo &myIdent = - ast->Idents.get(type_name.GetCString()); - clang::DeclarationName myName = - ast->DeclarationNames.getIdentifier(&myIdent); - - clang::DeclContext::lookup_result result = - decl_context->lookup(myName); - - if (!result.empty()) { - clang::NamedDecl *named_decl = result[0]; - if (const RecordDeclType *record_decl = - llvm::dyn_cast<RecordDeclType>(named_decl)) - compiler_type.SetCompilerType( - this, clang::QualType(record_decl->getTypeForDecl(), 0) - .getAsOpaquePtr()); - } + clang::ASTContext &ast = getASTContext(); + if (!decl_context) + decl_context = ast.getTranslationUnitDecl(); + + clang::IdentifierInfo &myIdent = ast.Idents.get(type_name.GetCString()); + clang::DeclarationName myName = + ast.DeclarationNames.getIdentifier(&myIdent); + + clang::DeclContext::lookup_result result = decl_context->lookup(myName); + + if (!result.empty()) { + clang::NamedDecl *named_decl = result[0]; + if (const RecordDeclType *record_decl = + llvm::dyn_cast<RecordDeclType>(named_decl)) + compiler_type.SetCompilerType( + this, clang::QualType(record_decl->getTypeForDecl(), 0) + .getAsOpaquePtr()); } } @@ -261,9 +249,11 @@ public: bool omit_empty_base_classes); CompilerType CreateRecordType(clang::DeclContext *decl_ctx, - lldb::AccessType access_type, const char *name, - int kind, lldb::LanguageType language, - ClangASTMetadata *metadata = nullptr); + lldb::AccessType access_type, + llvm::StringRef name, int kind, + lldb::LanguageType language, + ClangASTMetadata *metadata = nullptr, + bool exports_symbols = false); class TemplateParameterInfos { public: @@ -309,10 +299,7 @@ public: class_template_specialization_decl); static clang::DeclContext * - GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl); - - static clang::DeclContext * - GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl); + GetAsDeclContext(clang::FunctionDecl *function_decl); static bool CheckOverloadedOperatorKindParameterCount( bool is_method, clang::OverloadedOperatorKind op_kind, @@ -320,13 +307,11 @@ public: bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size); - static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field, - uint32_t &bitfield_bit_size); - static bool RecordHasFields(const clang::RecordDecl *record_decl); - CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx, - bool isForwardDecl, bool isInternal, + CompilerType CreateObjCClass(llvm::StringRef name, + clang::DeclContext *decl_ctx, bool isForwardDecl, + bool isInternal, ClangASTMetadata *metadata = nullptr); bool SetTagTypeKind(clang::QualType type, int kind) const; @@ -345,11 +330,6 @@ public: GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx, bool is_inline = false); - static clang::NamespaceDecl * - GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name, - clang::DeclContext *decl_ctx, - bool is_inline = false); - // Function Types clang::FunctionDecl * @@ -357,36 +337,16 @@ public: const CompilerType &function_Type, int storage, bool is_inline); - static CompilerType CreateFunctionType(clang::ASTContext *ast, - const CompilerType &result_type, - const CompilerType *args, - unsigned num_args, bool is_variadic, - unsigned type_quals, - clang::CallingConv cc); - - static CompilerType CreateFunctionType(clang::ASTContext *ast, - const CompilerType &result_type, - const CompilerType *args, - unsigned num_args, bool is_variadic, - unsigned type_quals) { - return ClangASTContext::CreateFunctionType( - ast, result_type, args, num_args, is_variadic, type_quals, clang::CC_C); - } - CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, - bool is_variadic, unsigned type_quals) { - return ClangASTContext::CreateFunctionType( - getASTContext(), result_type, args, num_args, is_variadic, type_quals); - } + bool is_variadic, unsigned type_quals, + clang::CallingConv cc); CompilerType CreateFunctionType(const CompilerType &result_type, const CompilerType *args, unsigned num_args, - bool is_variadic, unsigned type_quals, - clang::CallingConv cc) { - return ClangASTContext::CreateFunctionType(getASTContext(), result_type, - args, num_args, is_variadic, - type_quals, cc); + bool is_variadic, unsigned type_quals) { + return CreateFunctionType(result_type, args, num_args, is_variadic, + type_quals, clang::CC_C); } clang::ParmVarDecl *CreateParameterDeclaration(clang::DeclContext *decl_ctx, @@ -414,15 +374,9 @@ public: // Integer type functions - static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast, - size_t bit_size, bool is_signed); + CompilerType GetIntTypeFromBitSize(size_t bit_size, bool is_signed); - CompilerType GetPointerSizedIntType(bool is_signed) { - return GetPointerSizedIntType(getASTContext(), is_signed); - } - - static CompilerType GetPointerSizedIntType(clang::ASTContext *ast, - bool is_signed); + CompilerType GetPointerSizedIntType(bool is_signed); // Floating point functions @@ -436,14 +390,12 @@ public: #endif // LLDB_ENABLE_ALL // ClangASTContext callbacks for external source lookups. - static void CompleteTagDecl(void *baton, clang::TagDecl *); + void CompleteTagDecl(clang::TagDecl *); - static void CompleteObjCInterfaceDecl(void *baton, - clang::ObjCInterfaceDecl *); + void CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *); - static bool LayoutRecordType( - void *baton, const clang::RecordDecl *record_decl, uint64_t &size, - uint64_t &alignment, + bool LayoutRecordType( + const clang::RecordDecl *record_decl, uint64_t &size, uint64_t &alignment, llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets, llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets, @@ -468,12 +420,16 @@ public: // CompilerDeclContext override functions + /// Creates a CompilerDeclContext from the given DeclContext + /// with the current ClangASTContext instance as its typesystem. + /// The DeclContext has to come from the ASTContext of this + /// ClangASTContext. + CompilerDeclContext CreateDeclContext(clang::DeclContext *ctx); + std::vector<CompilerDecl> DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_using_decls) override; - bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override; - ConstString DeclContextGetName(void *opaque_decl_ctx) override; ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override; @@ -504,7 +460,7 @@ public: DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc); static ClangASTMetadata *DeclContextGetMetaData(const CompilerDeclContext &dc, - const void *object); + const clang::Decl *object); static clang::ASTContext * DeclContextGetClangASTContext(const CompilerDeclContext &dc); @@ -604,8 +560,7 @@ public: bool SupportsLanguage(lldb::LanguageType language) override; - static bool GetCXXClassName(const CompilerType &type, - std::string &class_name); + static llvm::Optional<std::string> GetCXXClassName(const CompilerType &type); // Type Completion @@ -672,6 +627,8 @@ public: CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type) override; + CompilerType GetAtomicType(lldb::opaque_compiler_type_t type) override; + CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override; CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override; @@ -815,13 +772,11 @@ public: const CompilerType &var_type, lldb::AccessType access); - clang::CXXMethodDecl * - AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name, - const char *mangled_name, - const CompilerType &method_type, - lldb::AccessType access, bool is_virtual, - bool is_static, bool is_inline, bool is_explicit, - bool is_attr_used, bool is_artificial); + clang::CXXMethodDecl *AddMethodToCXXRecordType( + lldb::opaque_compiler_type_t type, llvm::StringRef name, + const char *mangled_name, const CompilerType &method_type, + lldb::AccessType access, bool is_virtual, bool is_static, bool is_inline, + bool is_explicit, bool is_attr_used, bool is_artificial); void AddMethodOverridesForCXXRecordType(lldb::opaque_compiler_type_t type); @@ -853,7 +808,7 @@ public: // (lldb::opaque_compiler_type_t type, "-[NString // stringWithCString:]") const CompilerType &method_compiler_type, lldb::AccessType access, - bool is_artificial, bool is_variadic); + bool is_artificial, bool is_variadic, bool is_objc_direct_call); static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type, bool has_extern); @@ -931,7 +886,8 @@ public: static clang::TypedefNameDecl *GetAsTypedefDecl(const CompilerType &type); - clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type); + static clang::CXXRecordDecl * + GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type); static clang::ObjCInterfaceDecl * GetAsObjCInterfaceDecl(const CompilerType &type); @@ -972,11 +928,8 @@ public: clang::DeclarationName GetDeclarationName(const char *name, const CompilerType &function_clang_type); - - virtual const clang::ExternalASTMerger::OriginMap &GetOriginMap() { - return m_origins; - } -protected: + +private: const clang::ClassTemplateSpecializationDecl * GetAsTemplateSpecialization(lldb::opaque_compiler_type_t type); @@ -997,20 +950,23 @@ protected: #ifdef LLDB_ENABLE_ALL std::unique_ptr<PDBASTParser> m_pdb_ast_parser_up; #endif // LLDB_ENABLE_ALL - std::unique_ptr<ClangASTSource> m_scratch_ast_source_up; std::unique_ptr<clang::MangleContext> m_mangle_ctx_up; - CompleteTagDeclCallback m_callback_tag_decl = nullptr; - CompleteObjCInterfaceDeclCallback m_callback_objc_decl = nullptr; - void *m_callback_baton = nullptr; - clang::ExternalASTMerger::OriginMap m_origins; uint32_t m_pointer_byte_size = 0; bool m_ast_owned = false; + + typedef llvm::DenseMap<const clang::Decl *, ClangASTMetadata> DeclMetadataMap; + /// Maps Decls to their associated ClangASTMetadata. + DeclMetadataMap m_decl_metadata; + + typedef llvm::DenseMap<const clang::Type *, ClangASTMetadata> TypeMetadataMap; + /// Maps Types to their associated ClangASTMetadata. + TypeMetadataMap m_type_metadata; + /// The sema associated that is currently used to build this ASTContext. /// May be null if we are already done parsing this ASTContext or the /// ASTContext wasn't created by parsing source code. clang::Sema *m_sema = nullptr; -private: // For ClangASTContext only ClangASTContext(const ClangASTContext &); const ClangASTContext &operator=(const ClangASTContext &); @@ -1021,10 +977,12 @@ private: class ClangASTContextForExpressions : public ClangASTContext { public: - ClangASTContextForExpressions(Target &target, ArchSpec arch); + ClangASTContextForExpressions(Target &target, llvm::Triple triple); ~ClangASTContextForExpressions() override = default; + void Finalize() override; + UserExpression * GetUserExpression(llvm::StringRef expr, llvm::StringRef prefix, lldb::LanguageType language, @@ -1041,17 +999,12 @@ public: const char *name) override; PersistentExpressionState *GetPersistentExpressionState() override; - - clang::ExternalASTMerger &GetMergerUnchecked(); - - const clang::ExternalASTMerger::OriginMap &GetOriginMap() override { - return GetMergerUnchecked().GetOrigins(); - } private: lldb::TargetWP m_target_wp; std::unique_ptr<PersistentExpressionState> m_persistent_variables; // These are the persistent variables associated // with this process for the expression parser + std::unique_ptr<ClangASTSource> m_scratch_ast_source_up; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTImporter.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTImporter.h index f963f9b2b1dc..faec3a77b56f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTImporter.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTImporter.h @@ -30,57 +30,6 @@ namespace lldb_private { -class ClangASTMetrics { -public: - static void DumpCounters(Log *log); - static void ClearLocalCounters() { local_counters = {0, 0, 0, 0, 0, 0}; } - - static void RegisterVisibleQuery() { - ++global_counters.m_visible_query_count; - ++local_counters.m_visible_query_count; - } - - static void RegisterLexicalQuery() { - ++global_counters.m_lexical_query_count; - ++local_counters.m_lexical_query_count; - } - - static void RegisterLLDBImport() { - ++global_counters.m_lldb_import_count; - ++local_counters.m_lldb_import_count; - } - - static void RegisterClangImport() { - ++global_counters.m_clang_import_count; - ++local_counters.m_clang_import_count; - } - - static void RegisterDeclCompletion() { - ++global_counters.m_decls_completed_count; - ++local_counters.m_decls_completed_count; - } - - static void RegisterRecordLayout() { - ++global_counters.m_record_layout_count; - ++local_counters.m_record_layout_count; - } - -private: - struct Counters { - uint64_t m_visible_query_count; - uint64_t m_lexical_query_count; - uint64_t m_lldb_import_count; - uint64_t m_clang_import_count; - uint64_t m_decls_completed_count; - uint64_t m_record_layout_count; - }; - - static Counters global_counters; - static Counters local_counters; - - static void DumpCounters(Log *log, Counters &counters); -}; - class ClangASTImporter { public: struct LayoutInfo { @@ -99,26 +48,22 @@ public: : m_file_manager(clang::FileSystemOptions(), FileSystem::Instance().GetVirtualFileSystem()) {} - clang::QualType CopyType(clang::ASTContext *dst_ctx, - clang::ASTContext *src_ctx, clang::QualType type); - - lldb::opaque_compiler_type_t CopyType(clang::ASTContext *dst_ctx, - clang::ASTContext *src_ctx, - lldb::opaque_compiler_type_t type); - CompilerType CopyType(ClangASTContext &dst, const CompilerType &src_type); - clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx, - clang::Decl *decl); + clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::Decl *decl); - lldb::opaque_compiler_type_t DeportType(clang::ASTContext *dst_ctx, - clang::ASTContext *src_ctx, - lldb::opaque_compiler_type_t type); + CompilerType DeportType(ClangASTContext &dst, const CompilerType &src_type); - clang::Decl *DeportDecl(clang::ASTContext *dst_ctx, - clang::ASTContext *src_ctx, clang::Decl *decl); + clang::Decl *DeportDecl(clang::ASTContext *dst_ctx, clang::Decl *decl); - void InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout); + /// Sets the layout for the given RecordDecl. The layout will later be + /// used by Clang's during code generation. Not calling this function for + /// a RecordDecl will cause that Clang's codegen tries to layout the + /// record by itself. + /// + /// \param decl The RecordDecl to set the layout for. + /// \param layout The layout for the record. + void SetRecordLayout(clang::RecordDecl *decl, const LayoutInfo &layout); bool LayoutRecordType( const clang::RecordDecl *record_decl, uint64_t &bit_size, @@ -147,19 +92,6 @@ public: bool RequireCompleteType(clang::QualType type); - bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl, - clang::ASTContext **original_ctx) { - DeclOrigin origin = GetDeclOrigin(decl); - - if (original_decl) - *original_decl = origin.decl; - - if (original_ctx) - *original_ctx = origin.ctx; - - return origin.Valid(); - } - void SetDeclOrigin(const clang::Decl *decl, clang::Decl *original_decl); ClangASTMetadata *GetDeclMetadata(const clang::Decl *decl); @@ -233,7 +165,7 @@ public: clang::Decl *decl; }; - typedef std::map<const clang::Decl *, DeclOrigin> OriginMap; + typedef llvm::DenseMap<const clang::Decl *, DeclOrigin> OriginMap; /// Listener interface used by the ASTImporterDelegate to inform other code /// about decls that have been imported the first time. @@ -313,7 +245,7 @@ public: /// ASTContext. Used by the CxxModuleHandler to mark declarations that /// were created from the 'std' C++ module to prevent that the Importer /// tries to sync them with the broken equivalent in the debug info AST. - std::set<clang::Decl *> m_decls_to_ignore; + llvm::SmallPtrSet<clang::Decl *, 16> m_decls_to_ignore; ClangASTImporter &m_master; clang::ASTContext *m_source_ctx; CxxModuleHandler *m_std_handler = nullptr; @@ -322,8 +254,8 @@ public: }; typedef std::shared_ptr<ASTImporterDelegate> ImporterDelegateSP; - typedef std::map<clang::ASTContext *, ImporterDelegateSP> DelegateMap; - typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP> + typedef llvm::DenseMap<clang::ASTContext *, ImporterDelegateSP> DelegateMap; + typedef llvm::DenseMap<const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap; struct ASTContextMetadata { @@ -340,7 +272,7 @@ public: }; typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP; - typedef std::map<const clang::ASTContext *, ASTContextMetadataSP> + typedef llvm::DenseMap<const clang::ASTContext *, ASTContextMetadataSP> ContextMetadataMap; ContextMetadataMap m_metadata_map; @@ -353,9 +285,8 @@ public: ASTContextMetadataSP(new ASTContextMetadata(dst_ctx)); m_metadata_map[dst_ctx] = context_md; return context_md; - } else { - return context_md_iter->second; } + return context_md_iter->second; } ASTContextMetadataSP MaybeGetContextMetadata(clang::ASTContext *dst_ctx) { @@ -363,8 +294,7 @@ public: if (context_md_iter != m_metadata_map.end()) return context_md_iter->second; - else - return ASTContextMetadataSP(); + return ASTContextMetadataSP(); } ImporterDelegateSP GetDelegate(clang::ASTContext *dst_ctx, @@ -379,9 +309,8 @@ public: ImporterDelegateSP(new ASTImporterDelegate(*this, dst_ctx, src_ctx)); delegates[src_ctx] = delegate; return delegate; - } else { - return delegate_iter->second; } + return delegate_iter->second; } public: diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTMetadata.h index 8e69f6d3e4eb..fdf4388f0847 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCommon.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangASTMetadata.h @@ -1,4 +1,4 @@ -//===-- ClangExternalASTSourceCommon.h --------------------------*- C++ -*-===// +//===-- ClangASTMetadata.h --------------------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. @@ -6,34 +6,8 @@ // //===----------------------------------------------------------------------===// -#ifndef liblldb_ClangExternalASTSourceCommon_h -#define liblldb_ClangExternalASTSourceCommon_h - -// Clang headers like to use NDEBUG inside of them to enable/disable debug -// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing -// or another. This is bad because it means that if clang was built in release -// mode, it assumes that you are building in release mode which is not always -// the case. You can end up with functions that are defined as empty in header -// files when NDEBUG is not defined, and this can cause link errors with the -// clang .a files that you have since you might be missing functions in the .a -// file. So we have to define NDEBUG when including clang headers to avoid any -// mismatches. This is covered by rdar://problem/8691220 - -#if !defined(NDEBUG) && !defined(LLVM_NDEBUG_OFF) -#define LLDB_DEFINED_NDEBUG_FOR_CLANG -#define NDEBUG -// Need to include assert.h so it is as clang would expect it to be (disabled) -#include <assert.h> -#endif - -#ifdef LLDB_DEFINED_NDEBUG_FOR_CLANG -#undef NDEBUG -#undef LLDB_DEFINED_NDEBUG_FOR_CLANG -// Need to re-include assert.h so it is as _we_ would expect it to be (enabled) -#include <assert.h> -#endif - -#include "clang/AST/ExternalASTSource.h" +#ifndef liblldb_ClangASTMetadata_h +#define liblldb_ClangASTMetadata_h #include "lldb/Core/dwarf.h" #include "lldb/lldb-defines.h" @@ -121,23 +95,6 @@ private: m_is_self : 1, m_is_dynamic_cxx : 1; }; -class ClangExternalASTSourceCommon : public clang::ExternalASTSource { -public: - ClangExternalASTSourceCommon(); - ~ClangExternalASTSourceCommon() override; - - ClangASTMetadata *GetMetadata(const void *object); - void SetMetadata(const void *object, ClangASTMetadata &metadata); - bool HasMetadata(const void *object); - - static ClangExternalASTSourceCommon *Lookup(clang::ExternalASTSource *source); - -private: - typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap; - - MetadataMap m_metadata; -}; - } // namespace lldb_private -#endif // liblldb_ClangExternalASTSourceCommon_h +#endif // liblldb_ClangASTMetadata_h diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h index a2d4f8137a05..290ecc9b9017 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h @@ -9,86 +9,22 @@ #ifndef liblldb_ClangExternalASTSourceCallbacks_h_ #define liblldb_ClangExternalASTSourceCallbacks_h_ -#include <stdint.h> - -#include "clang/AST/CharUnits.h" -#include "llvm/ADT/DenseMap.h" - -#include "lldb/Core/ClangForward.h" -#include "lldb/Symbol/ClangExternalASTSourceCommon.h" -#include "lldb/Symbol/CompilerType.h" -#include "lldb/lldb-enumerations.h" +#include "lldb/Symbol/ClangASTContext.h" +#include "clang/AST/ExternalASTSource.h" namespace lldb_private { -class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon { -public: - typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *); - typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, - clang::ObjCInterfaceDecl *); - typedef void (*FindExternalVisibleDeclsByNameCallback)( - void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, - llvm::SmallVectorImpl<clang::NamedDecl *> *results); - typedef bool (*LayoutRecordTypeCallback)( - void *baton, const clang::RecordDecl *Record, uint64_t &Size, - uint64_t &Alignment, - llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets, - llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> - &BaseOffsets, - llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> - &VirtualBaseOffsets); - - ClangExternalASTSourceCallbacks( - CompleteTagDeclCallback tag_decl_callback, - CompleteObjCInterfaceDeclCallback objc_decl_callback, - FindExternalVisibleDeclsByNameCallback find_by_name_callback, - LayoutRecordTypeCallback layout_record_type_callback, - void *callback_baton) - : m_callback_tag_decl(tag_decl_callback), - m_callback_objc_decl(objc_decl_callback), - m_callback_find_by_name(find_by_name_callback), - m_callback_layout_record_type(layout_record_type_callback), - m_callback_baton(callback_baton) {} - - // clang::ExternalASTSource +class ClangASTContext; - clang::Decl *GetExternalDecl(uint32_t ID) override { - // This method only needs to be implemented if the AST source ever passes - // back decl sets as VisibleDeclaration objects. - return nullptr; - } - - clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override { - // This operation is meant to be used via a LazyOffsetPtr. It only needs - // to be implemented if the AST source uses methods like - // FunctionDecl::setLazyBody when building decls. - return nullptr; - } - - clang::Selector GetExternalSelector(uint32_t ID) override { - // This operation only needs to be implemented if the AST source returns - // non-zero for GetNumKnownSelectors(). - return clang::Selector(); - } - - uint32_t GetNumExternalSelectors() override { return 0; } - - clang::CXXBaseSpecifier * - GetExternalCXXBaseSpecifiers(uint64_t Offset) override { - return nullptr; - } - - virtual void MaterializeVisibleDecls(const clang::DeclContext *decl_ctx) {} +class ClangExternalASTSourceCallbacks : public clang::ExternalASTSource { +public: + ClangExternalASTSourceCallbacks(ClangASTContext &ast) : m_ast(ast) {} void FindExternalLexicalDecls( const clang::DeclContext *DC, llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant, llvm::SmallVectorImpl<clang::Decl *> &Result) override; - bool - FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, - clang::DeclarationName decl_name) override; - void CompleteType(clang::TagDecl *tag_decl) override; void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override; @@ -101,36 +37,8 @@ public: llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override; - void SetExternalSourceCallbacks( - CompleteTagDeclCallback tag_decl_callback, - CompleteObjCInterfaceDeclCallback objc_decl_callback, - FindExternalVisibleDeclsByNameCallback find_by_name_callback, - LayoutRecordTypeCallback layout_record_type_callback, - void *callback_baton) { - m_callback_tag_decl = tag_decl_callback; - m_callback_objc_decl = objc_decl_callback; - m_callback_find_by_name = find_by_name_callback; - m_callback_layout_record_type = layout_record_type_callback; - m_callback_baton = callback_baton; - } - - void RemoveExternalSourceCallbacks(void *callback_baton) { - if (callback_baton == m_callback_baton) { - m_callback_tag_decl = nullptr; - m_callback_objc_decl = nullptr; - m_callback_find_by_name = nullptr; - m_callback_layout_record_type = nullptr; - } - } - -protected: - // Classes that inherit from ClangExternalASTSourceCallbacks can see and - // modify these - CompleteTagDeclCallback m_callback_tag_decl; - CompleteObjCInterfaceDeclCallback m_callback_objc_decl; - FindExternalVisibleDeclsByNameCallback m_callback_find_by_name; - LayoutRecordTypeCallback m_callback_layout_record_type; - void *m_callback_baton; +private: + ClangASTContext &m_ast; }; } // namespace lldb_private diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangUtil.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangUtil.h index d6106032190c..5ffbce340e59 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ClangUtil.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ClangUtil.h @@ -11,6 +11,7 @@ #ifndef LLDB_SYMBOL_CLANGUTIL_H #define LLDB_SYMBOL_CLANGUTIL_H +#include "clang/AST/DeclBase.h" #include "clang/AST/Type.h" #include "lldb/Symbol/CompilerType.h" @@ -30,6 +31,15 @@ struct ClangUtil { static CompilerType RemoveFastQualifiers(const CompilerType &ct); static clang::TagDecl *GetAsTagDecl(const CompilerType &type); + + /// Returns a textual representation of the given Decl's AST. Does not + /// deserialize any child nodes. + static std::string DumpDecl(const clang::Decl *d); + /// Returns a textual representation of the given type. + static std::string ToString(const clang::Type *t); + /// Returns a textual representation of the given CompilerType (assuming + /// its underlying type is a Clang type). + static std::string ToString(const CompilerType &c); }; } diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/CompileUnit.h b/contrib/llvm-project/lldb/include/lldb/Symbol/CompileUnit.h index d132c367b999..aec5cc7c8743 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/CompileUnit.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/CompileUnit.h @@ -13,12 +13,14 @@ #include "lldb/Core/ModuleChild.h" #include "lldb/Symbol/DebugMacros.h" #include "lldb/Symbol/Function.h" +#include "lldb/Symbol/LineTable.h" #include "lldb/Symbol/SourceModule.h" #include "lldb/Utility/Stream.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" #include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/DenseSet.h" namespace lldb_private { /// \class CompileUnit CompileUnit.h "lldb/Symbol/CompileUnit.h" @@ -34,7 +36,6 @@ namespace lldb_private { /// table. class CompileUnit : public std::enable_shared_from_this<CompileUnit>, public ModuleChild, - public FileSpec, public UserID, public SymbolContextScope { public: @@ -44,7 +45,7 @@ public: /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the /// source language type. /// - /// \param[in] module + /// \param[in] module_sp /// The parent module that owns this compile unit. This value /// must be a valid pointer value. /// @@ -82,7 +83,7 @@ public: /// convert into a FileSpec, the SymbolFile plug-in supplied \a uid, and the /// source language type. /// - /// \param[in] module + /// \param[in] module_sp /// The parent module that owns this compile unit. This value /// must be a valid pointer value. /// @@ -115,9 +116,6 @@ public: const FileSpec &file_spec, lldb::user_id_t uid, lldb::LanguageType language, lldb_private::LazyBool is_optimized); - /// Destructor - ~CompileUnit() override; - /// Add a function to this compile unit. /// /// Typically called by the SymbolFile plug-ins as they partially parse the @@ -163,6 +161,18 @@ public: void ForeachFunction( llvm::function_ref<bool(const lldb::FunctionSP &)> lambda) const; + /// Find a function in the compile unit based on the predicate matching_lambda + /// + /// \param[in] matching_lambda + /// A predicate that will be used within FindFunction to evaluate each + /// FunctionSP in m_functions_by_uid. When the predicate returns true + /// FindFunction will return the corresponding FunctionSP. + /// + /// \return + /// The first FunctionSP that the matching_lambda prediate returns true for. + lldb::FunctionSP FindFunction( + llvm::function_ref<bool(const lldb::FunctionSP &)> matching_lambda); + /// Dump the compile unit contents to the stream \a s. /// /// \param[in] s @@ -212,6 +222,9 @@ public: const FileSpec *file_spec_ptr, bool exact, LineEntry *line_entry); + /// Return the primary source file associated with this compile unit. + const FileSpec &GetPrimaryFile() const { return m_file_spec; } + /// Get the line table for the compile unit. /// /// Called by clients and the SymbolFile plug-in. The SymbolFile plug-ins @@ -229,9 +242,20 @@ public: /// compilation unit. Recursively also descends into the referenced external /// modules of any encountered compilation unit. /// + /// \param visited_symbol_files + /// A set of SymbolFiles that were already visited to avoid + /// visiting one file more than once. + /// /// \param[in] lambda - /// The lambda that should be applied to every module. - void ForEachExternalModule(llvm::function_ref<void(lldb::ModuleSP)> f); + /// The lambda that should be applied to every function. The lambda can + /// return true if the iteration should be aborted earlier. + /// + /// \return + /// If the lambda early-exited, this function returns true to + /// propagate the early exit. + virtual bool ForEachExternalModule( + llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files, + llvm::function_ref<bool(Module &)> lambda); /// Get the compile unit's support file list. /// @@ -357,14 +381,11 @@ public: /// A SymbolContext list class that will get any matching /// entries appended to. /// - /// \return - /// The number of new matches that were added to \a sc_list. - /// /// \see enum SymbolContext::Scope - uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line, - bool check_inlines, bool exact, - lldb::SymbolContextItem resolve_scope, - SymbolContextList &sc_list); + void ResolveSymbolContext(const FileSpec &file_spec, uint32_t line, + bool check_inlines, bool exact, + lldb::SymbolContextItem resolve_scope, + SymbolContextList &sc_list); /// Get whether compiler optimizations were enabled for this compile unit /// @@ -394,6 +415,8 @@ protected: /// All modules, including the current module, imported by this /// compile unit. std::vector<SourceModule> m_imported_modules; + /// The primary file associated with this compile unit. + FileSpec m_file_spec; /// Files associated with this compile unit's line table and /// declarations. FileSpecList m_support_files; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDecl.h b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDecl.h index 4817ec4b2267..4fd269d4730e 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDecl.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDecl.h @@ -15,16 +15,28 @@ namespace lldb_private { +/// Represents a generic declaration such as a function declaration. +/// +/// This class serves as an abstraction for a declaration inside one of the +/// TypeSystems implemented by the language plugins. It does not have any actual +/// logic in it but only stores an opaque pointer and a pointer to the +/// TypeSystem that gives meaning to this opaque pointer. All methods of this +/// class should call their respective method in the TypeSystem interface and +/// pass the opaque pointer along. +/// +/// \see lldb_private::TypeSystem class CompilerDecl { public: // Constructors and Destructors - CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {} + CompilerDecl() = default; + /// Creates a CompilerDecl with the given TypeSystem and opaque pointer. + /// + /// This constructor should only be called from the respective TypeSystem + /// implementation. CompilerDecl(TypeSystem *type_system, void *decl) : m_type_system(type_system), m_opaque_decl(decl) {} - ~CompilerDecl() {} - // Tests explicit operator bool() const { return IsValid(); } @@ -39,8 +51,6 @@ public: return m_type_system != nullptr && m_opaque_decl != nullptr; } - bool IsClang() const; - // Accessors TypeSystem *GetTypeSystem() const { return m_type_system; } @@ -75,8 +85,8 @@ public: CompilerType GetFunctionArgumentType(size_t arg_idx) const; private: - TypeSystem *m_type_system; - void *m_opaque_decl; + TypeSystem *m_type_system = nullptr; + void *m_opaque_decl = nullptr; }; bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDeclContext.h b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDeclContext.h index e7958c08d833..6db6f4d3f623 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDeclContext.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerDeclContext.h @@ -16,16 +16,32 @@ namespace lldb_private { +/// Represents a generic declaration context in a program. A declaration context +/// is data structure that contains declarations (e.g. namespaces). +/// +/// This class serves as an abstraction for a declaration context inside one of +/// the TypeSystems implemented by the language plugins. It does not have any +/// actual logic in it but only stores an opaque pointer and a pointer to the +/// TypeSystem that gives meaning to this opaque pointer. All methods of this +/// class should call their respective method in the TypeSystem interface and +/// pass the opaque pointer along. +/// +/// \see lldb_private::TypeSystem class CompilerDeclContext { public: - // Constructors and Destructors - CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {} + /// Constructs an invalid CompilerDeclContext. + CompilerDeclContext() = default; + /// Constructs a CompilerDeclContext with the given opaque decl context + /// and its respective TypeSystem instance. + /// + /// This constructor should only be called from the respective TypeSystem + /// implementation. + /// + /// \see lldb_private::ClangASTContext::CreateDeclContext(clang::DeclContext*) CompilerDeclContext(TypeSystem *type_system, void *decl_ctx) : m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {} - ~CompilerDeclContext() {} - // Tests explicit operator bool() const { return IsValid(); } @@ -40,8 +56,6 @@ public: return m_type_system != nullptr && m_opaque_decl_ctx != nullptr; } - bool IsClang() const; - std::vector<CompilerDecl> FindDeclByName(ConstString name, const bool ignore_using_decls); @@ -102,11 +116,9 @@ public: ConstString GetScopeQualifiedName() const; - bool IsStructUnionOrClass() const; - private: - TypeSystem *m_type_system; - void *m_opaque_decl_ctx; + TypeSystem *m_type_system = nullptr; + void *m_opaque_decl_ctx = nullptr; }; bool operator==(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h index bb9881c0bae3..37e826291c88 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/CompilerType.h @@ -20,24 +20,31 @@ namespace lldb_private { class DataExtractor; -// A class that can carry around a clang ASTContext and a opaque clang -// QualType. A clang::QualType can be easily reconstructed from an opaque clang -// type and often the ASTContext is needed when doing various type related -// tasks, so this class allows both items to travel in a single very -// lightweight class that can be used. There are many static equivalents of the -// member functions that allow the ASTContext and the opaque clang QualType to -// be specified for ease of use and to avoid code duplication. +/// Represents a generic type in a programming language. +/// +/// This class serves as an abstraction for a type inside one of the TypeSystems +/// implemented by the language plugins. It does not have any actual logic in it +/// but only stores an opaque pointer and a pointer to the TypeSystem that +/// gives meaning to this opaque pointer. All methods of this class should call +/// their respective method in the TypeSystem interface and pass the opaque +/// pointer along. +/// +/// \see lldb_private::TypeSystem class CompilerType { public: - // Constructors and Destructors - CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type); + /// Creates a CompilerType with the given TypeSystem and opaque compiler type. + /// + /// This constructor should only be called from the respective TypeSystem + /// implementation. + /// + /// \see lldb_private::ClangASTContext::GetType(clang::QualType) + CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type) + : m_type(type), m_type_system(type_system) {} CompilerType(const CompilerType &rhs) : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {} - CompilerType() : m_type(nullptr), m_type_system(nullptr) {} - - ~CompilerType(); + CompilerType() = default; // Operators @@ -108,11 +115,6 @@ public: bool IsPolymorphicClass() const; - bool - IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const { - return IsPossibleDynamicType(target_type, true, false); - } - bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr bool check_cplusplus, bool check_objc) const; @@ -223,6 +225,11 @@ public: // an invalid type. CompilerType AddVolatileModifier() const; + // Return a new CompilerType that is the atomic type of this type. If this + // type is not valid or the type system doesn't support atomic types, this + // returns an invalid type. + CompilerType GetAtomicType() const; + // Return a new CompilerType adds a restrict modifier to this type if this // type is valid and the type system supports restrict modifiers, else return // an invalid type. @@ -362,22 +369,14 @@ public: bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, Scalar &value) const; - bool SetValueFromScalar(const Scalar &value, Stream &strm); - - bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, - AddressType address_type, DataExtractor &data); - - bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr, - AddressType address_type, StreamString &new_value); - void Clear() { m_type = nullptr; m_type_system = nullptr; } private: - lldb::opaque_compiler_type_t m_type; - TypeSystem *m_type_system; + lldb::opaque_compiler_type_t m_type = nullptr; + TypeSystem *m_type_system = nullptr; }; bool operator==(const CompilerType &lhs, const CompilerType &rhs); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/DebugMacros.h b/contrib/llvm-project/lldb/include/lldb/Symbol/DebugMacros.h index d364299ef490..da46c8b23c1d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/DebugMacros.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/DebugMacros.h @@ -23,7 +23,9 @@ typedef std::shared_ptr<DebugMacros> DebugMacrosSP; class DebugMacroEntry { public: - enum EntryType { INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT }; + enum EntryType : uint8_t { + INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT + }; public: static DebugMacroEntry CreateDefineEntry(uint32_t line, const char *str); @@ -42,7 +44,7 @@ public: ~DebugMacroEntry() = default; - EntryType GetType() const { return m_type; } + EntryType GetType() const { return static_cast<EntryType>(m_type); } uint64_t GetLineNumber() const { return m_line; } @@ -60,7 +62,7 @@ private: DebugMacroEntry(EntryType type, const DebugMacrosSP &debug_macros_sp); - EntryType m_type : 3; + uint32_t m_type : 3; uint32_t m_line : 29; uint32_t m_debug_line_file_idx; ConstString m_str; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Declaration.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Declaration.h index 63798f883e5f..a751d6ba039f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Declaration.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Declaration.h @@ -55,16 +55,6 @@ public: { } - /// Construct with a reference to another Declaration object. - Declaration(const Declaration &rhs) - : m_file(rhs.m_file), m_line(rhs.m_line) -#ifdef LLDB_ENABLE_DECLARATION_COLUMNS - , - m_column(rhs.m_column) -#endif - { - } - /// Construct with a pointer to another Declaration object. Declaration(const Declaration *decl_ptr) : m_file(), m_line(0) @@ -102,9 +92,9 @@ public: /// The Right Hand Side const Declaration object reference. /// /// \return - /// \li -1 if lhs < rhs - /// \li 0 if lhs == rhs - /// \li 1 if lhs > rhs + /// -1 if lhs < rhs + /// 0 if lhs == rhs + /// 1 if lhs > rhs static int Compare(const Declaration &lhs, const Declaration &rhs); /// Checks if this object has the same file and line as another declaration diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Function.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Function.h index 1b23a99373ca..f675b5fdffa6 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Function.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Function.h @@ -19,6 +19,8 @@ namespace lldb_private { +class ExecutionContext; + /// \class FunctionInfo Function.h "lldb/Symbol/Function.h" /// A class that contains generic function information. /// @@ -68,9 +70,9 @@ public: /// The Right Hand Side const FunctionInfo object reference. /// /// \return - /// \li -1 if lhs < rhs - /// \li 0 if lhs == rhs - /// \li 1 if lhs > rhs + /// -1 if lhs < rhs + /// 0 if lhs == rhs + /// 1 if lhs > rhs static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs); /// Dump a description of this object to a Stream. @@ -183,9 +185,9 @@ public: /// reference. /// /// \return - /// \li -1 if lhs < rhs - /// \li 0 if lhs == rhs - /// \li 1 if lhs > rhs + /// -1 if lhs < rhs + /// 0 if lhs == rhs + /// 1 if lhs > rhs int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs); /// Dump a description of this object to a Stream. @@ -264,23 +266,14 @@ using CallSiteParameterArray = llvm::SmallVector<CallSiteParameter, 0>; /// in the call graph between two functions, or to evaluate DW_OP_entry_value. class CallEdge { public: - /// Construct a call edge using a symbol name to identify the calling - /// function, and a return PC within the calling function to identify a - /// specific call site. - /// - /// TODO: A symbol name may not be globally unique. To disambiguate ODR - /// conflicts, it's necessary to determine the \c Target a call edge is - /// associated with before resolving it. - CallEdge(const char *symbol_name, lldb::addr_t return_pc, - CallSiteParameterArray parameters); - - CallEdge(CallEdge &&) = default; - CallEdge &operator=(CallEdge &&) = default; + virtual ~CallEdge() {} /// Get the callee's definition. /// - /// Note that this might lazily invoke the DWARF parser. - Function *GetCallee(ModuleList &images); + /// Note that this might lazily invoke the DWARF parser. A register context + /// from the caller's activation is needed to find indirect call targets. + virtual Function *GetCallee(ModuleList &images, + ExecutionContext &exe_ctx) = 0; /// Get the load PC address of the instruction which executes after the call /// returns. Returns LLDB_INVALID_ADDRESS iff this is a tail call. \p caller @@ -293,29 +286,72 @@ public: lldb::addr_t GetUnresolvedReturnPCAddress() const { return return_pc; } /// Get the call site parameters available at this call edge. - llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const; + llvm::ArrayRef<CallSiteParameter> GetCallSiteParameters() const { + return parameters; + } + +protected: + CallEdge(lldb::addr_t return_pc, CallSiteParameterArray &¶meters) + : return_pc(return_pc), parameters(std::move(parameters)) {} + + /// An invalid address if this is a tail call. Otherwise, the function-local + /// PC offset. Adding this PC offset to the function's base load address + /// gives the return PC for the call. + lldb::addr_t return_pc; + + CallSiteParameterArray parameters; +}; + +/// A direct call site. Used to represent call sites where the address of the +/// callee is fixed (e.g. a function call in C in which the call target is not +/// a function pointer). +class DirectCallEdge : public CallEdge { +public: + /// Construct a call edge using a symbol name to identify the callee, and a + /// return PC within the calling function to identify a specific call site. + DirectCallEdge(const char *symbol_name, lldb::addr_t return_pc, + CallSiteParameterArray &¶meters) + : CallEdge(return_pc, std::move(parameters)) { + lazy_callee.symbol_name = symbol_name; + } + + Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override; private: void ParseSymbolFileAndResolve(ModuleList &images); - /// Either the callee's mangled name or its definition, discriminated by - /// \ref resolved. + // Used to describe a direct call. + // + // Either the callee's mangled name or its definition, discriminated by + // \ref resolved. union { const char *symbol_name; Function *def; } lazy_callee; - /// An invalid address if this is a tail call. Otherwise, the function-local - /// PC offset. Adding this PC offset to the function's base load address - /// gives the return PC for the call. - lldb::addr_t return_pc; + /// Whether or not an attempt was made to find the callee's definition. + bool resolved = false; +}; - CallSiteParameterArray parameters; +/// An indirect call site. Used to represent call sites where the address of +/// the callee is not fixed, e.g. a call to a C++ virtual function (where the +/// address is loaded out of a vtable), or a call to a function pointer in C. +class IndirectCallEdge : public CallEdge { +public: + /// Construct a call edge using a DWARFExpression to identify the callee, and + /// a return PC within the calling function to identify a specific call site. + IndirectCallEdge(DWARFExpression call_target, lldb::addr_t return_pc, + CallSiteParameterArray &¶meters) + : CallEdge(return_pc, std::move(parameters)), + call_target(std::move(call_target)) {} - /// Whether or not an attempt was made to find the callee's definition. - bool resolved; + Function *GetCallee(ModuleList &images, ExecutionContext &exe_ctx) override; - DISALLOW_COPY_AND_ASSIGN(CallEdge); +private: + // Used to describe an indirect call. + // + // Specifies the location of the callee address in the calling frame. + DWARFExpression call_target; }; /// \class Function Function.h "lldb/Symbol/Function.h" @@ -414,11 +450,11 @@ public: /// Get the outgoing call edges from this function, sorted by their return /// PC addresses (in increasing order). - llvm::MutableArrayRef<CallEdge> GetCallEdges(); + llvm::ArrayRef<std::unique_ptr<CallEdge>> GetCallEdges(); /// Get the outgoing tail-calling edges from this function. If none exist, /// return None. - llvm::MutableArrayRef<CallEdge> GetTailCallingEdges(); + llvm::ArrayRef<std::unique_ptr<CallEdge>> GetTailCallingEdges(); /// Get the outgoing call edge from this function which has the given return /// address \p return_pc, or return nullptr. Note that this will not return a @@ -587,11 +623,9 @@ protected: uint32_t m_prologue_byte_size; ///< Compute the prologue size once and cache it - // TODO: Use a layer of indirection to point to call edges, to save space - // when call info hasn't been parsed. bool m_call_edges_resolved = false; ///< Whether call site info has been /// parsed. - std::vector<CallEdge> m_call_edges; ///< Outgoing call edges. + std::vector<std::unique_ptr<CallEdge>> m_call_edges; ///< Outgoing call edges. private: DISALLOW_COPY_AND_ASSIGN(Function); }; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/LineEntry.h b/contrib/llvm-project/lldb/include/lldb/Symbol/LineEntry.h index fe97a78e3ed4..32ffef72ee5e 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/LineEntry.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/LineEntry.h @@ -42,11 +42,6 @@ struct LineEntry { /// \param[in] s /// The stream to which to dump the object description. /// - /// \param[in] comp_unit - /// The compile unit object that contains the support file - /// list so the line entry can dump the file name (since this - /// object contains a file index into the support file list). - /// /// \param[in] show_file /// If \b true, display the filename with the line entry which /// requires that the compile unit object \a comp_unit be a @@ -75,11 +70,6 @@ struct LineEntry { /// \param[in] s /// The stream to which to dump the object description. /// - /// \param[in] comp_unit - /// The compile unit object that contains the support file - /// list so the line entry can dump the file name (since this - /// object contains a file index into the support file list). - /// /// \return /// Returns \b true if the file and line were properly dumped, /// \b false otherwise. @@ -102,9 +92,9 @@ struct LineEntry { /// The Right Hand Side const LineEntry object reference. /// /// \return - /// \li -1 if lhs < rhs - /// \li 0 if lhs == rhs - /// \li 1 if lhs > rhs + /// -1 if lhs < rhs + /// 0 if lhs == rhs + /// 1 if lhs > rhs static int Compare(const LineEntry &lhs, const LineEntry &rhs); /// Give the range for this LineEntry + any additional LineEntries for this @@ -143,7 +133,6 @@ struct LineEntry { /// /// \param[in] target_sp /// Shared pointer to the target this LineEntry belongs to. - void ApplyFileMappings(lldb::TargetSP target_sp); // Member variables. diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/LineTable.h b/contrib/llvm-project/lldb/include/lldb/Symbol/LineTable.h index d24cc35e10f3..043f3eb895cb 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/LineTable.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/LineTable.h @@ -135,8 +135,8 @@ public: /// If true, match only if you find a line entry exactly matching \a line. /// If false, return the closest line entry greater than \a line. /// - /// \param[out] line_entry - /// A reference to a line entry object that will get a copy of + /// \param[out] line_entry_ptr + /// A pointer to a line entry object that will get a copy of /// the line entry if \b true is returned, otherwise \a /// line_entry is left untouched. /// @@ -194,16 +194,6 @@ public: size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges, bool append); - /// Given a file range link map, relink the current line table and return a - /// fixed up line table. - /// - /// \param[out] file_range_map - /// A collection of file ranges that maps to new file ranges - /// that will be used when linking the line table. - /// - /// \return - /// A new line table if at least one line table entry was able - /// to be mapped. typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t> FileRangeMap; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/ObjectFile.h b/contrib/llvm-project/lldb/include/lldb/Symbol/ObjectFile.h index 4d04f23a8286..841a38e5b15a 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/ObjectFile.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/ObjectFile.h @@ -130,7 +130,7 @@ public: /// ObjectFile plug-in interface and returns the first instance that can /// parse the file. /// - /// \param[in] module + /// \param[in] module_sp /// The parent module that owns this object file. /// /// \param[in] file_spec @@ -158,7 +158,7 @@ public: /// ObjectFile plug-in interface and returns the first instance that can /// parse the file. /// - /// \param[in] module + /// \param[in] module_sp /// The parent module that owns this object file. /// /// \param[in] process_sp @@ -356,13 +356,6 @@ public: /// Frees the symbol table. /// /// This function should only be used when an object file is - /// - /// \param[in] flags - /// eSymtabFromUnifiedSectionList: Whether to clear symbol table - /// for unified module section list, or object file. - /// - /// \return - /// The symbol table for this object file. virtual void ClearSymtab(); /// Gets the UUID for this object file. @@ -487,8 +480,8 @@ public: /// \return /// Returns the identifier string if one exists, else an empty /// string. - virtual std::string GetIdentifierString () { - return std::string(); + virtual std::string GetIdentifierString () { + return std::string(); } /// When the ObjectFile is a core file, lldb needs to locate the "binary" in @@ -652,8 +645,6 @@ public: /// /// \param[in] target /// Target where to load. - /// - /// \return virtual std::vector<LoadableData> GetLoadableData(Target &target); /// Creates a plugin-specific call frame info diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Symbol.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Symbol.h index b7f179d1449b..36f89c044ea9 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Symbol.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Symbol.h @@ -43,7 +43,9 @@ public: bool Compare(ConstString name, lldb::SymbolType type) const; - void Dump(Stream *s, Target *target, uint32_t index) const; + void Dump(Stream *s, Target *target, uint32_t index, + Mangled::NamePreference name_preference = + Mangled::ePreferDemangled) const; bool ValueIsAddress() const; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolContext.h b/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolContext.h index 76ec1a7de68e..4c7b727fe618 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolContext.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolContext.h @@ -51,7 +51,7 @@ public: /// /// Initialize all pointer to the specified values. /// - /// \param[in] module + /// \param[in] module_sp /// A Module pointer to the module for this context. /// /// \param[in] comp_unit @@ -84,18 +84,6 @@ public: ~SymbolContext(); - /// Assignment operator. - /// - /// Copies the address value from another SymbolContext object \a rhs into - /// \a this object. - /// - /// \param[in] rhs - /// A const SymbolContext object reference to copy. - /// - /// \return - /// A const SymbolContext object reference to \a this. - const SymbolContext &operator=(const SymbolContext &rhs); - /// Clear the object's state. /// /// Resets all pointer members to nullptr, and clears any class objects to @@ -279,11 +267,6 @@ public: /// For instance, if the symbol context contains an inlined block, it will /// return the inlined function name. /// - /// \param[in] prefer_mangled - /// if \btrue, then the mangled name will be returned if there - /// is one. Otherwise the unmangled name will be returned if it - /// is available. - /// /// \return /// The name of the function represented by this symbol context. ConstString GetFunctionName( @@ -298,14 +281,6 @@ public: /// ModuleList::FindFunctions(...) call in order to get the correct line /// table information for the symbol context. it will return the inlined /// function name. - /// - /// \param[in] prefer_mangled - /// if \btrue, then the mangled name will be returned if there - /// is one. Otherwise the unmangled name will be returned if it - /// is available. - /// - /// \return - /// The name of the function represented by this symbol context. LineEntry GetFunctionStartLineEntry() const; /// Find the block containing the inlined block that contains this block. @@ -319,13 +294,13 @@ public: /// \param[out] next_frame_sc /// A new symbol context that does what the title says it does. /// - /// \param[out] next_frame_addr + /// \param[out] inlined_frame_addr /// This is what you should report as the PC in \a next_frame_sc. /// /// \return /// \b true if this SymbolContext specifies a block contained in an /// inlined block. If this returns \b true, \a next_frame_sc and - /// \a next_frame_addr will be filled in correctly. + /// \a inlined_frame_addr will be filled in correctly. bool GetParentOfInlinedScope(const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &inlined_frame_addr) const; diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolFile.h b/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolFile.h index 6724b425abf3..fdd812eb5167 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolFile.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/SymbolFile.h @@ -33,7 +33,16 @@ namespace lldb_private { class SymbolFile : public PluginInterface { + /// LLVM RTTI support. + static char ID; + public: + /// LLVM RTTI support. + /// \{ + virtual bool isA(const void *ClassID) const { return ClassID == &ID; } + static bool classof(const SymbolFile *obj) { return obj->isA(&ID); } + /// \} + // Symbol file ability bits. // // Each symbol file can claim to support one or more symbol file abilities. @@ -122,9 +131,35 @@ public: virtual size_t ParseFunctions(CompileUnit &comp_unit) = 0; virtual bool ParseLineTable(CompileUnit &comp_unit) = 0; virtual bool ParseDebugMacros(CompileUnit &comp_unit) = 0; - virtual void - ForEachExternalModule(CompileUnit &comp_unit, - llvm::function_ref<void(lldb::ModuleSP)> f) {} + + /// Apply a lambda to each external lldb::Module referenced by this + /// \p comp_unit. Recursively also descends into the referenced external + /// modules of any encountered compilation unit. + /// + /// \param comp_unit + /// When this SymbolFile consists of multiple auxilliary + /// SymbolFiles, for example, a Darwin debug map that references + /// multiple .o files, comp_unit helps choose the auxilliary + /// file. In most other cases comp_unit's symbol file is + /// identiacal with *this. + /// + /// \param[in] lambda + /// The lambda that should be applied to every function. The lambda can + /// return true if the iteration should be aborted earlier. + /// + /// \param visited_symbol_files + /// A set of SymbolFiles that were already visited to avoid + /// visiting one file more than once. + /// + /// \return + /// If the lambda early-exited, this function returns true to + /// propagate the early exit. + virtual bool ForEachExternalModule( + lldb_private::CompileUnit &comp_unit, + llvm::DenseSet<lldb_private::SymbolFile *> &visited_symbol_files, + llvm::function_ref<bool(Module &)> lambda) { + return false; + } virtual bool ParseSupportFiles(CompileUnit &comp_unit, FileSpecList &support_files) = 0; virtual size_t ParseTypes(CompileUnit &comp_unit) = 0; @@ -193,9 +228,14 @@ public: TypeMap &types); /// Find types specified by a CompilerContextPattern. - /// \param languages Only return results in these languages. - virtual void FindTypes(llvm::ArrayRef<CompilerContext> pattern, - LanguageSet languages, TypeMap &types); + /// \param languages + /// Only return results in these languages. + /// \param searched_symbol_files + /// Prevents one file from being visited multiple times. + virtual void + FindTypes(llvm::ArrayRef<CompilerContext> pattern, LanguageSet languages, + llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, + TypeMap &types); virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, @@ -220,7 +260,8 @@ public: const ObjectFile *GetObjectFile() const { return m_objfile_sp.get(); } ObjectFile *GetMainObjectFile(); - virtual std::vector<CallEdge> ParseCallEdgesInFunction(UserID func_id) { + virtual std::vector<std::unique_ptr<CallEdge>> + ParseCallEdgesInFunction(UserID func_id) { return {}; } diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h index 99d15771ccc5..f121bef1bfbe 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Symtab.h @@ -40,8 +40,12 @@ public: uint32_t AddSymbol(const Symbol &symbol); size_t GetNumSymbols() const; void SectionFileAddressesChanged(); - void Dump(Stream *s, Target *target, SortOrder sort_type); - void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes) 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; uint32_t GetIndexForSymbol(const Symbol *symbol) const; std::recursive_mutex &GetMutex() { return m_mutex; } Symbol *FindSymbolByID(lldb::user_id_t uid) const; @@ -139,7 +143,29 @@ 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> + class FileRangeToIndexMapCompare { + public: + FileRangeToIndexMapCompare(const Symtab &symtab) : m_symtab(symtab) {} + bool operator()(const uint32_t a_data, const uint32_t b_data) const { + return rank(a_data) > rank(b_data); + } + + private: + // How much preferred is this symbol? + int rank(const uint32_t data) const { + const Symbol &symbol = *m_symtab.SymbolAtIndex(data); + if (symbol.IsExternal()) + return 3; + if (symbol.IsWeak()) + return 2; + if (symbol.IsDebug()) + return 0; + return 1; + } + const Symtab &m_symtab; + }; + typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t, 0, + FileRangeToIndexMapCompare> FileRangeToIndexMap; void InitNameIndexes(); void InitAddressIndexes(); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/Type.h b/contrib/llvm-project/lldb/include/lldb/Symbol/Type.h index 446e043a95ee..95a3bc497517 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/Type.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/Type.h @@ -80,22 +80,18 @@ public: eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type /// whose UID is m_encoding_uid eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type - /// whose UID is m_encoding_uid + /// whose UID is m_encoding_uid, + eEncodingIsAtomicUID, ///< This type is the type whose UID is + /// m_encoding_uid as an atomic type. eEncodingIsSyntheticUID }; - // We must force the underlying type of the enum to be unsigned here. Not - // all compilers behave the same with regards to the default underlying type - // of an enum, but because this enum is used in an enum bitfield and integer - // comparisons are done with the value we need to guarantee that it's always - // unsigned so that, for example, eResolveStateFull doesn't compare less than - // eResolveStateUnresolved when used in a 2-bit bitfield. - typedef enum ResolveStateTag : unsigned { - eResolveStateUnresolved = 0, - eResolveStateForward = 1, - eResolveStateLayout = 2, - eResolveStateFull = 3 - } ResolveState; + enum class ResolveState : unsigned char { + Unresolved = 0, + Forward = 1, + Layout = 2, + Full = 3 + }; Type(lldb::user_id_t uid, SymbolFile *symbol_file, ConstString name, llvm::Optional<uint64_t> byte_size, SymbolContextScope *context, @@ -200,17 +196,17 @@ public: uint32_t GetEncodingMask(); - bool IsCompleteObjCClass() { return m_flags.is_complete_objc_class; } + bool IsCompleteObjCClass() { return m_is_complete_objc_class; } void SetIsCompleteObjCClass(bool is_complete_objc_class) { - m_flags.is_complete_objc_class = is_complete_objc_class; + m_is_complete_objc_class = is_complete_objc_class; } protected: ConstString m_name; SymbolFile *m_symbol_file; - SymbolContextScope - *m_context; // The symbol context in which this type is defined + /// The symbol context in which this type is defined. + SymbolContextScope *m_context; Type *m_encoding_type; lldb::user_id_t m_encoding_uid; EncodingDataType m_encoding_uid_type; @@ -218,16 +214,8 @@ protected: uint64_t m_byte_size_has_value : 1; Declaration m_decl; CompilerType m_compiler_type; - - struct Flags { -#ifdef __GNUC__ - // using unsigned type here to work around a very noisy gcc warning - unsigned compiler_type_resolve_state : 2; -#else - ResolveState compiler_type_resolve_state : 2; -#endif - bool is_complete_objc_class : 1; - } m_flags; + ResolveState m_compiler_type_resolve_state; + bool m_is_complete_objc_class; Type *GetEncodingType(); diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h b/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h index 07295c244a5d..91f751acf6c7 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/TypeSystem.h @@ -49,51 +49,32 @@ struct LanguageSet { bool operator[](unsigned i) const; }; -/// Interface for representing the Type Systems in different languages. +/// Interface for representing a type system. +/// +/// Implemented by language plugins to define the type system for a given +/// language. +/// +/// This interface extensively used opaque pointers to prevent that generic +/// LLDB code has dependencies on language plugins. The type and semantics of +/// these opaque pointers are defined by the TypeSystem implementation inside +/// the respective language plugin. Opaque pointers from one TypeSystem +/// instance should never be passed to a different TypeSystem instance (even +/// when the language plugin for both TypeSystem instances is the same). +/// +/// Most of the functions in this class should not be called directly but only +/// called by their respective counterparts in CompilerType, CompilerDecl and +/// CompilerDeclContext. +/// +/// \see lldb_private::CompilerType +/// \see lldb_private::CompilerDecl +/// \see lldb_private::CompilerDeclContext class TypeSystem : public PluginInterface { public: - // Intrusive type system that allows us to use llvm casting. - // - // To add a new type system: - // - // 1 - Add a new enumeration for llvm casting below for your TypeSystem - // subclass, here we will use eKindFoo - // - // 2 - Your TypeSystem subclass will inherit from TypeSystem and needs - // to implement a static classof() function that returns your - // enumeration: - // - // class Foo : public lldb_private::TypeSystem - // { - // static bool classof(const TypeSystem *ts) - // { - // return ts->getKind() == TypeSystem::eKindFoo; - // } - // }; - // - // 3 - Contruct your TypeSystem subclass with the enumeration from below - // - // Foo() : - // TypeSystem(TypeSystem::eKindFoo), - // ... - // { - // } - // - // Then you can use the llvm casting on any "TypeSystem *" to get an instance - // of your subclass. - enum LLVMCastKind { - eKindClang, - eKindSwift, - eKindOCaml, - kNumKinds - }; - // Constructors and Destructors - TypeSystem(LLVMCastKind kind); - ~TypeSystem() override; - LLVMCastKind getKind() const { return m_kind; } + // LLVM RTTI support + virtual bool isA(const void *ClassID) const = 0; static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language, Module *module); @@ -135,8 +116,6 @@ public: DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls); - virtual bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) = 0; - virtual ConstString DeclContextGetName(void *opaque_decl_ctx) = 0; virtual ConstString @@ -265,6 +244,8 @@ public: virtual CompilerType GetRValueReferenceType(lldb::opaque_compiler_type_t type); + virtual CompilerType GetAtomicType(lldb::opaque_compiler_type_t type); + virtual CompilerType AddConstModifier(lldb::opaque_compiler_type_t type); virtual CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type); @@ -494,8 +475,7 @@ public: virtual bool IsMeaninglessWithoutDynamicResolution(void *type); protected: - const LLVMCastKind m_kind; // Support for llvm casting - SymbolFile *m_sym_file; + SymbolFile *m_sym_file = nullptr; }; class TypeSystemMap { diff --git a/contrib/llvm-project/lldb/include/lldb/Symbol/VariableList.h b/contrib/llvm-project/lldb/include/lldb/Symbol/VariableList.h index 54d27583cd7b..87f98668a8a8 100644 --- a/contrib/llvm-project/lldb/include/lldb/Symbol/VariableList.h +++ b/contrib/llvm-project/lldb/include/lldb/Symbol/VariableList.h @@ -16,6 +16,8 @@ namespace lldb_private { class VariableList { + typedef std::vector<lldb::VariableSP> collection; + public: // Constructors and Destructors // VariableList(const SymbolContext &symbol_context); @@ -65,11 +67,15 @@ public: size_t GetSize() const; bool Empty() const { return m_variables.empty(); } -protected: - typedef std::vector<lldb::VariableSP> collection; typedef collection::iterator iterator; typedef collection::const_iterator const_iterator; + iterator begin() { return m_variables.begin(); } + iterator end() { return m_variables.end(); } + const_iterator begin() const { return m_variables.begin(); } + const_iterator end() const { return m_variables.end(); } + +protected: collection m_variables; private: diff --git a/contrib/llvm-project/lldb/include/lldb/Target/ABI.h b/contrib/llvm-project/lldb/include/lldb/Target/ABI.h index 93378abc2ac2..1aff1e2f7817 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/ABI.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/ABI.h @@ -126,12 +126,7 @@ public: llvm::MCRegisterInfo &GetMCRegisterInfo() { return *m_mc_register_info_up; } - virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0; - - bool GetRegisterInfoByName(ConstString name, RegisterInfo &info); - - bool GetRegisterInfoByKind(lldb::RegisterKind reg_kind, uint32_t reg_num, - RegisterInfo &info); + virtual void AugmentRegisterInfo(RegisterInfo &info); virtual bool GetPointerReturnRegister(const char *&name) { return false; } @@ -143,6 +138,10 @@ protected: assert(m_mc_register_info_up && "ABI must have MCRegisterInfo"); } + bool GetRegisterInfoByName(ConstString name, RegisterInfo &info); + + virtual const RegisterInfo *GetRegisterInfoArray(uint32_t &count) = 0; + /// Utility function to construct a MCRegisterInfo using the ArchSpec triple. /// Plugins wishing to customize the construction can construct the /// MCRegisterInfo themselves. diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Language.h b/contrib/llvm-project/lldb/include/lldb/Target/Language.h index b49e96eeac17..e00b042ac253 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Language.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Language.h @@ -176,9 +176,6 @@ public: virtual HardcodedFormatters::HardcodedSyntheticFinder GetHardcodedSynthetics(); - virtual HardcodedFormatters::HardcodedValidatorFinder - GetHardcodedValidators(); - virtual std::vector<ConstString> GetPossibleFormattersMatches(ValueObject &valobj, lldb::DynamicValueType use_dynamic); diff --git a/contrib/llvm-project/lldb/include/lldb/Target/MemoryRegionInfo.h b/contrib/llvm-project/lldb/include/lldb/Target/MemoryRegionInfo.h index ead59d96cb01..2c975e7e7fce 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/MemoryRegionInfo.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/MemoryRegionInfo.h @@ -21,11 +21,13 @@ public: enum OptionalBool { eDontKnow = -1, eNo = 0, eYes = 1 }; - MemoryRegionInfo() - : m_range(), m_read(eDontKnow), m_write(eDontKnow), m_execute(eDontKnow), - m_mapped(eDontKnow), m_flash(eDontKnow), m_blocksize(0) {} - - ~MemoryRegionInfo() {} + MemoryRegionInfo() = default; + MemoryRegionInfo(RangeType range, OptionalBool read, OptionalBool write, + OptionalBool execute, OptionalBool mapped, ConstString name, + OptionalBool flash, lldb::offset_t blocksize) + : m_range(range), m_read(read), m_write(write), m_execute(execute), + m_mapped(mapped), m_name(name), m_flash(flash), m_blocksize(blocksize) { + } RangeType &GetRange() { return m_range; } @@ -88,20 +90,21 @@ public: bool operator==(const MemoryRegionInfo &rhs) const { return m_range == rhs.m_range && m_read == rhs.m_read && m_write == rhs.m_write && m_execute == rhs.m_execute && - m_mapped == rhs.m_mapped; + m_mapped == rhs.m_mapped && m_name == rhs.m_name && + m_flash == rhs.m_flash && m_blocksize == rhs.m_blocksize; } bool operator!=(const MemoryRegionInfo &rhs) const { return !(*this == rhs); } protected: RangeType m_range; - OptionalBool m_read; - OptionalBool m_write; - OptionalBool m_execute; - OptionalBool m_mapped; + OptionalBool m_read = eDontKnow; + OptionalBool m_write = eDontKnow; + OptionalBool m_execute = eDontKnow; + OptionalBool m_mapped = eDontKnow; ConstString m_name; - OptionalBool m_flash; - lldb::offset_t m_blocksize; + OptionalBool m_flash = eDontKnow; + lldb::offset_t m_blocksize = 0; }; inline bool operator<(const MemoryRegionInfo &lhs, @@ -117,6 +120,9 @@ inline bool operator<(lldb::addr_t lhs, const MemoryRegionInfo &rhs) { return lhs < rhs.GetRange().GetRangeBase(); } +llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, + const MemoryRegionInfo &Info); + // Forward-declarable wrapper. class MemoryRegionInfos : public std::vector<lldb_private::MemoryRegionInfo> { public: @@ -127,21 +133,13 @@ public: namespace llvm { template <> +/// If Options is empty, prints a textual representation of the value. If +/// Options is a single character, it uses that character for the "yes" value, +/// while "no" is printed as "-", and "don't know" as "?". This can be used to +/// print the permissions in the traditional "rwx" form. struct format_provider<lldb_private::MemoryRegionInfo::OptionalBool> { static void format(const lldb_private::MemoryRegionInfo::OptionalBool &B, - raw_ostream &OS, StringRef Options) { - switch(B) { - case lldb_private::MemoryRegionInfo::eNo: - OS << "no"; - return; - case lldb_private::MemoryRegionInfo::eYes: - OS << "yes"; - return; - case lldb_private::MemoryRegionInfo::eDontKnow: - OS << "don't know"; - return; - } - } + raw_ostream &OS, StringRef Options); }; } diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Platform.h b/contrib/llvm-project/lldb/include/lldb/Target/Platform.h index 6f643df53d1e..72b6be21b770 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Platform.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Platform.h @@ -380,9 +380,6 @@ public: /// attached to the process, or an empty shared pointer with an appropriate /// error. /// - /// \param[in] pid - /// The process ID that we should attempt to attach to. - /// /// \return /// An appropriate ProcessSP containing a valid shared pointer /// to the default Process subclass for the platform that is @@ -777,7 +774,7 @@ public: /// given an install name and a set (e.g. DYLD_LIBRARY_PATH provided) of /// alternate paths. /// - /// \param[in] path_list + /// \param[in] paths /// The list of paths to use to search for the library. First /// match wins. /// @@ -788,7 +785,7 @@ public: /// \param[out] loaded_path /// If non-null, the path to the dylib that was successfully loaded /// is stored in this path. - /// + /// /// \return /// A token that represents the shared library which can be /// passed to UnloadImage. A value of diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Process.h b/contrib/llvm-project/lldb/include/lldb/Target/Process.h index a4ef1cc40414..2ba996d4995f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Process.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Process.h @@ -85,9 +85,6 @@ public: std::chrono::seconds GetUtilityExpressionTimeout() const; protected: - static void OptionValueChangedCallback(void *baton, - OptionValue *option_value); - Process *m_process; // Can be nullptr for global ProcessProperties }; @@ -520,14 +517,6 @@ public: /// 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, @@ -714,8 +703,8 @@ public: /// 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. + /// \param[in] attach_info + /// The process attach info. /// /// \return /// Returns \a pid if attaching was successful, or @@ -1392,7 +1381,8 @@ public: /// the core file. /// /// \return - // true if the user should be warned about detaching from this process. + /// Returns \b 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. @@ -1722,8 +1712,9 @@ public: /// lldb, /// just not by the process itself. /// - /// \param[in/out] error + /// \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. @@ -2171,7 +2162,7 @@ public: /// WaitFor* calls above. Be sure to call RestoreProcessEvents when you are /// done. /// - /// \param[in] listener + /// \param[in] listener_sp /// This is the new listener to whom all process events will be delivered. /// /// \return @@ -2191,11 +2182,9 @@ public: OperatingSystem *GetOperatingSystem() { return m_os_up.get(); } - std::vector<LanguageRuntime *> - GetLanguageRuntimes(bool retry_if_null = true); + std::vector<LanguageRuntime *> GetLanguageRuntimes(); - LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language, - bool retry_if_null = true); + LanguageRuntime *GetLanguageRuntime(lldb::LanguageType language); bool IsPossibleDynamicValue(ValueObject &in_value); @@ -2272,7 +2261,7 @@ public: void ClearPreResumeAction(PreResumeActionCallback callback, void *baton); ProcessRunLock &GetRunLock(); - + bool CurrentThreadIsPrivateStateThread(); virtual Status SendEventData(const char *data) { @@ -2372,7 +2361,7 @@ public: /// The StructuredData type name as previously discovered by /// the Process-derived instance. /// - /// \param[in] config + /// \param[in] config_sp /// 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, @@ -2750,7 +2739,7 @@ protected: StructuredDataPluginMap m_structured_data_plugin_map; enum { eCanJITDontKnow = 0, eCanJITYes, eCanJITNo } m_can_jit; - + std::unique_ptr<UtilityFunction> m_dlopen_utility_func_up; llvm::once_flag m_dlopen_utility_func_flag_once; diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Queue.h b/contrib/llvm-project/lldb/include/lldb/Target/Queue.h index 01e8994f2441..10b9e0242070 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Queue.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Queue.h @@ -126,10 +126,7 @@ public: m_pending_items.push_back(item); } - /// Return the kind (serial, concurrent) of this queue - /// - /// \return - // Whether this is a serial or a concurrent queue + /// Return the kind (serial, concurrent) of this queue. lldb::QueueKind GetKind(); void SetKind(lldb::QueueKind kind); diff --git a/contrib/llvm-project/lldb/include/lldb/Target/StackFrame.h b/contrib/llvm-project/lldb/include/lldb/Target/StackFrame.h index d2e5795162cf..1c6a2b481160 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/StackFrame.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/StackFrame.h @@ -99,8 +99,6 @@ public: /// \param [in] pc /// The current pc value of this stack frame. /// - /// \param [in] frame_kind - /// /// \param [in] sc_ptr /// Optionally seed the StackFrame with the SymbolContext information that /// has @@ -289,18 +287,18 @@ public: llvm::StringRef var_expr, lldb::DynamicValueType use_dynamic, uint32_t options, lldb::VariableSP &var_sp, Status &error); - /// Determine whether this StackFrame has debug information available or not + /// Determine whether this StackFrame has debug information available or not. /// /// \return - // true if debug information is available for this frame (function, - // compilation unit, block, etc.) + /// true if debug information is available for this frame (function, + /// compilation unit, block, etc.) bool HasDebugInformation(); /// Return the disassembly for the instructions of this StackFrame's /// function as a single C string. /// /// \return - // C string with the assembly instructions for this function. + /// C string with the assembly instructions for this function. const char *Disassemble(); /// Print a description for this frame using the frame-format formatter @@ -407,7 +405,7 @@ public: /// is sufficient. One of the DynamicValueType enumerated values. /// /// \return - // A ValueObject for this variable. + /// A ValueObject for this variable. lldb::ValueObjectSP GetValueObjectForFrameVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic); @@ -424,7 +422,7 @@ public: /// is sufficient. One of the DynamicValueType enumerated values. /// /// \return - // A ValueObject for this variable. + /// A ValueObject for this variable. lldb::ValueObjectSP TrackGlobalVariable(const lldb::VariableSP &variable_sp, lldb::DynamicValueType use_dynamic); diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Target.h b/contrib/llvm-project/lldb/include/lldb/Target/Target.h index e465046959f2..1e9153c401ef 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Target.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Target.h @@ -203,34 +203,21 @@ public: void SetInjectLocalVariables(ExecutionContext *exe_ctx, bool b); - bool GetUseModernTypeLookup() const; - void SetRequireHardwareBreakpoints(bool b); bool GetRequireHardwareBreakpoints() const; private: // Callbacks for m_launch_info. - static void Arg0ValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void RunArgsValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void EnvVarsValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void InheritEnvValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void InputPathValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void OutputPathValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void ErrorPathValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void DetachOnErrorValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void DisableASLRValueChangedCallback(void *target_property_ptr, - OptionValue *); - static void DisableSTDIOValueChangedCallback(void *target_property_ptr, - OptionValue *); + void Arg0ValueChangedCallback(); + void RunArgsValueChangedCallback(); + void EnvVarsValueChangedCallback(); + void InputPathValueChangedCallback(); + void OutputPathValueChangedCallback(); + void ErrorPathValueChangedCallback(); + void DetachOnErrorValueChangedCallback(); + void DisableASLRValueChangedCallback(); + void DisableSTDIOValueChangedCallback(); // Member variables. ProcessLaunchInfo m_launch_info; @@ -906,8 +893,8 @@ public: /// The target call at present just consults the Platform's call of the /// same name. /// - /// \param[in] module_sp - /// A shared pointer reference to the module that checked. + /// \param[in] module_spec + /// Path to the module. /// /// \return \b true if the module should be excluded, \b false otherwise. bool ModuleIsExcludedForUnconstrainedSearches(const FileSpec &module_spec); @@ -1067,8 +1054,6 @@ public: const char *name, Status &error); - ClangASTContext *GetScratchClangASTContext(bool create_on_demand = true); - lldb::ClangASTImporterSP GetClangASTImporter(); // Install any files through the platform that need be to installed prior to diff --git a/contrib/llvm-project/lldb/include/lldb/Target/TargetList.h b/contrib/llvm-project/lldb/include/lldb/Target/TargetList.h index ece0705ae71c..50a7a321ead1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/TargetList.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/TargetList.h @@ -55,12 +55,12 @@ public: /// \param[in] debugger /// The debugger to associate this target with /// - /// \param[in] file_spec + /// \param[in] user_exe_path /// The main executable file for a debug target. This value - /// can be nullptr and the file can be set later using: + /// can be empty and the file can be set later using: /// Target::SetExecutableModule (ModuleSP&) /// - /// \param[in] triple_cstr + /// \param[in] triple_str /// A target triple string to be used for the target. This can /// be nullptr if the triple is not known or when attaching to a /// process. diff --git a/contrib/llvm-project/lldb/include/lldb/Target/Thread.h b/contrib/llvm-project/lldb/include/lldb/Target/Thread.h index 7c5ff6093baf..cdc8d39251c6 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/Thread.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/Thread.h @@ -128,10 +128,6 @@ public: /// Constructor /// - /// \param [in] process - /// - /// \param [in] tid - /// /// \param [in] use_invalid_index_id /// Optional parameter, defaults to false. The only subclass that /// is likely to set use_invalid_index_id == true is the HistoryThread @@ -760,6 +756,8 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// \param[in] stop_vote + /// See standard meanings for the stop & run votes in ThreadPlan.h. + /// /// \param[in] run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// @@ -807,11 +805,13 @@ public: /// \b true if we will stop other threads while we single step this one. /// /// \param[in] stop_vote + /// See standard meanings for the stop & run votes in ThreadPlan.h. /// /// \param[in] run_vote /// See standard meanings for the stop & run votes in ThreadPlan.h. /// /// \param[in] frame_idx + /// The fame index. /// /// \param[out] status /// A status with an error if queuing failed. @@ -899,7 +899,7 @@ public: virtual lldb::ThreadPlanSP QueueThreadPlanForStepScripted(bool abort_other_plans, const char *class_name, - StructuredData::ObjectSP extra_args_sp, + StructuredData::ObjectSP extra_args_sp, bool stop_other_threads, Status &status); // Thread Plan accessors: @@ -1004,7 +1004,7 @@ public: /// including the plan in that matches \a thread_index counting only /// the non-Private plans. /// - /// \param[in] up_to_plan_sp + /// \param[in] thread_index /// Discard all plans up to and including this user plan given by this /// index. /// @@ -1102,9 +1102,9 @@ public: // right even if you have not calculated this yourself, or if it disagrees // with what you might have calculated. virtual lldb::StopInfoSP GetPrivateStopInfo(); - + // Calculate the stop info that will be shown to lldb clients. For instance, - // a "step out" is implemented by running to a breakpoint on the function + // a "step out" is implemented by running to a breakpoint on the function // return PC, so the process plugin initially sets the stop info to a // StopInfoBreakpoint. But once we've run the ShouldStop machinery, we // discover that there's a completed ThreadPlanStepOut, and that's really diff --git a/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepOut.h b/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepOut.h index 00984db2dca9..576b416c3f2c 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepOut.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepOut.h @@ -72,6 +72,7 @@ private: std::vector<lldb::StackFrameSP> m_stepped_past_frames; lldb::ValueObjectSP m_return_valobj_sp; bool m_calculate_return_value; + StreamString m_constructor_errors; friend lldb::ThreadPlanSP Thread::QueueThreadPlanForStepOut( bool abort_other_plans, SymbolContext *addr_context, bool first_insn, diff --git a/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepRange.h b/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepRange.h index 93d54ad7dfd5..28209623a1e1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepRange.h +++ b/contrib/llvm-project/lldb/include/lldb/Target/ThreadPlanStepRange.h @@ -76,6 +76,12 @@ protected: lldb::BreakpointSP m_next_branch_bp_sp; bool m_use_fast_step; bool m_given_ranges_only; + bool m_found_calls = false; // When we set the next branch breakpoint for + // step over, we now extend them past call insns + // that directly return. But if we do that we + // need to run all threads, or we might cause + // deadlocks. This tells us whether we found + // any calls in setting the next branch breakpoint. private: std::vector<lldb::DisassemblerSP> m_instruction_ranges; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/ArchSpec.h b/contrib/llvm-project/lldb/include/lldb/Utility/ArchSpec.h index 3bfc988abf0b..15e2fdb10c32 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/ArchSpec.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/ArchSpec.h @@ -101,6 +101,7 @@ public: eCore_arm_armv6, eCore_arm_armv6m, eCore_arm_armv7, + eCore_arm_armv7l, eCore_arm_armv7f, eCore_arm_armv7s, eCore_arm_armv7k, @@ -122,6 +123,7 @@ public: eCore_thumbv7em, eCore_arm_arm64, eCore_arm_armv8, + eCore_arm_armv8l, eCore_arm_arm64_32, eCore_arm_aarch64, @@ -258,13 +260,6 @@ public: /// 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); - /// Returns true if the OS, vendor and environment fields of the triple are /// unset. The triple is expected to be normalized /// (llvm::Triple::normalize). @@ -438,7 +433,7 @@ public: /// \return A triple describing this ArchSpec. const llvm::Triple &GetTriple() const { return m_triple; } - void DumpTriple(Stream &s) const; + void DumpTriple(llvm::raw_ostream &s) const; /// Architecture triple setter. /// diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Args.h b/contrib/llvm-project/lldb/include/lldb/Utility/Args.h index 7987787e7af5..1308f4038dbd 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Args.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Args.h @@ -252,35 +252,6 @@ public: // For re-setting or blanking out the list of arguments. void Clear(); - static bool UInt64ValueIsValidForByteSize(uint64_t uval64, - size_t total_byte_size) { - if (total_byte_size > 8) - return false; - - if (total_byte_size == 8) - return true; - - const uint64_t max = (static_cast<uint64_t>(1) - << static_cast<uint64_t>(total_byte_size * 8)) - - 1; - return uval64 <= max; - } - - static bool SInt64ValueIsValidForByteSize(int64_t sval64, - size_t total_byte_size) { - if (total_byte_size > 8) - return false; - - if (total_byte_size == 8) - return true; - - const int64_t max = (static_cast<int64_t>(1) - << static_cast<uint64_t>(total_byte_size * 8 - 1)) - - 1; - const int64_t min = ~(max); - return min <= sval64 && sval64 <= max; - } - static lldb::Encoding StringToEncoding(llvm::StringRef s, lldb::Encoding fail_value = lldb::eEncodingInvalid); diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Baton.h b/contrib/llvm-project/lldb/include/lldb/Utility/Baton.h index 4050f2af2bf0..c42867489c65 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Baton.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Baton.h @@ -12,6 +12,8 @@ #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" +#include "llvm/Support/raw_ostream.h" + #include <memory> namespace lldb_private { @@ -37,8 +39,9 @@ public: virtual void *data() = 0; - virtual void GetDescription(Stream *s, - lldb::DescriptionLevel level) const = 0; + virtual void GetDescription(llvm::raw_ostream &s, + lldb::DescriptionLevel level, + unsigned indentation) const = 0; }; class UntypedBaton : public Baton { @@ -50,7 +53,8 @@ public: } void *data() override { return m_data; } - void GetDescription(Stream *s, lldb::DescriptionLevel level) const override; + void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const override; void *m_data; // Leave baton public for easy access }; @@ -63,7 +67,8 @@ public: const T *getItem() const { return Item.get(); } void *data() override { return Item.get(); } - void GetDescription(Stream *s, lldb::DescriptionLevel level) const override {} + void GetDescription(llvm::raw_ostream &s, lldb::DescriptionLevel level, + unsigned indentation) const override {} protected: std::unique_ptr<T> Item; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Broadcaster.h b/contrib/llvm-project/lldb/include/lldb/Utility/Broadcaster.h index fe4d1ca479b8..ead597d626d7 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Broadcaster.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Broadcaster.h @@ -65,7 +65,6 @@ public: } bool operator<(const BroadcastEventSpec &rhs) const; - BroadcastEventSpec &operator=(const BroadcastEventSpec &rhs); private: ConstString m_broadcaster_class; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Connection.h b/contrib/llvm-project/lldb/include/lldb/Utility/Connection.h index 77f3ef4a76ba..9e66dee1363b 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Connection.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Connection.h @@ -171,7 +171,7 @@ public: /// /// \return /// The underlying IOObject used for reading. - virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); } + virtual lldb::IOObjectSP GetReadObject() { return lldb::IOObjectSP(); }; private: // For Connection only diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/ConstString.h b/contrib/llvm-project/lldb/include/lldb/Utility/ConstString.h index 9a9ee458239f..74750459d16f 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/ConstString.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/ConstString.h @@ -147,8 +147,8 @@ public: /// Another string object to compare this object to. /// /// \return - /// \li \b true if this object is equal to \a rhs. - /// \li \b false if this object is not equal to \a rhs. + /// true if this object is equal to \a rhs. + /// false if this object is not equal to \a rhs. bool operator==(ConstString rhs) const { // We can do a pointer compare to compare these strings since they must // come from the same pool in order to be equal. @@ -166,8 +166,8 @@ public: /// Another string object to compare this object to. /// /// \return - /// \li \b true if this object is equal to \a rhs. - /// \li \b false if this object is not equal to \a rhs. + /// \b true if this object is equal to \a rhs. + /// \b false if this object is not equal to \a rhs. bool operator==(const char *rhs) const { // ConstString differentiates between empty strings and nullptr strings, but // StringRef doesn't. Therefore we have to do this check manually now. @@ -189,8 +189,8 @@ public: /// Another string object to compare this object to. /// /// \return - /// \li \b true if this object is not equal to \a rhs. - /// \li \b false if this object is equal to \a rhs. + /// \b true if this object is not equal to \a rhs. + /// \b false if this object is equal to \a rhs. bool operator!=(ConstString rhs) const { return m_string != rhs.m_string; } @@ -328,15 +328,15 @@ public: /// Test for empty string. /// /// \return - /// \li \b true if the contained string is empty. - /// \li \b false if the contained string is not empty. + /// \b true if the contained string is empty. + /// \b false if the contained string is not empty. bool IsEmpty() const { return m_string == nullptr || m_string[0] == '\0'; } /// Test for null string. /// /// \return - /// \li \b true if there is no string associated with this instance. - /// \li \b false if there is a string associated with this instance. + /// \b true if there is no string associated with this instance. + /// \b false if there is a string associated with this instance. bool IsNull() const { return m_string == nullptr; } /// Set the C string value. diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/DataEncoder.h b/contrib/llvm-project/lldb/include/lldb/Utility/DataEncoder.h index 7d44afd2ce69..f4964b250b9d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/DataEncoder.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/DataEncoder.h @@ -21,8 +21,9 @@ namespace lldb_private { -/// \class DataEncoder DataEncoder.h "lldb/Core/DataEncoder.h" An binary data -/// encoding class. +/// \class DataEncoder +/// +/// An binary data encoding class. /// /// DataEncoder is a class that can encode binary data (swapping if needed) to /// a data buffer. The data buffer can be caller owned, or can be shared data @@ -86,74 +87,6 @@ public: /// any references to shared data that this object may contain. void Clear(); - /// Get the current address size. - /// - /// Return the size in bytes of any address values this object will extract. - /// - /// \return - /// The size in bytes of address values that will be extracted. - uint8_t GetAddressByteSize() const { return m_addr_size; } - - /// Get the number of bytes contained in this object. - /// - /// \return - /// The total number of bytes of data this object refers to. - size_t GetByteSize() const { return m_end - m_start; } - - /// Get the data end pointer. - /// - /// \return - /// Returns a pointer to the next byte contained in this - /// object's data, or NULL of there is no data in this object. - uint8_t *GetDataEnd() { return m_end; } - - const uint8_t *GetDataEnd() const { return m_end; } - - /// Get the shared data offset. - /// - /// Get the offset of the first byte of data in the shared data (if any). - /// - /// \return - /// If this object contains shared data, this function returns - /// the offset in bytes into that shared data, zero otherwise. - size_t GetSharedDataOffset() const; - - /// Get the current byte order value. - /// - /// \return - /// The current byte order value from this object's internal - /// state. - lldb::ByteOrder GetByteOrder() const { return m_byte_order; } - - /// Get the data start pointer. - /// - /// \return - /// Returns a pointer to the first byte contained in this - /// object's data, or NULL of there is no data in this object. - uint8_t *GetDataStart() { return m_start; } - - const uint8_t *GetDataStart() const { return m_start; } - - /// Encode unsigned integer values into the data at \a offset. - /// - /// \param[in] offset - /// The offset within the contained data at which to put the - /// data. - /// - /// \param[in] value - /// The value to encode into the data. - /// - /// \return - /// The next offset in the bytes of this data if the data - /// was successfully encoded, UINT32_MAX if the encoding failed. - uint32_t PutU8(uint32_t offset, uint8_t value); - - uint32_t PutU16(uint32_t offset, uint16_t value); - - uint32_t PutU32(uint32_t offset, uint32_t value); - - uint32_t PutU64(uint32_t offset, uint64_t value); - /// Encode an unsigned integer of size \a byte_size to \a offset. /// /// Encode a single integer value at \a offset and return the offset that @@ -176,7 +109,7 @@ public: /// \return /// The next offset in the bytes of this data if the integer /// was successfully encoded, UINT32_MAX if the encoding failed. - uint32_t PutMaxU64(uint32_t offset, uint32_t byte_size, uint64_t value); + uint32_t PutUnsigned(uint32_t offset, uint32_t byte_size, uint64_t value); /// Encode an arbitrary number of bytes. /// @@ -232,36 +165,27 @@ public: /// NULL will be returned. uint32_t PutCString(uint32_t offset, const char *cstr); - lldb::DataBufferSP &GetSharedDataBuffer() { return m_data_sp; } +private: + uint32_t PutU8(uint32_t offset, uint8_t value); + uint32_t PutU16(uint32_t offset, uint16_t value); + uint32_t PutU32(uint32_t offset, uint32_t value); + uint32_t PutU64(uint32_t offset, uint64_t value); - /// Set the address byte size. - /// - /// Set the size in bytes that will be used when extracting any address and - /// pointer values from data contained in this object. - /// - /// \param[in] addr_size - /// The size in bytes to use when extracting addresses. - void SetAddressByteSize(uint8_t addr_size) { m_addr_size = addr_size; } + uint32_t BytesLeft(uint32_t offset) const { + const uint32_t size = GetByteSize(); + if (size > offset) + return size - offset; + return 0; + } - /// Set data with a buffer that is caller owned. - /// - /// Use data that is owned by the caller when extracting values. The data - /// must stay around as long as this object, or any object that copies a - /// subset of this object's data, is valid. If \a bytes is NULL, or \a - /// length is zero, this object will contain no data. - /// - /// \param[in] bytes - /// A pointer to caller owned data. - /// - /// \param[in] length - /// The length in bytes of \a bytes. - /// - /// \param[in] byte_order - /// A byte order of the data that we are extracting from. + /// Test the availability of \a length bytes of data from \a offset. /// /// \return - /// The number of bytes that this object now contains. - uint32_t SetData(void *bytes, uint32_t length, lldb::ByteOrder byte_order); + /// \b true if \a offset is a valid offset and there are \a + /// length bytes available at that offset, \b false otherwise. + bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const { + return length <= BytesLeft(offset); + } /// Adopt a subset of shared data in \a data_sp. /// @@ -288,15 +212,6 @@ public: uint32_t SetData(const lldb::DataBufferSP &data_sp, uint32_t offset = 0, uint32_t length = UINT32_MAX); - /// Set the byte_order value. - /// - /// Sets the byte order of the data to extract. Extracted values will be - /// swapped if necessary when decoding. - /// - /// \param[in] byte_order - /// The byte order value to use when extracting data. - void SetByteOrder(lldb::ByteOrder byte_order) { m_byte_order = byte_order; } - /// Test the validity of \a offset. /// /// \return @@ -304,34 +219,30 @@ public: /// object, \b false otherwise. bool ValidOffset(uint32_t offset) const { return offset < GetByteSize(); } - /// Test the availability of \a length bytes of data from \a offset. + /// Get the number of bytes contained in this object. /// /// \return - /// \b true if \a offset is a valid offset and there are \a - /// length bytes available at that offset, \b false otherwise. - bool ValidOffsetForDataOfSize(uint32_t offset, uint32_t length) const { - return length <= BytesLeft(offset); - } + /// The total number of bytes of data this object refers to. + size_t GetByteSize() const { return m_end - m_start; } - uint32_t BytesLeft(uint32_t offset) const { - const uint32_t size = GetByteSize(); - if (size > offset) - return size - offset; - return 0; - } +private: + /// A pointer to the first byte of data. + uint8_t *m_start; -protected: - // Member variables - uint8_t *m_start; ///< A pointer to the first byte of data. - uint8_t *m_end; ///< A pointer to the byte that is past the end of the data. - lldb::ByteOrder - m_byte_order; ///< The byte order of the data we are extracting from. - uint8_t m_addr_size; ///< The address size to use when extracting pointers or - /// addresses - mutable lldb::DataBufferSP m_data_sp; ///< The shared pointer to data that can - /// be shared among multiple instances + /// A pointer to the byte that is past the end of the data. + uint8_t *m_end; + + /// The byte order of the data we are extracting from. + lldb::ByteOrder m_byte_order; + + /// The address size to use when extracting pointers or + /// addresses + uint8_t m_addr_size; + + /// The shared pointer to data that can + /// be shared among multiple instances + mutable lldb::DataBufferSP m_data_sp; -private: DISALLOW_COPY_AND_ASSIGN(DataEncoder); }; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/DataExtractor.h b/contrib/llvm-project/lldb/include/lldb/Utility/DataExtractor.h index 333baf9fd349..bf0d1055cf43 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/DataExtractor.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/DataExtractor.h @@ -188,16 +188,11 @@ public: /// The type of objects to use when dumping data from this /// object. See DataExtractor::Type. /// - /// \param[in] type_format - /// The optional format to use for the \a type objects. If this - /// is nullptr, the default format for the \a type will be used. - /// /// \return /// The offset at which dumping ended. lldb::offset_t PutToLog(Log *log, lldb::offset_t offset, lldb::offset_t length, uint64_t base_addr, - uint32_t num_per_line, Type type, - const char *type_format = nullptr) const; + uint32_t num_per_line, Type type) const; /// Extract an arbitrary number of bytes in the specified byte order. /// diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h b/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h index 50ad1f1600d8..533426671cc6 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/FileSpec.h @@ -75,33 +75,10 @@ public: explicit FileSpec(llvm::StringRef path, const llvm::Triple &triple); - /// Copy constructor - /// - /// Makes a copy of the uniqued directory and filename strings from \a rhs - /// if it is not nullptr. - /// - /// \param[in] rhs - /// A const FileSpec object pointer to copy if non-nullptr. - FileSpec(const FileSpec *rhs); - - /// Destructor. - ~FileSpec(); - bool DirectoryEquals(const FileSpec &other) const; bool FileEquals(const FileSpec &other) const; - /// Assignment operator. - /// - /// Makes a copy of the uniqued directory and filename strings from \a rhs. - /// - /// \param[in] rhs - /// A const FileSpec object reference to assign to this object. - /// - /// \return - /// A const reference to this object. - const FileSpec &operator=(const FileSpec &rhs); - /// Equal to operator /// /// Tests if this object is equal to \a rhs. @@ -206,6 +183,12 @@ public: static bool Equal(const FileSpec &a, const FileSpec &b, bool full); + /// Match FileSpec \a pattern against FileSpec \a file. If \a pattern has a + /// directory component, then the \a file must have the same directory + /// component. Otherwise, just it matches just the filename. An empty \a + /// pattern matches everything. + static bool Match(const FileSpec &pattern, const FileSpec &file); + /// Attempt to guess path style for a given path string. It returns a style, /// if it was able to make a reasonable guess, or None if it wasn't. The guess /// will be correct if the input path was a valid absolute path on the system @@ -228,7 +211,7 @@ public: /// /// \param[in] s /// The stream to which to dump the object description. - void Dump(Stream *s) const; + void Dump(llvm::raw_ostream &s) const; Style GetPathStyle() const; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Flags.h b/contrib/llvm-project/lldb/include/lldb/Utility/Flags.h index aa869eca0c6e..254a5ec443c3 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Flags.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Flags.h @@ -33,17 +33,6 @@ public: /// The initial value for all flags. Flags(ValueType flags = 0) : m_flags(flags) {} - /// Copy constructor. - /// - /// Construct and copy the flags from \a rhs. - /// - /// \param[in] rhs - /// A const Flags object reference to copy. - Flags(const Flags &rhs) : m_flags(rhs.m_flags) {} - - /// Destructor. - ~Flags() {} - /// Get accessor for all flags. /// /// \return diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/GDBRemote.h b/contrib/llvm-project/lldb/include/lldb/Utility/GDBRemote.h index b4adeb368524..21b2c8cd73cd 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/GDBRemote.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/GDBRemote.h @@ -9,6 +9,8 @@ #ifndef liblldb_GDBRemote_h_ #define liblldb_GDBRemote_h_ +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/Reproducer.h" #include "lldb/Utility/StreamString.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-public.h" @@ -69,7 +71,6 @@ struct GDBRemotePacket { std::string data; }; - void Serialize(llvm::raw_ostream &strm) const; void Dump(Stream &strm) const; BinaryData packet; @@ -82,6 +83,46 @@ private: llvm::StringRef GetTypeStr() const; }; +namespace repro { +class PacketRecorder : public AbstractRecorder { +public: + PacketRecorder(const FileSpec &filename, std::error_code &ec) + : AbstractRecorder(filename, ec) {} + + static llvm::Expected<std::unique_ptr<PacketRecorder>> + Create(const FileSpec &filename); + + void Record(const GDBRemotePacket &packet); +}; + +class GDBRemoteProvider : public repro::Provider<GDBRemoteProvider> { +public: + struct Info { + static const char *name; + static const char *file; + }; + + GDBRemoteProvider(const FileSpec &directory) : Provider(directory) {} + + llvm::raw_ostream *GetHistoryStream(); + PacketRecorder *GetNewPacketRecorder(); + + void SetCallback(std::function<void()> callback) { + m_callback = std::move(callback); + } + + void Keep() override; + void Discard() override; + + static char ID; + +private: + std::function<void()> m_callback; + std::unique_ptr<llvm::raw_fd_ostream> m_stream_up; + std::vector<std::unique_ptr<PacketRecorder>> m_packet_recorders; +}; + +} // namespace repro } // namespace lldb_private LLVM_YAML_IS_DOCUMENT_LIST_VECTOR(lldb_private::GDBRemotePacket) diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Log.h b/contrib/llvm-project/lldb/include/lldb/Utility/Log.h index 09c0f6954478..01edec044565 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Log.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Log.h @@ -166,10 +166,10 @@ public: bool GetVerbose() const; -private: void VAPrintf(const char *format, va_list args); void VAError(const char *format, va_list args); +private: Channel &m_channel; // The mutex makes sure enable/disable operations are thread-safe. The diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/RangeMap.h b/contrib/llvm-project/lldb/include/lldb/Utility/RangeMap.h index 709b5d2f66c7..9e0307351836 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/RangeMap.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/RangeMap.h @@ -599,36 +599,17 @@ struct RangeData : public Range<B, S> { RangeData(B base, S size) : Range<B, S>(base, size), data() {} RangeData(B base, S size, DataType d) : Range<B, S>(base, size), data(d) {} - - bool operator<(const RangeData &rhs) const { - if (this->base == rhs.base) { - if (this->size == rhs.size) - return this->data < rhs.data; - else - return this->size < rhs.size; - } - return this->base < rhs.base; - } - - bool operator==(const RangeData &rhs) const { - return this->GetRangeBase() == rhs.GetRangeBase() && - this->GetByteSize() == rhs.GetByteSize() && this->data == rhs.data; - } - - bool operator!=(const RangeData &rhs) const { - return this->GetRangeBase() != rhs.GetRangeBase() || - this->GetByteSize() != rhs.GetByteSize() || this->data != rhs.data; - } }; -template <typename B, typename S, typename T, unsigned N = 0> +template <typename B, typename S, typename T, unsigned N = 0, + class Compare = std::less<T>> class RangeDataVector { public: typedef lldb_private::Range<B, S> Range; typedef RangeData<B, S, T> Entry; typedef llvm::SmallVector<Entry, N> Collection; - RangeDataVector() = default; + RangeDataVector(Compare compare = Compare()) : m_compare(compare) {} ~RangeDataVector() = default; @@ -636,7 +617,14 @@ public: void Sort() { if (m_entries.size() > 1) - std::stable_sort(m_entries.begin(), m_entries.end()); + std::stable_sort(m_entries.begin(), m_entries.end(), + [&compare = m_compare](const Entry &a, const Entry &b) { + if (a.base != b.base) + return a.base < b.base; + if (a.size != b.size) + return a.size < b.size; + return compare(a.data, b.data); + }); } #ifdef ASSERT_RANGEMAP_ARE_SORTED @@ -817,6 +805,7 @@ public: protected: Collection m_entries; + Compare m_compare; }; // A simple range with data class where you get to define the type of diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Reproducer.h b/contrib/llvm-project/lldb/include/lldb/Utility/Reproducer.h index 3db98a781d4c..0d23fe8571ff 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Reproducer.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Reproducer.h @@ -153,24 +153,13 @@ public: static char ID; }; -class DataRecorder { -public: - DataRecorder(const FileSpec &filename, std::error_code &ec) +class AbstractRecorder { +protected: + AbstractRecorder(const FileSpec &filename, std::error_code &ec) : m_filename(filename.GetFilename().GetStringRef()), m_os(filename.GetPath(), ec, llvm::sys::fs::OF_Text), m_record(true) {} - static llvm::Expected<std::unique_ptr<DataRecorder>> - Create(const FileSpec &filename); - - template <typename T> void Record(const T &t, bool newline = false) { - if (!m_record) - return; - m_os << t; - if (newline) - m_os << '\n'; - m_os.flush(); - } - +public: const FileSpec &GetFilename() { return m_filename; } void Stop() { @@ -180,10 +169,30 @@ public: private: FileSpec m_filename; + +protected: llvm::raw_fd_ostream m_os; bool m_record; }; +class DataRecorder : public AbstractRecorder { +public: + DataRecorder(const FileSpec &filename, std::error_code &ec) + : AbstractRecorder(filename, ec) {} + + static llvm::Expected<std::unique_ptr<DataRecorder>> + Create(const FileSpec &filename); + + template <typename T> void Record(const T &t, bool newline = false) { + if (!m_record) + return; + m_os << t; + if (newline) + m_os << '\n'; + m_os.flush(); + } +}; + class CommandProvider : public Provider<CommandProvider> { public: struct Info { @@ -204,32 +213,6 @@ private: std::vector<std::unique_ptr<DataRecorder>> m_data_recorders; }; -class ProcessGDBRemoteProvider - : public repro::Provider<ProcessGDBRemoteProvider> { -public: - struct Info { - static const char *name; - static const char *file; - }; - - ProcessGDBRemoteProvider(const FileSpec &directory) : Provider(directory) {} - - llvm::raw_ostream *GetHistoryStream(); - - void SetCallback(std::function<void()> callback) { - m_callback = std::move(callback); - } - - void Keep() override { m_callback(); } - void Discard() override { m_callback(); } - - static char ID; - -private: - std::function<void()> m_callback; - std::unique_ptr<llvm::raw_fd_ostream> m_stream_up; -}; - /// The generator is responsible for the logic needed to generate a /// reproducer. For doing so it relies on providers, who serialize data that /// is necessary for reproducing a failure. @@ -288,7 +271,7 @@ private: FileSpec m_root; /// Flag to ensure that we never call both keep and discard. - bool m_done; + bool m_done = false; }; class Loader final { @@ -359,13 +342,43 @@ private: mutable std::mutex m_mutex; }; -/// Helper class for replaying commands through the reproducer. -class CommandLoader { +template <typename T> class MultiLoader { public: - CommandLoader(std::vector<std::string> files) : m_files(files) {} + MultiLoader(std::vector<std::string> files) : m_files(files) {} + + static std::unique_ptr<MultiLoader> Create(Loader *loader) { + if (!loader) + return {}; + + FileSpec file = loader->GetFile<typename T::Info>(); + if (!file) + return {}; + + auto error_or_file = llvm::MemoryBuffer::getFile(file.GetPath()); + if (auto err = error_or_file.getError()) + return {}; - static std::unique_ptr<CommandLoader> Create(Loader *loader); - llvm::Optional<std::string> GetNextFile(); + std::vector<std::string> files; + llvm::yaml::Input yin((*error_or_file)->getBuffer()); + yin >> files; + + if (auto err = yin.error()) + return {}; + + for (auto &file : files) { + FileSpec absolute_path = + loader->GetRoot().CopyByAppendingPathComponent(file); + file = absolute_path.GetPath(); + } + + return std::make_unique<MultiLoader<T>>(std::move(files)); + } + + llvm::Optional<std::string> GetNextFile() { + if (m_index >= m_files.size()) + return {}; + return m_files[m_index++]; + } private: std::vector<std::string> m_files; diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Scalar.h b/contrib/llvm-project/lldb/include/lldb/Utility/Scalar.h index 72f153ff97cd..69c948ec6222 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Scalar.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Scalar.h @@ -172,7 +172,6 @@ public: Scalar &operator=(double v); Scalar &operator=(long double v); Scalar &operator=(llvm::APInt v); - Scalar &operator=(const Scalar &rhs); // Assignment operator Scalar &operator+=(const Scalar &rhs); Scalar &operator<<=(const Scalar &rhs); // Shift left Scalar &operator>>=(const Scalar &rhs); // Shift right (arithmetic) diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Status.h b/contrib/llvm-project/lldb/include/lldb/Utility/Status.h index e6a0a8e7fce1..36f52922c9bc 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Status.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Status.h @@ -64,8 +64,6 @@ public: explicit Status(const char *format, ...) __attribute__((format(printf, 2, 3))); - const Status &operator=(const Status &rhs); - ~Status(); // llvm::Error support diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/Stream.h b/contrib/llvm-project/lldb/include/lldb/Utility/Stream.h index 414f92177303..18a16a3461c1 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/Stream.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/Stream.h @@ -213,126 +213,14 @@ public: /// in one statement. Stream &operator<<(char ch); - /// Output a uint8_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint8_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint8_t uval); - - /// Output a uint16_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint16_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint16_t uval); - - /// Output a uint32_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint32_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint32_t uval); - - /// Output a uint64_t \a uval to the stream \a s. - /// - /// \param[in] uval - /// A uint64_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(uint64_t uval); - - /// Output a int8_t \a sval to the stream \a s. - /// - /// \param[in] sval - /// A int8_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(int8_t sval); - - /// Output a int16_t \a sval to the stream \a s. - /// - /// \param[in] sval - /// A int16_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(int16_t sval); - - /// Output a int32_t \a sval to the stream \a s. - /// - /// \param[in] sval - /// A int32_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(int32_t sval); - - /// Output a int64_t \a sval to the stream \a s. - /// - /// \param[in] sval - /// A int64_t value. - /// - /// \return - /// A reference to this class so multiple things can be streamed - /// in one statement. - Stream &operator<<(int64_t sval); - - /// Output an address value to this stream. - /// - /// Put an address \a addr out to the stream with optional \a prefix and \a - /// suffix strings. - /// - /// \param[in] addr - /// An address value. - /// - /// \param[in] addr_size - /// Size in bytes of the address, used for formatting. - /// - /// \param[in] prefix - /// A prefix C string. If nullptr, no prefix will be output. - /// - /// \param[in] suffix - /// A suffix C string. If nullptr, no suffix will be output. - void Address(uint64_t addr, uint32_t addr_size, const char *prefix = nullptr, - const char *suffix = nullptr); - - /// Output an address range to this stream. - /// - /// Put an address range \a lo_addr - \a hi_addr out to the stream with - /// optional \a prefix and \a suffix strings. - /// - /// \param[in] lo_addr - /// The start address of the address range. - /// - /// \param[in] hi_addr - /// The end address of the address range. - /// - /// \param[in] addr_size - /// Size in bytes of the address, used for formatting. - /// - /// \param[in] prefix - /// A prefix C string. If nullptr, no prefix will be output. - /// - /// \param[in] suffix - /// A suffix C string. If nullptr, no suffix will be output. - void AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, - const char *prefix = nullptr, const char *suffix = nullptr); + Stream &operator<<(uint8_t uval) = delete; + Stream &operator<<(uint16_t uval) = delete; + Stream &operator<<(uint32_t uval) = delete; + Stream &operator<<(uint64_t uval) = delete; + Stream &operator<<(int8_t sval) = delete; + Stream &operator<<(int16_t sval) = delete; + Stream &operator<<(int32_t sval) = delete; + Stream &operator<<(int64_t sval) = delete; /// Output a C string to the stream. /// @@ -373,8 +261,8 @@ public: /// Get the current indentation level. /// /// \return - /// The current indentation level as an integer. - int GetIndentLevel() const; + /// The current indentation level. + unsigned GetIndentLevel() const; /// Indent the current line in the stream. /// @@ -388,10 +276,10 @@ public: size_t Indent(llvm::StringRef s); /// Decrement the current indentation level. - void IndentLess(int amount = 2); + void IndentLess(unsigned amount = 2); /// Increment the current indentation level. - void IndentMore(int amount = 2); + void IndentMore(unsigned amount = 2); /// Output an offset value. /// @@ -446,7 +334,7 @@ public: /// /// \param[in] level /// The new indentation level. - void SetIndentLevel(int level); + void SetIndentLevel(unsigned level); /// Output a SLEB128 number to the stream. /// @@ -477,7 +365,7 @@ protected: uint32_t m_addr_size; ///< Size of an address in bytes. lldb::ByteOrder m_byte_order; ///< Byte order to use when encoding scalar types. - int m_indent_level; ///< Indention level. + unsigned m_indent_level; ///< Indention level. std::size_t m_bytes_written = 0; ///< Number of bytes written so far. void _PutHex8(uint8_t uvalue, bool add_prefix); @@ -523,6 +411,54 @@ protected: RawOstreamForward m_forwarder; }; +/// Output an address value to this stream. +/// +/// Put an address \a addr out to the stream with optional \a prefix and \a +/// suffix strings. +/// +/// \param[in] s +/// The output stream. +/// +/// \param[in] addr +/// An address value. +/// +/// \param[in] addr_size +/// Size in bytes of the address, used for formatting. +/// +/// \param[in] prefix +/// A prefix C string. If nullptr, no prefix will be output. +/// +/// \param[in] suffix +/// A suffix C string. If nullptr, no suffix will be output. +void DumpAddress(llvm::raw_ostream &s, uint64_t addr, uint32_t addr_size, + const char *prefix = nullptr, const char *suffix = nullptr); + +/// Output an address range to this stream. +/// +/// Put an address range \a lo_addr - \a hi_addr out to the stream with +/// optional \a prefix and \a suffix strings. +/// +/// \param[in] s +/// The output stream. +/// +/// \param[in] lo_addr +/// The start address of the address range. +/// +/// \param[in] hi_addr +/// The end address of the address range. +/// +/// \param[in] addr_size +/// Size in bytes of the address, used for formatting. +/// +/// \param[in] prefix +/// A prefix C string. If nullptr, no prefix will be output. +/// +/// \param[in] suffix +/// A suffix C string. If nullptr, no suffix will be output. +void DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, uint64_t hi_addr, + uint32_t addr_size, const char *prefix = nullptr, + const char *suffix = nullptr); + } // namespace lldb_private #endif // liblldb_Stream_h_ diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/StringExtractorGDBRemote.h b/contrib/llvm-project/lldb/include/lldb/Utility/StringExtractorGDBRemote.h index cbf6e0c29e8e..715f3cb2541d 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/StringExtractorGDBRemote.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/StringExtractorGDBRemote.h @@ -31,11 +31,6 @@ public: StringExtractorGDBRemote(const char *cstr) : StringExtractor(cstr), m_validator(nullptr) {} - StringExtractorGDBRemote(const StringExtractorGDBRemote &rhs) - : StringExtractor(rhs), m_validator(rhs.m_validator) {} - - ~StringExtractorGDBRemote() override {} - bool ValidateResponse() const; void CopyResponseValidator(const StringExtractorGDBRemote &rhs); diff --git a/contrib/llvm-project/lldb/include/lldb/Utility/VMRange.h b/contrib/llvm-project/lldb/include/lldb/Utility/VMRange.h index 9c2f9d090919..72f859b67582 100644 --- a/contrib/llvm-project/lldb/include/lldb/Utility/VMRange.h +++ b/contrib/llvm-project/lldb/include/lldb/Utility/VMRange.h @@ -10,16 +10,13 @@ #define liblldb_VMRange_h_ #include "lldb/lldb-types.h" +#include "llvm/Support/raw_ostream.h" #include <stddef.h> #include <stdint.h> #include <vector> namespace lldb_private { -class Stream; -} - -namespace lldb_private { // A vm address range. These can represent offsets ranges or actual // addresses. @@ -81,7 +78,7 @@ public: return false; } - void Dump(Stream *s, lldb::addr_t base_addr = 0, + void Dump(llvm::raw_ostream &s, lldb::addr_t base_addr = 0, uint32_t addr_width = 8) const; static bool ContainsValue(const VMRange::collection &coll, diff --git a/contrib/llvm-project/lldb/include/lldb/lldb-enumerations.h b/contrib/llvm-project/lldb/include/lldb/lldb-enumerations.h index 3c80bcffec20..8cbb459ee1ea 100644 --- a/contrib/llvm-project/lldb/include/lldb/lldb-enumerations.h +++ b/contrib/llvm-project/lldb/include/lldb/lldb-enumerations.h @@ -211,10 +211,11 @@ enum DescriptionLevel { /// Script interpreter types. enum ScriptLanguage { - eScriptLanguageNone, + eScriptLanguageNone = 0, eScriptLanguagePython, - eScriptLanguageDefault = eScriptLanguagePython, - eScriptLanguageUnknown + eScriptLanguageLua, + eScriptLanguageUnknown, + eScriptLanguageDefault = eScriptLanguagePython }; /// Register numbering types. @@ -690,6 +691,9 @@ enum SectionType { eSectionTypeDWARFDebugStrDwo, eSectionTypeDWARFDebugStrOffsetsDwo, eSectionTypeDWARFDebugTypesDwo, + eSectionTypeDWARFDebugRngListsDwo, + eSectionTypeDWARFDebugLocDwo, + eSectionTypeDWARFDebugLocListsDwo, }; FLAGS_ENUM(EmulateInstructionOptions){ diff --git a/contrib/llvm-project/lldb/include/lldb/lldb-forward.h b/contrib/llvm-project/lldb/include/lldb/lldb-forward.h index 8315fbb27346..d2371f94f4b8 100644 --- a/contrib/llvm-project/lldb/include/lldb/lldb-forward.h +++ b/contrib/llvm-project/lldb/include/lldb/lldb-forward.h @@ -260,7 +260,6 @@ class TypeEnumMemberImpl; class TypeEnumMemberListImpl; class TypeFormatImpl; class TypeNameSpecifierImpl; -class TypeValidatorImpl; class UUID; class UnixSignals; class Unwind; @@ -461,7 +460,6 @@ typedef std::shared_ptr<lldb_private::TypeNameSpecifierImpl> TypeNameSpecifierImplSP; typedef std::shared_ptr<lldb_private::TypeSummaryImpl> TypeSummaryImplSP; typedef std::shared_ptr<lldb_private::TypeSummaryOptions> TypeSummaryOptionsSP; -typedef std::shared_ptr<lldb_private::TypeValidatorImpl> TypeValidatorImplSP; typedef std::shared_ptr<lldb_private::ScriptedSyntheticChildren> ScriptedSyntheticChildrenSP; typedef std::shared_ptr<lldb_private::UnixSignals> UnixSignalsSP; diff --git a/contrib/llvm-project/lldb/include/lldb/lldb-private-interfaces.h b/contrib/llvm-project/lldb/include/lldb/lldb-private-interfaces.h index 04b78bcc19f8..27a2c4c3f27f 100644 --- a/contrib/llvm-project/lldb/include/lldb/lldb-private-interfaces.h +++ b/contrib/llvm-project/lldb/include/lldb/lldb-private-interfaces.h @@ -82,8 +82,6 @@ typedef bool (*BreakpointHitCallback)(void *baton, typedef bool (*WatchpointHitCallback)(void *baton, StoppointCallbackContext *context, lldb::user_id_t watch_id); -typedef void (*OptionValueChangedCallback)(void *baton, - OptionValue *option_value); typedef bool (*ThreadPlanShouldStopHereCallback)( ThreadPlan *current_plan, Flags &flags, lldb::FrameComparison operation, Status &status, void *baton); |