summaryrefslogtreecommitdiff
path: root/include/lldb/Core
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-08-20 20:51:52 +0000
commit5f29bb8a675e8f96452b632e7129113f7dec850e (patch)
tree3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /include/lldb/Core
parent88c643b6fec27eec436c8d138fee6346e92337d6 (diff)
Notes
Diffstat (limited to 'include/lldb/Core')
-rw-r--r--include/lldb/Core/Address.h184
-rw-r--r--include/lldb/Core/AddressRange.h130
-rw-r--r--include/lldb/Core/AddressResolver.h19
-rw-r--r--include/lldb/Core/AddressResolverFileLine.h18
-rw-r--r--include/lldb/Core/AddressResolverName.h18
-rw-r--r--include/lldb/Core/Architecture.h19
-rw-r--r--include/lldb/Core/ClangForward.h7
-rw-r--r--include/lldb/Core/Communication.h116
-rw-r--r--include/lldb/Core/Debugger.h68
-rw-r--r--include/lldb/Core/Disassembler.h89
-rw-r--r--include/lldb/Core/DumpDataExtractor.h29
-rw-r--r--include/lldb/Core/DumpRegisterValue.h7
-rw-r--r--include/lldb/Core/EmulateInstruction.h47
-rw-r--r--include/lldb/Core/FileLineResolver.h16
-rw-r--r--include/lldb/Core/FileSpecList.h92
-rw-r--r--include/lldb/Core/FormatEntity.h25
-rw-r--r--include/lldb/Core/Highlighter.h19
-rw-r--r--include/lldb/Core/IOHandler.h52
-rw-r--r--include/lldb/Core/IOStreamMacros.h7
-rw-r--r--include/lldb/Core/LoadedModuleInfoList.h7
-rw-r--r--include/lldb/Core/Mangled.h141
-rw-r--r--include/lldb/Core/MappedHash.h7
-rw-r--r--include/lldb/Core/Module.h417
-rw-r--r--include/lldb/Core/ModuleChild.h41
-rw-r--r--include/lldb/Core/ModuleList.h287
-rw-r--r--include/lldb/Core/ModuleSpec.h15
-rw-r--r--include/lldb/Core/Opcode.h16
-rw-r--r--include/lldb/Core/PluginInterface.h7
-rw-r--r--include/lldb/Core/PluginManager.h211
-rw-r--r--include/lldb/Core/RangeMap.h950
-rw-r--r--include/lldb/Core/RichManglingContext.h11
-rw-r--r--include/lldb/Core/STLUtils.h13
-rw-r--r--include/lldb/Core/SearchFilter.h141
-rw-r--r--include/lldb/Core/Section.h53
-rw-r--r--include/lldb/Core/SourceManager.h22
-rw-r--r--include/lldb/Core/StreamAsynchronousIO.h10
-rw-r--r--include/lldb/Core/StreamBuffer.h13
-rw-r--r--include/lldb/Core/StreamFile.h11
-rw-r--r--include/lldb/Core/StructuredDataImpl.h7
-rw-r--r--include/lldb/Core/ThreadSafeDenseMap.h7
-rw-r--r--include/lldb/Core/ThreadSafeDenseSet.h7
-rw-r--r--include/lldb/Core/ThreadSafeSTLMap.h11
-rw-r--r--include/lldb/Core/ThreadSafeSTLVector.h11
-rw-r--r--include/lldb/Core/ThreadSafeValue.h11
-rw-r--r--include/lldb/Core/UniqueCStringMap.h121
-rw-r--r--include/lldb/Core/UserSettingsController.h17
-rw-r--r--include/lldb/Core/Value.h17
-rw-r--r--include/lldb/Core/ValueObject.h64
-rw-r--r--include/lldb/Core/ValueObjectCast.h18
-rw-r--r--include/lldb/Core/ValueObjectChild.h11
-rw-r--r--include/lldb/Core/ValueObjectConstResult.h31
-rw-r--r--include/lldb/Core/ValueObjectConstResultCast.h16
-rw-r--r--include/lldb/Core/ValueObjectConstResultChild.h19
-rw-r--r--include/lldb/Core/ValueObjectConstResultImpl.h15
-rw-r--r--include/lldb/Core/ValueObjectDynamicValue.h15
-rw-r--r--include/lldb/Core/ValueObjectList.h23
-rw-r--r--include/lldb/Core/ValueObjectMemory.h14
-rw-r--r--include/lldb/Core/ValueObjectRegister.h30
-rw-r--r--include/lldb/Core/ValueObjectSyntheticFilter.h21
-rw-r--r--include/lldb/Core/ValueObjectVariable.h24
-rw-r--r--include/lldb/Core/dwarf.h17
61 files changed, 961 insertions, 2901 deletions
diff --git a/include/lldb/Core/Address.h b/include/lldb/Core/Address.h
index a02a0d45a082..080c00e76328 100644
--- a/include/lldb/Core/Address.h
+++ b/include/lldb/Core/Address.h
@@ -1,9 +1,8 @@
//===-- Address.h -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -20,39 +19,17 @@
namespace lldb_private {
class Block;
-}
-namespace lldb_private {
class CompileUnit;
-}
-namespace lldb_private {
class ExecutionContextScope;
-}
-namespace lldb_private {
class Function;
-}
-namespace lldb_private {
class SectionList;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Symbol;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class Target;
-}
-namespace lldb_private {
struct LineEntry;
-}
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-/// @class Address Address.h "lldb/Core/Address.h"
+/// \class Address Address.h "lldb/Core/Address.h"
/// A section + offset based address class.
///
/// The Address class allows addresses to be relative to a section that can
@@ -60,8 +37,8 @@ namespace lldb_private {
/// frameworks) being loaded at different addresses than the addresses found
/// in the object file that represents them on disk. There are currently two
/// types of addresses for a section:
-/// @li file addresses
-/// @li load addresses
+/// \li file addresses
+/// \li load addresses
///
/// File addresses represent the virtual addresses that are in the "on disk"
/// object files. These virtual addresses are converted to be relative to
@@ -79,14 +56,11 @@ namespace lldb_private {
/// load addresses of the main executable and any images (shared libraries)
/// will be resolved/unresolved. When this happens, breakpoints that are in
/// one of these sections can be set/cleared.
-//----------------------------------------------------------------------
class Address {
public:
- //------------------------------------------------------------------
/// Dump styles allow the Address::Dump(Stream *,DumpStyle) const function
/// to display Address contents in a variety of ways.
- //------------------------------------------------------------------
- typedef enum {
+ enum DumpStyle {
DumpStyleInvalid, ///< Invalid dump style
DumpStyleSectionNameOffset, ///< Display as the section name + offset.
///< \code
@@ -102,7 +76,7 @@ public:
/// // 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).
+ /// module name prepended (if any).
///< \code
/// // address for printf in libSystem.B.dylib as a file address
/// libSystem.B.dylib[0x000000000005dcff] \endcode
@@ -111,54 +85,48 @@ public:
/// // 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
+ /// 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).
DumpStyleResolvedDescriptionNoModule,
DumpStyleResolvedDescriptionNoFunctionArguments,
DumpStyleNoFunctionName, ///< Elide the function name; display an offset
- ///into the current function.
+ /// into the current function.
///< Used primarily in disassembly symbolication
DumpStyleDetailedSymbolContext, ///< Detailed symbol context information for
- ///an address for all symbol
+ /// an address for all symbol
///< context members.
DumpStyleResolvedPointerDescription ///< Dereference a pointer at the
- ///current address and then lookup the
+ /// current address and then lookup the
///< dereferenced address using DumpStyleResolvedDescription
- } DumpStyle;
+ };
- //------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL) and an invalid offset
/// (LLDB_INVALID_ADDRESS).
- //------------------------------------------------------------------
Address() : m_section_wp(), m_offset(LLDB_INVALID_ADDRESS) {}
- //------------------------------------------------------------------
/// Copy constructor
///
/// Makes a copy of the another Address object \a rhs.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// A const Address object reference to copy.
- //------------------------------------------------------------------
Address(const Address &rhs)
: m_section_wp(rhs.m_section_wp), m_offset(rhs.m_offset) {}
- //------------------------------------------------------------------
/// Construct with a section pointer and offset.
///
/// Initialize the address with the supplied \a section and \a offset.
///
- /// @param[in] section
+ /// \param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
- /// @param[in] offset
+ /// \param[in] offset
/// The offset in bytes into \a section.
- //------------------------------------------------------------------
Address(const lldb::SectionSP &section_sp, lldb::addr_t offset)
: m_section_wp(), // Don't init with section_sp in case section_sp is
// invalid (the weak_ptr will throw)
@@ -167,63 +135,53 @@ public:
m_section_wp = section_sp;
}
- //------------------------------------------------------------------
/// Construct with a virtual address and section list.
///
/// Initialize and resolve the address with the supplied virtual address \a
/// file_addr.
///
- /// @param[in] file_addr
+ /// \param[in] file_addr
/// A virtual file address.
///
- /// @param[in] section_list
+ /// \param[in] section_list
/// A list of sections, one of which may contain the \a file_addr.
- //------------------------------------------------------------------
Address(lldb::addr_t file_addr, const SectionList *section_list);
Address(lldb::addr_t abs_addr);
-//------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the address value from another Address object \a rhs into \a this
/// object.
///
-/// @param[in] rhs
+/// \param[in] rhs
/// A const Address object reference to copy.
///
-/// @return
+/// \return
/// A const Address object reference to \a this.
-//------------------------------------------------------------------
-#ifndef SWIG
const Address &operator=(const Address &rhs);
-#endif
- //------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL) and an invalid offset
/// (LLDB_INVALID_ADDRESS).
- //------------------------------------------------------------------
void Clear() {
m_section_wp.reset();
m_offset = LLDB_INVALID_ADDRESS;
}
- //------------------------------------------------------------------
/// Compare two Address objects.
///
- /// @param[in] lhs
+ /// \param[in] lhs
/// The Left Hand Side const Address object reference.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// The Right Hand Side const Address object reference.
///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
+ /// \return
+ /// \li -1 if lhs < rhs
+ /// \li 0 if lhs == rhs
+ /// \li 1 if lhs > rhs
static int CompareFileAddress(const Address &lhs, const Address &rhs);
static int CompareLoadAddress(const Address &lhs, const Address &rhs,
@@ -242,51 +200,46 @@ public:
}
};
- //------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
/// \a s. There are many ways to display a section offset based address, and
/// \a style lets the user choose.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
///
- /// @param[in] style
+ /// \param[in] style
/// The display style for the address.
///
- /// @param[in] fallback_style
+ /// \param[in] fallback_style
/// The display style for the address.
///
- /// @return
+ /// \return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
- /// @see Address::DumpStyle
- //------------------------------------------------------------------
+ /// \see Address::DumpStyle
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style,
DumpStyle fallback_style = DumpStyleInvalid,
uint32_t addr_byte_size = UINT32_MAX) const;
AddressClass GetAddressClass() const;
- //------------------------------------------------------------------
/// Get the file address.
///
/// If an address comes from a file on disk that has section relative
/// addresses, then it has a virtual address that is relative to unique
/// section in the object file.
///
- /// @return
+ /// \return
/// The valid file virtual address, or LLDB_INVALID_ADDRESS if
/// the address doesn't have a file virtual address (image is
/// from memory only with no representation on disk).
- //------------------------------------------------------------------
lldb::addr_t GetFileAddress() const;
- //------------------------------------------------------------------
/// Get the load address.
///
/// If an address comes from a file on disk that has section relative
@@ -296,13 +249,11 @@ public:
/// loaded/unloaded. If a section is loaded, then the load address can be
/// resolved.
///
- /// @return
+ /// \return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
- //------------------------------------------------------------------
lldb::addr_t GetLoadAddress(Target *target) const;
- //------------------------------------------------------------------
/// Get the load address as a callable code load address.
///
/// This function will first resolve its address to a load address. Then, if
@@ -312,14 +263,12 @@ public:
/// target) that are required when changing the program counter to setting a
/// return address.
///
- /// @return
+ /// \return
/// The valid load virtual address, or LLDB_INVALID_ADDRESS if
/// the address is currently not loaded.
- //------------------------------------------------------------------
lldb::addr_t GetCallableLoadAddress(Target *target,
bool is_indirect = false) const;
- //------------------------------------------------------------------
/// Get the load address as an opcode load address.
///
/// This function will first resolve its address to a load address. Then, if
@@ -331,25 +280,21 @@ public:
/// special purposes. The result of this function can be used to safely
/// write a software breakpoint trap to memory.
///
- /// @return
+ /// \return
/// The valid load virtual address with extra callable bits
/// removed, or LLDB_INVALID_ADDRESS if the address is currently
/// not loaded.
- //------------------------------------------------------------------
lldb::addr_t GetOpcodeLoadAddress(
Target *target,
AddressClass addr_class = AddressClass::eInvalid) const;
- //------------------------------------------------------------------
/// Get the section relative offset value.
///
- /// @return
+ /// \return
/// The current offset, or LLDB_INVALID_ADDRESS if this address
/// doesn't contain a valid offset.
- //------------------------------------------------------------------
lldb::addr_t GetOffset() const { return m_offset; }
- //------------------------------------------------------------------
/// Check if an address is section offset.
///
/// When converting a virtual file or load address into a section offset
@@ -358,49 +303,41 @@ public:
/// returns true if the current value contained in this object is section
/// offset based.
///
- /// @return
+ /// \return
/// Returns \b true if the address has a valid section and
/// offset, \b false otherwise.
- //------------------------------------------------------------------
bool IsSectionOffset() const {
return IsValid() && (GetSection().get() != nullptr);
}
- //------------------------------------------------------------------
/// Check if the object state is valid.
///
/// A valid Address object contains either a section pointer and
/// offset (for section offset based addresses), or just a valid offset
/// (for absolute addresses that have no section).
///
- /// @return
+ /// \return
/// Returns \b true if the offset is valid, \b false
/// otherwise.
- //------------------------------------------------------------------
bool IsValid() const { return m_offset != LLDB_INVALID_ADDRESS; }
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
- //------------------------------------------------------------------
size_t MemorySize() const;
- //------------------------------------------------------------------
/// Resolve a file virtual address using a section list.
///
/// Given a list of sections, attempt to resolve \a addr as an offset into
/// one of the file sections.
///
- /// @return
+ /// \return
/// Returns \b true if \a addr was able to be resolved, \b false
/// otherwise.
- //------------------------------------------------------------------
bool ResolveAddressUsingFileSections(lldb::addr_t addr,
const SectionList *sections);
- //------------------------------------------------------------------
/// Set the address to represent \a load_addr.
///
/// The address will attempt to find a loaded section within \a target that
@@ -408,25 +345,24 @@ public:
/// valid section and offset. Else this address object will have no section
/// (NULL) and the offset will be \a load_addr.
///
- /// @param[in] load_addr
+ /// \param[in] load_addr
/// A load address from a current process.
///
- /// @param[in] target
+ /// \param[in] target
/// The target to use when trying resolve the address into
/// a section + offset. The Target's SectionLoadList object
/// is used to resolve the address.
///
- /// @param[in] allow_section_end
+ /// \param[in] allow_section_end
/// If true, treat an address pointing to the end of the module as
/// belonging to that module.
///
- /// @return
+ /// \return
/// Returns \b true if the load address was resolved to be
/// section/offset, \b false otherwise. It is often ok for an
- /// address no not resolve to a section in a module, this often
+ /// address to not resolve to a section in a module, this often
/// happens for JIT'ed code, or any load addresses on the stack
/// or heap.
- //------------------------------------------------------------------
bool SetLoadAddress(lldb::addr_t load_addr, Target *target,
bool allow_section_end = false);
@@ -437,34 +373,28 @@ public:
bool SetCallableLoadAddress(lldb::addr_t load_addr, Target *target);
- //------------------------------------------------------------------
/// Get accessor for the module for this address.
///
- /// @return
+ /// \return
/// Returns the Module pointer that this address is an offset
/// in, or NULL if this address doesn't belong in a module, or
/// isn't resolved yet.
- //------------------------------------------------------------------
lldb::ModuleSP GetModule() const;
- //------------------------------------------------------------------
/// Get const accessor for the section.
///
- /// @return
+ /// \return
/// Returns the const lldb::Section pointer that this address is an
/// offset in, or NULL if this address is absolute.
- //------------------------------------------------------------------
lldb::SectionSP GetSection() const { return m_section_wp.lock(); }
- //------------------------------------------------------------------
/// Set accessor for the offset.
///
- /// @param[in] offset
+ /// \param[in] offset
/// A new offset value for this object.
///
- /// @return
+ /// \return
/// Returns \b true if the offset changed, \b false otherwise.
- //------------------------------------------------------------------
bool SetOffset(lldb::addr_t offset) {
bool changed = m_offset != offset;
m_offset = offset;
@@ -484,21 +414,18 @@ public:
return false;
}
- //------------------------------------------------------------------
/// Set accessor for the section.
///
- /// @param[in] section
+ /// \param[in] section
/// A new lldb::Section pointer to use as the section base. Can
/// be NULL for absolute addresses that are not relative to
/// any section.
- //------------------------------------------------------------------
void SetSection(const lldb::SectionSP &section_sp) {
m_section_wp = section_sp;
}
void ClearSection() { m_section_wp.reset(); }
- //------------------------------------------------------------------
/// Reconstruct a symbol context from an address.
///
/// This class doesn't inherit from SymbolContextScope because many address
@@ -506,8 +433,7 @@ public:
/// can reconstruct their symbol context by looking up the address in the
/// module found in the section.
///
- /// @see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
- //------------------------------------------------------------------
+ /// \see SymbolContextScope::CalculateSymbolContext(SymbolContext*)
uint32_t CalculateSymbolContext(SymbolContext *sc,
lldb::SymbolContextItem resolve_scope =
lldb::eSymbolContextEverything) const;
@@ -524,33 +450,26 @@ public:
bool CalculateSymbolContextLineEntry(LineEntry &line_entry) const;
- //------------------------------------------------------------------
// Returns true if the section should be valid, but isn't because the shared
// pointer to the section can't be reconstructed from a weak pointer that
// contains a valid weak reference to a section. Returns false if the section
// weak pointer has no reference to a section, or if the section is still
// valid
- //------------------------------------------------------------------
bool SectionWasDeleted() const;
protected:
- //------------------------------------------------------------------
// Member variables.
- //------------------------------------------------------------------
lldb::SectionWP m_section_wp; ///< The section for the address, can be NULL.
lldb::addr_t m_offset; ///< Offset into section if \a m_section_wp is valid...
- //------------------------------------------------------------------
// Returns true if the m_section_wp once had a reference to a valid section
// shared pointer, but no longer does. This can happen if we have an address
// from a module that gets unloaded and deleted. This function should only be
// called if GetSection() returns an empty shared pointer and you want to
// know if this address used to have a valid section.
- //------------------------------------------------------------------
bool SectionWasDeletedPrivate() const;
};
-//----------------------------------------------------------------------
// NOTE: Be careful using this operator. It can correctly compare two
// addresses from the same Module correctly. It can't compare two addresses
// from different modules in any meaningful way, but it will compare the module
@@ -562,7 +481,6 @@ protected:
// address results to make much sense
//
// This basically lets Address objects be used in ordered collection classes.
-//----------------------------------------------------------------------
bool operator<(const Address &lhs, const Address &rhs);
bool operator>(const Address &lhs, const Address &rhs);
bool operator==(const Address &lhs, const Address &rhs);
diff --git a/include/lldb/Core/AddressRange.h b/include/lldb/Core/AddressRange.h
index e3c820782aaf..4a019bfcfc3f 100644
--- a/include/lldb/Core/AddressRange.h
+++ b/include/lldb/Core/AddressRange.h
@@ -1,9 +1,8 @@
//===-- AddressRange.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -18,179 +17,159 @@
namespace lldb_private {
class SectionList;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Target;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
+/// \class AddressRange AddressRange.h "lldb/Core/AddressRange.h"
/// A section + offset based address range class.
-//----------------------------------------------------------------------
class AddressRange {
public:
- //------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with a invalid section (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS), and zero byte size.
- //------------------------------------------------------------------
AddressRange();
- //------------------------------------------------------------------
/// Construct with a section pointer, offset, and byte_size.
///
/// Initialize the address with the supplied \a section, \a offset and \a
/// byte_size.
///
- /// @param[in] section
+ /// \param[in] section
/// A section pointer to a valid lldb::Section, or NULL if the
/// address doesn't have a section or will get resolved later.
///
- /// @param[in] offset
+ /// \param[in] offset
/// The offset in bytes into \a section.
///
- /// @param[in] byte_size
+ /// \param[in] byte_size
/// The size in bytes of the address range.
- //------------------------------------------------------------------
AddressRange(const lldb::SectionSP &section, lldb::addr_t offset,
lldb::addr_t byte_size);
- //------------------------------------------------------------------
/// Construct with a virtual address, section list and byte size.
///
/// Initialize and resolve the address with the supplied virtual address \a
/// file_addr, and byte size \a byte_size.
///
- /// @param[in] file_addr
+ /// \param[in] file_addr
/// A virtual address.
///
- /// @param[in] byte_size
+ /// \param[in] byte_size
/// The size in bytes of the address range.
///
- /// @param[in] section_list
+ /// \param[in] section_list
/// A list of sections, one of which may contain the \a vaddr.
- //------------------------------------------------------------------
AddressRange(lldb::addr_t file_addr, lldb::addr_t byte_size,
const SectionList *section_list = nullptr);
- //------------------------------------------------------------------
/// Construct with a Address object address and byte size.
///
/// Initialize by copying the section offset address in \a so_addr, and
/// setting the byte size to \a byte_size.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object.
///
- /// @param[in] byte_size
+ /// \param[in] byte_size
/// The size in bytes of the address range.
- //------------------------------------------------------------------
AddressRange(const Address &so_addr, lldb::addr_t byte_size);
- //------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual in case this class is subclassed.
- //------------------------------------------------------------------
~AddressRange();
- //------------------------------------------------------------------
/// Clear the object's state.
///
/// Sets the section to an invalid value (NULL), an invalid offset
/// (LLDB_INVALID_ADDRESS) and a zero byte size.
- //------------------------------------------------------------------
void Clear();
- //------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object reference.
///
- /// @return
+ /// \return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
- //------------------------------------------------------------------
// bool
// Contains (const Address &so_addr) const;
- //------------------------------------------------------------------
/// Check if a section offset address is contained in this range.
///
- /// @param[in] so_addr_ptr
+ /// \param[in] so_addr_ptr
/// A section offset address object pointer.
///
- /// @return
+ /// \return
/// Returns \b true if \a so_addr is contained in this range,
/// \b false otherwise.
- //------------------------------------------------------------------
// bool
// Contains (const Address *so_addr_ptr) const;
- //------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a file address
/// is contained within this object's file address range.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object reference.
///
- /// @return
+ /// \return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable file address values and \a so_addr is contained
/// in the address range, \b false otherwise.
- //------------------------------------------------------------------
bool ContainsFileAddress(const Address &so_addr) const;
- //------------------------------------------------------------------
/// Check if the resolved file address \a file_addr is contained within this
/// object's file address range.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object reference.
///
- /// @return
+ /// \return
/// Returns \b true if both \a this has a resolvable file
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
- //------------------------------------------------------------------
bool ContainsFileAddress(lldb::addr_t file_addr) const;
- //------------------------------------------------------------------
/// Check if a section offset \a so_addr when represented as a load address
/// is contained within this object's load address range.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object reference.
///
- /// @return
+ /// \return
/// Returns \b true if both \a this and \a so_addr have
/// resolvable load address values and \a so_addr is contained
/// in the address range, \b false otherwise.
- //------------------------------------------------------------------
bool ContainsLoadAddress(const Address &so_addr, Target *target) const;
- //------------------------------------------------------------------
/// Check if the resolved load address \a load_addr is contained within this
/// object's load address range.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A section offset address object reference.
///
- /// @return
+ /// \return
/// Returns \b true if both \a this has a resolvable load
/// address value and \a so_addr is contained in the address
/// range, \b false otherwise.
- //------------------------------------------------------------------
bool ContainsLoadAddress(lldb::addr_t load_addr, Target *target) const;
//------------------------------------------------------------------
+ /// Extends this range with \b rhs_range if it overlaps this range on the
+ /// right side. The range overlaps on the right side if the base address
+ /// of \b rhs_range lies within this range or if it's contiguous on its
+ /// right side.
+ ///
+ /// @param[in] rhs_range
+ /// The range to extend at the right side.
+ ///
+ /// @return
+ /// Returns \b true if this range was extended, \b false otherwise.
+ //------------------------------------------------------------------
+ bool Extend(const AddressRange &rhs_range);
+
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
@@ -198,25 +177,23 @@ public:
/// range, and \a style lets the user choose how the base address gets
/// displayed.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
///
- /// @param[in] style
+ /// \param[in] style
/// The display style for the address.
///
- /// @return
+ /// \return
/// Returns \b true if the address was able to be displayed.
/// File and load addresses may be unresolved and it may not be
/// possible to display a valid value, \b false will be returned
/// in such cases.
///
- /// @see Address::DumpStyle
- //------------------------------------------------------------------
+ /// \see Address::DumpStyle
bool
Dump(Stream *s, Target *target, Address::DumpStyle style,
Address::DumpStyle fallback_style = Address::DumpStyleInvalid) const;
- //------------------------------------------------------------------
/// Dump a debug description of this object to a Stream.
///
/// Dump a debug description of the contents of this object to the supplied
@@ -225,59 +202,46 @@ public:
/// The debug description contains verbose internal state such and pointer
/// values, reference counts, etc.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //------------------------------------------------------------------
void DumpDebug(Stream *s) const;
- //------------------------------------------------------------------
/// Get accessor for the base address of the range.
///
- /// @return
+ /// \return
/// A reference to the base address object.
- //------------------------------------------------------------------
Address &GetBaseAddress() { return m_base_addr; }
- //------------------------------------------------------------------
/// Get const accessor for the base address of the range.
///
- /// @return
+ /// \return
/// A const reference to the base address object.
- //------------------------------------------------------------------
const Address &GetBaseAddress() const { return m_base_addr; }
- //------------------------------------------------------------------
/// Get accessor for the byte size of this range.
///
- /// @return
+ /// \return
/// The size in bytes of this address range.
- //------------------------------------------------------------------
lldb::addr_t GetByteSize() const { return m_byte_size; }
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
- //------------------------------------------------------------------
size_t MemorySize() const {
// Noting special for the memory size of a single AddressRange object, it
// is just the size of itself.
return sizeof(AddressRange);
}
- //------------------------------------------------------------------
/// Set accessor for the byte size of this range.
///
- /// @param[in] byte_size
+ /// \param[in] byte_size
/// The new size in bytes of this address range.
- //------------------------------------------------------------------
void SetByteSize(lldb::addr_t byte_size) { m_byte_size = byte_size; }
protected:
- //------------------------------------------------------------------
// Member variables
- //------------------------------------------------------------------
Address m_base_addr; ///< The section offset base address of this range.
lldb::addr_t m_byte_size; ///< The size in bytes of this address range.
};
diff --git a/include/lldb/Core/AddressResolver.h b/include/lldb/Core/AddressResolver.h
index 32751d64d6b4..cd95c7c31cd6 100644
--- a/include/lldb/Core/AddressResolver.h
+++ b/include/lldb/Core/AddressResolver.h
@@ -1,9 +1,8 @@
//===-- AddressResolver.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,29 +18,21 @@
namespace lldb_private {
class ModuleList;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
+/// \class AddressResolver AddressResolver.h "lldb/Core/AddressResolver.h"
/// This class works with SearchFilter to resolve function names and source
/// file locations to their concrete addresses.
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
/// General Outline:
/// The AddressResolver is a Searcher. In that protocol, the SearchFilter
/// asks the question "At what depth of the symbol context descent do you want
/// your callback to get called?" of the filter. The resolver answers this
/// question (in the GetDepth method) and provides the resolution callback.
-//----------------------------------------------------------------------
class AddressResolver : public Searcher {
public:
- typedef enum { Exact, Regexp, Glob } MatchType;
+ enum MatchType { Exact, Regexp, Glob };
AddressResolver();
diff --git a/include/lldb/Core/AddressResolverFileLine.h b/include/lldb/Core/AddressResolverFileLine.h
index bee72245ee6b..b98e7d4c6338 100644
--- a/include/lldb/Core/AddressResolverFileLine.h
+++ b/include/lldb/Core/AddressResolverFileLine.h
@@ -1,9 +1,8 @@
//===-- AddressResolverFileLine.h -------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,22 +18,13 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class AddressResolverFileLine AddressResolverFileLine.h
+/// \class AddressResolverFileLine AddressResolverFileLine.h
/// "lldb/Core/AddressResolverFileLine.h" This class finds address for source
/// file and line. Optionally, it will look for inlined instances of the file
/// and line specification.
-//----------------------------------------------------------------------
class AddressResolverFileLine : public AddressResolver {
public:
diff --git a/include/lldb/Core/AddressResolverName.h b/include/lldb/Core/AddressResolverName.h
index b4291938b290..ad14ef6daeb1 100644
--- a/include/lldb/Core/AddressResolverName.h
+++ b/include/lldb/Core/AddressResolverName.h
@@ -1,9 +1,8 @@
//===-- AddressResolverName.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -18,21 +17,12 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class AddressResolverName AddressResolverName.h
+/// \class AddressResolverName AddressResolverName.h
/// "lldb/Core/AddressResolverName.h" This class finds addresses for a given
/// function name, either by exact match or by regular expression.
-//----------------------------------------------------------------------
class AddressResolverName : public AddressResolver {
public:
diff --git a/include/lldb/Core/Architecture.h b/include/lldb/Core/Architecture.h
index 20537d67b02c..d8dbbb4f540f 100644
--- a/include/lldb/Core/Architecture.h
+++ b/include/lldb/Core/Architecture.h
@@ -1,9 +1,8 @@
//===-- Architecture.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -17,9 +16,8 @@ namespace lldb_private {
class Architecture : public PluginInterface {
public:
Architecture() = default;
- virtual ~Architecture() = default;
+ ~Architecture() override = default;
- //------------------------------------------------------------------
/// This is currently intended to handle cases where a
/// program stops at an instruction that won't get executed and it
/// allows the stop reason, like "breakpoint hit", to be replaced
@@ -30,10 +28,8 @@ public:
/// executed and therefore it wouldn't be correct to show the program
/// stopped at the current PC. The code is generic and applies to all
/// ARM CPUs.
- //------------------------------------------------------------------
virtual void OverrideStopInfo(Thread &thread) const = 0;
- //------------------------------------------------------------------
/// This method is used to get the number of bytes that should be
/// skipped, from function start address, to reach the first
/// instruction after the prologue. If overrode, it must return
@@ -49,12 +45,10 @@ public:
/// be compared with current address, in order to find out the
/// number of bytes that should be skipped, in case we are stopped
/// at either function entry point.
- //------------------------------------------------------------------
virtual size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const {
return 0;
}
- //------------------------------------------------------------------
/// Adjust function breakpoint address, if needed. In some cases,
/// the function start address is not the right place to set the
/// breakpoint, specially in functions with multiple entry points.
@@ -63,12 +57,10 @@ public:
/// both a global and a local entry point. In this case, the
/// breakpoint is adjusted to the first function address reached
/// by both entry points.
- //------------------------------------------------------------------
virtual void AdjustBreakpointAddress(const Symbol &func,
Address &addr) const {}
- //------------------------------------------------------------------
/// Get \a load_addr as a callable code load address for this target
///
/// Take \a load_addr and potentially add any address bits that are
@@ -78,13 +70,11 @@ public:
/// adjustment will always happen. If it is set to an address class
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
/// returned.
- //------------------------------------------------------------------
virtual lldb::addr_t GetCallableLoadAddress(
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
return addr;
}
- //------------------------------------------------------------------
/// Get \a load_addr as an opcode for this target.
///
/// Take \a load_addr and potentially strip any address bits that are
@@ -95,7 +85,6 @@ public:
/// adjustment will always happen. If it is set to an address class
/// that doesn't have code in it, LLDB_INVALID_ADDRESS will be
/// returned.
- //------------------------------------------------------------------
virtual lldb::addr_t GetOpcodeLoadAddress(
lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const {
diff --git a/include/lldb/Core/ClangForward.h b/include/lldb/Core/ClangForward.h
index 3fc12a555301..6b24b47c8a96 100644
--- a/include/lldb/Core/ClangForward.h
+++ b/include/lldb/Core/ClangForward.h
@@ -1,9 +1,8 @@
//===-- ClangForward.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/Communication.h b/include/lldb/Core/Communication.h
index f129b8f879d0..901b8fdb8c8b 100644
--- a/include/lldb/Core/Communication.h
+++ b/include/lldb/Core/Communication.h
@@ -1,9 +1,8 @@
//===-- Communication.h -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -28,18 +27,10 @@
namespace lldb_private {
class Connection;
-}
-namespace lldb_private {
class ConstString;
-}
-namespace lldb_private {
class Status;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class Communication Communication.h "lldb/Core/Communication.h" An
+/// \class Communication Communication.h "lldb/Core/Communication.h" An
/// abstract communications class.
///
/// Communication is an class that handles data communication between two data
@@ -60,8 +51,8 @@ namespace lldb_private {
/// "eBroadcastBit" below).
///
/// There are two modes in which communications can occur:
-/// @li single-threaded
-/// @li multi-threaded
+/// \li single-threaded
+/// \li multi-threaded
///
/// In single-threaded mode, all reads and writes happen synchronously on the
/// calling thread.
@@ -90,7 +81,6 @@ namespace lldb_private {
/// eBroadcastBitReadThreadDidExit event will be broadcast. Clients can also
/// post a \b eBroadcastBitReadThreadShouldExit event to this object which
/// will cause the read thread to exit.
-//----------------------------------------------------------------------
class Communication : public Broadcaster {
public:
FLAGS_ANONYMOUS_ENUM(){
@@ -116,72 +106,61 @@ public:
typedef void (*ReadThreadBytesReceived)(void *baton, const void *src,
size_t src_len);
- //------------------------------------------------------------------
/// Construct the Communication object with the specified name for the
/// Broadcaster that this object inherits from.
///
- /// @param[in] broadcaster_name
+ /// \param[in] broadcaster_name
/// The name of the broadcaster object. This name should be as
/// complete as possible to uniquely identify this object. The
/// broadcaster name can be updated after the connect function
/// is called.
- //------------------------------------------------------------------
Communication(const char *broadcaster_name);
- //------------------------------------------------------------------
/// Destructor.
///
/// The destructor is virtual since this class gets subclassed.
- //------------------------------------------------------------------
~Communication() override;
void Clear();
- //------------------------------------------------------------------
/// Connect using the current connection by passing \a url to its connect
/// function. string.
///
- /// @param[in] url
+ /// \param[in] url
/// A string that contains all information needed by the
/// subclass to connect to another client.
///
- /// @return
+ /// \return
/// \b True if the connect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
- /// @see Status& Communication::GetError ();
- /// @see bool Connection::Connect (const char *url);
- //------------------------------------------------------------------
+ /// \see Status& Communication::GetError ();
+ /// \see bool Connection::Connect (const char *url);
lldb::ConnectionStatus Connect(const char *url, Status *error_ptr);
- //------------------------------------------------------------------
/// Disconnect the communications connection if one is currently connected.
///
- /// @return
+ /// \return
/// \b True if the disconnect succeeded, \b false otherwise. The
/// internal error object should be filled in with an
/// appropriate value based on the result of this function.
///
- /// @see Status& Communication::GetError ();
- /// @see bool Connection::Disconnect ();
- //------------------------------------------------------------------
+ /// \see Status& Communication::GetError ();
+ /// \see bool Connection::Disconnect ();
lldb::ConnectionStatus Disconnect(Status *error_ptr = nullptr);
- //------------------------------------------------------------------
/// Check if the connection is valid.
///
- /// @return
+ /// \return
/// \b True if this object is currently connected, \b false
/// otherwise.
- //------------------------------------------------------------------
bool IsConnected() const;
bool HasConnection() const;
lldb_private::Connection *GetConnection() { return m_connection_sp.get(); }
- //------------------------------------------------------------------
/// Read bytes from the current connection.
///
/// If no read thread is running, this function call the connection's
@@ -194,46 +173,42 @@ public:
/// event. If this function consumes all of the bytes in the cache, it will
/// reset the \a eBroadcastBitReadThreadGotBytes event bit.
///
- /// @param[in] dst
+ /// \param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
- /// @param[in] dst_len
+ /// \param[in] dst_len
/// The number of bytes to attempt to read, and also the max
/// number of bytes that can be placed into \a dst.
///
- /// @param[in] timeout
+ /// \param[in] timeout
/// A timeout value or llvm::None for no timeout.
///
- /// @return
+ /// \return
/// The number of bytes actually read.
///
- /// @see size_t Connection::Read (void *, size_t);
- //------------------------------------------------------------------
+ /// \see size_t Connection::Read (void *, size_t);
size_t Read(void *dst, size_t dst_len, const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Status *error_ptr);
- //------------------------------------------------------------------
/// The actual write function that attempts to write to the communications
/// protocol.
///
/// Subclasses must override this function.
///
- /// @param[in] src
+ /// \param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
- /// @param[in] src_len
+ /// \param[in] src_len
/// The number of bytes to attempt to write, and also the
/// number of bytes are currently available in \a src.
///
- /// @return
+ /// \return
/// The number of bytes actually Written.
- //------------------------------------------------------------------
size_t Write(const void *src, size_t src_len, lldb::ConnectionStatus &status,
Status *error_ptr);
- //------------------------------------------------------------------
/// Sets the connection that it to be used by this class.
///
/// By making a communication class that uses different connections it
@@ -241,15 +216,13 @@ public:
/// connection without any interruption to the client. It also allows the
/// Communication class to be subclassed for packet based communication.
///
- /// @param[in] connection
+ /// \param[in] connection
/// A connection that this class will own and destroy.
///
- /// @see
+ /// \see
/// class Connection
- //------------------------------------------------------------------
void SetConnection(Connection *connection);
- //------------------------------------------------------------------
/// Starts a read thread whose sole purpose it to read bytes from the
/// current connection. This function will call connection's read function:
///
@@ -265,60 +238,51 @@ public:
/// default action of caching the bytes and broadcasting a \b
/// eBroadcastBitReadThreadGotBytes event.
///
- /// @return
+ /// \return
/// \b True if the read thread was successfully started, \b
/// false otherwise.
///
- /// @see size_t Connection::Read (void *, size_t);
- /// @see void Communication::AppendBytesToCache (const uint8_t * bytes,
+ /// \see size_t Connection::Read (void *, size_t);
+ /// \see void Communication::AppendBytesToCache (const uint8_t * bytes,
/// size_t len, bool broadcast);
- //------------------------------------------------------------------
virtual bool StartReadThread(Status *error_ptr = nullptr);
- //------------------------------------------------------------------
/// Stops the read thread by cancelling it.
///
- /// @return
+ /// \return
/// \b True if the read thread was successfully canceled, \b
/// false otherwise.
- //------------------------------------------------------------------
virtual bool StopReadThread(Status *error_ptr = nullptr);
virtual bool JoinReadThread(Status *error_ptr = nullptr);
- //------------------------------------------------------------------
/// Checks if there is a currently running read thread.
///
- /// @return
+ /// \return
/// \b True if the read thread is running, \b false otherwise.
- //------------------------------------------------------------------
bool ReadThreadIsRunning();
- //------------------------------------------------------------------
/// The static read thread function. This function will call the "DoRead"
/// function continuously and wait for data to become available. When data
/// is received it will append the available data to the internal cache and
/// broadcast a \b eBroadcastBitReadThreadGotBytes event.
///
- /// @param[in] comm_ptr
+ /// \param[in] comm_ptr
/// A pointer to an instance of this class.
///
- /// @return
+ /// \return
/// \b NULL.
///
- /// @see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
- //------------------------------------------------------------------
+ /// \see void Communication::ReadThreadGotBytes (const uint8_t *, size_t);
static lldb::thread_result_t ReadThread(lldb::thread_arg_t comm_ptr);
void SetReadThreadBytesReceivedCallback(ReadThreadBytesReceived callback,
void *callback_baton);
- //------------------------------------------------------------------
/// Wait for the read thread to process all outstanding data.
///
/// After this function returns, the read thread has processed all data that
/// has been waiting in the Connection queue.
///
- //------------------------------------------------------------------
void SynchronizeWithReadThread();
static const char *ConnectionStatusAsCString(lldb::ConnectionStatus status);
@@ -355,7 +319,6 @@ protected:
const Timeout<std::micro> &timeout,
lldb::ConnectionStatus &status, Status *error_ptr);
- //------------------------------------------------------------------
/// Append new bytes that get read from the read thread into the internal
/// object byte cache. This will cause a \b eBroadcastBitReadThreadGotBytes
/// event to be broadcast if \a broadcast is true.
@@ -368,34 +331,31 @@ protected:
/// of the \a eBroadcastBitReadThreadGotBytes event by setting \a broadcast
/// to false.
///
- /// @param[in] src
+ /// \param[in] src
/// A source buffer that must be at least \a src_len bytes
/// long.
///
- /// @param[in] src_len
+ /// \param[in] src_len
/// The number of bytes to append to the cache.
- //------------------------------------------------------------------
virtual void AppendBytesToCache(const uint8_t *src, size_t src_len,
bool broadcast,
lldb::ConnectionStatus status);
- //------------------------------------------------------------------
/// Get any available bytes from our data cache. If this call empties the
/// data cache, the \b eBroadcastBitReadThreadGotBytes event will be reset
/// to signify no more bytes are available.
///
- /// @param[in] dst
+ /// \param[in] dst
/// A destination buffer that must be at least \a dst_len bytes
/// long.
///
- /// @param[in] dst_len
+ /// \param[in] dst_len
/// The number of bytes to attempt to read from the cache,
/// and also the max number of bytes that can be placed into
/// \a dst.
///
- /// @return
+ /// \return
/// The number of bytes extracted from the data cache.
- //------------------------------------------------------------------
size_t GetCachedBytes(void *dst, size_t dst_len);
private:
diff --git a/include/lldb/Core/Debugger.h b/include/lldb/Core/Debugger.h
index 09f75ef0f8c6..8e608717a801 100644
--- a/include/lldb/Core/Debugger.h
+++ b/include/lldb/Core/Debugger.h
@@ -1,9 +1,8 @@
//===-- Debugger.h ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -46,36 +45,26 @@
#include <stddef.h>
#include <stdio.h>
-namespace lldb_private {
-class Address;
+namespace llvm {
+class raw_ostream;
}
+
namespace lldb_private {
+class Address;
class CommandInterpreter;
-}
-namespace lldb_private {
class Process;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class Target;
-}
-namespace llvm {
-class raw_ostream;
-}
-namespace lldb_private {
+namespace repro {
+class DataRecorder;
+}
-//----------------------------------------------------------------------
-/// @class Debugger Debugger.h "lldb/Core/Debugger.h"
+/// \class Debugger Debugger.h "lldb/Core/Debugger.h"
/// A class to manage flag bits.
///
/// Provides a global root objects for the debugger core.
-//----------------------------------------------------------------------
class Debugger : public std::enable_shared_from_this<Debugger>,
public UserID,
@@ -106,7 +95,7 @@ public:
static lldb::DebuggerSP FindDebuggerWithID(lldb::user_id_t id);
static lldb::DebuggerSP
- FindDebuggerWithInstanceName(const ConstString &instance_name);
+ FindDebuggerWithInstanceName(ConstString instance_name);
static size_t GetNumDebuggers();
@@ -130,7 +119,10 @@ public:
lldb::StreamFileSP GetErrorFile() { return m_error_file_sp; }
- void SetInputFileHandle(FILE *fh, bool tranfer_ownership);
+ repro::DataRecorder *GetInputRecorder();
+
+ void SetInputFileHandle(FILE *fh, bool tranfer_ownership,
+ repro::DataRecorder *recorder = nullptr);
void SetOutputFileHandle(FILE *fh, bool tranfer_ownership);
@@ -145,10 +137,12 @@ public:
lldb::StreamSP GetAsyncErrorStream();
CommandInterpreter &GetCommandInterpreter() {
- assert(m_command_interpreter_ap.get());
- return *m_command_interpreter_ap;
+ assert(m_command_interpreter_up.get());
+ return *m_command_interpreter_up;
}
+ ScriptInterpreter *GetScriptInterpreter(bool can_create = true);
+
lldb::ListenerSP GetListener() { return m_listener_sp; }
// This returns the Debugger's scratch source manager. It won't be able to
@@ -162,16 +156,14 @@ public:
}
ExecutionContext GetSelectedExecutionContext();
- //------------------------------------------------------------------
/// Get accessor for the target list.
///
/// The target list is part of the global debugger object. This the single
/// debugger shared instance to control where targets get created and to
/// allow for tracking and searching for targets based on certain criteria.
///
- /// @return
+ /// \return
/// A global shared target list.
- //------------------------------------------------------------------
TargetList &GetTargetList() { return m_target_list; }
PlatformList &GetPlatformList() { return m_platform_list; }
@@ -180,10 +172,8 @@ public:
void DispatchInputEndOfFile();
- //------------------------------------------------------------------
// If any of the streams are not set, set them to the in/out/err stream of
// the top most input reader to ensure they at least have something
- //------------------------------------------------------------------
void AdoptTopIOHandlerFilesIfInvalid(lldb::StreamFileSP &in,
lldb::StreamFileSP &out,
lldb::StreamFileSP &err);
@@ -222,9 +212,7 @@ public:
void SetLoggingCallback(lldb::LogOutputCallback log_callback, void *baton);
- //----------------------------------------------------------------------
// Properties Functions
- //----------------------------------------------------------------------
enum StopDisassemblyType {
eStopDisassemblyTypeNever = 0,
eStopDisassemblyTypeNoDebugInfo,
@@ -303,7 +291,7 @@ public:
bool GetNotifyVoid() const;
- const ConstString &GetInstanceName() { return m_instance_name; }
+ ConstString GetInstanceName() { return m_instance_name; }
bool LoadPlugin(const FileSpec &spec, Status &error);
@@ -371,6 +359,9 @@ protected:
lldb::StreamFileSP m_output_file_sp;
lldb::StreamFileSP m_error_file_sp;
+ /// Used for shadowing the input file when capturing a reproducer.
+ repro::DataRecorder *m_input_recorder;
+
lldb::BroadcasterManagerSP m_broadcaster_manager_sp; // The debugger acts as a
// broadcaster manager of
// last resort.
@@ -382,7 +373,7 @@ protected:
PlatformList m_platform_list;
lldb::ListenerSP m_listener_sp;
- std::unique_ptr<SourceManager> m_source_manager_ap; // This is a scratch
+ std::unique_ptr<SourceManager> m_source_manager_up; // This is a scratch
// source manager that we
// return if we have no
// targets.
@@ -391,7 +382,10 @@ protected:
// this debugger used this
// shared
// source file cache.
- std::unique_ptr<CommandInterpreter> m_command_interpreter_ap;
+ std::unique_ptr<CommandInterpreter> m_command_interpreter_up;
+
+ lldb::ScriptInterpreterSP m_script_interpreter_sp;
+ std::recursive_mutex m_script_interpreter_mutex;
IOHandlerStack m_input_reader_stack;
llvm::StringMap<std::weak_ptr<llvm::raw_ostream>> m_log_streams;
@@ -406,9 +400,7 @@ protected:
lldb::ListenerSP m_forward_listener_sp;
llvm::once_flag m_clear_once;
- //----------------------------------------------------------------------
// Events for m_sync_broadcaster
- //----------------------------------------------------------------------
enum {
eBroadcastBitEventThreadIsListening = (1 << 0),
};
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h
index 7cec837e71f8..ba9ca87832f6 100644
--- a/include/lldb/Core/Disassembler.h
+++ b/include/lldb/Core/Disassembler.h
@@ -1,9 +1,8 @@
//===-- Disassembler.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -39,41 +38,21 @@
#include <stdint.h>
#include <stdio.h>
-namespace lldb_private {
-class AddressRange;
+namespace llvm {
+template <typename T> class SmallVectorImpl;
}
+
namespace lldb_private {
+class AddressRange;
class DataExtractor;
-}
-namespace lldb_private {
class Debugger;
-}
-namespace lldb_private {
class Disassembler;
-}
-namespace lldb_private {
class Module;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class SymbolContextList;
-}
-namespace lldb_private {
class Target;
-}
-namespace lldb_private {
struct RegisterInfo;
-}
-namespace llvm {
-template <typename T> class SmallVectorImpl;
-}
-
-namespace lldb_private {
class Instruction {
public:
@@ -110,38 +89,37 @@ public:
m_address = addr;
}
- //------------------------------------------------------------------
/// Dump the text representation of this Instruction to a Stream
///
/// Print the (optional) address, (optional) bytes, opcode,
/// operands, and instruction comments to a stream.
///
- /// @param[in] s
+ /// \param[in] s
/// The Stream to add the text to.
///
- /// @param[in] show_address
+ /// \param[in] show_address
/// Whether the address (using disassembly_addr_format_spec formatting)
/// should be printed.
///
- /// @param[in] show_bytes
+ /// \param[in] show_bytes
/// Whether the bytes of the assembly instruction should be printed.
///
- /// @param[in] max_opcode_byte_size
+ /// \param[in] max_opcode_byte_size
/// The size (in bytes) of the largest instruction in the list that
/// we are printing (for text justification/alignment purposes)
/// Only needed if show_bytes is true.
///
- /// @param[in] exe_ctx
+ /// \param[in] exe_ctx
/// The current execution context, if available. May be used in
/// the assembling of the operands+comments for this instruction.
/// Pass NULL if not applicable.
///
- /// @param[in] sym_ctx
+ /// \param[in] sym_ctx
/// The SymbolContext for this instruction.
/// Pass NULL if not available/computed.
/// Only needed if show_address is true.
///
- /// @param[in] prev_sym_ctx
+ /// \param[in] prev_sym_ctx
/// The SymbolContext for the previous instruction. Depending on
/// the disassembly address format specification, a change in
/// Symbol / Function may mean that a line is printed with the new
@@ -150,17 +128,16 @@ public:
/// the InstructionList.
/// Only needed if show_address is true.
///
- /// @param[in] disassembly_addr_format
+ /// \param[in] disassembly_addr_format
/// The format specification for how addresses are printed.
/// Only needed if show_address is true.
///
- /// @param[in] max_address_text_size
+ /// \param[in] max_address_text_size
/// The length of the longest address string at the start of the
/// disassembly line that will be printed (the
/// Debugger::FormatDisassemblerAddress() string)
/// so this method can properly align the instruction opcodes.
/// May be 0 to indicate no indentation/alignment of the opcodes.
- //------------------------------------------------------------------
virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address,
bool show_bytes, const ExecutionContext *exe_ctx,
const SymbolContext *sym_ctx,
@@ -293,8 +270,32 @@ public:
lldb::InstructionSP GetInstructionAtIndex(size_t idx) const;
+ //------------------------------------------------------------------
+ /// Get the index of the next branch instruction.
+ ///
+ /// Given a list of instructions, find the next branch instruction
+ /// in the list by returning an index.
+ ///
+ /// @param[in] start
+ /// The instruction index of the first instruction to check.
+ ///
+ /// @param[in] target
+ /// A LLDB target object that is used to resolve addresses.
+ ///
+ /// @param[in] ignore_calls
+ /// It true, then fine the first branch instruction that isn't
+ /// 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.
+ ///
+ /// @return
+ /// The instruction index of the first branch that is at or past
+ /// \a start. Returns UINT32_MAX if no matching branches are
+ /// found.
+ //------------------------------------------------------------------
uint32_t GetIndexOfNextBranchInstruction(uint32_t start,
- Target &target) const;
+ Target &target,
+ bool ignore_calls) const;
uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr,
Target &target);
@@ -414,7 +415,7 @@ public:
static bool
Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name,
const char *flavor, const ExecutionContext &exe_ctx,
- const ConstString &name, Module *module,
+ ConstString name, Module *module,
uint32_t num_instructions, bool mixed_source_and_assembly,
uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
@@ -424,9 +425,7 @@ public:
uint32_t num_instructions, bool mixed_source_and_assembly,
uint32_t num_mixed_context_lines, uint32_t options, Stream &strm);
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
Disassembler(const ArchSpec &arch, const char *flavor);
~Disassembler() override;
@@ -536,18 +535,14 @@ protected:
return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl);
};
- //------------------------------------------------------------------
// Classes that inherit from Disassembler can see and modify these
- //------------------------------------------------------------------
ArchSpec m_arch;
InstructionList m_instruction_list;
lldb::addr_t m_base_addr;
std::string m_flavor;
private:
- //------------------------------------------------------------------
// For Disassembler only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(Disassembler);
};
diff --git a/include/lldb/Core/DumpDataExtractor.h b/include/lldb/Core/DumpDataExtractor.h
index 88446d48fa64..2a9d778e0a6a 100644
--- a/include/lldb/Core/DumpDataExtractor.h
+++ b/include/lldb/Core/DumpDataExtractor.h
@@ -1,9 +1,8 @@
//===-- DumpDataExtractor.h -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -21,7 +20,6 @@ class DataExtractor;
class ExecutionContextScope;
class Stream;
-//------------------------------------------------------------------
/// Dumps \a item_count objects into the stream \a s.
///
/// Dumps \a item_count objects using \a item_format, each of which
@@ -35,31 +33,31 @@ class Stream;
/// same start offset, format and size, yet differing \a
/// item_bit_size and \a item_bit_offset values.
///
-/// @param[in] s
+/// \param[in] s
/// The stream to dump the output to. This value can not be nullptr.
///
-/// @param[in] offset
+/// \param[in] offset
/// The offset into the data at which to start dumping.
///
-/// @param[in] item_format
+/// \param[in] item_format
/// The format to use when dumping each item.
///
-/// @param[in] item_byte_size
+/// \param[in] item_byte_size
/// The byte size of each item.
///
-/// @param[in] item_count
+/// \param[in] item_count
/// The number of items to dump.
///
-/// @param[in] num_per_line
+/// \param[in] num_per_line
/// The number of items to display on each line.
///
-/// @param[in] base_addr
+/// \param[in] base_addr
/// The base address that gets added to the offset displayed on
/// each line if the value is valid. Is \a base_addr is
/// LLDB_INVALID_ADDRESS then no address values will be prepended
/// to any lines.
///
-/// @param[in] item_bit_size
+/// \param[in] item_bit_size
/// If the value to display is a bitfield, this value should
/// be the number of bits that the bitfield item has within the
/// item's byte size value. This function will need to be called
@@ -68,7 +66,7 @@ class Stream;
/// exist within the same integer value. If the items being
/// displayed are not bitfields, this value should be zero.
///
-/// @param[in] item_bit_offset
+/// \param[in] item_bit_offset
/// If the value to display is a bitfield, this value should
/// be the offset in bits, or shift right amount, that the
/// bitfield item occupies within the item's byte size value.
@@ -78,9 +76,8 @@ class Stream;
/// same integer value. If the items being displayed are not
/// bitfields, this value should be zero.
///
-/// @return
+/// \return
/// The offset at which dumping ended.
-//------------------------------------------------------------------
lldb::offset_t
DumpDataExtractor(const DataExtractor &DE, Stream *s, lldb::offset_t offset,
lldb::Format item_format, size_t item_byte_size,
diff --git a/include/lldb/Core/DumpRegisterValue.h b/include/lldb/Core/DumpRegisterValue.h
index bc4860fbc0e5..443fdb34266a 100644
--- a/include/lldb/Core/DumpRegisterValue.h
+++ b/include/lldb/Core/DumpRegisterValue.h
@@ -1,9 +1,8 @@
//===-- DumpRegisterValue.h -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/EmulateInstruction.h b/include/lldb/Core/EmulateInstruction.h
index 5198f3eac922..6b19c17e5491 100644
--- a/include/lldb/Core/EmulateInstruction.h
+++ b/include/lldb/Core/EmulateInstruction.h
@@ -1,9 +1,8 @@
//===-- EmulateInstruction.h ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,29 +23,16 @@
#include <stddef.h>
#include <stdint.h>
+
namespace lldb_private {
class OptionValueDictionary;
-}
-namespace lldb_private {
class RegisterContext;
-}
-namespace lldb_private {
class RegisterValue;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Target;
-}
-namespace lldb_private {
class UnwindPlan;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class EmulateInstruction EmulateInstruction.h
+/// \class EmulateInstruction EmulateInstruction.h
/// "lldb/Core/EmulateInstruction.h"
/// A class that allows emulation of CPU opcodes.
///
@@ -103,7 +89,6 @@ namespace lldb_private {
/// paths in a debugger (single step prediction, finding save restore
/// locations of registers for unwinding stack frame variables) and emulating
/// the instruction is just a bonus.
-//----------------------------------------------------------------------
class EmulateInstruction : public PluginInterface {
public:
@@ -368,9 +353,7 @@ public:
~EmulateInstruction() override = default;
- //----------------------------------------------------------------------
// Mandatory overrides
- //----------------------------------------------------------------------
virtual bool
SupportsEmulatingInstructionsOfType(InstructionType inst_type) = 0;
@@ -390,9 +373,7 @@ public:
virtual bool GetRegisterInfo(lldb::RegisterKind reg_kind, uint32_t reg_num,
RegisterInfo &reg_info) = 0;
- //----------------------------------------------------------------------
// Optional overrides
- //----------------------------------------------------------------------
virtual bool SetInstruction(const Opcode &insn_opcode,
const Address &inst_addr, Target *target);
@@ -401,9 +382,7 @@ public:
static const char *TranslateRegister(lldb::RegisterKind reg_kind,
uint32_t reg_num, std::string &reg_name);
- //----------------------------------------------------------------------
// RegisterInfo variants
- //----------------------------------------------------------------------
bool ReadRegister(const RegisterInfo *reg_info, RegisterValue &reg_value);
uint64_t ReadRegisterUnsigned(const RegisterInfo *reg_info,
@@ -415,9 +394,7 @@ public:
bool WriteRegisterUnsigned(const Context &context,
const RegisterInfo *reg_info, uint64_t reg_value);
- //----------------------------------------------------------------------
// Register kind and number variants
- //----------------------------------------------------------------------
bool ReadRegister(lldb::RegisterKind reg_kind, uint32_t reg_num,
RegisterValue &reg_value);
@@ -512,18 +489,16 @@ public:
protected:
ArchSpec m_arch;
- void *m_baton;
- ReadMemoryCallback m_read_mem_callback;
- WriteMemoryCallback m_write_mem_callback;
- ReadRegisterCallback m_read_reg_callback;
- WriteRegisterCallback m_write_reg_callback;
- lldb::addr_t m_addr;
+ void *m_baton = nullptr;
+ ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault;
+ WriteMemoryCallback m_write_mem_callback = &WriteMemoryDefault;
+ ReadRegisterCallback m_read_reg_callback = &ReadRegisterDefault;
+ WriteRegisterCallback m_write_reg_callback = &WriteRegisterDefault;
+ lldb::addr_t m_addr = LLDB_INVALID_ADDRESS;
Opcode m_opcode;
private:
- //------------------------------------------------------------------
// For EmulateInstruction only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(EmulateInstruction);
};
diff --git a/include/lldb/Core/FileLineResolver.h b/include/lldb/Core/FileLineResolver.h
index 6de99bc0c4dc..1967ed58cd3b 100644
--- a/include/lldb/Core/FileLineResolver.h
+++ b/include/lldb/Core/FileLineResolver.h
@@ -1,9 +1,8 @@
//===-- FileLineResolver.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,18 +18,11 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class Stream;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
+/// \class FileLineResolver FileLineResolver.h "lldb/Core/FileLineResolver.h"
/// This class finds address for source file and line. Optionally, it will
/// look for inlined instances of the file and line specification.
-//----------------------------------------------------------------------
class FileLineResolver : public Searcher {
public:
diff --git a/include/lldb/Core/FileSpecList.h b/include/lldb/Core/FileSpecList.h
index db6490ef7133..79623ef1fdca 100644
--- a/include/lldb/Core/FileSpecList.h
+++ b/include/lldb/Core/FileSpecList.h
@@ -1,9 +1,8 @@
//===-- FileSpecList.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,165 +18,138 @@
namespace lldb_private {
class Stream;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h"
+/// \class FileSpecList FileSpecList.h "lldb/Core/FileSpecList.h"
/// A file collection class.
///
/// A class that contains a mutable list of FileSpec objects.
-//----------------------------------------------------------------------
class FileSpecList {
public:
- //------------------------------------------------------------------
/// Default constructor.
///
/// Initialize this object with an empty file list.
- //------------------------------------------------------------------
FileSpecList();
- //------------------------------------------------------------------
/// Copy constructor.
- ///
- /// Initialize this object with a copy of the file list from \a rhs.
- ///
- /// @param[in] rhs
- /// A const reference to another file list object.
- //------------------------------------------------------------------
- FileSpecList(const FileSpecList &rhs);
+ FileSpecList(const FileSpecList &rhs) = default;
+
+ /// Move constructor
+ FileSpecList(FileSpecList &&rhs) = default;
+
+ /// Initialize this object from a vector of FileSpecs
+ FileSpecList(std::vector<FileSpec> &&rhs) : m_files(std::move(rhs)) {}
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~FileSpecList();
- //------------------------------------------------------------------
/// Assignment operator.
///
/// Replace the file list in this object with the file list from \a rhs.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// A file list object to copy.
///
- /// @return
+ /// \return
/// A const reference to this object.
- //------------------------------------------------------------------
- const FileSpecList &operator=(const FileSpecList &rhs);
+ FileSpecList &operator=(const FileSpecList &rhs) = default;
+
+ /// Move-assignment operator.
+ FileSpecList &operator=(FileSpecList &&rhs) = default;
- //------------------------------------------------------------------
/// Append a FileSpec object to the list.
///
/// Appends \a file to the end of the file list.
///
- /// @param[in] file
+ /// \param[in] file
/// A new file to append to this file list.
- //------------------------------------------------------------------
void Append(const FileSpec &file);
- //------------------------------------------------------------------
/// Append a FileSpec object if unique.
///
/// Appends \a file to the end of the file list if it doesn't already exist
/// in the file list.
///
- /// @param[in] file
+ /// \param[in] file
/// A new file to append to this file list.
///
- /// @return
+ /// \return
/// \b true if the file was appended, \b false otherwise.
- //------------------------------------------------------------------
bool AppendIfUnique(const FileSpec &file);
- //------------------------------------------------------------------
/// Clears the file list.
- //------------------------------------------------------------------
void Clear();
- //------------------------------------------------------------------
/// Dumps the file list to the supplied stream pointer "s".
///
- /// @param[in] s
+ /// \param[in] s
/// The stream that will be used to dump the object description.
- //------------------------------------------------------------------
void Dump(Stream *s, const char *separator_cstr = "\n") const;
- //------------------------------------------------------------------
/// Find a file index.
///
/// Find the index of the file in the file spec list that matches \a file
/// starting \a idx entries into the file spec list.
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into the file list.
///
- /// @param[in] file
+ /// \param[in] file
/// The file specification to search for.
///
- /// @param[in] full
+ /// \param[in] full
/// Should FileSpec::Equal be called with "full" true or false.
///
- /// @return
+ /// \return
/// The index of the file that matches \a file if it is found,
/// else UINT32_MAX is returned.
- //------------------------------------------------------------------
size_t FindFileIndex(size_t idx, const FileSpec &file, bool full) const;
- //------------------------------------------------------------------
/// Get file at index.
///
/// Gets a file from the file list. If \a idx is not a valid index, an empty
/// FileSpec object will be returned. The file objects that are returned can
/// be tested using FileSpec::operator void*().
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into the file list.
///
- /// @return
+ /// \return
/// A copy of the FileSpec object at index \a idx. If \a idx
/// is out of range, then an empty FileSpec object will be
/// returned.
- //------------------------------------------------------------------
const FileSpec &GetFileSpecAtIndex(size_t idx) const;
- //------------------------------------------------------------------
/// Get file specification pointer at index.
///
/// Gets a file from the file list. The file objects that are returned can
/// be tested using FileSpec::operator void*().
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into the file list.
///
- /// @return
+ /// \return
/// A pointer to a contained FileSpec object at index \a idx.
/// If \a idx is out of range, then an NULL is returned.
- //------------------------------------------------------------------
const FileSpec *GetFileSpecPointerAtIndex(size_t idx) const;
- //------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This returns
/// the size in bytes of this object, not any shared string values it may
/// refer to.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
+ /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
bool IsEmpty() const { return m_files.empty(); }
- //------------------------------------------------------------------
/// Get the number of files in the file list.
///
- /// @return
+ /// \return
/// The number of files in the file spec list.
- //------------------------------------------------------------------
size_t GetSize() const;
bool Insert(size_t idx, const FileSpec &file) {
diff --git a/include/lldb/Core/FormatEntity.h b/include/lldb/Core/FormatEntity.h
index b58f3b104e46..634d9df2ad83 100644
--- a/include/lldb/Core/FormatEntity.h
+++ b/include/lldb/Core/FormatEntity.h
@@ -1,9 +1,8 @@
//===-- FormatEntity.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,20 +23,10 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class ExecutionContext;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class StringList;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class ValueObject;
}
namespace llvm {
@@ -52,7 +41,7 @@ public:
Invalid,
ParentNumber,
ParentString,
- InsertString,
+ EscapeCode,
Root,
String,
Scope,
@@ -111,14 +100,10 @@ public:
CurrentPCArrow
};
- enum FormatType { None, UInt32, UInt64, CString };
-
struct Definition {
const char *name;
const char *string; // Insert this exact string into the output
Entry::Type type;
- FormatType format_type; // uint32_t, uint64_t, cstr, or anything that can
- // be formatted by printf or lldb::Format
uint64_t data;
uint32_t num_children;
Definition *children; // An array of "num_children" Definition entries,
@@ -216,14 +201,12 @@ public:
static size_t AutoComplete(lldb_private::CompletionRequest &request);
- //----------------------------------------------------------------------
// Format the current elements into the stream \a s.
//
// The root element will be stripped off and the format str passed in will be
// either an empty string (print a description of this object), or contain a
// `.`-separated series like a domain name that identifies further
// sub-elements to display.
- //----------------------------------------------------------------------
static bool FormatFileSpec(const FileSpec &file, Stream &s,
llvm::StringRef elements,
llvm::StringRef element_format);
diff --git a/include/lldb/Core/Highlighter.h b/include/lldb/Core/Highlighter.h
index 220557c1f032..88d3bb3a3cd1 100644
--- a/include/lldb/Core/Highlighter.h
+++ b/include/lldb/Core/Highlighter.h
@@ -1,9 +1,8 @@
//===-- Highlighter.h -------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,17 +18,13 @@
namespace lldb_private {
-//----------------------------------------------------------------------
/// Represents style that the highlighter should apply to the given source code.
/// Stores information about how every kind of token should be annotated.
-//----------------------------------------------------------------------
struct HighlightStyle {
- //----------------------------------------------------------------------
/// A pair of strings that should be placed around a certain token. Usually
/// stores color codes in these strings (the suffix string is often used for
/// resetting the terminal attributes back to normal).
- //----------------------------------------------------------------------
class ColorStyle {
std::string m_prefix;
std::string m_suffix;
@@ -48,8 +43,8 @@ struct HighlightStyle {
void Apply(Stream &s, llvm::StringRef value) const;
/// Sets the prefix and suffix strings.
- /// @param prefix
- /// @param suffix
+ /// \param prefix
+ /// \param suffix
void Set(llvm::StringRef prefix, llvm::StringRef suffix);
};
@@ -84,9 +79,7 @@ struct HighlightStyle {
/// Matches '(' or ')'
ColorStyle parentheses;
- //-----------------------------------------------------------------------
// C language specific options
- //-----------------------------------------------------------------------
/// Matches directives to a preprocessor (if the language has any).
ColorStyle pp_directive;
@@ -95,9 +88,7 @@ struct HighlightStyle {
static HighlightStyle MakeVimStyle();
};
-//----------------------------------------------------------------------
/// Annotates source code with color attributes.
-//----------------------------------------------------------------------
class Highlighter {
public:
Highlighter() = default;
diff --git a/include/lldb/Core/IOHandler.h b/include/lldb/Core/IOHandler.h
index 4bd577390b2c..b7180675cf4e 100644
--- a/include/lldb/Core/IOHandler.h
+++ b/include/lldb/Core/IOHandler.h
@@ -1,9 +1,8 @@
//===-- IOHandler.h ---------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -14,6 +13,7 @@
#include "lldb/Utility/ConstString.h"
#include "lldb/Utility/Flags.h"
#include "lldb/Utility/Predicate.h"
+#include "lldb/Utility/Reproducer.h"
#include "lldb/Utility/Stream.h"
#include "lldb/Utility/StringList.h"
#include "lldb/lldb-defines.h"
@@ -59,7 +59,8 @@ public:
IOHandler(Debugger &debugger, IOHandler::Type type,
const lldb::StreamFileSP &input_sp,
const lldb::StreamFileSP &output_sp,
- const lldb::StreamFileSP &error_sp, uint32_t flags);
+ const lldb::StreamFileSP &error_sp, uint32_t flags,
+ repro::DataRecorder *data_recorder);
virtual ~IOHandler();
@@ -137,23 +138,19 @@ public:
const Flags &GetFlags() const { return m_flags; }
- //------------------------------------------------------------------
/// Check if the input is being supplied interactively by a user
///
/// This will return true if the input stream is a terminal (tty or
/// pty) and can cause IO handlers to do different things (like
/// for a confirmation when deleting all breakpoints).
- //------------------------------------------------------------------
bool GetIsInteractive();
- //------------------------------------------------------------------
/// Check if the input is coming from a real terminal.
///
/// A real terminal has a valid size with a certain number of rows
/// and columns. If this function returns true, then terminal escape
/// sequences are expected to work (cursor movement escape sequences,
/// clearing lines, etc).
- //------------------------------------------------------------------
bool GetIsRealTerminal();
void SetPopped(bool b);
@@ -170,6 +167,7 @@ protected:
lldb::StreamFileSP m_input_sp;
lldb::StreamFileSP m_output_sp;
lldb::StreamFileSP m_error_sp;
+ repro::DataRecorder *m_data_recorder;
Predicate<bool> m_popped;
Flags m_flags;
Type m_type;
@@ -181,14 +179,12 @@ private:
DISALLOW_COPY_AND_ASSIGN(IOHandler);
};
-//------------------------------------------------------------------
/// A delegate class for use with IOHandler subclasses.
///
/// The IOHandler delegate is designed to be mixed into classes so
/// they can use an IOHandler subclass to fetch input and notify the
/// object that inherits from this delegate class when a token is
/// received.
-//------------------------------------------------------------------
class IOHandlerDelegate {
public:
enum class Completion { None, LLDBCommand, Expression };
@@ -198,7 +194,7 @@ public:
virtual ~IOHandlerDelegate() = default;
- virtual void IOHandlerActivated(IOHandler &io_handler) {}
+ virtual void IOHandlerActivated(IOHandler &io_handler, bool interactive) {}
virtual void IOHandlerDeactivated(IOHandler &io_handler) {}
@@ -209,37 +205,34 @@ public:
virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; }
- //------------------------------------------------------------------
/// Called when a new line is created or one of an identified set of
/// indentation characters is typed.
///
/// This function determines how much indentation should be added
/// or removed to match the recommended amount for the final line.
///
- /// @param[in] io_handler
+ /// \param[in] io_handler
/// The IOHandler that responsible for input.
///
- /// @param[in] lines
+ /// \param[in] lines
/// The current input up to the line to be corrected. Lines
/// following the line containing the cursor are not included.
///
- /// @param[in] cursor_position
+ /// \param[in] cursor_position
/// The number of characters preceding the cursor on the final
/// line at the time.
///
- /// @return
+ /// \return
/// Returns an integer describing the number of spaces needed
/// to correct the indentation level. Positive values indicate
/// that spaces should be added, while negative values represent
/// spaces that should be removed.
- //------------------------------------------------------------------
virtual int IOHandlerFixIndentation(IOHandler &io_handler,
const StringList &lines,
int cursor_position) {
return 0;
}
- //------------------------------------------------------------------
/// Called when a line or lines have been retrieved.
///
/// This function can handle the current line and possibly call
@@ -247,29 +240,26 @@ public:
/// "quit" is entered as a command, of when an empty line is
/// received. It is up to the delegate to determine when a line
/// should cause a IOHandler to exit.
- //------------------------------------------------------------------
virtual void IOHandlerInputComplete(IOHandler &io_handler,
std::string &data) = 0;
virtual void IOHandlerInputInterrupted(IOHandler &io_handler,
std::string &data) {}
- //------------------------------------------------------------------
/// Called to determine whether typing enter after the last line in
/// \a lines should end input. This function will not be called on
/// IOHandler objects that are getting single lines.
- /// @param[in] io_handler
+ /// \param[in] io_handler
/// The IOHandler that responsible for updating the lines.
///
- /// @param[in] lines
+ /// \param[in] lines
/// The current multi-line content. May be altered to provide
/// alternative input when complete.
///
- /// @return
+ /// \return
/// Return an boolean to indicate whether input is complete,
/// true indicates that no additional input is necessary, while
/// false indicates that more input is required.
- //------------------------------------------------------------------
virtual bool IOHandlerIsInputComplete(IOHandler &io_handler,
StringList &lines) {
// Impose no requirements for input to be considered complete. subclasses
@@ -285,24 +275,20 @@ public:
virtual const char *IOHandlerGetHelpPrologue() { return nullptr; }
- //------------------------------------------------------------------
// Intercept the IOHandler::Interrupt() calls and do something.
//
// Return true if the interrupt was handled, false if the IOHandler should
// continue to try handle the interrupt itself.
- //------------------------------------------------------------------
virtual bool IOHandlerInterrupt(IOHandler &io_handler) { return false; }
protected:
Completion m_completion; // Support for common builtin completions
};
-//----------------------------------------------------------------------
// IOHandlerDelegateMultiline
//
// A IOHandlerDelegate that handles terminating multi-line input when
// the last line is equal to "end_line" which is specified in the constructor.
-//----------------------------------------------------------------------
class IOHandlerDelegateMultiline : public IOHandlerDelegate {
public:
IOHandlerDelegateMultiline(const char *end_line,
@@ -344,7 +330,8 @@ public:
uint32_t line_number_start, // If non-zero show line numbers
// starting at
// 'line_number_start'
- IOHandlerDelegate &delegate);
+ IOHandlerDelegate &delegate,
+ repro::DataRecorder *data_recorder);
IOHandlerEditline(Debugger &debugger, IOHandler::Type type,
const lldb::StreamFileSP &input_sp,
@@ -356,7 +343,8 @@ public:
uint32_t line_number_start, // If non-zero show line numbers
// starting at
// 'line_number_start'
- IOHandlerDelegate &delegate);
+ IOHandlerDelegate &delegate,
+ repro::DataRecorder *data_recorder);
IOHandlerEditline(Debugger &, IOHandler::Type, const char *, const char *,
const char *, bool, bool, uint32_t,
@@ -436,7 +424,7 @@ private:
protected:
#ifndef LLDB_DISABLE_LIBEDIT
- std::unique_ptr<Editline> m_editline_ap;
+ std::unique_ptr<Editline> m_editline_up;
#endif
IOHandlerDelegate &m_delegate;
std::string m_prompt;
diff --git a/include/lldb/Core/IOStreamMacros.h b/include/lldb/Core/IOStreamMacros.h
index 2562f179ca5d..45bde88f9441 100644
--- a/include/lldb/Core/IOStreamMacros.h
+++ b/include/lldb/Core/IOStreamMacros.h
@@ -1,9 +1,8 @@
//===-- IOStreamMacros.h ----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/LoadedModuleInfoList.h b/include/lldb/Core/LoadedModuleInfoList.h
index 5ef0f8929b89..f7f83604fc1a 100644
--- a/include/lldb/Core/LoadedModuleInfoList.h
+++ b/include/lldb/Core/LoadedModuleInfoList.h
@@ -1,9 +1,8 @@
//===-- LoadedModuleInfoList.h ----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/Mangled.h b/include/lldb/Core/Mangled.h
index 12edf8200e43..fb52afd6ed34 100644
--- a/include/lldb/Core/Mangled.h
+++ b/include/lldb/Core/Mangled.h
@@ -1,9 +1,8 @@
//===-- Mangled.h -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,8 +22,7 @@
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class Mangled Mangled.h "lldb/Core/Mangled.h"
+/// \class Mangled Mangled.h "lldb/Core/Mangled.h"
/// A class that handles mangled names.
///
/// Designed to handle mangled names. The demangled version of any names will
@@ -34,7 +32,6 @@ namespace lldb_private {
/// class for their mangled names. Uniqued string pools are used for the
/// mangled, demangled, and token string values to allow for faster
/// comparisons and for efficient memory use.
-//----------------------------------------------------------------------
class Mangled {
public:
enum NamePreference {
@@ -49,188 +46,156 @@ public:
eManglingSchemeItanium
};
- //----------------------------------------------------------------------
/// Default constructor.
///
/// Initialize with both mangled and demangled names empty.
- //----------------------------------------------------------------------
Mangled();
- //----------------------------------------------------------------------
/// Construct with name.
///
/// Constructor with an optional string and a boolean indicating if it is
/// the mangled version.
///
- /// @param[in] name
+ /// \param[in] name
/// The already const name to copy into this object.
///
- /// @param[in] is_mangled
+ /// \param[in] is_mangled
/// If \b true then \a name is a mangled name, if \b false then
/// \a name is demangled.
- //----------------------------------------------------------------------
- Mangled(const ConstString &name, bool is_mangled);
+ Mangled(ConstString name, bool is_mangled);
Mangled(llvm::StringRef name, bool is_mangled);
- //----------------------------------------------------------------------
/// Construct with name.
///
/// Constructor with an optional string and auto-detect if \a name is
/// mangled or not.
///
- /// @param[in] name
+ /// \param[in] name
/// The already const name to copy into this object.
- //----------------------------------------------------------------------
- explicit Mangled(const ConstString &name);
+ explicit Mangled(ConstString name);
explicit Mangled(llvm::StringRef name);
- //----------------------------------------------------------------------
/// Destructor
///
/// Releases its ref counts on the mangled and demangled strings that live
/// in the global string pool.
- //----------------------------------------------------------------------
~Mangled();
- //----------------------------------------------------------------------
/// Convert to pointer operator.
///
/// This allows code to check a Mangled object to see if it contains a valid
/// mangled name using code such as:
///
- /// @code
+ /// \code
/// Mangled mangled(...);
/// if (mangled)
/// { ...
- /// @endcode
+ /// \endcode
///
- /// @return
+ /// \return
/// A pointer to this object if either the mangled or unmangled
/// name is set, NULL otherwise.
- //----------------------------------------------------------------------
operator void *() const;
- //----------------------------------------------------------------------
/// Logical NOT operator.
///
/// This allows code to check a Mangled object to see if it contains an
/// empty mangled name using code such as:
///
- /// @code
+ /// \code
/// Mangled mangled(...);
/// if (!mangled)
/// { ...
- /// @endcode
+ /// \endcode
///
- /// @return
+ /// \return
/// Returns \b true if the object has an empty mangled and
/// unmangled name, \b false otherwise.
- //----------------------------------------------------------------------
bool operator!() const;
- //----------------------------------------------------------------------
/// Clear the mangled and demangled values.
- //----------------------------------------------------------------------
void Clear();
- //----------------------------------------------------------------------
/// Compare the mangled string values
///
/// Compares the Mangled::GetName() string in \a lhs and \a rhs.
///
- /// @param[in] lhs
+ /// \param[in] lhs
/// A const reference to the Left Hand Side object to compare.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// 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
- //----------------------------------------------------------------------
+ /// \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
static int Compare(const Mangled &lhs, const Mangled &rhs);
- //----------------------------------------------------------------------
/// Dump a description of this object to a Stream \a s.
///
/// Dump a Mangled object to stream \a s. We don't force our demangled name
/// to be computed currently (we don't use the accessor).
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //----------------------------------------------------------------------
void Dump(Stream *s) const;
- //----------------------------------------------------------------------
/// Dump a debug description of this object to a Stream \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //----------------------------------------------------------------------
void DumpDebug(Stream *s) const;
- //----------------------------------------------------------------------
/// Demangled name get accessor.
///
- /// @return
+ /// \return
/// A const reference to the demangled name string object.
- //----------------------------------------------------------------------
- const ConstString &GetDemangledName(lldb::LanguageType language) const;
+ ConstString GetDemangledName(lldb::LanguageType language) const;
- //----------------------------------------------------------------------
/// Display demangled name get accessor.
///
- /// @return
+ /// \return
/// A const reference to the display demangled name string object.
- //----------------------------------------------------------------------
ConstString GetDisplayDemangledName(lldb::LanguageType language) const;
- void SetDemangledName(const ConstString &name) { m_demangled = name; }
+ void SetDemangledName(ConstString name) { m_demangled = name; }
- void SetMangledName(const ConstString &name) { m_mangled = name; }
+ void SetMangledName(ConstString name) { m_mangled = name; }
- //----------------------------------------------------------------------
/// Mangled name get accessor.
///
- /// @return
+ /// \return
/// A reference to the mangled name string object.
- //----------------------------------------------------------------------
ConstString &GetMangledName() { return m_mangled; }
- //----------------------------------------------------------------------
/// Mangled name get accessor.
///
- /// @return
+ /// \return
/// A const reference to the mangled name string object.
- //----------------------------------------------------------------------
- const ConstString &GetMangledName() const { return m_mangled; }
+ ConstString GetMangledName() const { return m_mangled; }
- //----------------------------------------------------------------------
/// Best name get accessor.
///
- /// @param[in] preference
+ /// \param[in] preference
/// Which name would you prefer to get?
///
- /// @return
+ /// \return
/// A const reference to the preferred name string object if this
/// object has a valid name of that kind, else a const reference to the
/// other name is returned.
- //----------------------------------------------------------------------
ConstString GetName(lldb::LanguageType language,
NamePreference preference = ePreferDemangled) const;
- //----------------------------------------------------------------------
/// Check if "name" matches either the mangled or demangled name.
///
- /// @param[in] name
+ /// \param[in] name
/// A name to match against both strings.
///
- /// @return
+ /// \return
/// \b True if \a name matches either name, \b false otherwise.
- //----------------------------------------------------------------------
- bool NameMatches(const ConstString &name, lldb::LanguageType language) const {
+ bool NameMatches(ConstString name, lldb::LanguageType language) const {
if (m_mangled == name)
return true;
return GetDemangledName(language) == name;
@@ -238,47 +203,40 @@ public:
bool NameMatches(const RegularExpression &regex,
lldb::LanguageType language) const;
- //----------------------------------------------------------------------
/// Get the memory cost of this object.
///
/// Return the size in bytes that this object takes in memory. This returns
/// the size in bytes of this object, not any shared string values it may
/// refer to.
///
- /// @return
+ /// \return
/// The number of bytes that this object occupies in memory.
///
- /// @see ConstString::StaticMemorySize ()
- //----------------------------------------------------------------------
+ /// \see ConstString::StaticMemorySize ()
size_t MemorySize() const;
- //----------------------------------------------------------------------
/// Set the string value in this object.
///
/// If \a is_mangled is \b true, then the mangled named is set to \a name,
/// else the demangled name is set to \a name.
///
- /// @param[in] name
+ /// \param[in] name
/// The already const version of the name for this object.
///
- /// @param[in] is_mangled
+ /// \param[in] is_mangled
/// If \b true then \a name is a mangled name, if \b false then
/// \a name is demangled.
- //----------------------------------------------------------------------
- void SetValue(const ConstString &name, bool is_mangled);
+ void SetValue(ConstString name, bool is_mangled);
- //----------------------------------------------------------------------
/// Set the string value in this object.
///
/// This version auto detects if the string is mangled by inspecting the
/// string value and looking for common mangling prefixes.
///
- /// @param[in] name
+ /// \param[in] name
/// The already const version of the name for this object.
- //----------------------------------------------------------------------
- void SetValue(const ConstString &name);
+ void SetValue(ConstString name);
- //----------------------------------------------------------------------
/// Try to guess the language from the mangling.
///
/// For a mangled name to have a language it must have both a mangled and a
@@ -290,16 +248,14 @@ public:
/// aren't mangled and it isn't clear what language the name represents
/// (there will be no mangled name).
///
- /// @return
+ /// \return
/// The language for the mangled/demangled name, eLanguageTypeUnknown
/// if there is no mangled or demangled counterpart.
- //----------------------------------------------------------------------
lldb::LanguageType GuessLanguage() const;
/// Function signature for filtering mangled names.
using SkipMangledNameFn = bool(llvm::StringRef, ManglingScheme);
- //----------------------------------------------------------------------
/// Trigger explicit demangling to obtain rich mangling information. This is
/// optimized for batch processing while populating a name index. To get the
/// pure demangled name string for a single entity, use GetDemangledName()
@@ -312,24 +268,21 @@ public:
/// This function is thread-safe when used with different \a context
/// instances in different threads.
///
- /// @param[in] context
+ /// \param[in] context
/// The context for this function. A single instance can be stack-
/// allocated in the caller's frame and used for multiple calls.
///
- /// @param[in] skip_mangled_name
+ /// \param[in] skip_mangled_name
/// A filtering function for skipping entities based on name and mangling
/// scheme. This can be null if unused.
///
- /// @return
+ /// \return
/// True on success, false otherwise.
- //----------------------------------------------------------------------
bool DemangleWithRichManglingInfo(RichManglingContext &context,
SkipMangledNameFn *skip_mangled_name);
private:
- //----------------------------------------------------------------------
/// Mangled member variables.
- //----------------------------------------------------------------------
ConstString m_mangled; ///< The mangled version of the name
mutable ConstString m_demangled; ///< Mutable so we can get it on demand with
///a const version of this object
diff --git a/include/lldb/Core/MappedHash.h b/include/lldb/Core/MappedHash.h
index 8d9a91e69079..7dc9b5be3465 100644
--- a/include/lldb/Core/MappedHash.h
+++ b/include/lldb/Core/MappedHash.h
@@ -1,9 +1,8 @@
//===-- MappedHash.h --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/Module.h b/include/lldb/Core/Module.h
index 270a401172fa..544895ea89e9 100644
--- a/include/lldb/Core/Module.h
+++ b/include/lldb/Core/Module.h
@@ -1,9 +1,8 @@
//===-- Module.h ------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -40,60 +39,24 @@
namespace lldb_private {
class CompilerDeclContext;
-}
-namespace lldb_private {
class Function;
-}
-namespace lldb_private {
class Log;
-}
-namespace lldb_private {
class ObjectFile;
-}
-namespace lldb_private {
class RegularExpression;
-}
-namespace lldb_private {
class SectionList;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Symbol;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class SymbolContextList;
-}
-namespace lldb_private {
class SymbolFile;
-}
-namespace lldb_private {
class SymbolVendor;
-}
-namespace lldb_private {
class Symtab;
-}
-namespace lldb_private {
class Target;
-}
-namespace lldb_private {
class TypeList;
-}
-namespace lldb_private {
class TypeMap;
-}
-namespace lldb_private {
class VariableList;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class Module Module.h "lldb/Core/Module.h"
+/// \class Module Module.h "lldb/Core/Module.h"
/// A class that describes an executable image and its associated
/// object and symbol files.
///
@@ -108,7 +71,6 @@ namespace lldb_private {
/// Module::GetSymbolVendor() is called.
///
/// The module will parse more detailed information as more queries are made.
-//----------------------------------------------------------------------
class Module : public std::enable_shared_from_this<Module>,
public SymbolContextScope {
public:
@@ -124,30 +86,28 @@ public:
static std::recursive_mutex &GetAllocationModuleCollectionMutex();
- //------------------------------------------------------------------
/// Construct with file specification and architecture.
///
/// Clients that wish to share modules with other targets should use
/// ModuleList::GetSharedModule().
///
- /// @param[in] file_spec
+ /// \param[in] file_spec
/// The file specification for the on disk representation of
/// this executable image.
///
- /// @param[in] arch
+ /// \param[in] arch
/// The architecture to set as the current architecture in
/// this module.
///
- /// @param[in] object_name
+ /// \param[in] object_name
/// The name of an object in a module used to extract a module
/// within a module (.a files and modules that contain multiple
/// architectures).
///
- /// @param[in] object_offset
+ /// \param[in] object_offset
/// The offset within an existing module used to extract a
/// module within a module (.a files and modules that contain
/// multiple architectures).
- //------------------------------------------------------------------
Module(
const FileSpec &file_spec, const ArchSpec &arch,
const ConstString *object_name = nullptr,
@@ -164,25 +124,26 @@ public:
lldb::ModuleSP module_sp(new Module());
module_sp->m_objfile_sp =
std::make_shared<ObjFilePlugin>(module_sp, std::forward<Args>(args)...);
-
- // Once we get the object file, update our module with the object file's
- // architecture since it might differ in vendor/os if some parts were
- // unknown.
- if (ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture()) {
- module_sp->m_arch = arch;
- return module_sp;
- }
- return nullptr;
+ module_sp->m_did_load_objfile.store(true, std::memory_order_relaxed);
+
+ // Once we get the object file, set module ArchSpec to the one we get from
+ // the object file. If the object file does not have an architecture, we
+ // consider the creation a failure.
+ ArchSpec arch = module_sp->m_objfile_sp->GetArchitecture();
+ if (!arch)
+ return nullptr;
+ module_sp->m_arch = arch;
+
+ // Also copy the object file's FileSpec.
+ module_sp->m_file = module_sp->m_objfile_sp->GetFileSpec();
+ return module_sp;
}
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~Module() override;
bool MatchesModuleSpec(const ModuleSpec &module_ref);
- //------------------------------------------------------------------
/// Set the load address for all sections in a module to be the file address
/// plus \a slide.
///
@@ -191,23 +152,23 @@ public:
/// address for all top level sections to be the section file address +
/// offset.
///
- /// @param[in] target
+ /// \param[in] target
/// The target in which to apply the section load addresses.
///
- /// @param[in] value
+ /// \param[in] value
/// if \a value_is_offset is true, then value is the offset to
/// apply to all file addresses for all top level sections in
/// the object file as each section load address is being set.
/// If \a value_is_offset is false, then "value" is the new
/// absolute base address for the image.
///
- /// @param[in] value_is_offset
+ /// \param[in] value_is_offset
/// If \b true, then \a value is an offset to apply to each
/// file address of each top level section.
/// If \b false, then \a value is the image base address that
/// will be used to rigidly slide all loadable sections.
///
- /// @param[out] changed
+ /// \param[out] changed
/// If any section load addresses were changed in \a target,
/// then \a changed will be set to \b true. Else \a changed
/// will be set to false. This allows this function to be
@@ -216,18 +177,15 @@ public:
/// be false and no module updated notification will need to
/// be sent out.
///
- /// @return
+ /// \return
/// /b True if any sections were successfully loaded in \a target,
/// /b false otherwise.
- //------------------------------------------------------------------
bool SetLoadAddress(Target &target, lldb::addr_t value, bool value_is_offset,
bool &changed);
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ /// \copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
+ /// \see SymbolContextScope
void CalculateSymbolContext(SymbolContext *sc) override;
lldb::ModuleSP CalculateSymbolContextModule() override;
@@ -236,7 +194,6 @@ public:
GetDescription(Stream *s,
lldb::DescriptionLevel level = lldb::eDescriptionLevelFull);
- //------------------------------------------------------------------
/// Get the module path and object name.
///
/// Modules can refer to object files. In this case the specification is
@@ -252,12 +209,10 @@ public:
/// There are many places where logging wants to log this fully qualified
/// specification, so we centralize this functionality here.
///
- /// @return
+ /// \return
/// The object path + object name if there is one.
- //------------------------------------------------------------------
std::string GetSpecificationDescription() const;
- //------------------------------------------------------------------
/// Dump a description of this object to a Stream.
///
/// Dump a description of the contents of this object to the supplied stream
@@ -265,39 +220,34 @@ public:
/// to this point at which this function is called, so this is a good way to
/// see what has been parsed in a module.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
- //------------------------------------------------------------------
void Dump(Stream *s);
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ /// \copydoc SymbolContextScope::DumpSymbolContext(Stream*)
///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
+ /// \see SymbolContextScope
void DumpSymbolContext(Stream *s) override;
- //------------------------------------------------------------------
/// Find a symbol in the object file's symbol table.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the symbol that we are looking for.
///
- /// @param[in] symbol_type
+ /// \param[in] symbol_type
/// If set to eSymbolTypeAny, find a symbol of any type that
/// has a name that matches \a name. If set to any other valid
/// SymbolType enumeration value, then search only for
/// symbols that match \a symbol_type.
///
- /// @return
+ /// \return
/// Returns a valid symbol pointer if a symbol was found,
/// nullptr otherwise.
- //------------------------------------------------------------------
const Symbol *FindFirstSymbolWithNameAndType(
- const ConstString &name,
+ ConstString name,
lldb::SymbolType symbol_type = lldb::eSymbolTypeAny);
- size_t FindSymbolsWithNameAndType(const ConstString &name,
+ size_t FindSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list);
@@ -305,132 +255,123 @@ public:
lldb::SymbolType symbol_type,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find a function symbols in the object file's symbol table.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the symbol that we are looking for.
///
- /// @param[in] name_type_mask
+ /// \param[in] name_type_mask
/// A mask that has one or more bitwise OR'ed values from the
/// lldb::FunctionNameType enumeration type that indicate what
/// kind of names we are looking for.
///
- /// @param[out] sc_list
+ /// \param[out] sc_list
/// A list to append any matching symbol contexts to.
///
- /// @return
+ /// \return
/// The number of symbol contexts that were added to \a sc_list
- //------------------------------------------------------------------
- size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask,
+ size_t FindFunctionSymbols(ConstString name, uint32_t name_type_mask,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find compile units by partial or full path.
///
/// Finds all compile units that match \a path in all of the modules and
/// returns the results in \a sc_list.
///
- /// @param[in] path
+ /// \param[in] path
/// The name of the function we are looking for.
///
- /// @param[in] append
+ /// \param[in] append
/// If \b true, then append any compile units that were found
/// to \a sc_list. If \b false, then the \a sc_list is cleared
/// and the contents of \a sc_list are replaced.
///
- /// @param[out] sc_list
+ /// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a sc_list.
- //------------------------------------------------------------------
size_t FindCompileUnits(const FileSpec &path, bool append,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find functions by name.
///
/// If the function is an inlined function, it will have a block,
/// representing the inlined function, and the function will be the
/// containing function. If it is not inlined, then the block will be NULL.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the compile unit we are looking for.
///
- /// @param[in] namespace_decl
+ /// \param[in] namespace_decl
/// If valid, a namespace to search in.
///
- /// @param[in] name_type_mask
+ /// \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
/// names, base names, C++ methods, or ObjC selectors.
/// See FunctionNameType for more details.
///
- /// @param[in] append
+ /// \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
+ /// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a sc_list.
- //------------------------------------------------------------------
- size_t FindFunctions(const ConstString &name,
+ size_t FindFunctions(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
lldb::FunctionNameType name_type_mask, bool symbols_ok,
bool inlines_ok, bool append,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find functions by name.
///
/// If the function is an inlined function, it will have a block,
/// representing the inlined function, and the function will be the
/// containing function. If it is not inlined, then the block will be NULL.
///
- /// @param[in] regex
+ /// \param[in] regex
/// A regular expression to use when matching the name.
///
- /// @param[in] append
+ /// \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
+ /// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a sc_list.
- //------------------------------------------------------------------
size_t FindFunctions(const RegularExpression &regex, bool symbols_ok,
bool inlines_ok, bool append,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find addresses by file/line
///
- /// @param[in] target_sp
+ /// \param[in] target_sp
/// The target the addresses are desired for.
///
- /// @param[in] file
+ /// \param[in] file
/// Source file to locate.
///
- /// @param[in] line
+ /// \param[in] line
/// Source line to locate.
///
- /// @param[in] function
+ /// \param[in] function
/// Optional filter function. Addresses within this function will be
/// added to the 'local' list. All others will be added to the 'extern'
/// list.
///
- /// @param[out] output_local
+ /// \param[out] output_local
/// All matching addresses within 'function'
///
- /// @param[out] output_extern
+ /// \param[out] output_extern
/// All matching addresses not within 'function'
void FindAddressesForLine(const lldb::TargetSP target_sp,
const FileSpec &file, uint32_t line,
@@ -438,50 +379,45 @@ public:
std::vector<Address> &output_local,
std::vector<Address> &output_extern);
- //------------------------------------------------------------------
/// Find global and static variables by name.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the global or static variable we are looking
/// for.
///
- /// @param[in] parent_decl_ctx
+ /// \param[in] parent_decl_ctx
/// If valid, a decl context that results must exist within
///
- /// @param[in] max_matches
+ /// \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] variable_list
+ /// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// @return
+ /// \return
/// The number of matches added to \a variable_list.
- //------------------------------------------------------------------
- size_t FindGlobalVariables(const ConstString &name,
+ size_t FindGlobalVariables(ConstString name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches, VariableList &variable_list);
- //------------------------------------------------------------------
/// Find global and static variables by regular expression.
///
- /// @param[in] regex
+ /// \param[in] regex
/// A regular expression to use when matching the name.
///
- /// @param[in] max_matches
+ /// \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] variable_list
+ /// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// @return
+ /// \return
/// The number of matches added to \a variable_list.
- //------------------------------------------------------------------
size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
VariableList &variable_list);
- //------------------------------------------------------------------
/// Find types by name.
///
/// Type lookups in modules go through the SymbolVendor (which will use one
@@ -499,74 +435,66 @@ public:
/// have to specify complete scoping on all expressions, but it also allows
/// for exact matching when required.
///
- /// @param[in] type_name
+ /// \param[in] type_name
/// The name of the type we are looking for that is a fully
/// or partially qualified type name.
///
- /// @param[in] exact_match
+ /// \param[in] exact_match
/// If \b true, \a type_name is fully qualified and must match
/// exactly. If \b false, \a type_name is a partially qualified
/// name where the leading namespaces or classes can be
/// omitted to make finding types that a user may type
/// easier.
///
- /// @param[out] type_list
+ /// \param[out] type_list
/// A type list gets populated with any matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a type_list.
- //------------------------------------------------------------------
size_t
- FindTypes(const ConstString &type_name, bool exact_match, size_t max_matches,
+ FindTypes(ConstString type_name, bool exact_match, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeList &types);
lldb::TypeSP FindFirstType(const SymbolContext &sc,
- const ConstString &type_name, bool exact_match);
+ ConstString type_name, bool exact_match);
- //------------------------------------------------------------------
/// Find types by name that are in a namespace. This function is used by the
/// expression parser when searches need to happen in an exact namespace
/// scope.
///
- /// @param[in] type_name
+ /// \param[in] type_name
/// The name of a type within a namespace that should not include
/// any qualifying namespaces (just a type basename).
///
- /// @param[in] namespace_decl
+ /// \param[in] namespace_decl
/// The namespace declaration that this type must exist in.
///
- /// @param[out] type_list
+ /// \param[out] type_list
/// A type list gets populated with any matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a type_list.
- //------------------------------------------------------------------
- size_t FindTypesInNamespace(const ConstString &type_name,
+ size_t FindTypesInNamespace(ConstString type_name,
const CompilerDeclContext *parent_decl_ctx,
size_t max_matches, TypeList &type_list);
- //------------------------------------------------------------------
/// Get const accessor for the module architecture.
///
- /// @return
+ /// \return
/// A const reference to the architecture object.
- //------------------------------------------------------------------
const ArchSpec &GetArchitecture() const;
- //------------------------------------------------------------------
/// Get const accessor for the module file specification.
///
/// This function returns the file for the module on the host system that is
/// running LLDB. This can differ from the path on the platform since we
/// might be doing remote debugging.
///
- /// @return
+ /// \return
/// A const reference to the file specification object.
- //------------------------------------------------------------------
const FileSpec &GetFileSpec() const { return m_file; }
- //------------------------------------------------------------------
/// Get accessor for the module platform file specification.
///
/// Platform file refers to the path of the module as it is known on the
@@ -577,9 +505,8 @@ public:
/// "/tmp/lldb/platform-cache/remote.host.computer/usr/lib/liba.dylib" The
/// file could also be cached in a local developer kit directory.
///
- /// @return
+ /// \return
/// A const reference to the file specification object.
- //------------------------------------------------------------------
const FileSpec &GetPlatformFileSpec() const {
if (m_platform_file)
return m_platform_file;
@@ -614,63 +541,54 @@ public:
m_mod_time = mod_time;
}
- //------------------------------------------------------------------
/// Tells whether this module is capable of being the main executable for a
/// process.
///
- /// @return
+ /// \return
/// \b true if it is, \b false otherwise.
- //------------------------------------------------------------------
bool IsExecutable();
- //------------------------------------------------------------------
/// Tells whether this module has been loaded in the target passed in. This
/// call doesn't distinguish between whether the module is loaded by the
/// dynamic loader, or by a "target module add" type call.
///
- /// @param[in] target
+ /// \param[in] target
/// The target to check whether this is loaded in.
///
- /// @return
+ /// \return
/// \b true if it is, \b false otherwise.
- //------------------------------------------------------------------
bool IsLoadedInTarget(Target *target);
bool LoadScriptingResourceInTarget(Target *target, Status &error,
Stream *feedback_stream = nullptr);
- //------------------------------------------------------------------
/// Get the number of compile units for this module.
///
- /// @return
+ /// \return
/// The number of compile units that the symbol vendor plug-in
/// finds.
- //------------------------------------------------------------------
size_t GetNumCompileUnits();
lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
- const ConstString &GetObjectName() const;
+ ConstString GetObjectName() const;
uint64_t GetObjectOffset() const { return m_object_offset; }
- //------------------------------------------------------------------
/// Get the object file representation for the current architecture.
///
/// If the object file has not been located or parsed yet, this function
/// will find the best ObjectFile plug-in that can parse Module::m_file.
///
- /// @return
+ /// \return
/// If Module::m_file does not exist, or no plug-in was found
/// that can parse the file, or the object file doesn't contain
/// the current architecture in Module::m_arch, nullptr will be
/// returned, else a valid object file interface will be
/// returned. The returned pointer is owned by this object and
/// remains valid as long as the object is around.
- //------------------------------------------------------------------
virtual ObjectFile *GetObjectFile();
- //------------------------------------------------------------------
/// Get the unified section list for the module. This is the section list
/// created by the module's object file and any debug info and symbol files
/// created by the symbol vendor.
@@ -678,12 +596,10 @@ public:
/// If the symbol vendor has not been loaded yet, this function will return
/// the section list for the object file.
///
- /// @return
+ /// \return
/// Unified module section list.
- //------------------------------------------------------------------
virtual SectionList *GetSectionList();
- //------------------------------------------------------------------
/// Notify the module that the file addresses for the Sections have been
/// updated.
///
@@ -691,12 +607,23 @@ public:
/// should be called. Any parts of the module, object file, or symbol file
/// that has cached those file addresses must invalidate or update its
/// cache.
- //------------------------------------------------------------------
virtual void SectionFileAddressesChanged();
+ /// Returns a reference to the UnwindTable for this Module
+ ///
+ /// The UnwindTable contains FuncUnwinders objects for any function in this
+ /// Module. If a FuncUnwinders object hasn't been created yet (i.e. the
+ /// function has yet to be unwound in a stack walk), it will be created when
+ /// requested. Specifically, we do not create FuncUnwinders objects for
+ /// functions until they are needed.
+ ///
+ /// \return
+ /// Returns the unwind table for this module. If this object has no
+ /// associated object file, an empty UnwindTable is returned.
+ UnwindTable &GetUnwindTable();
+
llvm::VersionTuple GetVersion();
- //------------------------------------------------------------------
/// Load an object file from memory.
///
/// If available, the size of the object file in memory may be passed to
@@ -705,54 +632,46 @@ public:
/// enable the ObjectFile plugins to read the header of the object file
/// without going back to the process.
///
- /// @return
+ /// \return
/// The object file loaded from memory or nullptr, if the operation
/// failed (see the `error` for more information in that case).
- //------------------------------------------------------------------
ObjectFile *GetMemoryObjectFile(const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr, Status &error,
size_t size_to_read = 512);
- //------------------------------------------------------------------
/// Get the symbol vendor interface for the current architecture.
///
/// If the symbol vendor file has not been located yet, this function will
/// find the best SymbolVendor plug-in that can use the current object file.
///
- /// @return
+ /// \return
/// If this module does not have a valid object file, or no
/// plug-in can be found that can use the object file, nullptr will
/// be returned, else a valid symbol vendor plug-in interface
/// will be returned. The returned pointer is owned by this
/// object and remains valid as long as the object is around.
- //------------------------------------------------------------------
virtual SymbolVendor *
GetSymbolVendor(bool can_create = true,
lldb_private::Stream *feedback_strm = nullptr);
- //------------------------------------------------------------------
/// Get accessor the type list for this module.
///
- /// @return
+ /// \return
/// A valid type list pointer, or nullptr if there is no valid
/// symbol vendor for this module.
- //------------------------------------------------------------------
TypeList *GetTypeList();
- //------------------------------------------------------------------
/// Get a reference to the UUID value contained in this object.
///
/// If the executable image file doesn't not have a UUID value built into
/// the file format, an MD5 checksum of the entire file, or slice of the
/// file for the current architecture should be used.
///
- /// @return
+ /// \return
/// A const pointer to the internal copy of the UUID value in
/// this module if this module has a valid UUID value, NULL
/// otherwise.
- //------------------------------------------------------------------
const lldb_private::UUID &GetUUID();
- //------------------------------------------------------------------
/// A debugging function that will cause everything in a module to
/// be parsed.
///
@@ -763,12 +682,10 @@ public:
/// complete list of the resulting debug information that gets parsed, or as
/// a debug function to ensure that the module can consume all of the debug
/// data the symbol vendor provides.
- //------------------------------------------------------------------
void ParseAllDebugSymbols();
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr);
- //------------------------------------------------------------------
/// Resolve the symbol context for the given address.
///
/// Tries to resolve the matching symbol context based on a lookup from the
@@ -782,10 +699,10 @@ public:
/// line entry. Use the return value to determine which of these properties
/// have been modified.
///
- /// @param[in] so_addr
+ /// \param[in] so_addr
/// A load address to resolve.
///
- /// @param[in] resolve_scope
+ /// \param[in] resolve_scope
/// The scope that should be resolved (see SymbolContext::Scope).
/// A combination of flags from the enumeration SymbolContextItem
/// requesting a resolution depth. Note that the flags that are
@@ -794,24 +711,22 @@ public:
/// eSymbolContextModule, and eSymbolContextFunction requires
/// eSymbolContextSymbol.
///
- /// @param[out] sc
+ /// \param[out] sc
/// The SymbolContext that is modified based on symbol resolution.
///
- /// @param[in] resolve_tail_call_address
+ /// \param[in] resolve_tail_call_address
/// Determines if so_addr should resolve to a symbol in the case
/// of a function whose last instruction is a call. In this case,
/// the PC can be one past the address range of the function.
///
- /// @return
+ /// \return
/// The scope that has been resolved (see SymbolContext::Scope).
///
- /// @see SymbolContext::Scope
- //------------------------------------------------------------------
+ /// \see SymbolContext::Scope
uint32_t ResolveSymbolContextForAddress(
const Address &so_addr, lldb::SymbolContextItem resolve_scope,
SymbolContext &sc, bool resolve_tail_call_address = false);
- //------------------------------------------------------------------
/// Resolve items in the symbol context for a given file and line.
///
/// Tries to resolve \a file_path and \a line to a list of matching symbol
@@ -823,40 +738,38 @@ public:
/// to only what is needed -- typically the module, compile unit, line table
/// and line table entry are sufficient.
///
- /// @param[in] file_path
+ /// \param[in] file_path
/// A path to a source file to match. If \a file_path does not
/// specify a directory, then this query will match all files
/// whose base filename matches. If \a file_path does specify
/// a directory, the fullpath to the file must match.
///
- /// @param[in] line
+ /// \param[in] line
/// The source line to match, or zero if just the compile unit
/// should be resolved.
///
- /// @param[in] check_inlines
+ /// \param[in] check_inlines
/// Check for inline file and line number matches. This option
/// should be used sparingly as it will cause all line tables
/// for every compile unit to be parsed and searched for
/// matching inline file entries.
///
- /// @param[in] resolve_scope
+ /// \param[in] resolve_scope
/// The scope that should be resolved (see
/// SymbolContext::Scope).
///
- /// @param[out] sc_list
+ /// \param[out] sc_list
/// A symbol context list that gets matching symbols contexts
/// appended to.
///
- /// @return
+ /// \return
/// The number of matches that were added to \a sc_list.
///
- /// @see SymbolContext::Scope
- //------------------------------------------------------------------
+ /// \see SymbolContext::Scope
uint32_t ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Resolve items in the symbol context for a given file and line.
///
/// Tries to resolve \a file_spec and \a line to a list of matching symbol
@@ -868,42 +781,41 @@ public:
/// to only what is needed -- typically the module, compile unit, line table
/// and line table entry are sufficient.
///
- /// @param[in] file_spec
+ /// \param[in] file_spec
/// A file spec to a source file to match. If \a file_path does
/// not specify a directory, then this query will match all
/// files whose base filename matches. If \a file_path does
/// specify a directory, the fullpath to the file must match.
///
- /// @param[in] line
+ /// \param[in] line
/// The source line to match, or zero if just the compile unit
/// should be resolved.
///
- /// @param[in] check_inlines
+ /// \param[in] check_inlines
/// Check for inline file and line number matches. This option
/// should be used sparingly as it will cause all line tables
/// for every compile unit to be parsed and searched for
/// matching inline file entries.
///
- /// @param[in] resolve_scope
+ /// \param[in] resolve_scope
/// The scope that should be resolved (see
/// SymbolContext::Scope).
///
- /// @param[out] sc_list
+ /// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
- /// @return
+ /// \return
/// A integer that contains SymbolContext::Scope bits set for
/// each item that was successfully resolved.
///
- /// @see SymbolContext::Scope
- //------------------------------------------------------------------
+ /// \see SymbolContext::Scope
uint32_t ResolveSymbolContextsForFileSpec(
const FileSpec &file_spec, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list);
void SetFileSpecAndObjectName(const FileSpec &file,
- const ConstString &object_name);
+ ConstString object_name);
bool GetIsDynamicLinkEditor();
@@ -931,17 +843,13 @@ public:
void ReportErrorIfModifyDetected(const char *format, ...)
__attribute__((format(printf, 2, 3)));
- //------------------------------------------------------------------
// Return true if the file backing this module has changed since the module
// was originally created since we saved the initial file modification time
// when the module first gets created.
- //------------------------------------------------------------------
bool FileHasChanged() const;
- //------------------------------------------------------------------
// SymbolVendor, SymbolFile and ObjectFile member objects should lock the
// module mutex to avoid deadlocks.
- //------------------------------------------------------------------
std::recursive_mutex &GetMutex() const { return m_mutex; }
PathMappingList &GetSourceMappingList() { return m_source_mappings; }
@@ -950,7 +858,6 @@ public:
return m_source_mappings;
}
- //------------------------------------------------------------------
/// Finds a source file given a file spec using the module source path
/// remappings (if any).
///
@@ -959,41 +866,37 @@ public:
/// if the remappings are on a network file system, so use this function
/// sparingly (not in a tight debug info parsing loop).
///
- /// @param[in] orig_spec
+ /// \param[in] orig_spec
/// The original source file path to try and remap.
///
- /// @param[out] new_spec
+ /// \param[out] new_spec
/// The newly remapped filespec that is guaranteed to exist.
///
- /// @return
+ /// \return
/// /b true if \a orig_spec was successfully located and
/// \a new_spec is filled in with an existing file spec,
/// \b false otherwise.
- //------------------------------------------------------------------
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
- //------------------------------------------------------------------
/// Remaps a source file given \a path into \a new_path.
///
/// Remaps \a path if any source remappings match. This function does NOT
/// stat the file system so it can be used in tight loops where debug info
/// is being parsed.
///
- /// @param[in] path
+ /// \param[in] path
/// The original source file path to try and remap.
///
- /// @param[out] new_path
+ /// \param[out] new_path
/// The newly remapped filespec that is may or may not exist.
///
- /// @return
+ /// \return
/// /b true if \a path was successfully located and \a new_path
/// is filled in with a new source path, \b false otherwise.
- //------------------------------------------------------------------
bool RemapSourceFile(llvm::StringRef path, std::string &new_path) const;
bool RemapSourceFile(const char *, std::string &) const = delete;
- //----------------------------------------------------------------------
- /// @class LookupInfo Module.h "lldb/Core/Module.h"
+ /// \class LookupInfo Module.h "lldb/Core/Module.h"
/// A class that encapsulates name lookup information.
///
/// Users can type a wide variety of partial names when setting breakpoints
@@ -1014,7 +917,6 @@ public:
/// Function lookups are done in Module.cpp, ModuleList.cpp and in
/// BreakpointResolverName.cpp and they all now use this class to do lookups
/// correctly.
- //----------------------------------------------------------------------
class LookupInfo {
public:
LookupInfo()
@@ -1022,16 +924,16 @@ public:
m_name_type_mask(lldb::eFunctionNameTypeNone),
m_match_name_after_lookup(false) {}
- LookupInfo(const ConstString &name, lldb::FunctionNameType name_type_mask,
+ LookupInfo(ConstString name, lldb::FunctionNameType name_type_mask,
lldb::LanguageType language);
- const ConstString &GetName() const { return m_name; }
+ ConstString GetName() const { return m_name; }
- void SetName(const ConstString &name) { m_name = name; }
+ void SetName(ConstString name) { m_name = name; }
- const ConstString &GetLookupName() const { return m_lookup_name; }
+ ConstString GetLookupName() const { return m_lookup_name; }
- void SetLookupName(const ConstString &name) { m_lookup_name = name; }
+ void SetLookupName(ConstString name) { m_lookup_name = name; }
lldb::FunctionNameType GetNameTypeMask() const { return m_name_type_mask; }
@@ -1061,9 +963,7 @@ public:
};
protected:
- //------------------------------------------------------------------
// Member Variables
- //------------------------------------------------------------------
mutable std::recursive_mutex m_mutex; ///< A mutex to keep this object happy
///in multi-threaded environments.
@@ -1091,8 +991,11 @@ protected:
lldb::ObjectFileSP m_objfile_sp; ///< A shared pointer to the object file
///parser for this module as it may or may
///not be shared with the SymbolFile
+ llvm::Optional<UnwindTable> m_unwind_table; ///< Table of FuncUnwinders
+ /// objects created for this
+ /// Module's functions
lldb::SymbolVendorUP
- m_symfile_ap; ///< A pointer to the symbol vendor for this module.
+ m_symfile_up; ///< A pointer to the symbol vendor for this module.
std::vector<lldb::SymbolVendorUP>
m_old_symfiles; ///< If anyone calls Module::SetSymbolFileFileSpec() and
///changes the symbol file,
@@ -1104,9 +1007,9 @@ protected:
///when you have debug info for a module
///that doesn't match where the sources
///currently are
- lldb::SectionListUP m_sections_ap; ///< Unified section list for module that
- ///is used by the ObjectFile and and
- ///ObjectFile instances for the debug info
+ lldb::SectionListUP m_sections_up; ///< Unified section list for module that
+ /// is used by the ObjectFile and and
+ /// ObjectFile instances for the debug info
std::atomic<bool> m_did_load_objfile{false};
std::atomic<bool> m_did_load_symbol_vendor{false};
@@ -1115,7 +1018,6 @@ protected:
m_first_file_changed_log : 1; /// See if the module was modified after it
/// was initially opened.
- //------------------------------------------------------------------
/// Resolve a file or load virtual address.
///
/// Tries to resolve \a vm_addr as a file address (if \a
@@ -1124,31 +1026,30 @@ protected:
/// indicates what clients wish to resolve and can be used to limit the
/// scope of what is parsed.
///
- /// @param[in] vm_addr
+ /// \param[in] vm_addr
/// The load virtual address to resolve.
///
- /// @param[in] vm_addr_is_file_addr
+ /// \param[in] vm_addr_is_file_addr
/// If \b true, \a vm_addr is a file address, else \a vm_addr
/// if a load address.
///
- /// @param[in] resolve_scope
+ /// \param[in] resolve_scope
/// The scope that should be resolved (see
/// SymbolContext::Scope).
///
- /// @param[out] so_addr
+ /// \param[out] so_addr
/// The section offset based address that got resolved if
/// any bits are returned.
///
- /// @param[out] sc
+ /// \param[out] sc
// The symbol context that has objects filled in. Each bit
/// in the \a resolve_scope pertains to a member in the \a sc.
///
- /// @return
+ /// \return
/// A integer that contains SymbolContext::Scope bits set for
/// each item that was successfully resolved.
///
- /// @see SymbolContext::Scope
- //------------------------------------------------------------------
+ /// \see SymbolContext::Scope
uint32_t ResolveSymbolContextForAddress(lldb::addr_t vm_addr,
bool vm_addr_is_file_addr,
lldb::SymbolContextItem resolve_scope,
@@ -1172,7 +1073,7 @@ private:
Module(); // Only used internally by CreateJITModule ()
size_t FindTypes_Impl(
- const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
+ ConstString name, const CompilerDeclContext *parent_decl_ctx,
bool append, size_t max_matches,
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
TypeMap &types);
diff --git a/include/lldb/Core/ModuleChild.h b/include/lldb/Core/ModuleChild.h
index 73438040c359..8a81c1a6cf8a 100644
--- a/include/lldb/Core/ModuleChild.h
+++ b/include/lldb/Core/ModuleChild.h
@@ -1,9 +1,8 @@
//===-- ModuleChild.h -------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -14,68 +13,46 @@
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
+/// \class ModuleChild ModuleChild.h "lldb/Core/ModuleChild.h"
/// A mix in class that contains a pointer back to the module
/// that owns the object which inherits from it.
-//----------------------------------------------------------------------
class ModuleChild {
public:
- //------------------------------------------------------------------
/// Construct with owning module.
///
- /// @param[in] module
+ /// \param[in] module
/// The module that owns the object that inherits from this
/// class.
- //------------------------------------------------------------------
ModuleChild(const lldb::ModuleSP &module_sp);
- //------------------------------------------------------------------
- /// Copy constructor.
- ///
- /// @param[in] rhs
- /// A const ModuleChild class reference to copy.
- //------------------------------------------------------------------
- ModuleChild(const ModuleChild &rhs);
-
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~ModuleChild();
- //------------------------------------------------------------------
/// Assignment operator.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// A const ModuleChild class reference to copy.
///
- /// @return
+ /// \return
/// A const reference to this object.
- //------------------------------------------------------------------
const ModuleChild &operator=(const ModuleChild &rhs);
- //------------------------------------------------------------------
/// Get const accessor for the module pointer.
///
- /// @return
+ /// \return
/// A const pointer to the module that owns the object that
/// inherits from this class.
- //------------------------------------------------------------------
lldb::ModuleSP GetModule() const;
- //------------------------------------------------------------------
/// Set accessor for the module pointer.
///
- /// @param[in] module
+ /// \param[in] module
/// A new module that owns the object that inherits from this
/// 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.
};
diff --git a/include/lldb/Core/ModuleList.h b/include/lldb/Core/ModuleList.h
index a28d97113d63..1e26c35e4c15 100644
--- a/include/lldb/Core/ModuleList.h
+++ b/include/lldb/Core/ModuleList.h
@@ -1,9 +1,8 @@
//===-- ModuleList.h --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -32,48 +31,19 @@
namespace lldb_private {
class ConstString;
-}
-namespace lldb_private {
class FileSpecList;
-}
-namespace lldb_private {
class Function;
-}
-namespace lldb_private {
class Log;
-}
-namespace lldb_private {
class Module;
-}
-namespace lldb_private {
class RegularExpression;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class SymbolContextList;
-}
-namespace lldb_private {
class SymbolFile;
-}
-namespace lldb_private {
class Target;
-}
-namespace lldb_private {
class TypeList;
-}
-namespace lldb_private {
class UUID;
-}
-namespace lldb_private {
class VariableList;
-}
-
-namespace lldb_private {
class ModuleListProperties : public Properties {
public:
@@ -82,91 +52,101 @@ public:
FileSpec GetClangModulesCachePath() const;
bool SetClangModulesCachePath(llvm::StringRef path);
bool GetEnableExternalLookup() const;
+ bool SetEnableExternalLookup(bool new_value);
};
-//----------------------------------------------------------------------
-/// @class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
+/// \class ModuleList ModuleList.h "lldb/Core/ModuleList.h"
/// A collection class for Module objects.
///
/// Modules in the module collection class are stored as reference counted
/// shared pointers to Module objects.
-//----------------------------------------------------------------------
class ModuleList {
public:
class Notifier {
public:
virtual ~Notifier() = default;
- virtual void ModuleAdded(const ModuleList &module_list,
- const lldb::ModuleSP &module_sp) = 0;
- virtual void ModuleRemoved(const ModuleList &module_list,
- const lldb::ModuleSP &module_sp) = 0;
- virtual void ModuleUpdated(const ModuleList &module_list,
- const lldb::ModuleSP &old_module_sp,
- const lldb::ModuleSP &new_module_sp) = 0;
- virtual void WillClearList(const ModuleList &module_list) = 0;
+ virtual void NotifyModuleAdded(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) = 0;
+ virtual void NotifyModuleRemoved(const ModuleList &module_list,
+ const lldb::ModuleSP &module_sp) = 0;
+ virtual void NotifyModuleUpdated(const ModuleList &module_list,
+ const lldb::ModuleSP &old_module_sp,
+ const lldb::ModuleSP &new_module_sp) = 0;
+ virtual void NotifyWillClearList(const ModuleList &module_list) = 0;
+
+ virtual void NotifyModulesRemoved(lldb_private::ModuleList &module_list) = 0;
};
- //------------------------------------------------------------------
/// Default constructor.
///
/// Creates an empty list of Module objects.
- //------------------------------------------------------------------
ModuleList();
- //------------------------------------------------------------------
/// Copy Constructor.
///
/// Creates a new module list object with a copy of the modules from \a rhs.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// Another module list object.
- //------------------------------------------------------------------
ModuleList(const ModuleList &rhs);
ModuleList(ModuleList::Notifier *notifier);
- //------------------------------------------------------------------
/// Destructor.
- //------------------------------------------------------------------
~ModuleList();
- //------------------------------------------------------------------
/// Assignment operator.
///
/// Copies the module list from \a rhs into this list.
///
- /// @param[in] rhs
+ /// \param[in] rhs
/// Another module list object.
///
- /// @return
+ /// \return
/// A const reference to this object.
- //------------------------------------------------------------------
const ModuleList &operator=(const ModuleList &rhs);
- //------------------------------------------------------------------
/// Append a module to the module list.
///
- /// Appends the module to the collection.
- ///
- /// @param[in] module_sp
+ /// \param[in] module_sp
/// A shared pointer to a module to add to this collection.
- //------------------------------------------------------------------
- void Append(const lldb::ModuleSP &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,
+ /// before resuming execution.
+ void Append(const lldb::ModuleSP &module_sp, bool notify = true);
- //------------------------------------------------------------------
/// Append a module to the module list and remove any equivalent modules.
/// Equivalent modules are ones whose file, platform file and architecture
/// matches.
///
/// Replaces the module to the collection.
///
- /// @param[in] module_sp
+ /// \param[in] module_sp
/// A shared pointer to a module to replace in this collection.
- //------------------------------------------------------------------
void ReplaceEquivalent(const lldb::ModuleSP &module_sp);
- bool AppendIfNeeded(const lldb::ModuleSP &module_sp);
+ /// 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,
+ /// before resuming execution.
+ bool AppendIfNeeded(const lldb::ModuleSP &module_sp, bool notify = true);
void Append(const ModuleList &module_list);
@@ -175,36 +155,30 @@ public:
bool ReplaceModule(const lldb::ModuleSP &old_module_sp,
const lldb::ModuleSP &new_module_sp);
- //------------------------------------------------------------------
/// Clear the object's state.
///
/// Clears the list of modules and releases a reference to each module
/// object and if the reference count goes to zero, the module will be
/// deleted.
- //------------------------------------------------------------------
void Clear();
- //------------------------------------------------------------------
/// Clear the object's state.
///
/// Clears the list of modules and releases a reference to each module
/// object and if the reference count goes to zero, the module will be
/// deleted. Also release all memory that might be held by any collection
/// classes (like std::vector)
- //------------------------------------------------------------------
void Destroy();
- //------------------------------------------------------------------
/// Dump the description of each module contained in this list.
///
/// Dump the description of each module contained in this list to the
/// supplied stream \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// The stream to which to dump the object description.
///
- /// @see Module::Dump(Stream *) const
- //------------------------------------------------------------------
+ /// \see Module::Dump(Stream *) const
void Dump(Stream *s) const;
void LogUUIDAndPaths(Log *log, const char *prefix_cstr);
@@ -213,155 +187,134 @@ public:
size_t GetIndexForModule(const Module *module) const;
- //------------------------------------------------------------------
/// Get the module shared pointer for the module at index \a idx.
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into this module collection.
///
- /// @return
+ /// \return
/// A shared pointer to a Module which can contain NULL if
/// \a idx is out of range.
///
- /// @see ModuleList::GetSize()
- //------------------------------------------------------------------
+ /// \see ModuleList::GetSize()
lldb::ModuleSP GetModuleAtIndex(size_t idx) const;
- //------------------------------------------------------------------
/// Get the module shared pointer for the module at index \a idx without
/// acquiring the ModuleList mutex. This MUST already have been acquired
/// with ModuleList::GetMutex and locked for this call to be safe.
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into this module collection.
///
- /// @return
+ /// \return
/// A shared pointer to a Module which can contain NULL if
/// \a idx is out of range.
///
- /// @see ModuleList::GetSize()
- //------------------------------------------------------------------
+ /// \see ModuleList::GetSize()
lldb::ModuleSP GetModuleAtIndexUnlocked(size_t idx) const;
- //------------------------------------------------------------------
/// Get the module pointer for the module at index \a idx.
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into this module collection.
///
- /// @return
+ /// \return
/// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
- /// @see ModuleList::GetSize()
- //------------------------------------------------------------------
+ /// \see ModuleList::GetSize()
Module *GetModulePointerAtIndex(size_t idx) const;
- //------------------------------------------------------------------
/// Get the module pointer for the module at index \a idx without acquiring
/// the ModuleList mutex. This MUST already have been acquired with
/// ModuleList::GetMutex and locked for this call to be safe.
///
- /// @param[in] idx
+ /// \param[in] idx
/// An index into this module collection.
///
- /// @return
+ /// \return
/// A pointer to a Module which can by nullptr if \a idx is out
/// of range.
///
- /// @see ModuleList::GetSize()
- //------------------------------------------------------------------
+ /// \see ModuleList::GetSize()
Module *GetModulePointerAtIndexUnlocked(size_t idx) const;
- //------------------------------------------------------------------
/// Find compile units by partial or full path.
///
/// Finds all compile units that match \a path in all of the modules and
/// returns the results in \a sc_list.
///
- /// @param[in] path
+ /// \param[in] path
/// The name of the compile unit we are looking for.
///
- /// @param[in] append
+ /// \param[in] append
/// If \b true, then append any compile units that were found
/// to \a sc_list. If \b false, then the \a sc_list is cleared
/// and the contents of \a sc_list are replaced.
///
- /// @param[out] sc_list
+ /// \param[out] sc_list
/// A symbol context list that gets filled in with all of the
/// matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a sc_list.
- //------------------------------------------------------------------
size_t FindCompileUnits(const FileSpec &path, bool append,
SymbolContextList &sc_list) const;
- //------------------------------------------------------------------
- /// @see Module::FindFunctions ()
- //------------------------------------------------------------------
- size_t FindFunctions(const ConstString &name,
+ /// \see Module::FindFunctions ()
+ size_t FindFunctions(ConstString name,
lldb::FunctionNameType name_type_mask,
bool include_symbols, bool include_inlines, bool append,
SymbolContextList &sc_list) const;
- //------------------------------------------------------------------
- /// @see Module::FindFunctionSymbols ()
- //------------------------------------------------------------------
- size_t FindFunctionSymbols(const ConstString &name,
+ /// \see Module::FindFunctionSymbols ()
+ size_t FindFunctionSymbols(ConstString name,
lldb::FunctionNameType name_type_mask,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
- /// @see Module::FindFunctions ()
- //------------------------------------------------------------------
+ /// \see Module::FindFunctions ()
size_t FindFunctions(const RegularExpression &name, bool include_symbols,
bool include_inlines, bool append,
SymbolContextList &sc_list);
- //------------------------------------------------------------------
/// Find global and static variables by name.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the global or static variable we are looking
/// for.
///
- /// @param[in] max_matches
+ /// \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] variable_list
+ /// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// @return
+ /// \return
/// The number of matches added to \a variable_list.
- //------------------------------------------------------------------
- size_t FindGlobalVariables(const ConstString &name, size_t max_matches,
+ size_t FindGlobalVariables(ConstString name, size_t max_matches,
VariableList &variable_list) const;
- //------------------------------------------------------------------
/// Find global and static variables by regular expression.
///
- /// @param[in] regex
+ /// \param[in] regex
/// A regular expression to use when matching the name.
///
- /// @param[in] max_matches
+ /// \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] variable_list
+ /// \param[in] variable_list
/// A list of variables that gets the matches appended to.
///
- /// @return
+ /// \return
/// The number of matches added to \a variable_list.
- //------------------------------------------------------------------
size_t FindGlobalVariables(const RegularExpression &regex, size_t max_matches,
VariableList &variable_list) const;
- //------------------------------------------------------------------
/// Finds the first module whose file specification matches \a file_spec.
///
- /// @param[in] file_spec_ptr
+ /// \param[in] file_spec_ptr
/// 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
@@ -369,42 +322,39 @@ public:
/// NULL, then file specifications won't be compared when
/// searching for matching modules.
///
- /// @param[in] arch_ptr
+ /// \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
+ /// \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
+ /// \param[in] object_name
/// An optional object name that must match as well. This value
/// can be NULL.
///
- /// @param[out] matching_module_list
+ /// \param[out] matching_module_list
/// A module list that gets filled in with any modules that
/// match the search criteria.
///
- /// @return
+ /// \return
/// The number of matching modules found by the search.
- //------------------------------------------------------------------
size_t FindModules(const ModuleSpec &module_spec,
ModuleList &matching_module_list) const;
lldb::ModuleSP FindModule(const Module *module_ptr) const;
- //------------------------------------------------------------------
// Find a module by UUID
//
// The UUID value for a module is extracted from the ObjectFile and is the
// MD5 checksum, or a smarter object file equivalent, so finding modules by
// UUID values is very efficient and accurate.
- //------------------------------------------------------------------
lldb::ModuleSP FindModule(const UUID &uuid) const;
lldb::ModuleSP FindFirstModule(const ModuleSpec &module_spec) const;
- size_t FindSymbolsWithNameAndType(const ConstString &name,
+ size_t FindSymbolsWithNameAndType(ConstString name,
lldb::SymbolType symbol_type,
SymbolContextList &sc_list,
bool append = false) const;
@@ -414,67 +364,64 @@ public:
SymbolContextList &sc_list,
bool append = false) const;
- //------------------------------------------------------------------
/// Find types by name.
///
- /// @param[in] search_first
+ /// \param[in] search_first
/// If non-null, this module will be searched before any other
/// modules.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the type we are looking for.
///
- /// @param[in] append
+ /// \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
+ /// \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
+ /// \param[in] encoding
/// Limit the search to specific types, or get all types if
/// set to Type::invalid.
///
- /// @param[in] udt_name
+ /// \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] type_list
/// A type list gets populated with any matches.
///
- /// @return
+ /// \return
/// The number of matches added to \a type_list.
- //------------------------------------------------------------------
- size_t FindTypes(Module *search_first, const ConstString &name,
+ size_t FindTypes(Module *search_first, ConstString name,
bool name_is_fully_qualified, size_t max_matches,
llvm::DenseSet<SymbolFile *> &searched_symbol_files,
TypeList &types) const;
bool FindSourceFile(const FileSpec &orig_spec, FileSpec &new_spec) const;
- //------------------------------------------------------------------
/// Find addresses by file/line
///
- /// @param[in] target_sp
+ /// \param[in] target_sp
/// The target the addresses are desired for.
///
- /// @param[in] file
+ /// \param[in] file
/// Source file to locate.
///
- /// @param[in] line
+ /// \param[in] line
/// Source line to locate.
///
- /// @param[in] function
+ /// \param[in] function
/// Optional filter function. Addresses within this function will be
/// added to the 'local' list. All others will be added to the 'extern'
/// list.
///
- /// @param[out] output_local
+ /// \param[out] output_local
/// All matching addresses within 'function'
///
- /// @param[out] output_extern
+ /// \param[out] output_extern
/// All matching addresses not within 'function'
void FindAddressesForLine(const lldb::TargetSP target_sp,
const FileSpec &file, uint32_t line,
@@ -482,7 +429,21 @@ public:
std::vector<Address> &output_local,
std::vector<Address> &output_extern);
- bool Remove(const lldb::ModuleSP &module_sp);
+ /// Remove a module from the module list.
+ ///
+ /// \param[in] module_sp
+ /// A shared pointer to a module to remove from this collection.
+ ///
+ /// \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::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);
size_t Remove(ModuleList &module_list);
@@ -492,36 +453,28 @@ public:
bool ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) const;
- //------------------------------------------------------------------
- /// @copydoc Module::ResolveSymbolContextForAddress (const Address
+ /// \copydoc Module::ResolveSymbolContextForAddress (const Address
/// &,uint32_t,SymbolContext&)
- //------------------------------------------------------------------
uint32_t ResolveSymbolContextForAddress(const Address &so_addr,
lldb::SymbolContextItem resolve_scope,
SymbolContext &sc) const;
- //------------------------------------------------------------------
- /// @copydoc Module::ResolveSymbolContextForFilePath (const char
+ /// \copydoc Module::ResolveSymbolContextForFilePath (const char
/// *,uint32_t,bool,uint32_t,SymbolContextList&)
- //------------------------------------------------------------------
uint32_t ResolveSymbolContextForFilePath(
const char *file_path, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
- //------------------------------------------------------------------
- /// @copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec
+ /// \copydoc Module::ResolveSymbolContextsForFileSpec (const FileSpec
/// &,uint32_t,bool,uint32_t,SymbolContextList&)
- //------------------------------------------------------------------
uint32_t ResolveSymbolContextsForFileSpec(
const FileSpec &file_spec, uint32_t line, bool check_inlines,
lldb::SymbolContextItem resolve_scope, SymbolContextList &sc_list) const;
- //------------------------------------------------------------------
/// Gets the size of the module list.
///
- /// @return
+ /// \return
/// The number of modules in the module list.
- //------------------------------------------------------------------
size_t GetSize() const;
bool LoadScriptingResourcesInTarget(Target *target, std::list<Status> &errors,
@@ -552,9 +505,7 @@ public:
&callback) const;
protected:
- //------------------------------------------------------------------
// Class typedefs.
- //------------------------------------------------------------------
typedef std::vector<lldb::ModuleSP>
collection; ///< The module collection type.
@@ -567,9 +518,7 @@ protected:
void ClearImpl(bool use_notifier = true);
- //------------------------------------------------------------------
// Member variables.
- //------------------------------------------------------------------
collection m_modules; ///< The collection of modules.
mutable std::recursive_mutex m_modules_mutex;
diff --git a/include/lldb/Core/ModuleSpec.h b/include/lldb/Core/ModuleSpec.h
index ae772c2a1efe..ab0f4e9912a8 100644
--- a/include/lldb/Core/ModuleSpec.h
+++ b/include/lldb/Core/ModuleSpec.h
@@ -1,9 +1,8 @@
//===-- ModuleSpec.h --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -125,7 +124,7 @@ public:
ConstString &GetObjectName() { return m_object_name; }
- const ConstString &GetObjectName() const { return m_object_name; }
+ ConstString GetObjectName() const { return m_object_name; }
uint64_t GetObjectOffset() const { return m_object_offset; }
@@ -312,8 +311,10 @@ public:
ModuleSpecList &operator=(const ModuleSpecList &rhs) {
if (this != &rhs) {
- std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex);
- std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex);
+ std::lock(m_mutex, rhs.m_mutex);
+ std::lock_guard<std::recursive_mutex> lhs_guard(m_mutex, std::adopt_lock);
+ std::lock_guard<std::recursive_mutex> rhs_guard(rhs.m_mutex,
+ std::adopt_lock);
m_specs = rhs.m_specs;
}
return *this;
diff --git a/include/lldb/Core/Opcode.h b/include/lldb/Core/Opcode.h
index fb6cc825abd2..1a30ce4834ac 100644
--- a/include/lldb/Core/Opcode.h
+++ b/include/lldb/Core/Opcode.h
@@ -1,9 +1,8 @@
//===-- Opcode.h ------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,18 +18,13 @@
#include <stdint.h>
#include <string.h>
-namespace lldb_private {
-class DataExtractor;
-}
-namespace lldb_private {
-class Stream;
-}
-
namespace lldb {
class SBInstruction;
}
namespace lldb_private {
+class DataExtractor;
+class Stream;
class Opcode {
public:
diff --git a/include/lldb/Core/PluginInterface.h b/include/lldb/Core/PluginInterface.h
index 24f53c62ab09..6e625a605917 100644
--- a/include/lldb/Core/PluginInterface.h
+++ b/include/lldb/Core/PluginInterface.h
@@ -1,9 +1,8 @@
//===-- PluginInterface.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/PluginManager.h b/include/lldb/Core/PluginManager.h
index 598ee9a8d8e3..1bac1e5df694 100644
--- a/include/lldb/Core/PluginManager.h
+++ b/include/lldb/Core/PluginManager.h
@@ -1,9 +1,8 @@
//===-- PluginManager.h -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,17 +22,9 @@
namespace lldb_private {
class CommandInterpreter;
-}
-namespace lldb_private {
class ConstString;
-}
-namespace lldb_private {
class Debugger;
-}
-namespace lldb_private {
class StringList;
-}
-namespace lldb_private {
class PluginManager {
public:
@@ -41,10 +32,8 @@ public:
static void Terminate();
- //------------------------------------------------------------------
// ABI
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
ABICreateInstance create_callback);
static bool UnregisterPlugin(ABICreateInstance create_callback);
@@ -52,15 +41,13 @@ public:
static ABICreateInstance GetABICreateCallbackAtIndex(uint32_t idx);
static ABICreateInstance
- GetABICreateCallbackForPluginName(const ConstString &name);
+ GetABICreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// Architecture
- //------------------------------------------------------------------
using ArchitectureCreateInstance =
std::unique_ptr<Architecture> (*)(const ArchSpec &);
- static void RegisterPlugin(const ConstString &name,
+ static void RegisterPlugin(ConstString name,
llvm::StringRef description,
ArchitectureCreateInstance create_callback);
@@ -69,10 +56,8 @@ public:
static std::unique_ptr<Architecture>
CreateArchitectureInstance(const ArchSpec &arch);
- //------------------------------------------------------------------
// Disassembler
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
DisassemblerCreateInstance create_callback);
static bool UnregisterPlugin(DisassemblerCreateInstance create_callback);
@@ -81,13 +66,11 @@ public:
GetDisassemblerCreateCallbackAtIndex(uint32_t idx);
static DisassemblerCreateInstance
- GetDisassemblerCreateCallbackForPluginName(const ConstString &name);
+ GetDisassemblerCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// DynamicLoader
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
DynamicLoaderCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -97,13 +80,11 @@ public:
GetDynamicLoaderCreateCallbackAtIndex(uint32_t idx);
static DynamicLoaderCreateInstance
- GetDynamicLoaderCreateCallbackForPluginName(const ConstString &name);
+ GetDynamicLoaderCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// JITLoader
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
JITLoaderCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -113,12 +94,10 @@ public:
GetJITLoaderCreateCallbackAtIndex(uint32_t idx);
static JITLoaderCreateInstance
- GetJITLoaderCreateCallbackForPluginName(const ConstString &name);
+ GetJITLoaderCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// EmulateInstruction
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
EmulateInstructionCreateInstance create_callback);
static bool
@@ -128,12 +107,10 @@ public:
GetEmulateInstructionCreateCallbackAtIndex(uint32_t idx);
static EmulateInstructionCreateInstance
- GetEmulateInstructionCreateCallbackForPluginName(const ConstString &name);
+ GetEmulateInstructionCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// OperatingSystem
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
OperatingSystemCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback);
@@ -143,12 +120,10 @@ public:
GetOperatingSystemCreateCallbackAtIndex(uint32_t idx);
static OperatingSystemCreateInstance
- GetOperatingSystemCreateCallbackForPluginName(const ConstString &name);
+ GetOperatingSystemCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// Language
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
LanguageCreateInstance create_callback);
static bool UnregisterPlugin(LanguageCreateInstance create_callback);
@@ -156,15 +131,14 @@ public:
static LanguageCreateInstance GetLanguageCreateCallbackAtIndex(uint32_t idx);
static LanguageCreateInstance
- GetLanguageCreateCallbackForPluginName(const ConstString &name);
+ GetLanguageCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// LanguageRuntime
- //------------------------------------------------------------------
- static bool
- RegisterPlugin(const ConstString &name, const char *description,
- LanguageRuntimeCreateInstance create_callback,
- LanguageRuntimeGetCommandObject command_callback = nullptr);
+ static bool RegisterPlugin(
+ ConstString name, const char *description,
+ LanguageRuntimeCreateInstance create_callback,
+ LanguageRuntimeGetCommandObject command_callback = nullptr,
+ LanguageRuntimeGetExceptionPrecondition precondition_callback = nullptr);
static bool UnregisterPlugin(LanguageRuntimeCreateInstance create_callback);
@@ -174,13 +148,14 @@ public:
static LanguageRuntimeGetCommandObject
GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx);
+ static LanguageRuntimeGetExceptionPrecondition
+ GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx);
+
static LanguageRuntimeCreateInstance
- GetLanguageRuntimeCreateCallbackForPluginName(const ConstString &name);
+ GetLanguageRuntimeCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// SystemRuntime
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
SystemRuntimeCreateInstance create_callback);
static bool UnregisterPlugin(SystemRuntimeCreateInstance create_callback);
@@ -189,13 +164,11 @@ public:
GetSystemRuntimeCreateCallbackAtIndex(uint32_t idx);
static SystemRuntimeCreateInstance
- GetSystemRuntimeCreateCallbackForPluginName(const ConstString &name);
+ GetSystemRuntimeCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// ObjectFile
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
ObjectFileCreateInstance create_callback,
ObjectFileCreateMemoryInstance create_memory_callback,
ObjectFileGetModuleSpecifications get_module_specifications,
@@ -213,19 +186,17 @@ public:
GetObjectFileGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
static ObjectFileCreateInstance
- GetObjectFileCreateCallbackForPluginName(const ConstString &name);
+ GetObjectFileCreateCallbackForPluginName(ConstString name);
static ObjectFileCreateMemoryInstance
- GetObjectFileCreateMemoryCallbackForPluginName(const ConstString &name);
+ GetObjectFileCreateMemoryCallbackForPluginName(ConstString name);
static Status SaveCore(const lldb::ProcessSP &process_sp,
const FileSpec &outfile);
- //------------------------------------------------------------------
// ObjectContainer
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
ObjectContainerCreateInstance create_callback,
ObjectFileGetModuleSpecifications get_module_specifications);
@@ -235,16 +206,14 @@ public:
GetObjectContainerCreateCallbackAtIndex(uint32_t idx);
static ObjectContainerCreateInstance
- GetObjectContainerCreateCallbackForPluginName(const ConstString &name);
+ GetObjectContainerCreateCallbackForPluginName(ConstString name);
static ObjectFileGetModuleSpecifications
GetObjectContainerGetModuleSpecificationsCallbackAtIndex(uint32_t idx);
- //------------------------------------------------------------------
// Platform
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
PlatformCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -253,7 +222,7 @@ public:
static PlatformCreateInstance GetPlatformCreateCallbackAtIndex(uint32_t idx);
static PlatformCreateInstance
- GetPlatformCreateCallbackForPluginName(const ConstString &name);
+ GetPlatformCreateCallbackForPluginName(ConstString name);
static const char *GetPlatformPluginNameAtIndex(uint32_t idx);
@@ -261,11 +230,9 @@ public:
static size_t AutoCompletePlatformName(llvm::StringRef partial_name,
StringList &matches);
- //------------------------------------------------------------------
// Process
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
ProcessCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -274,16 +241,14 @@ public:
static ProcessCreateInstance GetProcessCreateCallbackAtIndex(uint32_t idx);
static ProcessCreateInstance
- GetProcessCreateCallbackForPluginName(const ConstString &name);
+ GetProcessCreateCallbackForPluginName(ConstString name);
static const char *GetProcessPluginNameAtIndex(uint32_t idx);
static const char *GetProcessPluginDescriptionAtIndex(uint32_t idx);
- //------------------------------------------------------------------
// ScriptInterpreter
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
lldb::ScriptLanguage script_lang,
ScriptInterpreterCreateInstance create_callback);
@@ -294,32 +259,29 @@ public:
static lldb::ScriptInterpreterSP
GetScriptInterpreterForLanguage(lldb::ScriptLanguage script_lang,
- CommandInterpreter &interpreter);
+ Debugger &debugger);
- //------------------------------------------------------------------
// StructuredDataPlugin
- //------------------------------------------------------------------
- //------------------------------------------------------------------
/// Register a StructuredDataPlugin class along with optional
/// callbacks for debugger initialization and Process launch info
/// filtering and manipulation.
///
- /// @param[in] name
+ /// \param[in] name
/// The name of the plugin.
///
- /// @param[in] description
+ /// \param[in] description
/// A description string for the plugin.
///
- /// @param[in] create_callback
+ /// \param[in] create_callback
/// The callback that will be invoked to create an instance of
/// the callback. This may not be nullptr.
///
- /// @param[in] debugger_init_callback
+ /// \param[in] debugger_init_callback
/// An optional callback that will be made when a Debugger
/// instance is initialized.
///
- /// @param[in] filter_callback
+ /// \param[in] filter_callback
/// An optional callback that will be invoked before LLDB
/// launches a process for debugging. The callback must
/// do the following:
@@ -331,11 +293,10 @@ public:
/// plugin if, for instance, additional environment variables
/// are needed to support the feature when enabled.
///
- /// @return
+ /// \return
/// Returns true upon success; otherwise, false.
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
StructuredDataPluginCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr,
StructuredDataFilterLaunchInfo filter_callback = nullptr);
@@ -347,17 +308,15 @@ public:
GetStructuredDataPluginCreateCallbackAtIndex(uint32_t idx);
static StructuredDataPluginCreateInstance
- GetStructuredDataPluginCreateCallbackForPluginName(const ConstString &name);
+ GetStructuredDataPluginCreateCallbackForPluginName(ConstString name);
static StructuredDataFilterLaunchInfo
GetStructuredDataFilterCallbackAtIndex(uint32_t idx,
bool &iteration_complete);
- //------------------------------------------------------------------
// SymbolFile
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
SymbolFileCreateInstance create_callback,
DebuggerInitializeCallback debugger_init_callback = nullptr);
@@ -367,12 +326,10 @@ public:
GetSymbolFileCreateCallbackAtIndex(uint32_t idx);
static SymbolFileCreateInstance
- GetSymbolFileCreateCallbackForPluginName(const ConstString &name);
+ GetSymbolFileCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// SymbolVendor
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
SymbolVendorCreateInstance create_callback);
static bool UnregisterPlugin(SymbolVendorCreateInstance create_callback);
@@ -381,12 +338,10 @@ public:
GetSymbolVendorCreateCallbackAtIndex(uint32_t idx);
static SymbolVendorCreateInstance
- GetSymbolVendorCreateCallbackForPluginName(const ConstString &name);
+ GetSymbolVendorCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// UnwindAssembly
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
UnwindAssemblyCreateInstance create_callback);
static bool UnregisterPlugin(UnwindAssemblyCreateInstance create_callback);
@@ -395,12 +350,10 @@ public:
GetUnwindAssemblyCreateCallbackAtIndex(uint32_t idx);
static UnwindAssemblyCreateInstance
- GetUnwindAssemblyCreateCallbackForPluginName(const ConstString &name);
+ GetUnwindAssemblyCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// MemoryHistory
- //------------------------------------------------------------------
- static bool RegisterPlugin(const ConstString &name, const char *description,
+ static bool RegisterPlugin(ConstString name, const char *description,
MemoryHistoryCreateInstance create_callback);
static bool UnregisterPlugin(MemoryHistoryCreateInstance create_callback);
@@ -409,13 +362,11 @@ public:
GetMemoryHistoryCreateCallbackAtIndex(uint32_t idx);
static MemoryHistoryCreateInstance
- GetMemoryHistoryCreateCallbackForPluginName(const ConstString &name);
+ GetMemoryHistoryCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// InstrumentationRuntime
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
InstrumentationRuntimeCreateInstance create_callback,
InstrumentationRuntimeGetType get_type_callback);
@@ -429,13 +380,11 @@ public:
GetInstrumentationRuntimeCreateCallbackAtIndex(uint32_t idx);
static InstrumentationRuntimeCreateInstance
- GetInstrumentationRuntimeCreateCallbackForPluginName(const ConstString &name);
+ GetInstrumentationRuntimeCreateCallbackForPluginName(ConstString name);
- //------------------------------------------------------------------
// TypeSystem
- //------------------------------------------------------------------
static bool RegisterPlugin(
- const ConstString &name, const char *description,
+ ConstString name, const char *description,
TypeSystemCreateInstance create_callback,
TypeSystemEnumerateSupportedLanguages enumerate_languages_callback);
@@ -445,20 +394,18 @@ public:
GetTypeSystemCreateCallbackAtIndex(uint32_t idx);
static TypeSystemCreateInstance
- GetTypeSystemCreateCallbackForPluginName(const ConstString &name);
+ GetTypeSystemCreateCallbackForPluginName(ConstString name);
static TypeSystemEnumerateSupportedLanguages
GetTypeSystemEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
static TypeSystemEnumerateSupportedLanguages
GetTypeSystemEnumerateSupportedLanguagesCallbackForPluginName(
- const ConstString &name);
+ ConstString name);
- //------------------------------------------------------------------
// REPL
- //------------------------------------------------------------------
static bool
- RegisterPlugin(const ConstString &name, const char *description,
+ RegisterPlugin(ConstString name, const char *description,
REPLCreateInstance create_callback,
REPLEnumerateSupportedLanguages enumerate_languages_callback);
@@ -467,79 +414,77 @@ public:
static REPLCreateInstance GetREPLCreateCallbackAtIndex(uint32_t idx);
static REPLCreateInstance
- GetREPLCreateCallbackForPluginName(const ConstString &name);
+ GetREPLCreateCallbackForPluginName(ConstString name);
static REPLEnumerateSupportedLanguages
GetREPLEnumerateSupportedLanguagesCallbackAtIndex(uint32_t idx);
static REPLEnumerateSupportedLanguages
GetREPLSystemEnumerateSupportedLanguagesCallbackForPluginName(
- const ConstString &name);
+ ConstString name);
- //------------------------------------------------------------------
// Some plug-ins might register a DebuggerInitializeCallback callback when
// registering the plug-in. After a new Debugger instance is created, this
// DebuggerInitialize function will get called. This allows plug-ins to
// install Properties and do any other initialization that requires a
// debugger instance.
- //------------------------------------------------------------------
static void DebuggerInitialize(Debugger &debugger);
static lldb::OptionValuePropertiesSP
GetSettingForDynamicLoaderPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForDynamicLoaderPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForPlatformPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForPlatformPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForProcessPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForProcessPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForSymbolFilePlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForSymbolFilePlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForJITLoaderPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForJITLoaderPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForOperatingSystemPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForOperatingSystemPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
static lldb::OptionValuePropertiesSP
GetSettingForStructuredDataPlugin(Debugger &debugger,
- const ConstString &setting_name);
+ ConstString setting_name);
static bool CreateSettingForStructuredDataPlugin(
Debugger &debugger, const lldb::OptionValuePropertiesSP &properties_sp,
- const ConstString &description, bool is_global_property);
+ ConstString description, bool is_global_property);
};
} // namespace lldb_private
diff --git a/include/lldb/Core/RangeMap.h b/include/lldb/Core/RangeMap.h
deleted file mode 100644
index 5a75a24f7f61..000000000000
--- a/include/lldb/Core/RangeMap.h
+++ /dev/null
@@ -1,950 +0,0 @@
-//===-- RangeMap.h ----------------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef liblldb_RangeMap_h_
-#define liblldb_RangeMap_h_
-
-#include <algorithm>
-#include <vector>
-
-#include "llvm/ADT/SmallVector.h"
-
-#include "lldb/lldb-private.h"
-
-// Uncomment to make sure all Range objects are sorted when needed
-//#define ASSERT_RANGEMAP_ARE_SORTED
-
-namespace lldb_private {
-
-//----------------------------------------------------------------------
-// Templatized classes for dealing with generic ranges and also collections of
-// ranges, or collections of ranges that have associated data.
-//----------------------------------------------------------------------
-
-//----------------------------------------------------------------------
-// A simple range class where you get to define the type of the range
-// base "B", and the type used for the range byte size "S".
-//----------------------------------------------------------------------
-template <typename B, typename S> struct Range {
- typedef B BaseType;
- typedef S SizeType;
-
- BaseType base;
- SizeType size;
-
- Range() : base(0), size(0) {}
-
- Range(BaseType b, SizeType s) : base(b), size(s) {}
-
- void Clear(BaseType b = 0) {
- base = b;
- size = 0;
- }
-
- // Set the start value for the range, and keep the same size
- BaseType GetRangeBase() const { return base; }
-
- void SetRangeBase(BaseType b) { base = b; }
-
- void Slide(BaseType slide) { base += slide; }
-
- bool Union(const Range &rhs)
- {
- if (DoesAdjoinOrIntersect(rhs))
- {
- auto new_end = std::max<BaseType>(GetRangeEnd(), rhs.GetRangeEnd());
- base = std::min<BaseType>(base, rhs.base);
- size = new_end - base;
- return true;
- }
- return false;
- }
-
- BaseType GetRangeEnd() const { return base + size; }
-
- void SetRangeEnd(BaseType end) {
- if (end > base)
- size = end - base;
- else
- size = 0;
- }
-
- SizeType GetByteSize() const { return size; }
-
- void SetByteSize(SizeType s) { size = s; }
-
- bool IsValid() const { return size > 0; }
-
- bool Contains(BaseType r) const {
- return (GetRangeBase() <= r) && (r < GetRangeEnd());
- }
-
- bool ContainsEndInclusive(BaseType r) const {
- return (GetRangeBase() <= r) && (r <= GetRangeEnd());
- }
-
- bool Contains(const Range &range) const {
- return Contains(range.GetRangeBase()) &&
- ContainsEndInclusive(range.GetRangeEnd());
- }
-
- // Returns true if the two ranges adjoing or intersect
- bool DoesAdjoinOrIntersect(const Range &rhs) const {
- const BaseType lhs_base = this->GetRangeBase();
- const BaseType rhs_base = rhs.GetRangeBase();
- const BaseType lhs_end = this->GetRangeEnd();
- const BaseType rhs_end = rhs.GetRangeEnd();
- bool result = (lhs_base <= rhs_end) && (lhs_end >= rhs_base);
- return result;
- }
-
- // Returns true if the two ranges intersect
- bool DoesIntersect(const Range &rhs) const {
- const BaseType lhs_base = this->GetRangeBase();
- const BaseType rhs_base = rhs.GetRangeBase();
- const BaseType lhs_end = this->GetRangeEnd();
- const BaseType rhs_end = rhs.GetRangeEnd();
- bool result = (lhs_base < rhs_end) && (lhs_end > rhs_base);
- return result;
- }
-
- bool operator<(const Range &rhs) const {
- if (base == rhs.base)
- return size < rhs.size;
- return base < rhs.base;
- }
-
- bool operator==(const Range &rhs) const {
- return base == rhs.base && size == rhs.size;
- }
-
- bool operator!=(const Range &rhs) const {
- return base != rhs.base || size != rhs.size;
- }
-};
-
-//----------------------------------------------------------------------
-// A range array class where you get to define the type of the ranges
-// that the collection contains.
-//----------------------------------------------------------------------
-
-template <typename B, typename S, unsigned N> class RangeArray {
-public:
- typedef B BaseType;
- typedef S SizeType;
- typedef Range<B, S> Entry;
- typedef llvm::SmallVector<Entry, N> Collection;
-
- RangeArray() = default;
-
- ~RangeArray() = default;
-
- void Append(const Entry &entry) { m_entries.push_back(entry); }
-
- void Append(B base, S size) { m_entries.emplace_back(base, size); }
-
- bool RemoveEntrtAtIndex(uint32_t idx) {
- if (idx < m_entries.size()) {
- m_entries.erase(m_entries.begin() + idx);
- return true;
- }
- return false;
- }
-
- void Sort() {
- if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
- }
-
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- bool IsSorted() const {
- typename Collection::const_iterator pos, end, prev;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && *pos < *prev)
- return false;
- }
- return true;
- }
-#endif
-
- void CombineConsecutiveRanges() {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- // Can't combine if ranges if we have zero or one range
- if (m_entries.size() > 1) {
- // The list should be sorted prior to calling this function
- typename Collection::iterator pos;
- typename Collection::iterator end;
- typename Collection::iterator prev;
- bool can_combine = false;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
- can_combine = true;
- break;
- }
- }
-
- // We we can combine at least one entry, then we make a new collection
- // and populate it accordingly, and then swap it into place.
- if (can_combine) {
- Collection minimal_ranges;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
- minimal_ranges.back().SetRangeEnd(
- std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
- else
- minimal_ranges.push_back(*pos);
- }
- // Use the swap technique in case our new vector is much smaller. We
- // must swap when using the STL because std::vector objects never
- // release or reduce the memory once it has been allocated/reserved.
- m_entries.swap(minimal_ranges);
- }
- }
- }
-
- BaseType GetMinRangeBase(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the first
- // range's base
- return m_entries.front().GetRangeBase();
- }
-
- BaseType GetMaxRangeEnd(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the last
- // range's end
- return m_entries.back().GetRangeEnd();
- }
-
- void Slide(BaseType slide) {
- typename Collection::iterator pos, end;
- for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
- pos->Slide(slide);
- }
-
- void Clear() { m_entries.clear(); }
-
- bool IsEmpty() const { return m_entries.empty(); }
-
- size_t GetSize() const { return m_entries.size(); }
-
- const Entry *GetEntryAtIndex(size_t i) const {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- // Clients must ensure that "i" is a valid index prior to calling this
- // function
- const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
-
- Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
-
- const Entry *Back() const {
- return (m_entries.empty() ? nullptr : &m_entries.back());
- }
-
- static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
- return lhs.GetRangeBase() < rhs.GetRangeBase();
- }
-
- uint32_t FindEntryIndexThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return std::distance(begin, pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr))
- return std::distance(begin, pos);
- }
- }
- return UINT32_MAX;
- }
-
- const Entry *FindEntryThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
- const Entry *FindEntryThatContains(const Entry &range) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, range, BaseLessThan);
-
- if (pos != end && pos->Contains(range)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(range)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
-protected:
- Collection m_entries;
-};
-
-template <typename B, typename S> class RangeVector {
-public:
- typedef B BaseType;
- typedef S SizeType;
- typedef Range<B, S> Entry;
- typedef std::vector<Entry> Collection;
-
- RangeVector() = default;
-
- ~RangeVector() = default;
-
- void Append(const Entry &entry) { m_entries.push_back(entry); }
-
- void Append(B base, S size) { m_entries.emplace_back(base, size); }
-
- // Insert an item into a sorted list and optionally combine it with any
- // adjacent blocks if requested.
- void Insert(const Entry &entry, bool combine) {
- if (m_entries.empty()) {
- m_entries.push_back(entry);
- return;
- }
- auto begin = m_entries.begin();
- auto end = m_entries.end();
- auto pos = std::lower_bound(begin, end, entry);
- if (combine) {
- if (pos != end && pos->Union(entry)) {
- CombinePrevAndNext(pos);
- return;
- }
- if (pos != begin) {
- auto prev = pos - 1;
- if (prev->Union(entry)) {
- CombinePrevAndNext(prev);
- return;
- }
- }
- }
- m_entries.insert(pos, entry);
- }
-
- bool RemoveEntryAtIndex(uint32_t idx) {
- if (idx < m_entries.size()) {
- m_entries.erase(m_entries.begin() + idx);
- return true;
- }
- return false;
- }
-
- void Sort() {
- if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
- }
-
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- bool IsSorted() const {
- typename Collection::const_iterator pos, end, prev;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && *pos < *prev)
- return false;
- }
- return true;
- }
-#endif
-
- void CombineConsecutiveRanges() {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- // Can't combine if ranges if we have zero or one range
- if (m_entries.size() > 1) {
- // The list should be sorted prior to calling this function
- typename Collection::iterator pos;
- typename Collection::iterator end;
- typename Collection::iterator prev;
- bool can_combine = false;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos)) {
- can_combine = true;
- break;
- }
- }
-
- // We we can combine at least one entry, then we make a new collection
- // and populate it accordingly, and then swap it into place.
- if (can_combine) {
- Collection minimal_ranges;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->DoesAdjoinOrIntersect(*pos))
- minimal_ranges.back().SetRangeEnd(
- std::max<BaseType>(prev->GetRangeEnd(), pos->GetRangeEnd()));
- else
- minimal_ranges.push_back(*pos);
- }
- // Use the swap technique in case our new vector is much smaller. We
- // must swap when using the STL because std::vector objects never
- // release or reduce the memory once it has been allocated/reserved.
- m_entries.swap(minimal_ranges);
- }
- }
- }
-
- BaseType GetMinRangeBase(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the first
- // range's base
- return m_entries.front().GetRangeBase();
- }
-
- BaseType GetMaxRangeEnd(BaseType fail_value) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (m_entries.empty())
- return fail_value;
- // m_entries must be sorted, so if we aren't empty, we grab the last
- // range's end
- return m_entries.back().GetRangeEnd();
- }
-
- void Slide(BaseType slide) {
- typename Collection::iterator pos, end;
- for (pos = m_entries.begin(), end = m_entries.end(); pos != end; ++pos)
- pos->Slide(slide);
- }
-
- void Clear() { m_entries.clear(); }
-
- void Reserve(typename Collection::size_type size) { m_entries.reserve(size); }
-
- bool IsEmpty() const { return m_entries.empty(); }
-
- size_t GetSize() const { return m_entries.size(); }
-
- const Entry *GetEntryAtIndex(size_t i) const {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- // Clients must ensure that "i" is a valid index prior to calling this
- // function
- Entry &GetEntryRef(size_t i) { return m_entries[i]; }
- const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
-
- Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
-
- const Entry *Back() const {
- return (m_entries.empty() ? nullptr : &m_entries.back());
- }
-
- static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
- return lhs.GetRangeBase() < rhs.GetRangeBase();
- }
-
- uint32_t FindEntryIndexThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return std::distance(begin, pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr))
- return std::distance(begin, pos);
- }
- }
- return UINT32_MAX;
- }
-
- const Entry *FindEntryThatContains(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry(addr, 1);
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- if (pos != end && pos->Contains(addr)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(addr)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
- const Entry *FindEntryThatContains(const Entry &range) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, range, BaseLessThan);
-
- if (pos != end && pos->Contains(range)) {
- return &(*pos);
- } else if (pos != begin) {
- --pos;
- if (pos->Contains(range)) {
- return &(*pos);
- }
- }
- }
- return nullptr;
- }
-
-protected:
-
- void CombinePrevAndNext(typename Collection::iterator pos) {
- // Check if the prev or next entries in case they need to be unioned with
- // the entry pointed to by "pos".
- if (pos != m_entries.begin()) {
- auto prev = pos - 1;
- if (prev->Union(*pos))
- m_entries.erase(pos);
- pos = prev;
- }
-
- auto end = m_entries.end();
- if (pos != end) {
- auto next = pos + 1;
- if (next != end) {
- if (pos->Union(*next))
- m_entries.erase(next);
- }
- }
- return;
- }
-
- Collection m_entries;
-};
-
-//----------------------------------------------------------------------
-// A simple range with data class where you get to define the type of
-// the range base "B", the type used for the range byte size "S", and the type
-// for the associated data "T".
-//----------------------------------------------------------------------
-template <typename B, typename S, typename T>
-struct RangeData : public Range<B, S> {
- typedef T DataType;
-
- DataType data;
-
- RangeData() : Range<B, S>(), data() {}
-
- 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>
-class RangeDataVector {
-public:
- typedef RangeData<B, S, T> Entry;
- typedef llvm::SmallVector<Entry, N> Collection;
-
- RangeDataVector() = default;
-
- ~RangeDataVector() = default;
-
- void Append(const Entry &entry) { m_entries.push_back(entry); }
-
- void Sort() {
- if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
- }
-
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- bool IsSorted() const {
- typename Collection::const_iterator pos, end, prev;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && *pos < *prev)
- return false;
- }
- return true;
- }
-#endif
-
- void CombineConsecutiveEntriesWithEqualData() {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- typename Collection::iterator pos;
- typename Collection::iterator end;
- typename Collection::iterator prev;
- bool can_combine = false;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && prev->data == pos->data) {
- can_combine = true;
- break;
- }
- }
-
- // We we can combine at least one entry, then we make a new collection and
- // populate it accordingly, and then swap it into place.
- if (can_combine) {
- Collection minimal_ranges;
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end;
- pos != end; prev = pos++) {
- if (prev != end && prev->data == pos->data)
- minimal_ranges.back().SetRangeEnd(pos->GetRangeEnd());
- else
- minimal_ranges.push_back(*pos);
- }
- // Use the swap technique in case our new vector is much smaller. We must
- // swap when using the STL because std::vector objects never release or
- // reduce the memory once it has been allocated/reserved.
- m_entries.swap(minimal_ranges);
- }
- }
-
- void Clear() { m_entries.clear(); }
-
- bool IsEmpty() const { return m_entries.empty(); }
-
- size_t GetSize() const { return m_entries.size(); }
-
- const Entry *GetEntryAtIndex(size_t i) const {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- Entry *GetMutableEntryAtIndex(size_t i) {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- // Clients must ensure that "i" is a valid index prior to calling this
- // function
- const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
-
- static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
- return lhs.GetRangeBase() < rhs.GetRangeBase();
- }
-
- uint32_t FindEntryIndexThatContains(B addr) const {
- const Entry *entry = FindEntryThatContains(addr);
- if (entry)
- return std::distance(m_entries.begin(), entry);
- return UINT32_MAX;
- }
-
- uint32_t FindEntryIndexesThatContain(B addr,
- std::vector<uint32_t> &indexes) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
-
- if (!m_entries.empty()) {
- for (const auto &entry : m_entries) {
- if (entry.Contains(addr))
- indexes.push_back(entry.data);
- }
- }
- return indexes.size();
- }
-
- Entry *FindEntryThatContains(B addr) {
- return const_cast<Entry *>(
- static_cast<const RangeDataVector *>(this)->FindEntryThatContains(
- addr));
- }
-
- const Entry *FindEntryThatContains(B addr) const {
- return FindEntryThatContains(Entry(addr, 1));
- }
-
- const Entry *FindEntryThatContains(const Entry &range) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(begin, end, range, BaseLessThan);
-
- while (pos != begin && pos[-1].Contains(range))
- --pos;
-
- if (pos != end && pos->Contains(range))
- return &(*pos);
- }
- return nullptr;
- }
-
- const Entry *FindEntryStartsAt(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- auto begin = m_entries.begin(), end = m_entries.end();
- auto pos = std::lower_bound(begin, end, Entry(addr, 1), BaseLessThan);
- if (pos != end && pos->base == addr)
- return &(*pos);
- }
- return nullptr;
- }
-
- // This method will return the entry that contains the given address, or the
- // entry following that address. If you give it an address of 0 and the
- // first entry starts at address 0x100, you will get the entry at 0x100.
- //
- // For most uses, FindEntryThatContains is the correct one to use, this is a
- // less commonly needed behavior. It was added for core file memory regions,
- // where we want to present a gap in the memory regions as a distinct region,
- // so we need to know the start address of the next memory section that
- // exists.
- const Entry *FindEntryThatContainsOrFollows(B addr) const {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- typename Collection::const_iterator begin = m_entries.begin();
- typename Collection::const_iterator end = m_entries.end();
- typename Collection::const_iterator pos =
- std::lower_bound(m_entries.begin(), end, addr,
- [](const Entry &lhs, B rhs_base) -> bool {
- return lhs.GetRangeEnd() <= rhs_base;
- });
-
- while (pos != begin && pos[-1].Contains(addr))
- --pos;
-
- if (pos != end)
- return &(*pos);
- }
- return nullptr;
- }
-
- Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
-
- const Entry *Back() const {
- return (m_entries.empty() ? nullptr : &m_entries.back());
- }
-
-protected:
- Collection m_entries;
-};
-
-//----------------------------------------------------------------------
-// A simple range with data class where you get to define the type of
-// the range base "B", the type used for the range byte size "S", and the type
-// for the associated data "T".
-//----------------------------------------------------------------------
-template <typename B, typename T> struct AddressData {
- typedef B BaseType;
- typedef T DataType;
-
- BaseType addr;
- DataType data;
-
- AddressData() : addr(), data() {}
-
- AddressData(B a, DataType d) : addr(a), data(d) {}
-
- bool operator<(const AddressData &rhs) const {
- if (this->addr == rhs.addr)
- return this->data < rhs.data;
- return this->addr < rhs.addr;
- }
-
- bool operator==(const AddressData &rhs) const {
- return this->addr == rhs.addr && this->data == rhs.data;
- }
-
- bool operator!=(const AddressData &rhs) const {
- return this->addr != rhs.addr || this->data == rhs.data;
- }
-};
-
-template <typename B, typename T, unsigned N> class AddressDataArray {
-public:
- typedef AddressData<B, T> Entry;
- typedef llvm::SmallVector<Entry, N> Collection;
-
- AddressDataArray() = default;
-
- ~AddressDataArray() = default;
-
- void Append(const Entry &entry) { m_entries.push_back(entry); }
-
- void Sort() {
- if (m_entries.size() > 1)
- std::stable_sort(m_entries.begin(), m_entries.end());
- }
-
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- bool IsSorted() const {
- typename Collection::const_iterator pos, end, prev;
- // First we determine if we can combine any of the Entry objects so we
- // don't end up allocating and making a new collection for no reason
- for (pos = m_entries.begin(), end = m_entries.end(), prev = end; pos != end;
- prev = pos++) {
- if (prev != end && *pos < *prev)
- return false;
- }
- return true;
- }
-#endif
-
- void Clear() { m_entries.clear(); }
-
- bool IsEmpty() const { return m_entries.empty(); }
-
- size_t GetSize() const { return m_entries.size(); }
-
- const Entry *GetEntryAtIndex(size_t i) const {
- return ((i < m_entries.size()) ? &m_entries[i] : nullptr);
- }
-
- // Clients must ensure that "i" is a valid index prior to calling this
- // function
- const Entry &GetEntryRef(size_t i) const { return m_entries[i]; }
-
- static bool BaseLessThan(const Entry &lhs, const Entry &rhs) {
- return lhs.addr < rhs.addr;
- }
-
- Entry *FindEntry(B addr, bool exact_match_only) {
-#ifdef ASSERT_RANGEMAP_ARE_SORTED
- assert(IsSorted());
-#endif
- if (!m_entries.empty()) {
- Entry entry;
- entry.addr = addr;
- typename Collection::iterator begin = m_entries.begin();
- typename Collection::iterator end = m_entries.end();
- typename Collection::iterator pos =
- std::lower_bound(begin, end, entry, BaseLessThan);
-
- while (pos != begin && pos[-1].addr == addr)
- --pos;
-
- if (pos != end) {
- if (pos->addr == addr || !exact_match_only)
- return &(*pos);
- }
- }
- return nullptr;
- }
-
- const Entry *FindNextEntry(const Entry *entry) {
- if (entry >= &*m_entries.begin() && entry + 1 < &*m_entries.end())
- return entry + 1;
- return nullptr;
- }
-
- Entry *Back() { return (m_entries.empty() ? nullptr : &m_entries.back()); }
-
- const Entry *Back() const {
- return (m_entries.empty() ? nullptr : &m_entries.back());
- }
-
-protected:
- Collection m_entries;
-};
-
-} // namespace lldb_private
-
-#endif // liblldb_RangeMap_h_
diff --git a/include/lldb/Core/RichManglingContext.h b/include/lldb/Core/RichManglingContext.h
index 30841bfb2668..e6fa2599e55a 100644
--- a/include/lldb/Core/RichManglingContext.h
+++ b/include/lldb/Core/RichManglingContext.h
@@ -1,9 +1,8 @@
//===-- RichManglingContext.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -34,11 +33,11 @@ public:
/// Use the ItaniumPartialDemangler to obtain rich mangling information from
/// the given mangled name.
- bool FromItaniumName(const ConstString &mangled);
+ bool FromItaniumName(ConstString mangled);
/// Use the legacy language parser implementation to obtain rich mangling
/// information from the given demangled name.
- bool FromCxxMethodName(const ConstString &demangled);
+ bool FromCxxMethodName(ConstString demangled);
/// If this symbol describes a constructor or destructor.
bool IsCtorOrDtor() const;
diff --git a/include/lldb/Core/STLUtils.h b/include/lldb/Core/STLUtils.h
index 0ed354fa4e32..830aca36a116 100644
--- a/include/lldb/Core/STLUtils.h
+++ b/include/lldb/Core/STLUtils.h
@@ -1,9 +1,8 @@
//===-- STLUtils.h ----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -17,28 +16,22 @@
#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) {}
diff --git a/include/lldb/Core/SearchFilter.h b/include/lldb/Core/SearchFilter.h
index f53ef658fd3f..f38690c95f52 100644
--- a/include/lldb/Core/SearchFilter.h
+++ b/include/lldb/Core/SearchFilter.h
@@ -1,9 +1,8 @@
//===-- SearchFilter.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -20,55 +19,33 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class Breakpoint;
-}
-namespace lldb_private {
class CompileUnit;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class Function;
-}
-namespace lldb_private {
class ModuleList;
-}
-namespace lldb_private {
class SearchFilter;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContext;
-}
-namespace lldb_private {
class Target;
}
namespace lldb_private {
-//----------------------------------------------------------------------
-/// @class Searcher SearchFilter.h "lldb/Core/SearchFilter.h" Class that is
+/// \class Searcher SearchFilter.h "lldb/Core/SearchFilter.h" Class that is
/// driven by the SearchFilter to search the SymbolContext space of the target
/// program.
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
/// General Outline:
/// Provides the callback and search depth for the SearchFilter search.
-//----------------------------------------------------------------------
class Searcher {
public:
- typedef enum {
+ enum CallbackReturn {
eCallbackReturnStop = 0, // Stop the iteration
eCallbackReturnContinue, // Continue the iteration
eCallbackReturnPop // Pop one level up and continue iterating
- } CallbackReturn;
+ };
Searcher();
@@ -80,23 +57,18 @@ public:
virtual lldb::SearchDepth GetDepth() = 0;
- //------------------------------------------------------------------
/// Prints a canonical description for the searcher to the stream \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// Stream to which the output is copied.
- //------------------------------------------------------------------
virtual void GetDescription(Stream *s);
};
-//----------------------------------------------------------------------
-/// @class SearchFilter SearchFilter.h "lldb/Core/SearchFilter.h" Class
+/// \class SearchFilter SearchFilter.h "lldb/Core/SearchFilter.h" Class
/// descends through the SymbolContext space of the target, applying a filter
/// at each stage till it reaches the depth specified by the GetDepth method
/// of the searcher, and calls its callback at that point.
-//----------------------------------------------------------------------
-//----------------------------------------------------------------------
/// General Outline:
/// Provides the callback and search depth for the SearchFilter search.
///
@@ -107,141 +79,112 @@ public:
/// that since the resolution of the Searcher may be greater than that of the
/// SearchFilter, before the Searcher qualifies an address it should pass it
/// to "AddressPasses." The default implementation is "Everything Passes."
-//----------------------------------------------------------------------
class SearchFilter {
public:
- //------------------------------------------------------------------
/// The basic constructor takes a Target, which gives the space to search.
///
- /// @param[in] target
+ /// \param[in] target
/// The Target that provides the module list to search.
- //------------------------------------------------------------------
SearchFilter(const lldb::TargetSP &target_sp);
- SearchFilter(const SearchFilter &rhs);
-
SearchFilter(const lldb::TargetSP &target_sp, unsigned char filterType);
virtual ~SearchFilter();
- SearchFilter &operator=(const SearchFilter &rhs);
-
- //------------------------------------------------------------------
/// Call this method with a file spec to see if that spec passes the filter.
///
- /// @param[in] spec
+ /// \param[in] spec
/// The file spec to check against the filter.
- /// @return
+ /// \return
/// \b true if \a spec passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool ModulePasses(const FileSpec &spec);
- //------------------------------------------------------------------
/// Call this method with a Module to see if that module passes the filter.
///
- /// @param[in] module
+ /// \param[in] module
/// The Module to check against the filter.
///
- /// @return
+ /// \return
/// \b true if \a module passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool ModulePasses(const lldb::ModuleSP &module_sp);
- //------------------------------------------------------------------
/// Call this method with a Address to see if \a address passes the filter.
///
- /// @param[in] addr
+ /// \param[in] addr
/// The address to check against the filter.
///
- /// @return
+ /// \return
/// \b true if \a address passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool AddressPasses(Address &addr);
- //------------------------------------------------------------------
/// Call this method with a FileSpec to see if \a file spec passes the
/// filter as the name of a compilation unit.
///
- /// @param[in] fileSpec
+ /// \param[in] fileSpec
/// The file spec to check against the filter.
///
- /// @return
+ /// \return
/// \b true if \a file spec passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool CompUnitPasses(FileSpec &fileSpec);
- //------------------------------------------------------------------
/// Call this method with a CompileUnit to see if \a comp unit passes the
/// filter.
///
- /// @param[in] compUnit
+ /// \param[in] compUnit
/// The CompileUnit to check against the filter.
///
- /// @return
+ /// \return
/// \b true if \a Comp Unit passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool CompUnitPasses(CompileUnit &compUnit);
- //------------------------------------------------------------------
/// Call this method with a Function to see if \a function passes the
/// filter.
///
- /// @param[in] function
+ /// \param[in] function
/// The Functions to check against the filter.
///
- /// @return
+ /// \return
/// \b true if \a function passes, and \b false otherwise.
- //------------------------------------------------------------------
virtual bool FunctionPasses(Function &function);
- //------------------------------------------------------------------
/// Call this method to do the search using the Searcher.
///
- /// @param[in] searcher
+ /// \param[in] searcher
/// The searcher to drive with this search.
///
- //------------------------------------------------------------------
virtual void Search(Searcher &searcher);
- //------------------------------------------------------------------
/// Call this method to do the search using the Searcher in the module list
/// \a modules.
///
- /// @param[in] searcher
+ /// \param[in] searcher
/// The searcher to drive with this search.
///
- /// @param[in] modules
+ /// \param[in] modules
/// The module list within which to restrict the search.
///
- //------------------------------------------------------------------
virtual void SearchInModuleList(Searcher &searcher, ModuleList &modules);
- //------------------------------------------------------------------
/// This determines which items are REQUIRED for the filter to pass. For
/// instance, if you are filtering by Compilation Unit, obviously symbols
/// that have no compilation unit can't pass So return eSymbolContextCU and
/// search callbacks can then short cut the search to avoid looking at
/// things that obviously won't pass.
///
- /// @return
+ /// \return
/// The required elements for the search, which is an or'ed together
/// set of lldb:SearchContextItem enum's.
///
- //------------------------------------------------------------------
virtual uint32_t GetFilterRequiredItems();
- //------------------------------------------------------------------
/// Prints a canonical description for the search filter to the stream \a s.
///
- /// @param[in] s
+ /// \param[in] s
/// Stream to which the output is copied.
- //------------------------------------------------------------------
virtual void GetDescription(Stream *s);
- //------------------------------------------------------------------
/// Standard "Dump" method. At present it does nothing.
- //------------------------------------------------------------------
virtual void Dump(Stream *s) const;
lldb::SearchFilterSP CopyForBreakpoint(Breakpoint &breakpoint);
@@ -329,12 +272,10 @@ private:
unsigned char SubclassID;
};
-//----------------------------------------------------------------------
-/// @class SearchFilterForUnconstrainedSearches SearchFilter.h
+/// \class SearchFilterForUnconstrainedSearches SearchFilter.h
/// "lldb/Core/SearchFilter.h" This is a SearchFilter that searches through
/// all modules. It also consults the
/// Target::ModuleIsExcludedForUnconstrainedSearches.
-//----------------------------------------------------------------------
class SearchFilterForUnconstrainedSearches : public SearchFilter {
public:
SearchFilterForUnconstrainedSearches(const lldb::TargetSP &target_sp)
@@ -357,31 +298,23 @@ protected:
lldb::SearchFilterSP DoCopyForBreakpoint(Breakpoint &breakpoint) override;
};
-//----------------------------------------------------------------------
-/// @class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
+/// \class SearchFilterByModule SearchFilter.h "lldb/Core/SearchFilter.h" This
/// is a SearchFilter that restricts the search to a given module.
-//----------------------------------------------------------------------
class SearchFilterByModule : public SearchFilter {
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] target
/// The Target that provides the module list to search.
///
- /// @param[in] module
+ /// \param[in] module
/// The Module that limits the search.
- //------------------------------------------------------------------
SearchFilterByModule(const lldb::TargetSP &targetSP, const FileSpec &module);
- SearchFilterByModule(const SearchFilterByModule &rhs);
-
~SearchFilterByModule() override;
- SearchFilterByModule &operator=(const SearchFilterByModule &rhs);
-
bool ModulePasses(const lldb::ModuleSP &module_sp) override;
bool ModulePasses(const FileSpec &spec) override;
@@ -416,16 +349,14 @@ private:
class SearchFilterByModuleList : public SearchFilter {
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] target
/// The Target that provides the module list to search.
///
- /// @param[in] module
+ /// \param[in] module
/// The Module that limits the search.
- //------------------------------------------------------------------
SearchFilterByModuleList(const lldb::TargetSP &targetSP,
const FileSpecList &module_list);
@@ -433,8 +364,6 @@ public:
const FileSpecList &module_list,
enum FilterTy filter_ty);
- SearchFilterByModuleList(const SearchFilterByModuleList &rhs);
-
~SearchFilterByModuleList() override;
SearchFilterByModuleList &operator=(const SearchFilterByModuleList &rhs);
@@ -475,16 +404,14 @@ protected:
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
+ /// \param[in] target
/// The Target that provides the module list to search.
///
- /// @param[in] module
+ /// \param[in] module
/// The Module that limits the search.
- //------------------------------------------------------------------
SearchFilterByModuleListAndCU(const lldb::TargetSP &targetSP,
const FileSpecList &module_list,
const FileSpecList &cu_list);
diff --git a/include/lldb/Core/Section.h b/include/lldb/Core/Section.h
index 4157bb877b4c..881d43702cee 100644
--- a/include/lldb/Core/Section.h
+++ b/include/lldb/Core/Section.h
@@ -1,9 +1,8 @@
//===-- Section.h -----------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -27,24 +26,11 @@
namespace lldb_private {
class Address;
-}
-namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class ObjectFile;
-}
-namespace lldb_private {
class Section;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Target;
-}
-
-namespace lldb_private {
class SectionList {
public:
@@ -52,6 +38,11 @@ public:
typedef collection::iterator iterator;
typedef collection::const_iterator const_iterator;
+ const_iterator begin() const { return m_sections.begin(); }
+ const_iterator end() const { return m_sections.end(); }
+ const_iterator begin() { return m_sections.begin(); }
+ const_iterator end() { return m_sections.end(); }
+
SectionList();
~SectionList();
@@ -68,7 +59,7 @@ public:
void Dump(Stream *s, Target *target, bool show_header, uint32_t depth) const;
- lldb::SectionSP FindSectionByName(const ConstString &section_dstr) const;
+ lldb::SectionSP FindSectionByName(ConstString section_dstr) const;
lldb::SectionSP FindSectionByID(lldb::user_id_t sect_id) const;
@@ -110,7 +101,7 @@ class Section : public std::enable_shared_from_this<Section>,
public:
// Create a root section (one that has no parent)
Section(const lldb::ModuleSP &module_sp, ObjectFile *obj_file,
- lldb::user_id_t sect_id, const ConstString &name,
+ lldb::user_id_t sect_id, ConstString name,
lldb::SectionType sect_type, lldb::addr_t file_vm_addr,
lldb::addr_t vm_size, lldb::offset_t file_offset,
lldb::offset_t file_size, uint32_t log2align, uint32_t flags,
@@ -121,7 +112,7 @@ public:
// sections, non-NULL for
// child sections
const lldb::ModuleSP &module_sp, ObjectFile *obj_file,
- lldb::user_id_t sect_id, const ConstString &name,
+ lldb::user_id_t sect_id, ConstString name,
lldb::SectionType sect_type, lldb::addr_t file_vm_addr,
lldb::addr_t vm_size, lldb::offset_t file_offset,
lldb::offset_t file_size, uint32_t log2align, uint32_t flags,
@@ -176,7 +167,7 @@ public:
bool IsDescendant(const Section *section);
- const ConstString &GetName() const { return m_name; }
+ ConstString GetName() const { return m_name; }
bool Slide(lldb::addr_t slide_amount, bool slide_children);
@@ -190,56 +181,48 @@ public:
void SetIsThreadSpecific(bool b) { m_thread_specific = b; }
- //------------------------------------------------------------------
/// Get the permissions as OR'ed bits from lldb::Permissions
- //------------------------------------------------------------------
uint32_t GetPermissions() const;
- //------------------------------------------------------------------
/// Set the permissions using bits OR'ed from lldb::Permissions
- //------------------------------------------------------------------
void SetPermissions(uint32_t permissions);
ObjectFile *GetObjectFile() { return m_obj_file; }
const ObjectFile *GetObjectFile() const { return m_obj_file; }
- //------------------------------------------------------------------
/// Read the section data from the object file that the section
/// resides in.
///
- /// @param[in] dst
+ /// \param[in] dst
/// Where to place the data
///
- /// @param[in] dst_len
+ /// \param[in] dst_len
/// How many bytes of section data to read
///
- /// @param[in] offset
+ /// \param[in] offset
/// The offset in bytes within this section's data at which to
/// start copying data from.
///
- /// @return
+ /// \return
/// The number of bytes read from the section, or zero if the
/// section has no data or \a offset is not a valid offset
/// in this section.
- //------------------------------------------------------------------
lldb::offset_t GetSectionData(void *dst, lldb::offset_t dst_len,
lldb::offset_t offset = 0);
- //------------------------------------------------------------------
/// Get the shared reference to the section data from the object
/// file that the section resides in. No copies of the data will be
/// make unless the object file has been read from memory. If the
/// object file is on disk, it will shared the mmap data for the
/// entire object file.
///
- /// @param[in] data
+ /// \param[in] data
/// Where to place the data, address byte size, and byte order
///
- /// @return
+ /// \return
/// The number of bytes read from the section, or zero if the
/// section has no data or \a offset is not a valid offset
/// in this section.
- //------------------------------------------------------------------
lldb::offset_t GetSectionData(DataExtractor &data);
uint32_t GetLog2Align() { return m_log2align; }
diff --git a/include/lldb/Core/SourceManager.h b/include/lldb/Core/SourceManager.h
index d31ba037c5d6..bca817750d8d 100644
--- a/include/lldb/Core/SourceManager.h
+++ b/include/lldb/Core/SourceManager.h
@@ -1,9 +1,8 @@
//===-- SourceManager.h -----------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -25,22 +24,12 @@
namespace lldb_private {
class RegularExpression;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContextList;
-}
-namespace lldb_private {
class Target;
-}
-
-namespace lldb_private {
class SourceManager {
public:
-#ifndef SWIG
class File {
friend bool operator==(const SourceManager::File &lhs,
const SourceManager::File &rhs);
@@ -100,11 +89,9 @@ public:
private:
void CommonInitializer(const FileSpec &file_spec, Target *target);
};
-#endif // SWIG
typedef std::shared_ptr<File> FileSP;
-#ifndef SWIG
// The SourceFileCache class separates the source manager from the cache of
// source files, so the cache can be stored in the Debugger, but the source
// managers can be per target.
@@ -120,11 +107,8 @@ public:
typedef std::map<FileSpec, FileSP> FileCache;
FileCache m_file_cache;
};
-#endif // SWIG
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
// A source manager can be made with a non-null target, in which case it can
// use the path remappings to find
// source files that are not in their build locations. With no target it
diff --git a/include/lldb/Core/StreamAsynchronousIO.h b/include/lldb/Core/StreamAsynchronousIO.h
index 89667be05878..6237e12b7d1e 100644
--- a/include/lldb/Core/StreamAsynchronousIO.h
+++ b/include/lldb/Core/StreamAsynchronousIO.h
@@ -1,9 +1,8 @@
//===-- StreamAsynchronousIO.h -----------------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -18,9 +17,6 @@
namespace lldb_private {
class Debugger;
-}
-
-namespace lldb_private {
class StreamAsynchronousIO : public Stream {
public:
diff --git a/include/lldb/Core/StreamBuffer.h b/include/lldb/Core/StreamBuffer.h
index 7b2468330ad2..6c516519781f 100644
--- a/include/lldb/Core/StreamBuffer.h
+++ b/include/lldb/Core/StreamBuffer.h
@@ -1,9 +1,8 @@
//===-- StreamBuffer.h ------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,9 +23,9 @@ public:
StreamBuffer(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order)
: Stream(flags, addr_size, byte_order), m_packet() {}
- virtual ~StreamBuffer() {}
+ ~StreamBuffer() override {}
- virtual void Flush() {
+ void Flush() override {
// Nothing to do when flushing a buffer based stream...
}
@@ -43,7 +42,7 @@ public:
protected:
llvm::SmallVector<char, N> m_packet;
- virtual size_t WriteImpl(const void *s, size_t length) {
+ size_t WriteImpl(const void *s, size_t length) override {
if (s && length)
m_packet.append((const char *)s, ((const char *)s) + length);
return length;
diff --git a/include/lldb/Core/StreamFile.h b/include/lldb/Core/StreamFile.h
index 86db3e4ae487..54aeab16b3f1 100644
--- a/include/lldb/Core/StreamFile.h
+++ b/include/lldb/Core/StreamFile.h
@@ -1,9 +1,8 @@
//===-- StreamFile.h --------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -22,9 +21,7 @@ namespace lldb_private {
class StreamFile : public Stream {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
StreamFile();
StreamFile(uint32_t flags, uint32_t addr_size, lldb::ByteOrder byte_order);
@@ -48,9 +45,7 @@ public:
protected:
- //------------------------------------------------------------------
// Classes that inherit from StreamFile can see and modify these
- //------------------------------------------------------------------
File m_file;
size_t WriteImpl(const void *s, size_t length) override;
diff --git a/include/lldb/Core/StructuredDataImpl.h b/include/lldb/Core/StructuredDataImpl.h
index 2912f4ec7de0..79a709af7ca3 100644
--- a/include/lldb/Core/StructuredDataImpl.h
+++ b/include/lldb/Core/StructuredDataImpl.h
@@ -1,9 +1,8 @@
//===-- StructuredDataImpl.h ------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/ThreadSafeDenseMap.h b/include/lldb/Core/ThreadSafeDenseMap.h
index 2fc428c4f7d4..c485b91acb47 100644
--- a/include/lldb/Core/ThreadSafeDenseMap.h
+++ b/include/lldb/Core/ThreadSafeDenseMap.h
@@ -1,10 +1,9 @@
//===-- ThreadSafeDenseMap.h ------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/ThreadSafeDenseSet.h b/include/lldb/Core/ThreadSafeDenseSet.h
index 74a010544705..fbc8d3fb02f8 100644
--- a/include/lldb/Core/ThreadSafeDenseSet.h
+++ b/include/lldb/Core/ThreadSafeDenseSet.h
@@ -1,10 +1,9 @@
//===-- ThreadSafeDenseSet.h ------------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
diff --git a/include/lldb/Core/ThreadSafeSTLMap.h b/include/lldb/Core/ThreadSafeSTLMap.h
index 4058fdfe15a8..df0208cd49b3 100644
--- a/include/lldb/Core/ThreadSafeSTLMap.h
+++ b/include/lldb/Core/ThreadSafeSTLMap.h
@@ -1,9 +1,8 @@
//===-- ThreadSafeSTLMap.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -22,9 +21,7 @@ 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() {}
@@ -122,9 +119,7 @@ private:
collection m_collection;
mutable std::recursive_mutex m_mutex;
- //------------------------------------------------------------------
// For ThreadSafeSTLMap only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLMap);
};
diff --git a/include/lldb/Core/ThreadSafeSTLVector.h b/include/lldb/Core/ThreadSafeSTLVector.h
index b65936f81fec..e1666a69ef7e 100644
--- a/include/lldb/Core/ThreadSafeSTLVector.h
+++ b/include/lldb/Core/ThreadSafeSTLVector.h
@@ -1,10 +1,9 @@
//===-- ThreadSafeSTLVector.h ------------------------------------*- C++
//-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,9 +22,7 @@ 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;
@@ -66,9 +63,7 @@ private:
collection m_collection;
mutable std::recursive_mutex m_mutex;
- //------------------------------------------------------------------
// For ThreadSafeSTLVector only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeSTLVector);
};
diff --git a/include/lldb/Core/ThreadSafeValue.h b/include/lldb/Core/ThreadSafeValue.h
index 35424a1791e6..91f96814363f 100644
--- a/include/lldb/Core/ThreadSafeValue.h
+++ b/include/lldb/Core/ThreadSafeValue.h
@@ -1,9 +1,8 @@
//===-- ThreadSafeValue.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,9 +18,7 @@ namespace lldb_private {
template <class T> class ThreadSafeValue {
public:
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
ThreadSafeValue() : m_value(), m_mutex() {}
ThreadSafeValue(const T &value) : m_value(value), m_mutex() {}
@@ -56,9 +53,7 @@ private:
T m_value;
mutable std::recursive_mutex m_mutex;
- //------------------------------------------------------------------
// For ThreadSafeValue only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ThreadSafeValue);
};
diff --git a/include/lldb/Core/UniqueCStringMap.h b/include/lldb/Core/UniqueCStringMap.h
index cfb84b4c2160..9949bd45f4fa 100644
--- a/include/lldb/Core/UniqueCStringMap.h
+++ b/include/lldb/Core/UniqueCStringMap.h
@@ -1,9 +1,8 @@
//===-- UniqueCStringMap.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -18,38 +17,24 @@
namespace lldb_private {
-//----------------------------------------------------------------------
// Templatized uniqued string map.
//
// This map is useful for mapping unique C string names to values of type T.
// Each "const char *" name added must be unique for a given
// C string value. ConstString::GetCString() can provide such strings.
// Any other string table that has guaranteed unique values can also be used.
-//----------------------------------------------------------------------
template <typename T> class UniqueCStringMap {
public:
struct Entry {
- Entry() {}
-
- Entry(ConstString cstr) : cstring(cstr), value() {}
-
Entry(ConstString cstr, const T &v) : cstring(cstr), value(v) {}
- // This is only for uniqueness, not lexicographical ordering, so we can
- // just compare pointers.
- bool operator<(const Entry &rhs) const {
- return cstring.GetCString() < rhs.cstring.GetCString();
- }
-
ConstString cstring;
T value;
};
- //------------------------------------------------------------------
// Call this function multiple times to add a bunch of entries to this map,
// then later call UniqueCStringMap<T>::Sort() before doing any searches by
// name.
- //------------------------------------------------------------------
void Append(ConstString unique_cstr, const T &value) {
m_map.push_back(typename UniqueCStringMap<T>::Entry(unique_cstr, value));
}
@@ -58,25 +43,10 @@ public:
void Clear() { m_map.clear(); }
- //------------------------------------------------------------------
- // Call this function to always keep the map sorted when putting entries into
- // the map.
- //------------------------------------------------------------------
- void Insert(ConstString unique_cstr, const T &value) {
- typename UniqueCStringMap<T>::Entry e(unique_cstr, value);
- m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e);
- }
-
- void Insert(const Entry &e) {
- m_map.insert(std::upper_bound(m_map.begin(), m_map.end(), e), e);
- }
-
- //------------------------------------------------------------------
// Get an entries by index in a variety of forms.
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned values.
- //------------------------------------------------------------------
bool GetValueAtIndex(uint32_t idx, T &value) const {
if (idx < m_map.size()) {
value = m_map[idx].value;
@@ -103,49 +73,37 @@ public:
return ((idx < m_map.size()) ? m_map[idx].cstring : ConstString());
}
- //------------------------------------------------------------------
// Find the value for the unique string in the map.
//
// Return the value for \a unique_cstr if one is found, return \a fail_value
// otherwise. This method works well for simple type
// T values and only if there is a sensible failure value that can
// be returned and that won't match any existing values.
- //------------------------------------------------------------------
T Find(ConstString unique_cstr, T fail_value) const {
- Entry search_entry(unique_cstr);
- const_iterator end = m_map.end();
- const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry);
- if (pos != end) {
- if (pos->cstring == unique_cstr)
- return pos->value;
- }
+ auto pos = llvm::lower_bound(m_map, unique_cstr, Compare());
+ if (pos != m_map.end() && pos->cstring == unique_cstr)
+ return pos->value;
return fail_value;
}
- //------------------------------------------------------------------
// Get a pointer to the first entry that matches "name". nullptr will be
// returned if there is no entry that matches "name".
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned pointer.
- //------------------------------------------------------------------
const Entry *FindFirstValueForName(ConstString unique_cstr) const {
- Entry search_entry(unique_cstr);
- const_iterator end = m_map.end();
- const_iterator pos = std::lower_bound(m_map.begin(), end, search_entry);
- if (pos != end && pos->cstring == unique_cstr)
+ auto pos = llvm::lower_bound(m_map, unique_cstr, Compare());
+ if (pos != m_map.end() && pos->cstring == unique_cstr)
return &(*pos);
return nullptr;
}
- //------------------------------------------------------------------
// Get a pointer to the next entry that matches "name" from a previously
// returned Entry pointer. nullptr will be returned if there is no subsequent
// entry that matches "name".
//
// The caller is responsible for ensuring that the collection does not change
// during while using the returned pointer.
- //------------------------------------------------------------------
const Entry *FindNextValueForName(const Entry *entry_ptr) const {
if (!m_map.empty()) {
const Entry *first_entry = &m_map[0];
@@ -162,15 +120,9 @@ public:
size_t GetValues(ConstString unique_cstr, std::vector<T> &values) const {
const size_t start_size = values.size();
- Entry search_entry(unique_cstr);
- const_iterator pos, end = m_map.end();
- for (pos = std::lower_bound(m_map.begin(), end, search_entry); pos != end;
- ++pos) {
- if (pos->cstring == unique_cstr)
- values.push_back(pos->value);
- else
- break;
- }
+ for (const Entry &entry : llvm::make_range(std::equal_range(
+ m_map.begin(), m_map.end(), unique_cstr, Compare())))
+ values.push_back(entry.value);
return values.size() - start_size;
}
@@ -188,25 +140,18 @@ public:
return values.size() - start_size;
}
- //------------------------------------------------------------------
// Get the total number of entries in this map.
- //------------------------------------------------------------------
size_t GetSize() const { return m_map.size(); }
- //------------------------------------------------------------------
// Returns true if this map is empty.
- //------------------------------------------------------------------
bool IsEmpty() const { return m_map.empty(); }
- //------------------------------------------------------------------
// Reserve memory for at least "n" entries in the map. This is useful to call
// when you know you will be adding a lot of entries using
// UniqueCStringMap::Append() (which should be followed by a call to
// UniqueCStringMap::Sort()) or to UniqueCStringMap::Insert().
- //------------------------------------------------------------------
void Reserve(size_t n) { m_map.reserve(n); }
- //------------------------------------------------------------------
// Sort the unsorted contents in this map. A typical code flow would be:
// size_t approximate_num_entries = ....
// UniqueCStringMap<uint32_t> my_map;
@@ -216,16 +161,13 @@ public:
// my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
// }
// my_map.Sort();
- //------------------------------------------------------------------
- void Sort() { llvm::sort(m_map.begin(), m_map.end()); }
+ void Sort() { llvm::sort(m_map.begin(), m_map.end(), Compare()); }
- //------------------------------------------------------------------
// Since we are using a vector to contain our items it will always double its
// memory consumption as things are added to the vector, so if you intend to
// keep a UniqueCStringMap around and have a lot of entries in the map, you
// will want to call this function to create a new vector and copy _only_ the
// exact size needed as part of the finalization of the string map.
- //------------------------------------------------------------------
void SizeToFit() {
if (m_map.size() < m_map.capacity()) {
collection temp(m_map.begin(), m_map.end());
@@ -233,28 +175,27 @@ public:
}
}
- size_t Erase(ConstString unique_cstr) {
- size_t num_removed = 0;
- Entry search_entry(unique_cstr);
- iterator end = m_map.end();
- iterator begin = m_map.begin();
- iterator lower_pos = std::lower_bound(begin, end, search_entry);
- if (lower_pos != end) {
- if (lower_pos->cstring == unique_cstr) {
- iterator upper_pos = std::upper_bound(lower_pos, end, search_entry);
- if (lower_pos == upper_pos) {
- m_map.erase(lower_pos);
- num_removed = 1;
- } else {
- num_removed = std::distance(lower_pos, upper_pos);
- m_map.erase(lower_pos, upper_pos);
- }
- }
+protected:
+ struct Compare {
+ bool operator()(const Entry &lhs, const Entry &rhs) {
+ return operator()(lhs.cstring, rhs.cstring);
}
- return num_removed;
- }
-protected:
+ bool operator()(const Entry &lhs, ConstString rhs) {
+ return operator()(lhs.cstring, rhs);
+ }
+
+ bool operator()(ConstString lhs, const Entry &rhs) {
+ return operator()(lhs, rhs.cstring);
+ }
+
+ // This is only for uniqueness, not lexicographical ordering, so we can
+ // just compare pointers. *However*, comparing pointers from different
+ // allocations is UB, so we need compare their integral values instead.
+ bool operator()(ConstString lhs, ConstString rhs) {
+ return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
+ }
+ };
typedef std::vector<Entry> collection;
typedef typename collection::iterator iterator;
typedef typename collection::const_iterator const_iterator;
diff --git a/include/lldb/Core/UserSettingsController.h b/include/lldb/Core/UserSettingsController.h
index 350b5babb47b..6ae3bdec1665 100644
--- a/include/lldb/Core/UserSettingsController.h
+++ b/include/lldb/Core/UserSettingsController.h
@@ -1,9 +1,8 @@
//====-- UserSettingsController.h --------------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,17 +22,9 @@
namespace lldb_private {
class CommandInterpreter;
-}
-namespace lldb_private {
class ConstString;
-}
-namespace lldb_private {
class ExecutionContext;
-}
-namespace lldb_private {
class Property;
-}
-namespace lldb_private {
class Stream;
}
@@ -78,7 +69,7 @@ public:
std::vector<const Property *> &matching_properties) const;
lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
- const ConstString &name);
+ ConstString name);
// We sometimes need to introduce a setting to enable experimental features,
// but then we don't want the setting for these to cause errors when the
diff --git a/include/lldb/Core/Value.h b/include/lldb/Core/Value.h
index 249adb24fbc9..b786e4866f6c 100644
--- a/include/lldb/Core/Value.h
+++ b/include/lldb/Core/Value.h
@@ -1,9 +1,8 @@
//===-- Value.h -------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -27,20 +26,10 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class ExecutionContext;
-}
-namespace lldb_private {
class Module;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class Type;
-}
-namespace lldb_private {
class Variable;
}
diff --git a/include/lldb/Core/ValueObject.h b/include/lldb/Core/ValueObject.h
index cb6de7b41807..0808b86c67a1 100644
--- a/include/lldb/Core/ValueObject.h
+++ b/include/lldb/Core/ValueObject.h
@@ -1,9 +1,8 @@
//===-- ValueObject.h -------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -40,40 +39,19 @@
#include <stddef.h>
#include <stdint.h>
+
namespace lldb_private {
class Declaration;
-}
-namespace lldb_private {
class DumpValueObjectOptions;
-}
-namespace lldb_private {
class EvaluateExpressionOptions;
-}
-namespace lldb_private {
class ExecutionContextScope;
-}
-namespace lldb_private {
class Log;
-}
-namespace lldb_private {
class Scalar;
-}
-namespace lldb_private {
class Stream;
-}
-namespace lldb_private {
class SymbolContextScope;
-}
-namespace lldb_private {
class TypeFormatImpl;
-}
-namespace lldb_private {
class TypeSummaryImpl;
-}
-namespace lldb_private {
class TypeSummaryOptions;
-}
-namespace lldb_private {
/// ValueObject:
///
@@ -380,16 +358,12 @@ public:
virtual bool CanProvideValue();
- //------------------------------------------------------------------
// Subclasses must implement the functions below.
- //------------------------------------------------------------------
virtual uint64_t GetByteSize() = 0;
virtual lldb::ValueType GetValueType() const = 0;
- //------------------------------------------------------------------
// Subclasses can implement the functions below.
- //------------------------------------------------------------------
virtual ConstString GetTypeName();
virtual ConstString GetDisplayTypeName();
@@ -479,12 +453,10 @@ public:
virtual bool GetDeclaration(Declaration &decl);
- //------------------------------------------------------------------
// The functions below should NOT be modified by subclasses
- //------------------------------------------------------------------
const Status &GetError();
- const ConstString &GetName() const;
+ ConstString GetName() const;
virtual lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create);
@@ -504,10 +476,10 @@ public:
GetChildAtNamePath(llvm::ArrayRef<std::pair<ConstString, bool>> names,
ConstString *name_of_error = nullptr);
- virtual lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name,
+ virtual lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
bool can_create);
- virtual size_t GetIndexOfChildWithName(const ConstString &name);
+ virtual size_t GetIndexOfChildWithName(ConstString name);
size_t GetNumChildren(uint32_t max = UINT32_MAX);
@@ -574,14 +546,14 @@ public:
// Change the name of the current ValueObject. Should *not* be used from a
// synthetic child provider as it would change the name of the non synthetic
// child as well.
- void SetName(const ConstString &name);
+ void SetName(ConstString name);
virtual lldb::addr_t GetAddressOf(bool scalar_is_load_address = true,
AddressType *address_type = nullptr);
lldb::addr_t GetPointerValue(AddressType *address_type = nullptr);
- lldb::ValueObjectSP GetSyntheticChild(const ConstString &key) const;
+ lldb::ValueObjectSP GetSyntheticChild(ConstString key) const;
lldb::ValueObjectSP GetSyntheticArrayMember(size_t index, bool can_create);
@@ -618,7 +590,7 @@ public:
GetQualifiedRepresentationIfAvailable(lldb::DynamicValueType dynValue,
bool synthValue);
- virtual lldb::ValueObjectSP CreateConstantValue(const ConstString &name);
+ virtual lldb::ValueObjectSP CreateConstantValue(ConstString name);
virtual lldb::ValueObjectSP Dereference(Status &error);
@@ -626,7 +598,7 @@ public:
// ValueObject as its parent. It should be used when we want to change the
// name of a ValueObject without modifying the actual ValueObject itself
// (e.g. sythetic child provider).
- virtual lldb::ValueObjectSP Clone(const ConstString &new_name);
+ virtual lldb::ValueObjectSP Clone(ConstString new_name);
virtual lldb::ValueObjectSP AddressOf(Status &error);
@@ -789,7 +761,6 @@ public:
void SetHasCompleteType() { m_did_calculate_complete_objc_class_type = true; }
- //------------------------------------------------------------------
/// Find out if a ValueObject might have children.
///
/// This call is much more efficient than CalculateNumChildren() as
@@ -801,10 +772,9 @@ public:
/// pointers, references, arrays and more. Again, it does so without
/// doing any expensive type completion.
///
- /// @return
+ /// \return
/// Returns \b true if the ValueObject might have children, or \b
/// false otherwise.
- //------------------------------------------------------------------
virtual bool MightHaveChildren();
virtual lldb::VariableSP GetVariable() { return nullptr; }
@@ -859,9 +829,7 @@ protected:
size_t m_children_count;
};
- //------------------------------------------------------------------
// Classes that inherit from ValueObject can see and modify these
- //------------------------------------------------------------------
ValueObject
*m_parent; // The parent value object, or nullptr if this has no parent
ValueObject *m_root; // The root of the hierarchy for this ValueObject (or
@@ -944,9 +912,7 @@ protected:
friend class ValueObjectConstResultImpl;
friend class ValueObjectSynthetic; // For ClearUserVisibleData
- //------------------------------------------------------------------
// Constructors and Destructors
- //------------------------------------------------------------------
// Use the no-argument constructor to make a constant variable object (with
// no ExecutionContextScope.)
@@ -1000,15 +966,13 @@ protected:
void ClearUserVisibleData(
uint32_t items = ValueObject::eClearUserVisibleDataItemsAllStrings);
- void AddSyntheticChild(const ConstString &key, ValueObject *valobj);
+ void AddSyntheticChild(ConstString key, ValueObject *valobj);
DataExtractor &GetDataExtractor();
void ClearDynamicTypeInformation();
- //------------------------------------------------------------------
// Subclasses must implement the functions below.
- //------------------------------------------------------------------
virtual CompilerType GetCompilerTypeImpl() = 0;
@@ -1032,14 +996,12 @@ private:
DISALLOW_COPY_AND_ASSIGN(ValueObject);
};
-//------------------------------------------------------------------------------
// A value object manager class that is seeded with the static variable value
// and it vends the user facing value object. If the type is dynamic it can
// vend the dynamic type. If this user type also has a synthetic type
// associated with it, it will vend the synthetic type. The class watches the
// process' stop
// ID and will update the user type when needed.
-//------------------------------------------------------------------------------
class ValueObjectManager {
// The root value object is the static typed variable object.
lldb::ValueObjectSP m_root_valobj_sp;
diff --git a/include/lldb/Core/ValueObjectCast.h b/include/lldb/Core/ValueObjectCast.h
index 34814d9b17bb..feee493dfafb 100644
--- a/include/lldb/Core/ValueObjectCast.h
+++ b/include/lldb/Core/ValueObjectCast.h
@@ -1,9 +1,8 @@
-//===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
+//===-- ValueObjectCast.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -21,19 +20,14 @@
namespace lldb_private {
class ConstString;
-}
-
-namespace lldb_private {
-//---------------------------------------------------------------------------------
// A ValueObject that represents a given value represented as a different type.
-//---------------------------------------------------------------------------------
class ValueObjectCast : public ValueObject {
public:
~ValueObjectCast() override;
static lldb::ValueObjectSP Create(ValueObject &parent,
- const ConstString &name,
+ ConstString name,
const CompilerType &cast_type);
uint64_t GetByteSize() override;
@@ -53,7 +47,7 @@ public:
}
protected:
- ValueObjectCast(ValueObject &parent, const ConstString &name,
+ ValueObjectCast(ValueObject &parent, ConstString name,
const CompilerType &cast_type);
bool UpdateValue() override;
diff --git a/include/lldb/Core/ValueObjectChild.h b/include/lldb/Core/ValueObjectChild.h
index 6800775dc8f9..76209a22ec20 100644
--- a/include/lldb/Core/ValueObjectChild.h
+++ b/include/lldb/Core/ValueObjectChild.h
@@ -1,9 +1,8 @@
//===-- ValueObjectChild.h --------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -26,9 +25,7 @@
namespace lldb_private {
-//----------------------------------------------------------------------
// A child of another ValueObject.
-//----------------------------------------------------------------------
class ValueObjectChild : public ValueObject {
public:
~ValueObjectChild() override;
@@ -84,7 +81,7 @@ protected:
friend class ValueObjectConstResultImpl;
ValueObjectChild(ValueObject &parent, const CompilerType &compiler_type,
- const ConstString &name, uint64_t byte_size,
+ ConstString name, uint64_t byte_size,
int32_t byte_offset, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool is_base_class,
bool is_deref_of_parent,
diff --git a/include/lldb/Core/ValueObjectConstResult.h b/include/lldb/Core/ValueObjectConstResult.h
index c1c56d8dcb22..3bc957ef2b84 100644
--- a/include/lldb/Core/ValueObjectConstResult.h
+++ b/include/lldb/Core/ValueObjectConstResult.h
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResult.h --------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -27,18 +26,10 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class ExecutionContextScope;
-}
-namespace lldb_private {
class Module;
-}
-namespace lldb_private {
-//----------------------------------------------------------------------
// A frozen ValueObject copied into host memory
-//----------------------------------------------------------------------
class ValueObjectConstResult : public ValueObject {
public:
~ValueObjectConstResult() override;
@@ -49,22 +40,22 @@ public:
static lldb::ValueObjectSP
Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, const DataExtractor &data,
+ ConstString name, const DataExtractor &data,
lldb::addr_t address = LLDB_INVALID_ADDRESS);
static lldb::ValueObjectSP
Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, const lldb::DataBufferSP &result_data_sp,
+ ConstString name, const lldb::DataBufferSP &result_data_sp,
lldb::ByteOrder byte_order, uint32_t addr_size,
lldb::addr_t address = LLDB_INVALID_ADDRESS);
static lldb::ValueObjectSP
Create(ExecutionContextScope *exe_scope, const CompilerType &compiler_type,
- const ConstString &name, lldb::addr_t address,
+ ConstString name, lldb::addr_t address,
AddressType address_type, uint32_t addr_byte_size);
static lldb::ValueObjectSP Create(ExecutionContextScope *exe_scope,
- Value &value, const ConstString &name,
+ Value &value, ConstString name,
Module *module = nullptr);
// When an expression fails to evaluate, we return an error
@@ -135,23 +126,23 @@ private:
ValueObjectConstResult(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name, const DataExtractor &data,
+ ConstString name, const DataExtractor &data,
lldb::addr_t address);
ValueObjectConstResult(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name,
+ ConstString name,
const lldb::DataBufferSP &result_data_sp,
lldb::ByteOrder byte_order, uint32_t addr_size,
lldb::addr_t address);
ValueObjectConstResult(ExecutionContextScope *exe_scope,
const CompilerType &compiler_type,
- const ConstString &name, lldb::addr_t address,
+ ConstString name, lldb::addr_t address,
AddressType address_type, uint32_t addr_byte_size);
ValueObjectConstResult(ExecutionContextScope *exe_scope, const Value &value,
- const ConstString &name, Module *module = nullptr);
+ ConstString name, Module *module = nullptr);
ValueObjectConstResult(ExecutionContextScope *exe_scope, const Status &error);
diff --git a/include/lldb/Core/ValueObjectConstResultCast.h b/include/lldb/Core/ValueObjectConstResultCast.h
index bb2b4e6f092f..be9b12b4b57c 100644
--- a/include/lldb/Core/ValueObjectConstResultCast.h
+++ b/include/lldb/Core/ValueObjectConstResultCast.h
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultCast.h ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -23,19 +22,12 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class ValueObject;
-}
-
-namespace lldb_private {
class ValueObjectConstResultCast : public ValueObjectCast {
public:
- ValueObjectConstResultCast(ValueObject &parent, const ConstString &name,
+ ValueObjectConstResultCast(ValueObject &parent, ConstString name,
const CompilerType &cast_type,
lldb::addr_t live_address = LLDB_INVALID_ADDRESS);
diff --git a/include/lldb/Core/ValueObjectConstResultChild.h b/include/lldb/Core/ValueObjectConstResultChild.h
index f14fb75640e6..16fa74f71ed5 100644
--- a/include/lldb/Core/ValueObjectConstResultChild.h
+++ b/include/lldb/Core/ValueObjectConstResultChild.h
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultChild.h ----------------------------*- C++-*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -20,26 +19,18 @@
#include <stddef.h>
#include <stdint.h>
+
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class ValueObject;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
// A child of a ValueObjectConstResult.
-//----------------------------------------------------------------------
class ValueObjectConstResultChild : public ValueObjectChild {
public:
ValueObjectConstResultChild(ValueObject &parent,
const CompilerType &compiler_type,
- const ConstString &name, uint32_t byte_size,
+ ConstString name, uint32_t byte_size,
int32_t byte_offset, uint32_t bitfield_bit_size,
uint32_t bitfield_bit_offset, bool is_base_class,
bool is_deref_of_parent,
diff --git a/include/lldb/Core/ValueObjectConstResultImpl.h b/include/lldb/Core/ValueObjectConstResultImpl.h
index 5ea47bb3b3fa..ffac98e12e61 100644
--- a/include/lldb/Core/ValueObjectConstResultImpl.h
+++ b/include/lldb/Core/ValueObjectConstResultImpl.h
@@ -1,9 +1,8 @@
//===-- ValueObjectConstResultImpl.h ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -20,24 +19,16 @@
#include <stdint.h>
namespace lldb_private {
class CompilerType;
-}
-namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class ValueObject;
}
namespace lldb_private {
-//----------------------------------------------------------------------
// A class wrapping common implementation details for operations in
// ValueObjectConstResult ( & Child ) that may need to jump from the host
// memory space into the target's memory space
-//----------------------------------------------------------------------
class ValueObjectConstResultImpl {
public:
ValueObjectConstResultImpl(ValueObject *valobj,
diff --git a/include/lldb/Core/ValueObjectDynamicValue.h b/include/lldb/Core/ValueObjectDynamicValue.h
index 0c9ec8cce06e..f656d42e9a97 100644
--- a/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/include/lldb/Core/ValueObjectDynamicValue.h
@@ -1,9 +1,8 @@
//===-- ValueObjectDynamicValue.h -------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -27,19 +26,11 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Declaration;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
-//----------------------------------------------------------------------
// A ValueObject that represents memory at a given address, viewed as some
// set lldb type.
-//----------------------------------------------------------------------
class ValueObjectDynamicValue : public ValueObject {
public:
~ValueObjectDynamicValue() override;
diff --git a/include/lldb/Core/ValueObjectList.h b/include/lldb/Core/ValueObjectList.h
index d17510f7f581..42d19676d5d3 100644
--- a/include/lldb/Core/ValueObjectList.h
+++ b/include/lldb/Core/ValueObjectList.h
@@ -1,9 +1,8 @@
//===-- ValueObjectList.h ---------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -19,24 +18,10 @@
namespace lldb_private {
class ValueObject;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
// A collection of ValueObject values that
-//----------------------------------------------------------------------
class ValueObjectList {
public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- ValueObjectList();
-
- ValueObjectList(const ValueObjectList &rhs);
-
- ~ValueObjectList();
-
const ValueObjectList &operator=(const ValueObjectList &rhs);
void Append(const lldb::ValueObjectSP &val_obj_sp);
@@ -68,9 +53,7 @@ public:
}
protected:
typedef std::vector<lldb::ValueObjectSP> collection;
- //------------------------------------------------------------------
// Classes that inherit from ValueObjectList can see and modify these
- //------------------------------------------------------------------
collection m_value_objects;
};
diff --git a/include/lldb/Core/ValueObjectMemory.h b/include/lldb/Core/ValueObjectMemory.h
index c4b946af98ce..df3557f14989 100644
--- a/include/lldb/Core/ValueObjectMemory.h
+++ b/include/lldb/Core/ValueObjectMemory.h
@@ -1,9 +1,8 @@
//===-- ValueObjectMemory.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,14 +23,9 @@
namespace lldb_private {
class ExecutionContextScope;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
// A ValueObject that represents memory at a given address, viewed as some
// set lldb type.
-//----------------------------------------------------------------------
class ValueObjectMemory : public ValueObject {
public:
~ValueObjectMemory() override;
@@ -75,9 +69,7 @@ private:
ValueObjectMemory(ExecutionContextScope *exe_scope, llvm::StringRef name,
const Address &address, const CompilerType &ast_type);
- //------------------------------------------------------------------
// For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectMemory);
};
diff --git a/include/lldb/Core/ValueObjectRegister.h b/include/lldb/Core/ValueObjectRegister.h
index fb10c259e7d0..e584be6e6057 100644
--- a/include/lldb/Core/ValueObjectRegister.h
+++ b/include/lldb/Core/ValueObjectRegister.h
@@ -1,9 +1,8 @@
//===-- ValueObjectRegister.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,26 +23,13 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class ExecutionContextScope;
-}
-namespace lldb_private {
class Scalar;
-}
-namespace lldb_private {
class Stream;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
// A ValueObject that contains a root variable that may or may not
// have children.
-//----------------------------------------------------------------------
class ValueObjectRegisterContext : public ValueObject {
public:
~ValueObjectRegisterContext() override;
@@ -75,9 +61,7 @@ protected:
private:
ValueObjectRegisterContext(ValueObject &parent,
lldb::RegisterContextSP &reg_ctx_sp);
- //------------------------------------------------------------------
// For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterContext);
};
@@ -104,10 +88,10 @@ public:
ValueObject *CreateChildAtIndex(size_t idx, bool synthetic_array_member,
int32_t synthetic_index) override;
- lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name,
+ lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
bool can_create) override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
protected:
bool UpdateValue() override;
@@ -124,9 +108,7 @@ private:
ValueObjectRegisterSet(ExecutionContextScope *exe_scope,
lldb::RegisterContextSP &reg_ctx_sp, uint32_t set_idx);
- //------------------------------------------------------------------
// For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegisterSet);
};
@@ -180,9 +162,7 @@ private:
ValueObjectRegister(ExecutionContextScope *exe_scope,
lldb::RegisterContextSP &reg_ctx_sp, uint32_t reg_num);
- //------------------------------------------------------------------
// For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectRegister);
};
diff --git a/include/lldb/Core/ValueObjectSyntheticFilter.h b/include/lldb/Core/ValueObjectSyntheticFilter.h
index 9495d4ca5e25..3b14a3e9f388 100644
--- a/include/lldb/Core/ValueObjectSyntheticFilter.h
+++ b/include/lldb/Core/ValueObjectSyntheticFilter.h
@@ -1,9 +1,8 @@
//===-- ValueObjectSyntheticFilter.h ----------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -27,22 +26,14 @@
namespace lldb_private {
class Declaration;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class SyntheticChildrenFrontEnd;
-}
-namespace lldb_private {
-//----------------------------------------------------------------------
// A ValueObject that obtains its children from some source other than
// real information
// This is currently used to implement Python-based children and filters but
// you can bind it to any source of synthetic information and have it behave
// accordingly
-//----------------------------------------------------------------------
class ValueObjectSynthetic : public ValueObject {
public:
~ValueObjectSynthetic() override;
@@ -63,10 +54,10 @@ public:
lldb::ValueObjectSP GetChildAtIndex(size_t idx, bool can_create) override;
- lldb::ValueObjectSP GetChildMemberWithName(const ConstString &name,
+ lldb::ValueObjectSP GetChildMemberWithName(ConstString name,
bool can_create) override;
- size_t GetIndexOfChildWithName(const ConstString &name) override;
+ size_t GetIndexOfChildWithName(ConstString name) override;
lldb::ValueObjectSP
GetDynamicValue(lldb::DynamicValueType valueType) override;
@@ -142,7 +133,7 @@ protected:
// we need to hold on to the SyntheticChildren because someone might delete
// the type binding while we are alive
lldb::SyntheticChildrenSP m_synth_sp;
- std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_ap;
+ std::unique_ptr<SyntheticChildrenFrontEnd> m_synth_filter_up;
typedef ThreadSafeSTLMap<uint32_t, ValueObject *> ByIndexMap;
typedef ThreadSafeSTLMap<const char *, uint32_t> NameToIndexMap;
diff --git a/include/lldb/Core/ValueObjectVariable.h b/include/lldb/Core/ValueObjectVariable.h
index 81a8eabdacbb..86bb8ef90070 100644
--- a/include/lldb/Core/ValueObjectVariable.h
+++ b/include/lldb/Core/ValueObjectVariable.h
@@ -1,9 +1,8 @@
//===-- ValueObjectVariable.h -----------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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
//
//===----------------------------------------------------------------------===//
@@ -24,26 +23,13 @@
namespace lldb_private {
class DataExtractor;
-}
-namespace lldb_private {
class Declaration;
-}
-namespace lldb_private {
class Status;
-}
-namespace lldb_private {
class ExecutionContextScope;
-}
-namespace lldb_private {
class SymbolContextScope;
-}
-
-namespace lldb_private {
-//----------------------------------------------------------------------
// A ValueObject that contains a root variable that may or may not
// have children.
-//----------------------------------------------------------------------
class ValueObjectVariable : public ValueObject {
public:
~ValueObjectVariable() override;
@@ -77,7 +63,7 @@ public:
bool SetData(DataExtractor &data, Status &error) override;
- virtual lldb::VariableSP GetVariable() override { return m_variable_sp; }
+ lldb::VariableSP GetVariable() override { return m_variable_sp; }
protected:
bool UpdateValue() override;
@@ -92,9 +78,7 @@ protected:
private:
ValueObjectVariable(ExecutionContextScope *exe_scope,
const lldb::VariableSP &var_sp);
- //------------------------------------------------------------------
// For ValueObject only
- //------------------------------------------------------------------
DISALLOW_COPY_AND_ASSIGN(ValueObjectVariable);
};
diff --git a/include/lldb/Core/dwarf.h b/include/lldb/Core/dwarf.h
index 651a2bc29475..afe62e09fe16 100644
--- a/include/lldb/Core/dwarf.h
+++ b/include/lldb/Core/dwarf.h
@@ -1,22 +1,20 @@
//===-- dwarf.h -------------------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// 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 DebugBase_dwarf_h_
#define DebugBase_dwarf_h_
+#include "lldb/Utility/RangeMap.h"
#include <stdint.h>
// Get the DWARF constant definitions from llvm
#include "llvm/BinaryFormat/Dwarf.h"
-#include "lldb/Core/RangeMap.h"
-
// and stuff them in our default namespace
using namespace llvm::dwarf;
@@ -29,15 +27,8 @@ typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
// any addresses in the compile units that get
// parsed
-#ifdef DWARFUTILS_DWARF64
-#define DWARF_REF_ADDR_SIZE 8
-typedef uint64_t dw_offset_t; // Dwarf Debug Information Entry offset for any
- // offset into the file
-#else
-#define DWARF_REF_ADDR_SIZE 4
typedef uint32_t dw_offset_t; // Dwarf Debug Information Entry offset for any
// offset into the file
-#endif
/* Constants */
#define DW_INVALID_OFFSET (~(dw_offset_t)0)