Skip to content

Commit

Permalink
More cleanup of dead serialization code; also added missing SymReader…
Browse files Browse the repository at this point in the history
… include for previous commit.
  • Loading branch information
wrwilliams committed Oct 24, 2016
1 parent 1a1bc8a commit 17d6d5a
Show file tree
Hide file tree
Showing 17 changed files with 30 additions and 950 deletions.
3 changes: 1 addition & 2 deletions common/h/Serialization.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@ namespace Dyninst {
virtual ~AnnotationContainer() { }
virtual bool addItem_impl(T t) = 0;
bool addItem(T t) { return addItem_impl(t); }
virtual const char *getElementTypename() {return NULL;}
virtual Serializable *ac_serialize_impl(SerializerBase *, const char *) THROW_SPEC(SerializerError) { return NULL; };
virtual const char *getElementTypename() {return NULL;};
};
}

Expand Down
7 changes: 1 addition & 6 deletions symtabAPI/h/Aggregate.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,7 @@ class SYMTAB_EXPORT Aggregate
Offset offset_; // cached for speed


void restore_type_by_id(SerializerBase *, Type *&, unsigned) THROW_SPEC (SerializerError);
void restore_module_by_name(SerializerBase *, std::string &) THROW_SPEC (SerializerError);
//void rebuild_symbol_vector(SerializerBase *, std::vector<Offset> *) THROW_SPEC (SerializerError);
void rebuild_symbol_vector(SerializerBase *, std::vector<Address> &) THROW_SPEC (SerializerError);
void serialize_aggregate(SerializerBase *, const char * = "Aggregate") THROW_SPEC (SerializerError);
bool addMangledNameInternal(std::string name, bool isPrimary, bool demangle);
bool addMangledNameInternal(std::string name, bool isPrimary, bool demangle);
};

}
Expand Down
6 changes: 2 additions & 4 deletions symtabAPI/h/Collections.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,8 @@ class SYMTAB_EXPORT localVarCollection : public AnnotationContainer<localVar *>

void addLocalVar(localVar * var);
localVar * findLocalVar(std::string &name);
std::vector<localVar *> *getAllVars();
std::vector<localVar *> *getAllVars();

Serializable *ac_serialize_impl(SerializerBase *, const char * = "localVarCollection") THROW_SPEC (SerializerError);
};


Expand Down Expand Up @@ -97,8 +96,7 @@ class SYMTAB_EXPORT typeCollection : public Serializable//, public AnnotatableSp
// DWARF...
bool dwarfParsed_;

Serializable *serialize_impl(SerializerBase *, const char * = "typeCollection") THROW_SPEC (SerializerError);
public:
public:
typeCollection();
~typeCollection();
public:
Expand Down
5 changes: 1 addition & 4 deletions symtabAPI/h/Function.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,8 @@ class SYMTAB_EXPORT FunctionBase
/***** PPC64 Linux Specific Information *****/
Offset getPtrOffset() const;
Offset getTOCOffset() const;

Serializable * serialize_impl(SerializerBase *sb,
const char *tag = "Function") THROW_SPEC (SerializerError);

