Aggregate.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039 #if !defined(_Aggregate_h_)
00040 #define _Aggregate_h_
00041
00042 #include <iostream>
00043 #include "Annotatable.h"
00044
00045 SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const Dyninst::SymtabAPI::Aggregate &);
00046
00047 namespace Dyninst{
00048 namespace SymtabAPI{
00049
00050 class Symbol;
00051 class Module;
00052 class Symtab;
00053 class Region;
00054 class Aggregate;
00055 struct SymbolCompareByAddr;
00056
00057 class Aggregate
00058 {
00059 friend class Symtab;
00060 friend struct SymbolCompareByAddr;
00061 friend std::ostream &::operator<<(std::ostream &os, const Dyninst::SymtabAPI::Aggregate &);
00062
00063 protected:
00064 SYMTAB_EXPORT Aggregate();
00065 SYMTAB_EXPORT Aggregate(Symbol *sym);
00066
00067 public:
00068
00069 virtual ~Aggregate() {};
00070
00071 SYMTAB_EXPORT Offset getOffset() const;
00072 SYMTAB_EXPORT unsigned getSize() const;
00073 SYMTAB_EXPORT Module * getModule() const { return module_; }
00074 SYMTAB_EXPORT Region * getRegion() const;
00075
00076
00077 SYMTAB_EXPORT bool addSymbol(Symbol *sym);
00078 SYMTAB_EXPORT virtual bool removeSymbol(Symbol *sym) = 0;
00079 SYMTAB_EXPORT bool getSymbols(std::vector<Symbol *>&syms) const;
00080 SYMTAB_EXPORT Symbol * getFirstSymbol() const;
00081
00082
00083 SYMTAB_EXPORT const std::vector<std::string> &getAllMangledNames();
00084 SYMTAB_EXPORT const std::vector<std::string> &getAllPrettyNames();
00085 SYMTAB_EXPORT const std::vector<std::string> &getAllTypedNames();
00086
00087
00088 SYMTAB_EXPORT virtual bool addMangledName(std::string name, bool isPrimary);
00089 SYMTAB_EXPORT virtual bool addPrettyName(std::string name, bool isPrimary);
00090 SYMTAB_EXPORT virtual bool addTypedName(std::string name, bool isPrimary);
00091
00092 SYMTAB_EXPORT bool setModule(Module *mod);
00093 SYMTAB_EXPORT bool setSize(unsigned size);
00094 SYMTAB_EXPORT bool setOffset(unsigned offset);
00095
00096 bool operator==(const Aggregate &a);
00097
00098
00099 protected:
00100
00101 bool addMangledNameInt(std::string name, bool isPrimary);
00102 bool addPrettyNameInt(std::string name, bool isPrimary);
00103 bool addTypedNameInt(std::string name, bool isPrimary);
00104
00105 SYMTAB_EXPORT bool removeSymbolInt(Symbol *sym);
00106 SYMTAB_EXPORT virtual bool changeSymbolOffset(Symbol *sym);
00107
00108
00109
00110
00111 Module *module_;
00112
00113 std::vector<Symbol *> symbols_;
00114 Symbol *firstSymbol;
00115 Offset offset_;
00116
00117 std::vector<std::string> mangledNames_;
00118 std::vector<std::string> prettyNames_;
00119 std::vector<std::string> typedNames_;
00120
00121 void restore_type_by_id(SerializerBase *, Type *&, unsigned) THROW_SPEC (SerializerError);
00122 void restore_module_by_name(SerializerBase *, std::string &) THROW_SPEC (SerializerError);
00123
00124 void rebuild_symbol_vector(SerializerBase *, std::vector<Address> &) THROW_SPEC (SerializerError);
00125 SYMTAB_EXPORT void serialize_aggregate(SerializerBase *, const char * = "Aggregate") THROW_SPEC (SerializerError);
00126 };
00127
00128 }
00129 }
00130
00131 #endif