Skip to content

Commit

Permalink
Add symtab/Aggregate.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 2e48632 commit f5e13af
Show file tree
Hide file tree
Showing 4 changed files with 63 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/symtabAPI/developer/API.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SymtabAPI
:maxdepth: 1

notes
Aggregate.h
annotations.h
debug.h
dwarfWalker.h
Expand Down
30 changes: 30 additions & 0 deletions docs/symtabAPI/developer/Aggregate.h.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.. _`sec-dev:Aggregate.h`:

Aggregate.h
###########

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

.. cpp:class:: Aggregate

.. cpp:member:: protected Module *module_

Module we keep here so we can have the correct "primary"

.. cpp:member:: protected mutable dyn_mutex lock_
.. cpp:member:: protected std::vector<Symbol *> symbols_
.. cpp:member:: protected Symbol *firstSymbol

cached for speed

.. cpp:member:: protected Offset offset_

cached for speed

.. cpp:function:: protected Aggregate()
.. cpp:function:: protected Aggregate(Symbol *sym)
.. cpp:function:: protected Aggregate(Module *m)
.. cpp:function:: protected bool addMangledNameInternal(std::string name, bool isPrimary, bool demangle)
.. cpp:function:: protected void print(std::ostream &) const
.. cpp:function:: protected bool removeSymbolInt(Symbol *sym)
.. cpp:function:: protected virtual bool changeSymbolOffset(Symbol *sym)
31 changes: 30 additions & 1 deletion docs/symtabAPI/public/Aggregate.h.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,34 @@
.. _`sec:Aggregate.h`:

Aggregate.h
===========
###########

.. cpp:namespace:: Dyninst::SymtabAPI

.. cpp:class:: Aggregate

**A common superclass for all Symbol aggregates**

.. cpp:type:: name_iter = boost::transform_iterator<decltype(std::mem_fn(&Symbol::getPrettyName)), std::vector<Symbol*>::const_iterator>
.. cpp:function:: virtual ~Aggregate()
.. cpp:function:: virtual Offset getOffset() const
.. cpp:function:: virtual unsigned getSize() const
.. cpp:function:: Module * getModule() const
.. cpp:function:: Region * getRegion() const
.. cpp:function:: bool addSymbol(Symbol *sym)
.. cpp:function:: virtual bool removeSymbol(Symbol *sym) = 0
.. cpp:function:: bool getSymbols(std::vector<Symbol *> &syms) const
.. cpp:function:: Symbol *getFirstSymbol() const
.. cpp:function:: name_iter mangled_names_begin() const
.. cpp:function:: name_iter mangled_names_end() const
.. cpp:function:: name_iter pretty_names_begin() const
.. cpp:function:: name_iter pretty_names_end() const
.. cpp:function:: name_iter typed_names_begin() const
.. cpp:function:: name_iter typed_names_end() const
.. cpp:function:: virtual bool addMangledName(std::string name, bool isPrimary, bool isDebug=false)
.. cpp:function:: virtual bool addPrettyName(std::string name, bool isPrimary, bool isDebug=false)
.. cpp:function:: virtual bool addTypedName(std::string name, bool isPrimary, bool isDebug=false)
.. cpp:function:: bool setSize(unsigned size)
.. cpp:function:: bool setOffset(unsigned offset)
.. cpp:function:: bool operator==(const Aggregate &a)
.. cpp:function:: std::ostream& operator<<(std::ostream &os, Aggregate const& a)
9 changes: 2 additions & 7 deletions symtabAPI/h/Aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,6 @@
************************************************************************/

// Present a common superclass for all Symbol aggregates.
// We never create an Aggregate directly, but only via a child class.

#if !defined(_Aggregate_h_)
#define _Aggregate_h_

Expand Down Expand Up @@ -114,14 +111,12 @@ class SYMTAB_EXPORT Aggregate
bool removeSymbolInt(Symbol *sym);
virtual bool changeSymbolOffset(Symbol *sym);

// Offset comes from a symbol
// Module we keep here so we can have the correct "primary"
Module *module_;

mutable dyn_mutex lock_;
std::vector<Symbol *> symbols_;
Symbol *firstSymbol; // cached for speed
Offset offset_; // cached for speed
Symbol *firstSymbol;
Offset offset_;

bool addMangledNameInternal(std::string name, bool isPrimary, bool demangle);

Expand Down

0 comments on commit f5e13af

Please sign in to comment.