virtual unsigned getSize() const;
virtual unsigned getSize() const;
virtual std::string getName() const;
virtual Offset getOffset() const { return Aggregate::getOffset(); }
virtual bool addMangledName(std::string name, bool isPrimary, bool isDebug=false)
Expand Down
5 changes: 1 addition & 4 deletions symtabAPI/h/Region.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,10 +136,7 @@ class SYMTAB_EXPORT Region : public AnnotatableSparse {

bool updateRelocations(Address start, Address end, Symbol *oldsym, Symbol *newsym);

Serializable * serialize_impl(SerializerBase *sb,
const char *tag = "Region") THROW_SPEC (SerializerError);

Symtab *symtab() const { return symtab_; }
Symtab *symtab() const { return symtab_; }
protected:
Region(unsigned regnum, std::string name, Offset diskOff,
unsigned long diskSize, Offset memOff, unsigned long memSize,
Expand Down
7 changes: 0 additions & 7 deletions symtabAPI/h/Symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,6 @@ class SYMTAB_EXPORT Symbol : public Serializable,

bool versionHidden_;

void restore_module_and_region(SerializerBase *,
std::string &, Offset) THROW_SPEC (SerializerError);

public:

Serializable * serialize_impl(SerializerBase *,
const char *tag = "Symbol") THROW_SPEC (SerializerError);
};

class SYMTAB_EXPORT LookupInterface
Expand Down
9 changes: 2 additions & 7 deletions symtabAPI/h/Symtab.h
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,7 @@ class SYMTAB_EXPORT Symtab : public LookupInterface,
static Symtab *findOpenSymtab(std::string filename);
static bool closeSymtab(Symtab *);

bool exportXML(std::string filename);
bool exportBin(std::string filename);
static Symtab *importBin(std::string filename);
bool getRegValueAtFrame(Address pc,
bool getRegValueAtFrame(Address pc,
Dyninst::MachRegister reg,
Dyninst::MachRegisterVal &reg_result,
MemRegReader *reader);
Expand Down Expand Up @@ -629,9 +626,7 @@ class SYMTAB_EXPORT ExceptionBlock : public Serializable, public AnnotatableSpar
// Accessors provide consistent access to the *original* offsets.
// We allow this to be updated (e.g. to account for relocated code
public:
Serializable * serialize_impl(SerializerBase *sb,
const char *tag = "exceptionBlock") THROW_SPEC (SerializerError);
ExceptionBlock(Offset tStart, unsigned tSize, Offset cStart);
ExceptionBlock(Offset tStart, unsigned tSize, Offset cStart);
ExceptionBlock(Offset cStart);
ExceptionBlock(const ExceptionBlock &eb);
~ExceptionBlock();
Expand Down
43 changes: 8 additions & 35 deletions symtabAPI/h/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,8 @@ class SYMTAB_EXPORT Field : public Serializable, public FIELD_ANNOTATABLE_CLASS
int getOffset();

void fixupUnknown(Module *);
Serializable * serialize_impl(SerializerBase *sb,
const char *tag="Field") THROW_SPEC(SerializerError);
virtual bool operator==(const Field &) const;

virtual bool operator==(const Field &) const;
};

#define TYPE_ANNOTATABLE_CLASS AnnotatableDense
Expand All @@ -148,15 +147,7 @@ class SYMTAB_EXPORT Type : public Serializable, public TYPE_ANNOTATABLE_CLASS
typeCommon *);
static Type* upgradePlaceholder(Type *placeholder, Type *new_type);

public:

virtual void serialize_specific(SerializerBase *)
THROW_SPEC(SerializerError) {}

Serializable * serialize_impl(SerializerBase *,
const char * = "Type") THROW_SPEC (SerializerError);

protected:
protected:
typeId_t ID_; /* unique ID of type */
std::string name_;
unsigned int size_; /* size of type */
Expand Down Expand Up @@ -272,10 +263,8 @@ class SYMTAB_EXPORT fieldListType : public Type, public fieldListInterface
void addField(unsigned num, std::string fieldname, Type *type, int offsetVal = -1, visibility_t vis = visUnknown);
void addField(Field *fld);
void addField(unsigned num, Field *fld);

void serialize_fieldlist(Dyninst::SerializerBase *,
const char * = "fieldListType") THROW_SPEC (SerializerError);
// void addField(const std::string &fieldname, dataClass typeDes,

// void addField(const std::string &fieldname, dataClass typeDes,
// Type *type, int offset, int size, visibility_t vis = visUnknown);
};

