Skip to content

Commit

Permalink
Fix parseAPI/InstructionSource.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent b82f70f commit 28c6959
Showing 1 changed file with 25 additions and 56 deletions.
81 changes: 25 additions & 56 deletions docs/parseAPI/public/InstructionSource.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,85 +3,54 @@
InstructionSource.h
###################

.. cpp:namespace:: Dyninst::ParseAPI
.. cpp:namespace:: Dyninst

.. cpp:class:: InstructionSource

.. cpp:function:: InstructionSource()

.. cpp:function:: virtual bool isValidAddress(const Address)
.. cpp:function:: virtual bool isValidAddress(Address const addr)

Returns true if the address is a valid code location.
Checks if ``addr`` is a valid code location.

.. cpp:function:: virtual void* getPtrToInstruction(const Address)
.. cpp:function:: virtual void* getPtrToInstruction(Address const addr) = 0

Returns pointer to raw memory in the binary at the provided address.
Returns a pointer to the raw memory in the binary at ``addr``, assuming
that location is code.

.. cpp:function:: virtual void* getPtrToData(const Address)
.. cpp:function:: virtual void* getPtrToData(Address const addr) = 0

Returns pointer to raw memory in the binary at the provided address. The
address need not correspond to an executable code region.
Returns a pointer to the raw memory in the binary at ``addr``, assuming
that location is data.

.. cpp:function:: virtual unsigned int getAddressWidth()
.. cpp:function:: virtual unsigned int getAddressWidth() = 0

Returns the address width (e.g. four or eight bytes) for the represented
binary.
Returns the address width for the underlying architecture.

.. cpp:function:: virtual bool isCode(const Address)
.. cpp:function:: virtual bool isCode(Address const addr) = 0

Indicates whether the location is in a code region.
Checks if ``addr`` is in the code portion of the binary.

.. cpp:function:: virtual bool isData(const Address)
.. cpp:function:: virtual bool isData(Address const addr) = 0

Indicates whether the location is in a data region.
Checks if ``addr`` is in the data portion of the binary.

.. cpp:function:: virtual Address offset()
.. cpp:function:: virtual bool isReadOnly(Address const addr) = 0

The start of the region covered by this instruction source.

.. cpp:function:: virtual Address length()

The size of the region.

.. cpp:function:: virtual Architecture getArch()

The architecture of the instruction source. See the Dyninst manual for
details on architecture differences.
Checks if ``addr`` is in a read-only portion of the binary.

.. cpp:function:: virtual bool isAligned(const Address)
.. cpp:function:: virtual Address offset() = 0

For fixed-width instruction architectures, must return true if the
address is a valid instruction boundary and false otherwise; otherwise
returns true. This method has a default implementation that should be
sufficient.

CodeSource implementors need to fill in several data structures in the
base CodeSource class:

.. cpp:function:: std::map<Address, std::string> _linkage

Entries in the linkage map represent external linkage, e.g. the PLT in
ELF binaries. Filling in this map is optional.

.. cpp:function:: Address _table_of_contents
The start of the region covered by this instruction source.

Many binary format have “table of contents” structures for position
independant references. If such a structure exists, its address should
be filled in.
.. cpp:function:: virtual Address length() = 0

.. cpp:function:: std::vector<CodeRegion *> _regions Dyninst::IBSTree<CodeRegion> _region_tree
The size of the region.

One or more contiguous regions of code or data in the binary object must
be registered with the base class. Keeping these structures in sync is
the responsibility of the implementing class.
.. cpp:function:: virtual Architecture getArch() = 0

.. cpp:function:: std::vector<Hint> _hints
The architecture of the instruction source.

CodeSource implementors can supply a set of Hint objects describing
where functions are known to start in the binary. These hints are used
to seed the parsing algorithm. Refer to the CodeSource header file for
implementation details.
.. cpp:function:: virtual bool isAligned(Address const addr)

.. cpp:function:: virtual bool isReadOnly(const Address) const = 0
.. cpp:function:: virtual Architecture getArch() const = 0
.. cpp:function:: virtual bool isAligned(const Address) const
Checks if the address ``addr`` is aligned, given the underlying architecture.

0 comments on commit 28c6959

Please sign in to comment.