Skip to content

Commit

Permalink
Add symtab/Statement.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent eec21e9 commit f5bf2af
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 30 deletions.
1 change: 1 addition & 0 deletions docs/symtabAPI/developer/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ SymtabAPI
Object-nt.h
Region.h
relocationEntry.h
Statement.h
Type-mem.h
18 changes: 18 additions & 0 deletions docs/symtabAPI/developer/Statement.h.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
.. _`sec-dev:Statement.h`:

Statement.h
###########

.. cpp:namespace:: Dyninst::SymtabAPI::dev

.. cpp:class:: Statement : public AddressRange

**The base representation of line information**

.. cpp:function:: StringTablePtr getStrings_() const
.. cpp:function:: void setStrings_(StringTablePtr strings_)
.. cpp:function:: bool operator==(const Statement &cmp) const
.. cpp:function:: bool operator==(Offset addr) const
.. cpp:function:: bool operator<(Offset addr) const
.. cpp:function:: bool operator>(Offset addr) const
.. cpp:function:: unsigned int getFileIndex() const
71 changes: 42 additions & 29 deletions docs/symtabAPI/public/Statement.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,45 @@
Statement.h
###########

.. cpp:namespace:: Dyninst

Class Statement
---------------

A ``Statement`` is the base representation of line information.

=========== ============ ==========================================
Method name Return type Method description
=========== ============ ==========================================
startAddr Offset Starting address of this line in the file.
endAddr Offset Ending address of this line in the file.
getFile std::string File that contains the line.
getLine unsigned int Line number.
getColumn unsigned int Starting column number.
=========== ============ ==========================================

For backwards compatibility, this class may also be referred to as a
``LineNoTuple``, and provides the following legacy member variables.
They should not be used and will be removed in a future version of
SymtabAPI.

====== ============= ========================
Member Return type Method description
====== ============= ========================
first const char * Equivalent to getFile.
second unsigned int Equivalent to getLine.
column unsigned int Equivalent to getColumn.
====== ============= ========================
.. cpp:namespace:: Dyninst::SymtabAPI

.. cpp:class:: Statement : public AddressRange

**The base representation of line information**

.. attention:: Users should not create or modify statements.

.. cpp:type:: Statement *Ptr
.. cpp:type:: const Statement *ConstPtr

.. cpp:function:: Statement()

Creates an empty statement covering no addresses.

.. cpp:function:: Offset startAddr() const

Returns the starting address of this line in the file.

.. cpp:function:: Offset endAddr() const

Returns the ending address of this line in the file.

.. cpp:function:: const std::string &getFile() const

Returns the name of the file that contains the statement.

.. cpp:function:: unsigned int getLine() const

Returns the line number for this statement.

.. cpp:function:: unsigned int getColumn() const

Returns the starting column number for this statement.


Notes
=====

.. cpp:type:: Statement LineNoTuple

For backwards compatibility only. Do not use in new code.
2 changes: 1 addition & 1 deletion symtabAPI/h/Statement.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Dyninst { namespace SymtabAPI {
Offset start_addr = (Offset)-1L, Offset end_addr = (Offset)-1L)
: AddressRange(start_addr, end_addr), file_index_(file_index), line_(line), column_(col) {}

unsigned int file_index_{}; // Maybe this should be module?
unsigned int file_index_{};
unsigned int line_{};
unsigned int column_{};
StringTablePtr strings_{};
Expand Down

0 comments on commit f5bf2af

Please sign in to comment.