19#include "llvm/Support/Compiler.h"
36 : m_base_addr(file_addr, section_list), m_byte_size(byte_size) {}
40 : m_base_addr(section, offset), m_byte_size(byte_size) {}
43 : m_base_addr(so_addr), m_byte_size(byte_size) {}
52 range_sect_sp->GetModule() != addr_sect_sp->GetModule())
54 }
else if (addr_sect_sp) {
74 if (file_base_addr <= file_addr)
75 return (file_addr - file_base_addr) <
GetByteSize();
88 if (file_base_addr <= file_addr)
89 return (file_addr - file_base_addr) <
GetByteSize();
106 if (load_base_addr <= load_addr)
107 return (load_addr - load_base_addr) <
GetByteSize();
120 if (load_base_addr <= load_addr)
121 return (load_addr - load_base_addr) <
GetByteSize();
131 lhs_end_addr != rhs_base_addr)
136 if (lhs_end_addr >= rhs_end_addr)
156 int addr_size =
sizeof(
addr_t);
160 bool show_module =
false;
191 s->
Printf(
"%s", module_sp->GetFileSpec().GetFilename().AsCString(
205 s->
Printf(
"%p: AddressRange section = %p, offset = 0x%16.16" PRIx64
206 ", byte_size = 0x%16.16" PRIx64
"\n",
207 static_cast<const void *
>(
this),
218 s->
Printf(
"[0x%" PRIx64
"-0x%" PRIx64
")", start_addr,
225 const char *file_name =
"";
228 if (
const auto object_file = section_sp->GetObjectFile())
229 file_name = object_file->GetFileSpec().GetFilename().AsCString();
235 s->
Printf(
"%s[0x%" PRIx64
"-0x%" PRIx64
")", file_name, start_addr, end_addr);
247 return !(*
this == rhs);
A section + offset based address range class.
Address & GetBaseAddress()
Get accessor for the base address of the range.
bool ContainsFileAddress(const Address &so_addr) const
Check if a section offset address is contained in this range.
Address m_base_addr
The section offset base address of this range.
bool operator!=(const AddressRange &rhs)
bool operator==(const AddressRange &rhs)
bool Dump(Stream *s, Target *target, Address::DumpStyle style, Address::DumpStyle fallback_style=Address::DumpStyleInvalid) const
Dump a description of this object to a Stream.
bool GetDescription(Stream *s, Target *target) const
void Clear()
Clear the object's state.
void DumpDebug(Stream *s) const
Dump a debug description of this object to a Stream.
AddressRange()
Default constructor.
bool Contains(const Address &so_addr) const
Check if a section offset address is contained in this range.
~AddressRange()
Destructor.
bool ContainsLoadAddress(const Address &so_addr, Target *target) const
Check if a section offset so_addr when represented as a load address is contained within this object'...
bool Extend(const AddressRange &rhs_range)
Extends this range with rhs_range if it overlaps this range on the right side.
lldb::addr_t GetByteSize() const
Get accessor for the byte size of this range.
lldb::addr_t m_byte_size
The size in bytes of this address range.
A section + offset based address class.
lldb::addr_t GetLoadAddress(Target *target) const
Get the load address.
lldb::SectionSP GetSection() const
Get const accessor for the section.
void Clear()
Clear the object's state.
DumpStyle
Dump styles allow the Address::Dump(Stream *,DumpStyle) const function to display Address contents in...
@ DumpStyleFileAddress
Display as the file address (if any).
@ DumpStyleSectionNameOffset
Display as the section name + offset.
@ DumpStyleInvalid
Invalid dump style.
@ DumpStyleModuleWithFileAddress
Display as the file address with the module name prepended (if any).
@ DumpStyleSectionPointerOffset
Display as the section pointer + offset (debug output).
@ DumpStyleLoadAddress
Display as the load address (if resolved).
bool Dump(Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, DumpStyle fallback_style=DumpStyleInvalid, uint32_t addr_byte_size=UINT32_MAX, bool all_ranges=false, std::optional< Stream::HighlightSettings > settings=std::nullopt) const
Dump a description of this object to a Stream.
lldb::addr_t GetFileAddress() const
Get the file address.
lldb::addr_t GetOffset() const
Get the section relative offset value.
bool IsValid() const
Check if the object state is valid.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
const ArchSpec & GetArchitecture() const
#define LLDB_INVALID_ADDRESS
A class that represents a running process on the host machine.
void DumpAddressRange(llvm::raw_ostream &s, uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix=nullptr, const char *suffix=nullptr)
Output an address range to this stream.
void DumpAddress(llvm::raw_ostream &s, uint64_t addr, uint32_t addr_size, const char *prefix=nullptr, const char *suffix=nullptr)
Output an address value to this stream.
std::shared_ptr< lldb_private::Section > SectionSP
std::shared_ptr< lldb_private::Module > ModuleSP