PStack  2.0
Stack trace printer for MSVC and GCC binaries
psystem::image_symbol_iterator Class Reference

Iterator type for COFF-format debugging symbols. More...

#include <image_symbol_iterator.hpp>

Inheritance diagram for psystem::image_symbol_iterator:
Collaboration diagram for psystem::image_symbol_iterator:

Construction / Destruction

 image_symbol_iterator (psystem::address_t const in_ptr) noexcept
 Construct an iterator based on a backing store. More...
 
 image_symbol_iterator (image_symbol_iterator const &o) noexcept
 Copy another iterator's state into this one. More...
 
 ~image_symbol_iterator () noexcept
 Destroy this iterator instance. More...
 
image_symbol_iteratoroperator= (image_symbol_iterator const &o) noexcept
 Assign a new state to this instance. More...
 

Basic Iterator Interface

bool operator== (image_symbol_iterator const &other) const noexcept
 Determine the equality of two instances. More...
 
bool operator!= (image_symbol_iterator const &other) const noexcept
 Determine the inequality of two instances. More...
 
bool operator< (image_symbol_iterator const &o) const noexcept
 Determines if this is less-than another instance. More...
 
bool operator<= (image_symbol_iterator const &o) const noexcept
 Determines if this is less-than or equal-to another instance. More...
 
bool operator> (image_symbol_iterator const &o) const noexcept
 Determines if this is greater-than another instance. More...
 
bool operator>= (image_symbol_iterator const &o) const noexcept
 Determines if this is greater-than another or equal-to instance. More...
 
reference operator* () const noexcept
 Access the underlying container data as a reference type. More...
 
pointer operator-> () const noexcept
 Access to member data in the underlying container data. More...
 
void swap (image_symbol_iterator &o) noexcept
 Swap the contents of another iterator with this instance. More...
 

Random Access Iterator Interface

reference operator[] (size_t const count) const noexcept
 Access underlying container data by index. More...
 
image_symbol_iterator operator++ (int) noexcept
 Postfix increment. More...
 
image_symbol_iteratoroperator++ () noexcept
 Prefix increment. More...
 
image_symbol_iteratoroperator+= (size_t const count) noexcept
 Compound addition. More...
 
image_symbol_iterator operator-- (int) noexcept
 Postfix decrement. More...
 
image_symbol_iteratoroperator-- () noexcept
 Prefix decrement. More...
 
image_symbol_iteratoroperator-= (size_t const count) noexcept
 Compound subtraction. More...
 
image_symbol_iterator operator- (size_t const count) const noexcept
 Create a new iterator placed prior to this instance in the container. More...
 
difference_type operator- (image_symbol_iterator const &it) const noexcept
 Determine the distance between two iterators. More...
 

Member Data

IMAGE_SYMBOL const * m_current_symbol
 The COFF debugging symbol currently examined by this instance.
 

Detailed Description

Iterator type for COFF-format debugging symbols.

COFF images often maintain a section of the file dedicated to debugging symbols. The Win32 type, IMAGE_SYMBOL exposes this information, and that is the type that this iterator examines.

Note
While this type defines operator- as a member function, operator+ is a free-function to allow "4 + it" and "it + 4". While "it - 4" makes sense, "4 - it" is meaningless. Also, while "it1 - it2" is a reasonable offset computation, "it1 + it2" is meaningless.
Author
Matt Bisson
Date
8 February, 2015
Since
PSystem 2.0
Version
PSystem 2.0
Todo:
Some debug runtime bounds checking would be nice.

Constructor & Destructor Documentation

psystem::image_symbol_iterator::image_symbol_iterator ( psystem::address_t const  in_ptr)
explicitnoexcept

Construct an iterator based on a backing store.

This constructor copies only one pointer, but the data backing this pointer must outlive the iteration.

Parameters
[in]in_ptrI intended the iterator to be backed by a memory-mapped COFF image, so the input is a binary blob that we know points to the debugging symbols. This should be a contiguous array of IMAGE_SYMBOL structures. The constructor has no way to validate the real type of the data passed to it, so take care.
psystem::image_symbol_iterator::image_symbol_iterator ( image_symbol_iterator const &  o)
noexcept

Copy another iterator's state into this one.

Parameters
[in]oThe other iterator instance from which to transfer data.
psystem::image_symbol_iterator::~image_symbol_iterator ( )
noexcept

Destroy this iterator instance.

Todo:
Should "=default" when MSVC sorts out "noexcept".

Member Function Documentation

bool psystem::image_symbol_iterator::operator!= ( image_symbol_iterator const &  other) const
noexcept

Determine the inequality of two instances.