Expand All @@ -287,9 +276,8 @@ class SYMTAB_EXPORT rangedType : public Type, public rangedInterface {
//rangedType(const std::string &name, typeId_t ID, dataClass typeDes, int size, const char *low, const char *hi);
rangedType(std::string &name, typeId_t ID, dataClass typeDes, int size, unsigned long low, unsigned long hi);
rangedType(std::string &name, dataClass typeDes, int size, unsigned long low, unsigned long hi);
void serialize_ranged(SerializerBase *,
const char * = "rangedType") THROW_SPEC (SerializerError);
public:

public:
rangedType();
~rangedType();
bool operator==(const Type &) const;
Expand All @@ -308,8 +296,6 @@ class SYMTAB_EXPORT derivedType : public Type, public derivedInterface {
~derivedType();
bool operator==(const Type &) const;
Type *getConstituentType() const;
void serialize_derived(SerializerBase *,
const char * = "derivedType") THROW_SPEC(SerializerError);
};

// Derived classes from Type
Expand All @@ -328,7 +314,6 @@ class SYMTAB_EXPORT typeEnum : public Type {
std::vector<std::pair<std::string, int> > &getConstants();
bool setName(const char *name);
bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeFunction : public Type {
Expand All @@ -350,7 +335,6 @@ class SYMTAB_EXPORT typeFunction : public Type {

std::vector<Type *> &getParams();
bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeScalar : public Type {
Expand All @@ -363,7 +347,6 @@ class SYMTAB_EXPORT typeScalar : public Type {
static typeScalar *create(std::string &name, int size, Symtab *obj = NULL);
bool isSigned();
bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeCommon : public fieldListType {
Expand All @@ -381,7 +364,6 @@ class SYMTAB_EXPORT typeCommon : public fieldListType {
std::vector<CBlock *> *getCblocks() const;
void beginCommonBlock();
void endCommonBlock(Symbol *, void *baseAddr);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT CBlock : public Serializable, public AnnotatableSparse
Expand All @@ -400,9 +382,7 @@ class SYMTAB_EXPORT CBlock : public Serializable, public AnnotatableSparse
std::vector<Symbol *> *getFunctions();

void fixupUnknowns(Module *);

Serializable * serialize_impl(SerializerBase *,
const char *tag="CBlock") THROW_SPEC(SerializerError);

};

class SYMTAB_EXPORT typeStruct : public fieldListType {
Expand All @@ -422,7 +402,6 @@ class SYMTAB_EXPORT typeStruct : public fieldListType {
Symtab *obj = NULL);

bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeUnion : public fieldListType {
Expand All @@ -440,7 +419,6 @@ class SYMTAB_EXPORT typeUnion : public fieldListType {
static typeUnion *create(std::string &name, std::vector<Field *> &fields,
Symtab *obj = NULL);
bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typePointer : public derivedType {
Expand All @@ -455,7 +433,6 @@ class SYMTAB_EXPORT typePointer : public derivedType {
Symtab *obj = NULL);
bool isCompatible(Type *otype);
bool setPtr(Type *ptr);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeTypedef: public derivedType {
Expand All @@ -474,7 +451,6 @@ class SYMTAB_EXPORT typeTypedef: public derivedType {
static typeTypedef *create(std::string &name, Type *ptr, Symtab *obj = NULL);
bool isCompatible(Type *otype);
bool operator==(const Type &otype) const;
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeRef : public derivedType {
Expand All @@ -487,7 +463,6 @@ class SYMTAB_EXPORT typeRef : public derivedType {
static typeRef *create(std::string &name, Type *ptr, Symtab * obj = NULL);
bool isCompatible(Type *otype);
bool operator==(const Type &otype) const;
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeSubrange : public rangedType {
Expand All @@ -499,7 +474,6 @@ class SYMTAB_EXPORT typeSubrange : public rangedType {
typeSubrange( int size, long low, long hi, std::string name);
static typeSubrange *create(std::string &name, int size, long low, long hi, Symtab *obj = NULL);
bool isCompatible(Type *otype);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

class SYMTAB_EXPORT typeArray : public rangedType {
Expand All @@ -518,7 +492,6 @@ class SYMTAB_EXPORT typeArray : public rangedType {
bool isCompatible(Type *otype);
bool operator==(const Type &otype) const;
void fixupUnknowns(Module *);
void serialize_specific(SerializerBase *) THROW_SPEC(SerializerError);
};

} // namespace SymtabAPI
Expand Down
6 changes: 1 addition & 5 deletions symtabAPI/h/Variable.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ class SYMTAB_EXPORT Variable : public Aggregate, public Serializable, public Ann
void setType(Type *type);
Type *getType();

Serializable *serialize_impl(SerializerBase *sb,
const char *tag = "Variable") THROW_SPEC (SerializerError);
bool operator==(const Variable &v);
bool operator==(const Variable &v);

private:

Expand Down Expand Up @@ -120,8 +118,6 @@ class SYMTAB_EXPORT localVar : public Serializable, public AnnotatableSparse
std::string &getFileName();
std::vector<VariableLocation> &getLocationLists();
bool operator==(const localVar &l);
Serializable *serialize_impl(SerializerBase *,
const char * = "localVar") THROW_SPEC(SerializerError);
};

}
Expand Down
17 changes: 0 additions & 17 deletions symtabAPI/src/Aggregate.C
Original file line number Diff line number Diff line change
Expand Up @@ -244,21 +244,8 @@ bool Aggregate::changeSymbolOffset(Symbol *sym)
return true;
}

void Aggregate::restore_type_by_id(SerializerBase *, Type *&,
unsigned ) THROW_SPEC (SerializerError)
{
}

void Aggregate::restore_module_by_name(SerializerBase *, std::string &) THROW_SPEC (SerializerError)
{
}

extern Symbol * getSymForID(SerializerBase *sb, Address id);

void Aggregate::rebuild_symbol_vector(SerializerBase *, std::vector<Address> &) THROW_SPEC (SerializerError)
{
}

std::ostream &operator<<(std::ostream &os, const Dyninst::SymtabAPI::Aggregate &a)
{
std::string modname = a.module_ ? a.module_->fullName() : std::string("no_mod");
Expand All @@ -281,10 +268,6 @@ std::ostream &operator<<(std::ostream &os, const Dyninst::SymtabAPI::Aggregate &
return os;
}

void Aggregate::serialize_aggregate(SerializerBase *, const char *) THROW_SPEC (SerializerError)
{
}

bool Aggregate::operator==(const Aggregate &a)
{
if (symbols_.size() != a.symbols_.size()) return false;
Expand Down

0 comments on commit 17d6d5a

Please sign in to comment.