Parameters
[in]otherThe instance to compare against this for non-equivalence.
Returns
false if both this and other examine the same location in the same container; true in all other cases.
image_symbol_iterator::reference psystem::image_symbol_iterator::operator* ( ) const
noexcept

Access the underlying container data as a reference type.

Returns
A const-reference to IMAGE_SYMBOL in the container across which this instance iterates.
image_symbol_iterator psystem::image_symbol_iterator::operator++ ( int  )
noexcept

Postfix increment.

Make a copy of the current iterator, increment this, then return the copy.

Returns
A copy of the iterator before incrementing it.
image_symbol_iterator & psystem::image_symbol_iterator::operator++ ( )
noexcept

Prefix increment.

Simply advance the iterator to the next position.

Returns
A reference to the current iterator.
image_symbol_iterator & psystem::image_symbol_iterator::operator+= ( size_t const  count)
noexcept

Compound addition.

Parameters
[in]countThe number of positions to advance the iterator.
Returns
A reference to the current iterator.
image_symbol_iterator psystem::image_symbol_iterator::operator- ( size_t const  count) const
noexcept

Create a new iterator placed prior to this instance in the container.

Parameters
[in]countThe number of positions to decrease the resulting iterator relative to this one.
Returns
A new iterator at the desired position.
image_symbol_iterator::difference_type psystem::image_symbol_iterator::operator- ( image_symbol_iterator const &  it) const
noexcept

Determine the distance between two iterators.

Parameters
[in]itThe iterator against which this will be compared.
Returns
The number of elements that it is behind this. This value is negative if this is closer to the beginning of the container than it.
image_symbol_iterator psystem::image_symbol_iterator::operator-- ( int  )
noexcept

Postfix decrement.

Make a copy of the current iterator, decrement this, then return the copy.

Returns
A copy of the iterator before decrementing it.
image_symbol_iterator & psystem::image_symbol_iterator::operator-- ( )
noexcept

Prefix decrement.

Simply move the iterator to the prior position.

Returns
A reference to the current iterator.
image_symbol_iterator & psystem::image_symbol_iterator::operator-= ( size_t const  count)
noexcept

Compound subtraction.

Parameters
[in]countThe number of positions to decrease the iterator.
Returns
A reference to the current iterator.
image_symbol_iterator::pointer psystem::image_symbol_iterator::operator-> ( ) const
noexcept

Access to member data in the underlying container data.

Returns
Access to the IMAGE_SYMBOL through a const pointer.
bool psystem::image_symbol_iterator::operator< ( image_symbol_iterator const &  o) const
noexcept

Determines if this is less-than another instance.

Parameters
[in]oThe other iterator instance to compare against this.
Returns
true if this is closer to the beginning of the container than o.
bool psystem::image_symbol_iterator::operator<= ( image_symbol_iterator const &  o) const
noexcept

Determines if this is less-than or equal-to another instance.

Parameters
[in]oThe other iterator instance to compare against this.
Returns
true if this is closer to the beginning of the container than o, or if they are equal.
image_symbol_iterator & psystem::image_symbol_iterator::operator= ( image_symbol_iterator const &  o)
noexcept

Assign a new state to this instance.

Parameters
[in]oThe other iterator instance from which to transfer state.
Returns
The current instance.
bool psystem::image_symbol_iterator::operator== ( image_symbol_iterator const &  other) const
noexcept

Determine the equality of two instances.

Parameters
[in]otherThe instance to compare against this for equivalence.
Returns
true if both this and other examine the same location in the same container; false in all other cases.
bool psystem::image_symbol_iterator::operator> ( image_symbol_iterator const &  o) const
noexcept

Determines if this is greater-than another instance.

Parameters
[in]oThe other iterator instance to compare against this.
Returns
true if this is farther from the beginning of the container than o.
bool psystem::image_symbol_iterator::operator>= ( image_symbol_iterator const &  o) const
noexcept

Determines if this is greater-than another or equal-to instance.

Parameters
[in]oThe other iterator instance to compare against this.
Returns
true if this is farther from the beginning of the container than o, or if they are equal.
image_symbol_iterator::reference psystem::image_symbol_iterator::operator[] ( size_t const  count) const
noexcept

Access underlying container data by index.

This is an "offset" dereference operator. This means that this[0] is equivalent to *this, this[3] is equivalent to *(this+3), and so on.

Parameters
[in]countThe offset from this current iterator's position.
Returns
A const reference to the desired IMAGE_SYMBOL.
void psystem::image_symbol_iterator::swap ( image_symbol_iterator o)
noexcept

Swap the contents of another iterator with this instance.

This swaps the contents of the iterators (not the contents of the data being iterated across).

Parameters
[in]oThe other iterator instance that will swap with this.

The documentation for this class was generated from the following files: