| BPatch_function.h | | BPatch_function.h | |
| | | | |
| skipping to change at line 62 | | skipping to change at line 62 | |
| class BPatch_flowGraph; | | class BPatch_flowGraph; | |
| | | | |
| class BPatchTranslatorBase; | | class BPatchTranslatorBase; | |
| class ParameterType; | | class ParameterType; | |
| class ReturnParameterType; | | class ReturnParameterType; | |
| class BPatch_function; | | class BPatch_function; | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| class Function; | | class Function; | |
|
| Function *convert(const BPatch_function *); | | PARSER_EXPORT Function *convert(const BPatch_function *); | |
| }; | | }; | |
| namespace PatchAPI { | | namespace PatchAPI { | |
| class PatchFunction; | | class PatchFunction; | |
|
| PatchFunction *convert(const BPatch_function *); | | PARSER_EXPORT PatchFunction *convert(const BPatch_function *); | |
| }; | | }; | |
| }; | | }; | |
| | | | |
| #ifdef DYNINST_CLASS_NAME | | #ifdef DYNINST_CLASS_NAME | |
| #undef DYNINST_CLASS_NAME | | #undef DYNINST_CLASS_NAME | |
| #endif | | #endif | |
| #define DYNINST_CLASS_NAME BPatch_function | | #define DYNINST_CLASS_NAME BPatch_function | |
| | | | |
| class BPATCH_DLL_EXPORT BPatch_function : | | class BPATCH_DLL_EXPORT BPatch_function : | |
| public BPatch_sourceObj, | | public BPatch_sourceObj, | |
| | | | |
| skipping to change at line 191 | | skipping to change at line 191 | |
| // For users of the library: | | // For users of the library: | |
| | | | |
| API_EXPORT(Str, (), std::string, getName, ()); | | API_EXPORT(Str, (), std::string, getName, ()); | |
| | | | |
| // BPatch_function::getName | | // BPatch_function::getName | |
| // Returns <demangled> name of function | | // Returns <demangled> name of function | |
| API_EXPORT(Buffer, (s, len), | | API_EXPORT(Buffer, (s, len), | |
| | | | |
| char *,getName,(char *s, int len)); | | char *,getName,(char *s, int len)); | |
| | | | |
|
| | | // String interface to mangled name | |
| | | API_EXPORT(Str, (), std::string, getMangledName, ()); | |
| | | | |
| // BPatch_function::getMangledName | | // BPatch_function::getMangledName | |
| // Returns mangled name of function, same as getName for non-c++ mutat
ees | | // Returns mangled name of function, same as getName for non-c++ mutat
ees | |
| API_EXPORT(Int, (s, len), | | API_EXPORT(Int, (s, len), | |
| | | | |
| char *,getMangledName,(char *s, int len)); | | char *,getMangledName,(char *s, int len)); | |
| | | | |
| // BPatch_function::getTypedName | | // BPatch_function::getTypedName | |
| // Returns demanged name of function (with type string), may be empty | | // Returns demanged name of function (with type string), may be empty | |
| API_EXPORT(Int, (s, len), | | API_EXPORT(Int, (s, len), | |
| | | | |
| | | | |
End of changes. 3 change blocks. |
| 2 lines changed or deleted | | 5 lines changed or added | |
|
| CFG.h | | CFG.h | |
| | | | |
| skipping to change at line 37 | | skipping to change at line 37 | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA | |
| */ | | */ | |
| #ifndef _PARSER_CFG_H_ | | #ifndef _PARSER_CFG_H_ | |
| #define _PARSER_CFG_H_ | | #define _PARSER_CFG_H_ | |
| | | | |
| #include <vector> | | #include <vector> | |
| #include <set> | | #include <set> | |
| #include <map> | | #include <map> | |
| #include <string> | | #include <string> | |
|
| | | | |
| #include "dyntypes.h" | | #include "dyntypes.h" | |
| #include "IBSTree.h" | | #include "IBSTree.h" | |
| | | | |
| #include "InstructionSource.h" | | #include "InstructionSource.h" | |
| #include "ParseContainers.h" | | #include "ParseContainers.h" | |
| #include "Annotatable.h" | | #include "Annotatable.h" | |
| #include <iostream> | | #include <iostream> | |
|
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
|
| class CFGModifier; | | | |
| class CodeObject; | | class CodeObject; | |
|
| | | class CFGModifier; | |
| | | | |
| enum EdgeTypeEnum { | | enum EdgeTypeEnum { | |
| CALL = 0, | | CALL = 0, | |
| COND_TAKEN, | | COND_TAKEN, | |
| COND_NOT_TAKEN, | | COND_NOT_TAKEN, | |
| INDIRECT, | | INDIRECT, | |
| DIRECT, | | DIRECT, | |
| FALLTHROUGH, | | FALLTHROUGH, | |
| CATCH, | | CATCH, | |
| CALL_FT, // fallthrough after call instruction | | CALL_FT, // fallthrough after call instruction | |
| | | | |
| skipping to change at line 162 | | skipping to change at line 162 | |
| // (tail calls) | | // (tail calls) | |
| }; | | }; | |
| EdgeType _type; | | EdgeType _type; | |
| | | | |
| public: | | public: | |
| PARSER_EXPORT Edge(Block * source, | | PARSER_EXPORT Edge(Block * source, | |
| Block * target, | | Block * target, | |
| EdgeTypeEnum type); | | EdgeTypeEnum type); | |
| PARSER_EXPORT virtual ~Edge(); | | PARSER_EXPORT virtual ~Edge(); | |
| | | | |
|
| PARSER_EXPORT virtual Block * src() const { return _source; } | | PARSER_EXPORT Block * src() const { return _source; } | |
| PARSER_EXPORT virtual Block * trg() const { return _target; } | | PARSER_EXPORT Block * trg() const { return _target; } | |
| PARSER_EXPORT EdgeTypeEnum type() const { | | PARSER_EXPORT EdgeTypeEnum type() const { | |
| return static_cast<EdgeTypeEnum>(_type._type_enum); | | return static_cast<EdgeTypeEnum>(_type._type_enum); | |
| } | | } | |
| bool sinkEdge() const { return _type._sink != 0; } | | bool sinkEdge() const { return _type._sink != 0; } | |
| bool interproc() const { | | bool interproc() const { | |
| return (_type._interproc != 0 || | | return (_type._interproc != 0 || | |
| type() == CALL || | | type() == CALL || | |
| type() == RET); | | type() == RET); | |
| } | | } | |
| | | | |
| | | | |
| skipping to change at line 196 | | skipping to change at line 196 | |
| friend class Parser; | | friend class Parser; | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * Iteration over edges can be controlled by an EdgePredicate. | | * Iteration over edges can be controlled by an EdgePredicate. | |
| * Edges are returned only if pred(edge) evaluates true. | | * Edges are returned only if pred(edge) evaluates true. | |
| * | | * | |
| * EdgePredicates are composable by AND. | | * EdgePredicates are composable by AND. | |
| */ | | */ | |
| class EdgePredicate | | class EdgePredicate | |
|
| : public iterator_predicate< | | | |
| EdgePredicate, | | | |
| Edge *, | | | |
| Edge * | | | |
| > | | | |
| { | | { | |
|
| protected: | | | |
| EdgePredicate * _next; | | | |
| public: | | public: | |
|
| PARSER_EXPORT EdgePredicate() : _next(NULL) { } | | PARSER_EXPORT EdgePredicate() { } | |
| PARSER_EXPORT EdgePredicate(EdgePredicate * next) : _next(next) { } | | | |
| PARSER_EXPORT virtual ~EdgePredicate() { } | | PARSER_EXPORT virtual ~EdgePredicate() { } | |
| PARSER_EXPORT virtual bool pred_impl(Edge *) const; | | PARSER_EXPORT virtual bool pred_impl(Edge *) const; | |
|
| }; | | PARSER_EXPORT bool operator()(Edge* e) const | |
| | | { | |
| | | return pred_impl(e); | |
| | | } | |
| | | }; | |
| | | | |
| /* may follow branches into the function if there is shared code */ | | /* may follow branches into the function if there is shared code */ | |
| class Intraproc : public EdgePredicate { | | class Intraproc : public EdgePredicate { | |
| public: | | public: | |
| PARSER_EXPORT Intraproc() { } | | PARSER_EXPORT Intraproc() { } | |
|
| PARSER_EXPORT Intraproc(EdgePredicate * next) : EdgePredicate(next) { } | | | |
| PARSER_EXPORT ~Intraproc() { } | | PARSER_EXPORT ~Intraproc() { } | |
| PARSER_EXPORT bool pred_impl(Edge *) const; | | PARSER_EXPORT bool pred_impl(Edge *) const; | |
|
| | | | |
| }; | | }; | |
| | | | |
| /* follow interprocedural edges */ | | /* follow interprocedural edges */ | |
|
| class Interproc : public EdgePredicate { | | class Interproc : public EdgePredicate { | |
| public: | | public: | |
| PARSER_EXPORT Interproc() {} | | PARSER_EXPORT Interproc() {} | |
|
| PARSER_EXPORT Interproc(EdgePredicate * next) : EdgePredicate(next)
{ } | | | |
| PARSER_EXPORT ~Interproc() { } | | PARSER_EXPORT ~Interproc() { } | |
| PARSER_EXPORT bool pred_impl(Edge *) const; | | PARSER_EXPORT bool pred_impl(Edge *) const; | |
| }; | | }; | |
| | | | |
| /* | | /* | |
| * For proper ostritch-like denial of | | * For proper ostritch-like denial of | |
| * unresolved control flow edges | | * unresolved control flow edges | |
| */ | | */ | |
|
| class NoSinkPredicate : public ParseAPI::EdgePredicate { | | class NoSinkPredicate : public ParseAPI::EdgePredicate { | |
| public: | | public: | |
| NoSinkPredicate() { } | | NoSinkPredicate() { } | |
|
| NoSinkPredicate(EdgePredicate * next) | | | |
| : EdgePredicate(next) | | | |
| { } | | | |
| | | | |
| bool pred_impl(ParseAPI::Edge * e) const { | | bool pred_impl(ParseAPI::Edge * e) const { | |
| return !e->sinkEdge() && EdgePredicate::pred_impl(e); | | return !e->sinkEdge() && EdgePredicate::pred_impl(e); | |
| } | | } | |
| }; | | }; | |
| | | | |
| /* doesn't follow branches into the function if there is shared code */ | | /* doesn't follow branches into the function if there is shared code */ | |
| class Function; | | class Function; | |
|
| class SingleContext : public EdgePredicate { | | class SingleContext : public EdgePredicate { | |
| private: | | private: | |
| Function * _context; | | Function * _context; | |
| bool _forward; | | bool _forward; | |
| bool _backward; | | bool _backward; | |
| public: | | public: | |
| PARSER_EXPORT SingleContext(Function * f, bool forward, bool backward)
: | | PARSER_EXPORT SingleContext(Function * f, bool forward, bool backward)
: | |
| _context(f), | | _context(f), | |
| _forward(forward), | | _forward(forward), | |
| _backward(backward) { } | | _backward(backward) { } | |
| PARSER_EXPORT ~SingleContext() { } | | PARSER_EXPORT ~SingleContext() { } | |
| PARSER_EXPORT bool pred_impl(Edge *) const; | | PARSER_EXPORT bool pred_impl(Edge *) const; | |
| }; | | }; | |
| | | | |
| /* Doesn't follow branches into the function if there is shared code. | | /* Doesn't follow branches into the function if there is shared code. | |
| * Will follow interprocedural call/return edges */ | | * Will follow interprocedural call/return edges */ | |
|
| class SingleContextOrInterproc : public EdgePredicate { | | class SingleContextOrInterproc : public EdgePredicate { | |
| private: | | private: | |
| Function * _context; | | Function * _context; | |
| bool _forward; | | bool _forward; | |
| bool _backward; | | bool _backward; | |
| public: | | public: | |
| PARSER_EXPORT SingleContextOrInterproc(Function * f, bool forward,
bool backward) : | | PARSER_EXPORT SingleContextOrInterproc(Function * f, bool forward,
bool backward) : | |
| _context(f), | | _context(f), | |
| _forward(forward), | | _forward(forward), | |
| _backward(backward) { } | | _backward(backward) { } | |
| PARSER_EXPORT ~SingleContextOrInterproc() { } | | PARSER_EXPORT ~SingleContextOrInterproc() { } | |
| PARSER_EXPORT bool pred_impl(Edge *) const; | | PARSER_EXPORT bool pred_impl(Edge *) const; | |
|
| | | PARSER_EXPORT bool operator()(Edge* e) const | |
| | | { | |
| | | return pred_impl(e); | |
| | | } | |
| }; | | }; | |
| | | | |
|
| class CodeObject; | | | |
| class CodeRegion; | | class CodeRegion; | |
| class Block : public Dyninst::interval<Address>, | | class Block : public Dyninst::interval<Address>, | |
| public allocatable { | | public allocatable { | |
| friend class CFGModifier; | | friend class CFGModifier; | |
| public: | | public: | |
|
| typedef ContainerWrapper< | | typedef std::vector<Edge*> edgelist; | |
| std::vector<Edge*>, | | | |
| Edge*, | | | |
| Edge*, | | | |
| EdgePredicate | | | |
| > edgelist; | | | |
| | | | |
| PARSER_EXPORT Block(CodeObject * o, CodeRegion * r, Address start); | | PARSER_EXPORT Block(CodeObject * o, CodeRegion * r, Address start); | |
| PARSER_EXPORT virtual ~Block(); | | PARSER_EXPORT virtual ~Block(); | |
| | | | |
| PARSER_EXPORT Address start() const { return _start; } | | PARSER_EXPORT Address start() const { return _start; } | |
| PARSER_EXPORT Address end() const { return _end; } | | PARSER_EXPORT Address end() const { return _end; } | |
| PARSER_EXPORT Address lastInsnAddr() const { return _lastInsn; } | | PARSER_EXPORT Address lastInsnAddr() const { return _lastInsn; } | |
| PARSER_EXPORT Address last() const { return lastInsnAddr(); } | | PARSER_EXPORT Address last() const { return lastInsnAddr(); } | |
| PARSER_EXPORT Address size() const { return _end - _start; } | | PARSER_EXPORT Address size() const { return _end - _start; } | |
| | | | |
| | | | |
| skipping to change at line 312 | | skipping to change at line 302 | |
| PARSER_EXPORT CodeRegion * region() const { return _region; } | | PARSER_EXPORT CodeRegion * region() const { return _region; } | |
| | | | |
| /* Edge access */ | | /* Edge access */ | |
| PARSER_EXPORT const edgelist & sources() const { return _srclist; } | | PARSER_EXPORT const edgelist & sources() const { return _srclist; } | |
| PARSER_EXPORT const edgelist & targets() const { return _trglist; } | | PARSER_EXPORT const edgelist & targets() const { return _trglist; } | |
| | | | |
| PARSER_EXPORT bool consistent(Address addr, Address & prev_insn); | | PARSER_EXPORT bool consistent(Address addr, Address & prev_insn); | |
| | | | |
| PARSER_EXPORT int containingFuncs() const; | | PARSER_EXPORT int containingFuncs() const; | |
| PARSER_EXPORT void getFuncs(std::vector<Function *> & funcs); | | PARSER_EXPORT void getFuncs(std::vector<Function *> & funcs); | |
|
| | | template<class OutputIterator> void getFuncs(OutputIterator result); | |
| | | | |
| PARSER_EXPORT bool wasUserAdded() const; | | PARSER_EXPORT bool wasUserAdded() const; | |
| | | | |
| /* interval implementation */ | | /* interval implementation */ | |
| Address low() const { return start(); } | | Address low() const { return start(); } | |
| Address high() const { return end(); } | | Address high() const { return end(); } | |
| | | | |
| struct compare { | | struct compare { | |
| bool operator()(Block * const & b1, Block * const & b2) const { | | bool operator()(Block * const & b1, Block * const & b2) const { | |
| if(b1->start() < b2->start()) return true; | | if(b1->start() < b2->start()) return true; | |
| | | | |
| skipping to change at line 353 | | skipping to change at line 344 | |
| void updateEnd(Address addr); | | void updateEnd(Address addr); | |
| | | | |
| private: | | private: | |
| CodeObject * _obj; | | CodeObject * _obj; | |
| CodeRegion * _region; | | CodeRegion * _region; | |
| | | | |
| Address _start; | | Address _start; | |
| Address _end; | | Address _end; | |
| Address _lastInsn; | | Address _lastInsn; | |
| | | | |
|
| std::vector<Edge *> _sources; | | | |
| std::vector<Edge *> _targets; | | | |
| | | | |
| edgelist _srclist; | | edgelist _srclist; | |
| edgelist _trglist; | | edgelist _trglist; | |
| int _func_cnt; | | int _func_cnt; | |
| bool _parsed; | | bool _parsed; | |
| | | | |
| friend class Edge; | | friend class Edge; | |
| friend class Function; | | friend class Function; | |
| friend class Parser; | | friend class Parser; | |
| friend class CFGFactory; | | friend class CFGFactory; | |
| }; | | }; | |
| | | | |
| inline void Block::addSource(Edge * e) | | inline void Block::addSource(Edge * e) | |
| { | | { | |
|
| _sources.push_back(e); | | _srclist.push_back(e); | |
| } | | } | |
| | | | |
| inline void Block::addTarget(Edge * e) | | inline void Block::addTarget(Edge * e) | |
| { | | { | |
|
| _targets.push_back(e); | | _trglist.push_back(e); | |
| } | | } | |
| | | | |
| inline void Block::removeTarget(Edge * e) | | inline void Block::removeTarget(Edge * e) | |
| { | | { | |
|
| for(unsigned i=0;i<_targets.size();++i) { | | for(unsigned i=0;i<_trglist.size();++i) { | |
| if(_targets[i] == e) { | | if(_trglist[i] == e) { | |
| _targets[i] = _targets.back(); | | _trglist[i] = _trglist.back(); | |
| _targets.pop_back(); | | _trglist.pop_back(); | |
| break; | | break; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| inline void Block::removeSource(Edge * e) { | | inline void Block::removeSource(Edge * e) { | |
|
| for(unsigned i=0;i<_sources.size();++i) { | | for(unsigned i=0;i<_srclist.size();++i) { | |
| if(_sources[i] == e) { | | if(_srclist[i] == e) { | |
| _sources[i] = _sources.back(); | | _srclist[i] = _srclist.back(); | |
| _sources.pop_back(); | | _srclist.pop_back(); | |
| break; | | break; | |
| } | | } | |
| } | | } | |
| } | | } | |
| | | | |
| enum FuncReturnStatus { | | enum FuncReturnStatus { | |
| UNSET, | | UNSET, | |
| NORETURN, | | NORETURN, | |
| UNKNOWN, | | UNKNOWN, | |
| RETURN | | RETURN | |
| }; | | }; | |
| | | | |
| /* Discovery method of functions */ | | /* Discovery method of functions */ | |
| enum FuncSource { | | enum FuncSource { | |
| RT = 0, // recursive traversal (default) | | RT = 0, // recursive traversal (default) | |
| HINT, // specified in code object hints | | HINT, // specified in code object hints | |
| GAP, // gap heuristics | | GAP, // gap heuristics | |
| GAPRT, // RT from gap-discovered function | | GAPRT, // RT from gap-discovered function | |
| ONDEMAND, // dynamically discovered | | ONDEMAND, // dynamically discovered | |
|
| | | MODIFICATION, // Added via user modification | |
| _funcsource_end_ | | _funcsource_end_ | |
| }; | | }; | |
| | | | |
| enum StackTamper { | | enum StackTamper { | |
| TAMPER_UNSET, | | TAMPER_UNSET, | |
| TAMPER_NONE, | | TAMPER_NONE, | |
| TAMPER_REL, | | TAMPER_REL, | |
| TAMPER_ABS, | | TAMPER_ABS, | |
| TAMPER_NONZERO | | TAMPER_NONZERO | |
| }; | | }; | |
| | | | |
| skipping to change at line 444 | | skipping to change at line 433 | |
| FuncSource _src; | | FuncSource _src; | |
| FuncReturnStatus _rs; | | FuncReturnStatus _rs; | |
| | | | |
| std::string _name; | | std::string _name; | |
| Block * _entry; | | Block * _entry; | |
| protected: | | protected: | |
| PARSER_EXPORT Function(); | | PARSER_EXPORT Function(); | |
| public: | | public: | |
| bool _is_leaf_function; | | bool _is_leaf_function; | |
| Address _ret_addr; // return address of a function stored in stack at f
unction entry | | Address _ret_addr; // return address of a function stored in stack at f
unction entry | |
|
| typedef ContainerWrapper< | | typedef std::vector<Block*> blocklist; | |
| std::vector<Block*>, | | typedef std::set<Edge*> edgelist; | |
| Block*, | | | |
| Block* | | | |
| > blocklist; | | | |
| typedef ContainerWrapper< | | | |
| std::set<Edge*>, | | | |
| Edge*, | | | |
| Edge* | | | |
| > edgelist; | | | |
| | | | |
| PARSER_EXPORT Function(Address addr, string name, CodeObject * obj, | | PARSER_EXPORT Function(Address addr, string name, CodeObject * obj, | |
| CodeRegion * region, InstructionSource * isource); | | CodeRegion * region, InstructionSource * isource); | |
| | | | |
| PARSER_EXPORT virtual ~Function(); | | PARSER_EXPORT virtual ~Function(); | |
| | | | |
| PARSER_EXPORT virtual const string & name(); | | PARSER_EXPORT virtual const string & name(); | |
| | | | |
| PARSER_EXPORT Address addr() const { return _start; } | | PARSER_EXPORT Address addr() const { return _start; } | |
| PARSER_EXPORT CodeRegion * region() const { return _region; } | | PARSER_EXPORT CodeRegion * region() const { return _region; } | |
| PARSER_EXPORT InstructionSource * isrc() const { return _isrc; } | | PARSER_EXPORT InstructionSource * isrc() const { return _isrc; } | |
| PARSER_EXPORT CodeObject * obj() const { return _obj; } | | PARSER_EXPORT CodeObject * obj() const { return _obj; } | |
| PARSER_EXPORT FuncSource src() const { return _src; } | | PARSER_EXPORT FuncSource src() const { return _src; } | |
| PARSER_EXPORT FuncReturnStatus retstatus() const { return _rs; } | | PARSER_EXPORT FuncReturnStatus retstatus() const { return _rs; } | |
| PARSER_EXPORT Block * entry() const { return _entry; } | | PARSER_EXPORT Block * entry() const { return _entry; } | |
| PARSER_EXPORT bool parsed() const { return _parsed; } | | PARSER_EXPORT bool parsed() const { return _parsed; } | |
| | | | |
| /* Basic block and CFG access */ | | /* Basic block and CFG access */ | |
| PARSER_EXPORT blocklist & blocks(); | | PARSER_EXPORT blocklist & blocks(); | |
|
| | | PARSER_EXPORT const blocklist& blocks() const; | |
| | | | |
| PARSER_EXPORT bool contains(Block *b); | | PARSER_EXPORT bool contains(Block *b); | |
|
| PARSER_EXPORT edgelist & callEdges(); | | PARSER_EXPORT const edgelist & callEdges(); | |
| PARSER_EXPORT blocklist & returnBlocks(); | | PARSER_EXPORT const blocklist & returnBlocks(); | |
| PARSER_EXPORT blocklist & exitBlocks(); | | PARSER_EXPORT const blocklist & exitBlocks(); | |
| | | | |
| /* Function details */ | | /* Function details */ | |
| PARSER_EXPORT bool hasNoStackFrame() const { return _no_stack_frame; } | | PARSER_EXPORT bool hasNoStackFrame() const { return _no_stack_frame; } | |
| PARSER_EXPORT bool savesFramePointer() const { return _saves_fp; } | | PARSER_EXPORT bool savesFramePointer() const { return _saves_fp; } | |
| PARSER_EXPORT bool cleansOwnStack() const { return _cleans_stack; } | | PARSER_EXPORT bool cleansOwnStack() const { return _cleans_stack; } | |
| | | | |
| /* Parse updates and obfuscation */ | | /* Parse updates and obfuscation */ | |
| PARSER_EXPORT void setEntryBlock(Block *new_entry); | | PARSER_EXPORT void setEntryBlock(Block *new_entry); | |
| PARSER_EXPORT void set_retstatus(FuncReturnStatus rs); | | PARSER_EXPORT void set_retstatus(FuncReturnStatus rs); | |
| PARSER_EXPORT void removeBlock( Block* ); | | PARSER_EXPORT void removeBlock( Block* ); | |
| | | | |
| skipping to change at line 515 | | skipping to change at line 498 | |
| static void destroy(Function *f); | | static void destroy(Function *f); | |
| | | | |
| private: | | private: | |
| std::vector<Block *> const& blocks_int(); | | std::vector<Block *> const& blocks_int(); | |
| void delayed_link_return(CodeObject * co, Block * retblk); | | void delayed_link_return(CodeObject * co, Block * retblk); | |
| void finalize(); | | void finalize(); | |
| | | | |
| bool _parsed; | | bool _parsed; | |
| bool _cache_valid; | | bool _cache_valid; | |
| blocklist _bl; | | blocklist _bl; | |
|
| std::vector<Block *> _blocks; | | | |
| std::vector<FuncExtent *> _extents; | | std::vector<FuncExtent *> _extents; | |
| | | | |
| /* rapid lookup for edge predicate tests */ | | /* rapid lookup for edge predicate tests */ | |
| //typedef dyn_hash_map<Address, Block*> blockmap; | | //typedef dyn_hash_map<Address, Block*> blockmap; | |
| typedef std::map<Address, Block*> blockmap; | | typedef std::map<Address, Block*> blockmap; | |
| blockmap _bmap; | | blockmap _bmap; | |
| | | | |
| /* rapid lookup for interprocedural queries */ | | /* rapid lookup for interprocedural queries */ | |
|
| std::set<Edge *> _call_edges; | | | |
| edgelist _call_edge_list; | | edgelist _call_edge_list; | |
|
| std::vector<Block *> _return_blocks; | | | |
| blocklist _retBL; | | blocklist _retBL; | |
| // Superset of return blocks; this includes all blocks where | | // Superset of return blocks; this includes all blocks where | |
| // execution leaves the function without coming back, including | | // execution leaves the function without coming back, including | |
| // returns, calls to non-returning calls, tail calls, etc. | | // returns, calls to non-returning calls, tail calls, etc. | |
| // Might want to include exceptions... | | // Might want to include exceptions... | |
|
| std::vector<Block *> _exit_blocks; | | | |
| blocklist _exitBL; | | blocklist _exitBL; | |
| | | | |
| /* function details */ | | /* function details */ | |
| bool _no_stack_frame; | | bool _no_stack_frame; | |
| bool _saves_fp; | | bool _saves_fp; | |
| bool _cleans_stack; | | bool _cleans_stack; | |
| StackTamper _tamper; | | StackTamper _tamper; | |
| Address _tamper_addr; | | Address _tamper_addr; | |
| | | | |
| /*** Internal parsing methods and state ***/ | | /*** Internal parsing methods and state ***/ | |
| | | | |
End of changes. 34 change blocks. |
| 60 lines changed or deleted | | 39 lines changed or added | |
|
| CodeObject.h | | CodeObject.h | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| | | | |
| /** A CodeObject defines a collection of binary code, for example a binary, | | /** A CodeObject defines a collection of binary code, for example a binary, | |
| dynamic library, archive, memory snapshot, etc. In the context of | | dynamic library, archive, memory snapshot, etc. In the context of | |
| Dyninst, it maps to an image object. | | Dyninst, it maps to an image object. | |
| **/ | | **/ | |
| | | | |
| class Parser; // internals | | class Parser; // internals | |
| class ParseCallback; | | class ParseCallback; | |
| class ParseCallbackManager; | | class ParseCallbackManager; | |
| class CFGModifier; | | class CFGModifier; | |
|
| | | class CodeSource; | |
| | | | |
| class CodeObject { | | class CodeObject { | |
| friend class CFGModifier; | | friend class CFGModifier; | |
| public: | | public: | |
| PARSER_EXPORT static void version(int& major, int& minor, int& maintena
nce); | | PARSER_EXPORT static void version(int& major, int& minor, int& maintena
nce); | |
|
| typedef ContainerWrapper< | | typedef std::set<Function*,Function::less> funclist; | |
| std::set<Function*,Function::less>, | | | |
| Function*, | | | |
| Function* | | | |
| > funclist; | | | |
| | | | |
| PARSER_EXPORT CodeObject(CodeSource * cs, | | PARSER_EXPORT CodeObject(CodeSource * cs, | |
| CFGFactory * fact = NULL, | | CFGFactory * fact = NULL, | |
| ParseCallback * cb = NULL, | | ParseCallback * cb = NULL, | |
| bool defensiveMode = false); | | bool defensiveMode = false); | |
| PARSER_EXPORT ~CodeObject(); | | PARSER_EXPORT ~CodeObject(); | |
| | | | |
| /** Parsing interface **/ | | /** Parsing interface **/ | |
| | | | |
| // `hint-based' parsing | | // `hint-based' parsing | |
| | | | |
| skipping to change at line 108 | | skipping to change at line 105 | |
| | | | |
| // functions | | // functions | |
| PARSER_EXPORT Function * findFuncByEntry(CodeRegion * cr, Address entry
); | | PARSER_EXPORT Function * findFuncByEntry(CodeRegion * cr, Address entry
); | |
| PARSER_EXPORT int findFuncs(CodeRegion * cr, | | PARSER_EXPORT int findFuncs(CodeRegion * cr, | |
| Address addr, | | Address addr, | |
| std::set<Function*> & funcs); | | std::set<Function*> & funcs); | |
| // Find functions overlapping the range [start,end) | | // Find functions overlapping the range [start,end) | |
| PARSER_EXPORT int findFuncs(CodeRegion * cr, | | PARSER_EXPORT int findFuncs(CodeRegion * cr, | |
| Address start, Address end, | | Address start, Address end, | |
| std::set<Function*> & funcs); | | std::set<Function*> & funcs); | |
|
| PARSER_EXPORT funclist & funcs() { return flist; } | | PARSER_EXPORT const funclist & funcs() { return flist; } | |
| | | | |
| // blocks | | // blocks | |
| PARSER_EXPORT Block * findBlockByEntry(CodeRegion * cr, Address entry); | | PARSER_EXPORT Block * findBlockByEntry(CodeRegion * cr, Address entry); | |
| PARSER_EXPORT int findBlocks(CodeRegion * cr, | | PARSER_EXPORT int findBlocks(CodeRegion * cr, | |
| Address addr, std::set<Block*> & blocks); | | Address addr, std::set<Block*> & blocks); | |
| PARSER_EXPORT Block * findNextBlock(CodeRegion * cr, Address addr); | | PARSER_EXPORT Block * findNextBlock(CodeRegion * cr, Address addr); | |
| | | | |
| /* Misc */ | | /* Misc */ | |
| PARSER_EXPORT CodeSource * cs() const { return _cs; } | | PARSER_EXPORT CodeSource * cs() const { return _cs; } | |
| PARSER_EXPORT CFGFactory * fact() const { return _fact; } | | PARSER_EXPORT CFGFactory * fact() const { return _fact; } | |
| | | | |
| skipping to change at line 171 | | skipping to change at line 168 | |
| | | | |
| private: | | private: | |
| CodeSource * _cs; | | CodeSource * _cs; | |
| CFGFactory * _fact; | | CFGFactory * _fact; | |
| ParseCallbackManager * _pcb; | | ParseCallbackManager * _pcb; | |
| | | | |
| Parser * parser; // parser implementation | | Parser * parser; // parser implementation | |
| | | | |
| bool owns_factory; | | bool owns_factory; | |
| bool defensive; | | bool defensive; | |
|
| funclist flist; | | funclist& flist; | |
| }; | | }; | |
| | | | |
|
| | | // We need CFG.h, which is included by this | |
| | | template <class OutputIterator> | |
| | | void Block::getFuncs(OutputIterator result) { | |
| | | set<Function *> stab; | |
| | | _obj->findFuncs(region(), start(), stab); | |
| | | std::copy(stab.begin(), stab.end(), result); | |
| | | } | |
| | | | |
| }//namespace ParseAPI | | }//namespace ParseAPI | |
| }//namespace Dyninst | | }//namespace Dyninst | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 7 lines changed or deleted | | 12 lines changed or added | |
|
| Module.h | | Module.h | |
| | | | |
| skipping to change at line 135 | | skipping to change at line 135 | |
| SYMTAB_EXPORT supportedLanguages language() const; | | SYMTAB_EXPORT supportedLanguages language() const; | |
| SYMTAB_EXPORT void setLanguage(supportedLanguages lang); | | SYMTAB_EXPORT void setLanguage(supportedLanguages lang); | |
| | | | |
| SYMTAB_EXPORT Offset addr() const; | | SYMTAB_EXPORT Offset addr() const; | |
| SYMTAB_EXPORT Symtab *exec() const; | | SYMTAB_EXPORT Symtab *exec() const; | |
| | | | |
| SYMTAB_EXPORT bool isShared() const; | | SYMTAB_EXPORT bool isShared() const; | |
| SYMTAB_EXPORT ~Module(); | | SYMTAB_EXPORT ~Module(); | |
| | | | |
| // Symbol output methods | | // Symbol output methods | |
|
| SYMTAB_EXPORT virtual bool findSymbolByType(std::vector<Symbol *> &r | | SYMTAB_EXPORT virtual bool findSymbol(std::vector<Symbol *> &ret, | |
| et, | | const std::string& name, | |
| const std::string& name, | | Symbol::SymbolType sType = Sy | |
| Symbol::SymbolType sType, | | mbol::ST_UNKNOWN, | |
| NameType nameType = anyName, | | NameType nameType = anyName, | |
| bool isRegex = false, | | bool isRegex = false, | |
| bool checkCase = false); | | bool checkCase = false, | |
| | | bool includeUndefined = false | |
| | | ); | |
| SYMTAB_EXPORT virtual bool getAllSymbolsByType(std::vector<Symbol *>
&ret, | | SYMTAB_EXPORT virtual bool getAllSymbolsByType(std::vector<Symbol *>
&ret, | |
| Symbol::SymbolType sType); | | Symbol::SymbolType sType); | |
| SYMTAB_EXPORT virtual bool getAllSymbols(std::vector<Symbol *> &ret)
; | | SYMTAB_EXPORT virtual bool getAllSymbols(std::vector<Symbol *> &ret)
; | |
| | | | |
| // Function based methods | | // Function based methods | |
| SYMTAB_EXPORT bool getAllFunctions(std::vector<Function *>&ret); | | SYMTAB_EXPORT bool getAllFunctions(std::vector<Function *>&ret); | |
| SYMTAB_EXPORT bool findFunctionByEntryOffset(Function *&ret, const O
ffset offset); | | SYMTAB_EXPORT bool findFunctionByEntryOffset(Function *&ret, const O
ffset offset); | |
| SYMTAB_EXPORT bool findFunctionsByName(std::vector<Function *> &ret,
const std::string& name, | | SYMTAB_EXPORT bool findFunctionsByName(std::vector<Function *> &ret,
const std::string& name, | |
| NameType nameType = anyName, | | NameType nameType = anyName, | |
| bool isRegex = false, | | bool isRegex = false, | |
| | | | |
| skipping to change at line 186 | | skipping to change at line 187 | |
| SYMTAB_EXPORT bool getSourceLines(std::vector<Statement *> &lines, | | SYMTAB_EXPORT bool getSourceLines(std::vector<Statement *> &lines, | |
| Offset addressInRange); | | Offset addressInRange); | |
| SYMTAB_EXPORT bool getSourceLines(std::vector<LineNoTuple> &lines, | | SYMTAB_EXPORT bool getSourceLines(std::vector<LineNoTuple> &lines, | |
| Offset addressInRange); | | Offset addressInRange); | |
| SYMTAB_EXPORT bool getStatements(std::vector<Statement *> &statements); | | SYMTAB_EXPORT bool getStatements(std::vector<Statement *> &statements); | |
| SYMTAB_EXPORT LineInformation *getLineInformation(); | | SYMTAB_EXPORT LineInformation *getLineInformation(); | |
| | | | |
| SYMTAB_EXPORT bool hasLineInformation(); | | SYMTAB_EXPORT bool hasLineInformation(); | |
| SYMTAB_EXPORT bool setDefaultNamespacePrefix(std::string str); | | SYMTAB_EXPORT bool setDefaultNamespacePrefix(std::string str); | |
| | | | |
|
| // Deprecated methods | | | |
| SYMTAB_EXPORT virtual bool findSymbolByType(std::vector<Symbol *> &ret, | | | |
| const std::string& name, | | | |
| Symbol::SymbolType sType, | | | |
| bool isMangled = false, | | | |
| bool isRegex = false, | | | |
| bool checkCase = false); | | | |
| | | | |
| // Super secret private methods that aren't really private | | // Super secret private methods that aren't really private | |
| SYMTAB_EXPORT typeCollection *getModuleTypesPrivate(); | | SYMTAB_EXPORT typeCollection *getModuleTypesPrivate(); | |
| | | | |
| private: | | private: | |
| bool setLineInfo(Dyninst::SymtabAPI::LineInformation *lineInfo); | | bool setLineInfo(Dyninst::SymtabAPI::LineInformation *lineInfo); | |
| | | | |
| std::string fileName_; // short file | | std::string fileName_; // short file | |
| std::string fullName_; // full path to file | | std::string fullName_; // full path to file | |
| supportedLanguages language_; | | supportedLanguages language_; | |
| Offset addr_; // starting address of module | | Offset addr_; // starting address of module | |
| | | | |
End of changes. 2 change blocks. |
| 15 lines changed or deleted | | 9 lines changed or added | |
|
| ParseContainers.h | | ParseContainers.h | |
| | | | |
| skipping to change at line 33 | | skipping to change at line 33 | |
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| * Lesser General Public License for more details. | | * Lesser General Public License for more details. | |
| * | | * | |
| * You should have received a copy of the GNU Lesser General Public | | * You should have received a copy of the GNU Lesser General Public | |
| * License along with this library; if not, write to the Free Software | | * License along with this library; if not, write to the Free Software | |
| * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA | |
| */ | | */ | |
| #ifndef _ITERATORS_H_ | | #ifndef _ITERATORS_H_ | |
| #define _ITERATORS_H_ | | #define _ITERATORS_H_ | |
| | | | |
|
| | | #include <boost/iterator/filter_iterator.hpp> | |
| | | #include <boost/type_traits.hpp> | |
| | | #include <boost/function.hpp> | |
| /* | | /* | |
| * An iterator and a predicate interface, and a | | * An iterator and a predicate interface, and a | |
| * ContainerWrapper that can provide a forward | | * ContainerWrapper that can provide a forward | |
| * predicate iterator for any container that exports | | * predicate iterator for any container that exports | |
| * a begin() and end() | | * a begin() and end() | |
| */ | | */ | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
| namespace ParseAPI { | | namespace ParseAPI { | |
| | | | |
|
| /*** a simple forward iterator ***/ | | | |
| template < | | | |
| typename DERIVED, | | | |
| typename VALUE, | | | |
| typename REFERENCE = VALUE & | | | |
| > | | | |
| class iterator_base { | | | |
| public: | | | |
| DERIVED& operator++(); | | | |
| DERIVED operator++(int); | | | |
| bool operator==(const DERIVED &) const; | | | |
| bool operator!=(const DERIVED &) const; | | | |
| REFERENCE operator*() const; | | | |
| }; | | | |
| | | | |
| /*** A predicate interface ***/ | | /*** A predicate interface ***/ | |
| template < | | template < | |
|
| typename DERIVED, | | | |
| typename VALUE, | | typename VALUE, | |
| typename REFERENCE = VALUE & | | typename REFERENCE = VALUE & | |
| > | | > | |
| class iterator_predicate { | | class iterator_predicate { | |
|
| public: | | public: | |
| bool operator()(REFERENCE) const; | | inline bool operator()(const REFERENCE o) const | |
| }; | | | |
| | | | |
| // A default predicate type | | | |
| template<typename V, typename R = V&> | | | |
| class default_predicate | | | |
| : public iterator_predicate< | | | |
| default_predicate<V,R>, | | | |
| V, | | | |
| R | | | |
| > | | | |
| { | | { | |
|
| private: | | return pred_impl(o); | |
| bool pred_impl(R) const { return true; } | | } | |
| friend class iterator_predicate<default_predicate<V,R>,V,R>; | | virtual bool pred_impl(const REFERENCE) const | |
| | | { | |
| | | return true; | |
| | | } | |
| | | virtual ~iterator_predicate() | |
| | | { | |
| | | } | |
| | | | |
| }; | | }; | |
| | | | |
| /*** Container wrapper and iterators for predicate containers ***/ | | /*** Container wrapper and iterators for predicate containers ***/ | |
|
| template < | | | |
| typename CONTAINER, | | | |
| typename VALUE, | | | |
| typename REFERENCE, | | | |
| typename PREDICATE | | | |
| > | | | |
| class ContainerWrapper; | | | |
| | | | |
|
| template < | | template<typename ARG> | |
| typename CONTAINER, | | struct true_predicate : iterator_predicate<ARG> | |
| typename VALUE, | | | |
| typename REFERENCE = VALUE &, | | | |
| typename PREDICATE = class default_predicate<VALUE,REFERENCE> | | | |
| > | | | |
| class PredicateIterator | | | |
| : public iterator_base< | | | |
| PredicateIterator<CONTAINER,VALUE,REFERENCE,PREDICATE>, | | | |
| VALUE, | | | |
| REFERENCE | | | |
| > | | | |
| { | | { | |
|
| public: | | bool operator()(ARG) | |
| typedef ContainerWrapper<CONTAINER,VALUE,REFERENCE,PREDICATE> wrapper_t | | { | |
| ; | | return true; | |
| | | } | |
| PredicateIterator() : | | | |
| _m_cont(NULL), | | | |
| _m_pred(NULL), | | | |
| _m_init(false) | | | |
| { } | | | |
| PredicateIterator(const wrapper_t * cw) : | | | |
| _m_cont(cw), | | | |
| _m_pred(NULL), | | | |
| _m_cur(cw->_m_container.begin()), | | | |
| _m_init(true) | | | |
| { } | | | |
| PredicateIterator(const wrapper_t * cw, PREDICATE * p) : | | | |
| _m_cont(cw), | | | |
| _m_pred(p), | | | |
| _m_cur(cw->_m_container.begin()), | | | |
| _m_init(true) | | | |
| { } | | | |
| | | | |
| private: | | | |
| void increment(); | | | |
| REFERENCE dereference() const; | | | |
| bool equal(PredicateIterator const& o) const; | | | |
| | | | |
| bool uninit() const { return !_m_init; } | | | |
| | | | |
| const wrapper_t * _m_cont; | | | |
| PREDICATE * _m_pred; | | | |
| typename CONTAINER::const_iterator _m_cur; | | | |
| bool _m_init; | | | |
| | | | |
|
| friend class iterator_base<PredicateIterator,VALUE,REFERENCE>; | | | |
| }; | | }; | |
| | | | |
|
| | | #if 0 | |
| template < | | template < | |
|
| typename CONTAINER, | | typename C, | |
| typename VALUE, | | typename VALUE, | |
| typename REFERENCE = VALUE &, | | typename REFERENCE = VALUE &, | |
|
| typename PREDICATE = default_predicate<VALUE,REFERENCE> | | class PREDICATE = iterator_predicate<VALUE, REFERENCE> | |
| > | | > | |
|
| class ContainerWrapper | | class ContainerWrapper | |
| { | | { | |
| | | private: | |
| | | | |
| public: | | public: | |
|
| typedef PredicateIterator<CONTAINER,VALUE,REFERENCE,PREDICATE> iterator
; | | | |
| | | | |
|
| PARSER_EXPORT ContainerWrapper(CONTAINER & cont) : _m_container(cont) { | | typedef boost::filter_iterator<PREDICATE, typename boost::remove_const<C>: | |
| } | | :type::iterator> iterator; | |
| PARSER_EXPORT ~ContainerWrapper() { } | | typedef boost::filter_iterator<PREDICATE, typename boost::remove_const<C>: | |
| | | :type::const_iterator> const_iterator; | |
| | | | |
|
| iterator begin() const; | | PARSER_EXPORT ContainerWrapper(C & cont) : _m_container(cont) { } | |
| iterator begin(PREDICATE * p) const; | | PARSER_EXPORT ~ContainerWrapper() { } | |
| iterator const& end() const; | | | |
| size_t size() const; | | | |
| bool empty() const; | | | |
| private: | | | |
| CONTAINER const& _m_container; | | | |
| iterator _m_end; | | | |
| | | | |
|
| friend class PredicateIterator<CONTAINER,VALUE,REFERENCE,PREDICATE>; | | iterator begin() | |
| }; | | { | |
| | | return boost::make_filter_iterator<PREDICATE>(_m_container.begin(), _m_c | |
| | | ontainer.end()); | |
| | | } | |
| | | | |
| | | template <typename P> | |
| | | boost::filter_iterator<P, typename boost::remove_const<C>::type::iterator> | |
| | | begin(P * p) | |
| | | { | |
| | | return boost::make_filter_iterator(*p, _m_container.begin(), _m_containe | |
| | | r.end()); | |
| | | } | |
| | | | |
| | | iterator end() | |
| | | { | |
| | | return boost::make_filter_iterator<PREDICATE>(_m_container.end(), _m_con | |
| | | tainer.end()); | |
| | | } | |
| | | template <typename P> | |
| | | boost::filter_iterator<P, typename boost::remove_const<C>::type::iterator> | |
| | | end(P * p) | |
| | | { | |
| | | return boost::make_filter_iterator<>(*p, _m_container.end(), _m_containe | |
| | | r.end()); | |
| | | } | |
| | | const_iterator begin() const | |
| | | { | |
| | | return boost::make_filter_iterator<PREDICATE>(_m_container.begin(), _m_c | |
| | | ontainer.end()); | |
| | | } | |
| | | | |
| | | template <typename P> | |
| | | boost::filter_iterator<P, typename boost::remove_const<C>::type::const_ite | |
| | | rator> | |
| | | begin(P * p) const | |
| | | { | |
| | | return boost::make_filter_iterator(*p, _m_container.begin(), _m_containe | |
| | | r.end()); | |
| | | } | |
| | | | |
| | | const_iterator end() const | |
| | | { | |
| | | return boost::make_filter_iterator<PREDICATE>(_m_container.end(), _m_con | |
| | | tainer.end()); | |
| | | } | |
| | | template <typename P> | |
| | | boost::filter_iterator<P, typename boost::remove_const<C>::type::const_ite | |
| | | rator> | |
| | | end(P * p) const | |
| | | { | |
| | | return boost::make_filter_iterator(*p, _m_container.end(), _m_container. | |
| | | end()); | |
| | | } | |
| | | | |
|
| /*** implementation details ***/ | | size_t size() const; | |
| | | bool empty() const; | |
| | | private: | |
| | | C & _m_container; | |
| | | }; | |
| | | | |
|
| template<typename C,typename V,typename R,typename P> | | /*** implementation details ***/ | |
| inline PredicateIterator<C,V,R,P> | | | |
| ContainerWrapper<C,V,R,P>::begin() const | | | |
| { | | | |
| return iterator(this); | | | |
| } | | | |
| | | | |
| template<typename C,typename V,typename R,typename P> | | template<typename C,typename V,typename R,typename P> | |
|
| inline PredicateIterator<C,V,R,P> | | | |
| ContainerWrapper<C,V,R,P>::begin(P * p) const | | | |
| { | | | |
| iterator ret(this,p); | | | |
| if(ret != _m_end && !(*p)(*ret)) | | | |
| ++ret; | | | |
| return ret; | | | |
| } | | | |
| template<typename C,typename V,typename R,typename P> | | | |
| inline PredicateIterator<C,V,R,P> const& | | | |
| ContainerWrapper<C,V,R,P>::end() const | | | |
| { | | | |
| return _m_end; | | | |
| } | | | |
| template<typename C,typename V,typename R,typename P> | | | |
| inline size_t | | inline size_t | |
| ContainerWrapper<C,V,R,P>::size() const | | ContainerWrapper<C,V,R,P>::size() const | |
| { | | { | |
| return _m_container.size(); | | return _m_container.size(); | |
| } | | } | |
| template<typename C,typename V,typename R,typename P> | | template<typename C,typename V,typename R,typename P> | |
| inline bool | | inline bool | |
| ContainerWrapper<C,V,R,P>::empty() const | | ContainerWrapper<C,V,R,P>::empty() const | |
| { | | { | |
| return _m_container.empty(); | | return _m_container.empty(); | |
| } | | } | |
|
| | | #endif | |
| template<typename C,typename V,typename R, typename P> | | | |
| inline void PredicateIterator<C,V,R,P>::increment() | | | |
| { | | | |
| if(*this == _m_cont->end()) | | | |
| return; | | | |
| | | | |
| do { | | | |
| (void)++_m_cur; | | | |
| } while(*this != _m_cont->end() && (_m_pred && !(*_m_pred)(*(*this))) ) | | | |
| ; | | | |
| } | | | |
| | | | |
| template<typename C,typename V,typename R, typename P> | | | |
| inline R PredicateIterator<C,V,R,P>::dereference() const | | | |
| { | | | |
| return *_m_cur; | | | |
| } | | | |
| | | | |
| template<typename C,typename V,typename R, typename P> | | | |
| inline bool PredicateIterator<C,V,R,P>::equal(PredicateIterator const& o) c | | | |
| onst | | | |
| { | | | |
| if(o.uninit() && uninit()) | | | |
| return true; | | | |
| return (o.uninit() && _m_cur == _m_cont->_m_container.end()) || | | | |
| (uninit() && o._m_cur == o._m_cont->_m_container.end()) || | | | |
| (_m_cont == o._m_cont && _m_cur == o._m_cur); | | | |
| } | | | |
| | | | |
| /*** static binding implementation ***/ | | /*** static binding implementation ***/ | |
| | | | |
|
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline DERIVED& iterator_base<DERIVED,VALUE,REFERENCE>::operator++() | | | |
| { | | | |
| static_cast<DERIVED*>(this)->increment(); | | | |
| return *static_cast<DERIVED*>(this); | | | |
| } | | | |
| | | | |
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline DERIVED iterator_base<DERIVED,VALUE,REFERENCE>::operator++(int) | | | |
| { | | | |
| DERIVED copy(*static_cast<DERIVED*>(this)); | | | |
| static_cast<DERIVED*>(this)->increment(); | | | |
| return copy; | | | |
| } | | | |
| | | | |
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline bool iterator_base<DERIVED,VALUE,REFERENCE>::operator==(const DERIVE | | | |
| D & o) const | | | |
| { | | | |
| return static_cast<const DERIVED*>(this)->equal(o); | | | |
| } | | | |
| | | | |
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline bool iterator_base<DERIVED,VALUE,REFERENCE>::operator!=(const DERIVE | | | |
| D & o) const | | | |
| { | | | |
| return !static_cast<const DERIVED*>(this)->equal(o); | | | |
| } | | | |
| | | | |
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline REFERENCE iterator_base<DERIVED,VALUE,REFERENCE>::operator*() const | | | |
| { | | | |
| return static_cast<const DERIVED*>(this)->dereference(); | | | |
| } | | | |
| | | | |
| template<typename DERIVED,typename VALUE,typename REFERENCE> | | | |
| inline bool iterator_predicate<DERIVED,VALUE,REFERENCE>::operator()(REFEREN | | | |
| CE o) const | | | |
| { | | | |
| return static_cast<const DERIVED*>(this)->pred_impl(o); | | | |
| } | | | |
| | | | |
| } | | } | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 22 change blocks. |
| 195 lines changed or deleted | | 95 lines changed or added | |
|
| Region.h | | Region.h | |
| | | | |
| skipping to change at line 42 | | skipping to change at line 42 | |
| #define __REGION__H__ | | #define __REGION__H__ | |
| #include "Serialization.h" | | #include "Serialization.h" | |
| #include "symutil.h" | | #include "symutil.h" | |
| #include "Annotatable.h" | | #include "Annotatable.h" | |
| | | | |
| namespace Dyninst{ | | namespace Dyninst{ | |
| namespace SymtabAPI{ | | namespace SymtabAPI{ | |
| | | | |
| class Symbol; | | class Symbol; | |
| class relocationEntry; | | class relocationEntry; | |
|
| | | class Symtab; | |
| | | | |
| class Region : public AnnotatableSparse { | | class Region : public AnnotatableSparse { | |
| friend class Object; | | friend class Object; | |
| friend class Symtab; | | friend class Symtab; | |
| friend class SymtabTranslatorBase; | | friend class SymtabTranslatorBase; | |
| friend class SymtabTranslatorBin; | | friend class SymtabTranslatorBin; | |
| | | | |
| public: | | public: | |
| | | | |
| enum perm_t | | enum perm_t | |
| | | | |
| skipping to change at line 101 | | skipping to change at line 102 | |
| SYMTAB_EXPORT Region& operator=(const Region ®); | | SYMTAB_EXPORT Region& operator=(const Region ®); | |
| SYMTAB_EXPORT std::ostream& operator<< (std::ostream &os); | | SYMTAB_EXPORT std::ostream& operator<< (std::ostream &os); | |
| SYMTAB_EXPORT bool operator== (const Region ®); | | SYMTAB_EXPORT bool operator== (const Region ®); | |
| | | | |
| SYMTAB_EXPORT ~Region(); | | SYMTAB_EXPORT ~Region(); | |
| | | | |
| SYMTAB_EXPORT unsigned getRegionNumber() const; | | SYMTAB_EXPORT unsigned getRegionNumber() const; | |
| SYMTAB_EXPORT bool setRegionNumber(unsigned regnumber); | | SYMTAB_EXPORT bool setRegionNumber(unsigned regnumber); | |
| SYMTAB_EXPORT std::string getRegionName() const; | | SYMTAB_EXPORT std::string getRegionName() const; | |
| | | | |
|
| // getRegionAddr returns diskOffset on unixes, memory offset on windows | | | |
| SYMTAB_EXPORT Offset getRegionAddr() const; | | | |
| | | | |
| SYMTAB_EXPORT Offset getDiskOffset() const; | | SYMTAB_EXPORT Offset getDiskOffset() const; | |
| SYMTAB_EXPORT unsigned long getDiskSize() const; | | SYMTAB_EXPORT unsigned long getDiskSize() const; | |
| SYMTAB_EXPORT unsigned long getFileOffset(); | | SYMTAB_EXPORT unsigned long getFileOffset(); | |
| | | | |
| SYMTAB_EXPORT Offset getMemOffset() const; | | SYMTAB_EXPORT Offset getMemOffset() const; | |
| SYMTAB_EXPORT unsigned long getMemSize() const; | | SYMTAB_EXPORT unsigned long getMemSize() const; | |
| SYMTAB_EXPORT unsigned long getMemAlignment() const; | | SYMTAB_EXPORT unsigned long getMemAlignment() const; | |
| SYMTAB_EXPORT void setMemOffset(Offset); | | SYMTAB_EXPORT void setMemOffset(Offset); | |
| SYMTAB_EXPORT void setMemSize(unsigned long); | | SYMTAB_EXPORT void setMemSize(unsigned long); | |
| SYMTAB_EXPORT void setDiskSize(unsigned long); | | SYMTAB_EXPORT void setDiskSize(unsigned long); | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 141 | |
| SYMTAB_EXPORT RegionType getRegionType() const; | | SYMTAB_EXPORT RegionType getRegionType() const; | |
| | | | |
| SYMTAB_EXPORT bool addRelocationEntry(Offset relocationAddr, Symbol *dyn
ref, unsigned long relType, Region::RegionType rtype = Region::RT_REL); | | SYMTAB_EXPORT bool addRelocationEntry(Offset relocationAddr, Symbol *dyn
ref, unsigned long relType, Region::RegionType rtype = Region::RT_REL); | |
| SYMTAB_EXPORT bool addRelocationEntry(const relocationEntry& rel); | | SYMTAB_EXPORT bool addRelocationEntry(const relocationEntry& rel); | |
| | | | |
| SYMTAB_EXPORT bool updateRelocations(Address start, Address end, Symbol
*oldsym, Symbol *newsym); | | SYMTAB_EXPORT bool updateRelocations(Address start, Address end, Symbol
*oldsym, Symbol *newsym); | |
| | | | |
| SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | | SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | |
| const char *tag = "Region") THROW_SPEC (SerializerError); | | const char *tag = "Region") THROW_SPEC (SerializerError); | |
| | | | |
|
| | | SYMTAB_EXPORT Symtab *symtab() const { return symtab_; } | |
| protected: | | protected: | |
| SYMTAB_EXPORT Region(unsigned regnum, std::string name, Offset diskOff, | | SYMTAB_EXPORT Region(unsigned regnum, std::string name, Offset diskOff, | |
|
| unsigned long diskSize, Offset memOff, unsigned long memSize, | | unsigned long diskSize, Offset memOff, unsigned long | |
| char *rawDataPtr, perm_t perms, RegionType regType, bool isLoadabl | | memSize, | |
| e = false, | | char *rawDataPtr, perm_t perms, RegionType regType, | |
| bool isTLS = false, unsigned long memAlign = sizeof(unsigned)); | | bool isLoadable = false, | |
| | | bool isTLS = false, unsigned long memAlign = sizeof( | |
| | | unsigned)); | |
| | | void setSymtab(Symtab *sym) { symtab_ = sym; } | |
| private: | | private: | |
| unsigned regNum_; | | unsigned regNum_; | |
| std::string name_; | | std::string name_; | |
| Offset diskOff_; | | Offset diskOff_; | |
| unsigned long diskSize_; | | unsigned long diskSize_; | |
| Offset memOff_; | | Offset memOff_; | |
| unsigned long memSize_; | | unsigned long memSize_; | |
| Offset fileOff_; | | Offset fileOff_; | |
| void *rawDataPtr_; | | void *rawDataPtr_; | |
| perm_t permissions_; | | perm_t permissions_; | |
| RegionType rType_; | | RegionType rType_; | |
| bool isDirty_; | | bool isDirty_; | |
| std::vector<relocationEntry> rels_; | | std::vector<relocationEntry> rels_; | |
| char *buffer_; //To hold dirty data | | char *buffer_; //To hold dirty data | |
| bool isLoadable_; | | bool isLoadable_; | |
| bool isTLS_; | | bool isTLS_; | |
| unsigned long memAlign_; | | unsigned long memAlign_; | |
|
| | | Symtab *symtab_; | |
| }; | | }; | |
| | | | |
| }//namespace SymtabAPI | | }//namespace SymtabAPI | |
| | | | |
| }//namespace Dyninst | | }//namespace Dyninst | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 7 lines changed or deleted | | 10 lines changed or added | |
|
| Symtab.h | | Symtab.h | |
| | | | |
| skipping to change at line 54 | | skipping to change at line 54 | |
| | | | |
| #include "boost/shared_ptr.hpp" | | #include "boost/shared_ptr.hpp" | |
| | | | |
| class MappedFile; | | class MappedFile; | |
| | | | |
| #define SYM_MAJOR 6 | | #define SYM_MAJOR 6 | |
| #define SYM_MINOR 2 | | #define SYM_MINOR 2 | |
| #define SYM_BETA 1 | | #define SYM_BETA 1 | |
| | | | |
| namespace Dyninst { | | namespace Dyninst { | |
|
| | | | |
| | | namespace Dwarf { | |
| | | class DwarfFrameParser; | |
| | | typedef boost::shared_ptr<DwarfFrameParser> DwarfFrameParserPtr; | |
| | | } | |
| | | | |
| namespace SymtabAPI { | | namespace SymtabAPI { | |
| | | | |
| class Archive; | | class Archive; | |
| class builtInTypeCollection; | | class builtInTypeCollection; | |
| | | | |
| class ExceptionBlock; | | class ExceptionBlock; | |
| class Object; | | class Object; | |
| class localVar; | | class localVar; | |
| class relocationEntry; | | class relocationEntry; | |
| class Type; | | class Type; | |
| | | | |
| skipping to change at line 87 | | skipping to change at line 93 | |
| friend class Region; | | friend class Region; | |
| friend class emitElf; | | friend class emitElf; | |
| friend class emitElf64; | | friend class emitElf64; | |
| friend class emitElfStatic; | | friend class emitElfStatic; | |
| friend class emitWin; | | friend class emitWin; | |
| friend class Aggregate; | | friend class Aggregate; | |
| friend class relocationEntry; | | friend class relocationEntry; | |
| | | | |
| public: | | public: | |
| | | | |
|
| | | /**** DEBUG *****/ | |
| | | Dwarf::DwarfFrameParserPtr debugDwarf(); | |
| | | | |
| /***** Public Member Functions *****/ | | /***** Public Member Functions *****/ | |
| public: | | public: | |
| SYMTAB_EXPORT static void version(int& major, int& minor, int& maintenan
ce); | | SYMTAB_EXPORT static void version(int& major, int& minor, int& maintenan
ce); | |
| SYMTAB_EXPORT Symtab(MappedFile *); | | SYMTAB_EXPORT Symtab(MappedFile *); | |
| | | | |
| SYMTAB_EXPORT Symtab(); | | SYMTAB_EXPORT Symtab(); | |
| | | | |
| SYMTAB_EXPORT Symtab(const Symtab& obj); | | SYMTAB_EXPORT Symtab(const Symtab& obj); | |
| SYMTAB_EXPORT Symtab(unsigned char *mem_image, size_t image_size, | | SYMTAB_EXPORT Symtab(unsigned char *mem_image, size_t image_size, | |
| const std::string &name, bool defensive_binary, boo
l &err); | | const std::string &name, bool defensive_binary, boo
l &err); | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 334 | |
| // SYMTAB_EXPORT char* data_ptr () const; | | // SYMTAB_EXPORT char* data_ptr () const; | |
| SYMTAB_EXPORT Offset getInitOffset(); | | SYMTAB_EXPORT Offset getInitOffset(); | |
| SYMTAB_EXPORT Offset getFiniOffset(); | | SYMTAB_EXPORT Offset getFiniOffset(); | |
| | | | |
| SYMTAB_EXPORT const char* getInterpreterName() const; | | SYMTAB_EXPORT const char* getInterpreterName() const; | |
| | | | |
| SYMTAB_EXPORT unsigned getAddressWidth() const; | | SYMTAB_EXPORT unsigned getAddressWidth() const; | |
| SYMTAB_EXPORT Offset getLoadOffset() const; | | SYMTAB_EXPORT Offset getLoadOffset() const; | |
| SYMTAB_EXPORT Offset getEntryOffset() const; | | SYMTAB_EXPORT Offset getEntryOffset() const; | |
| SYMTAB_EXPORT Offset getBaseOffset() const; | | SYMTAB_EXPORT Offset getBaseOffset() const; | |
|
| SYMTAB_EXPORT Offset getTOCoffset() const; | | SYMTAB_EXPORT Offset getTOCoffset(Function *func = NULL) const; | |
| | | SYMTAB_EXPORT Offset getTOCoffset(Offset off) const; | |
| SYMTAB_EXPORT Address getLoadAddress(); | | SYMTAB_EXPORT Address getLoadAddress(); | |
| SYMTAB_EXPORT bool isDefensiveBinary() const; | | SYMTAB_EXPORT bool isDefensiveBinary() const; | |
| SYMTAB_EXPORT Offset fileToDiskOffset(Dyninst::Offset) const; | | SYMTAB_EXPORT Offset fileToDiskOffset(Dyninst::Offset) const; | |
| SYMTAB_EXPORT Offset fileToMemOffset(Dyninst::Offset) const; | | SYMTAB_EXPORT Offset fileToMemOffset(Dyninst::Offset) const; | |
| | | | |
| SYMTAB_EXPORT std::string getDefaultNamespacePrefix() const; | | SYMTAB_EXPORT std::string getDefaultNamespacePrefix() const; | |
| | | | |
| SYMTAB_EXPORT unsigned getNumberofRegions() const; | | SYMTAB_EXPORT unsigned getNumberofRegions() const; | |
| SYMTAB_EXPORT unsigned getNumberofSymbols() const; | | SYMTAB_EXPORT unsigned getNumberofSymbols() const; | |
| | | | |
| | | | |
| skipping to change at line 365 | | skipping to change at line 375 | |
| /***** Private Member Functions *****/ | | /***** Private Member Functions *****/ | |
| private: | | private: | |
| | | | |
| SYMTAB_EXPORT Symtab(std::string filename, bool defensive_bin, bool &err
); | | SYMTAB_EXPORT Symtab(std::string filename, bool defensive_bin, bool &err
); | |
| | | | |
| SYMTAB_EXPORT bool extractInfo(Object *linkedFile); | | SYMTAB_EXPORT bool extractInfo(Object *linkedFile); | |
| | | | |
| // Parsing code | | // Parsing code | |
| | | | |
| bool extractSymbolsFromFile(Object *linkedFile, std::vector<Symbol *> &r
aw_syms); | | bool extractSymbolsFromFile(Object *linkedFile, std::vector<Symbol *> &r
aw_syms); | |
|
| | | | |
| | | bool fixSymRegion(Symbol *sym); | |
| | | | |
| bool fixSymModules(std::vector<Symbol *> &raw_syms); | | bool fixSymModules(std::vector<Symbol *> &raw_syms); | |
| bool demangleSymbols(std::vector<Symbol *> &rawsyms); | | bool demangleSymbols(std::vector<Symbol *> &rawsyms); | |
| bool createIndices(std::vector<Symbol *> &raw_syms, bool undefined); | | bool createIndices(std::vector<Symbol *> &raw_syms, bool undefined); | |
| bool createAggregates(); | | bool createAggregates(); | |
| | | | |
| bool fixSymModule(Symbol *&sym); | | bool fixSymModule(Symbol *&sym); | |
| bool demangleSymbol(Symbol *&sym); | | bool demangleSymbol(Symbol *&sym); | |
| bool addSymbolToIndices(Symbol *&sym, bool undefined); | | bool addSymbolToIndices(Symbol *&sym, bool undefined); | |
| bool addSymbolToAggregates(Symbol *&sym); | | bool addSymbolToAggregates(Symbol *&sym); | |
| bool doNotAggregate(Symbol *&sym); | | bool doNotAggregate(Symbol *&sym); | |
| | | | |
| skipping to change at line 423 | | skipping to change at line 436 | |
| | | | |
| void checkPPC64DescriptorSymbols(Object *linkedFile); | | void checkPPC64DescriptorSymbols(Object *linkedFile); | |
| | | | |
| void parseLineInformation(); | | void parseLineInformation(); | |
| void parseTypes(); | | void parseTypes(); | |
| bool setDefaultNamespacePrefix(std::string &str); | | bool setDefaultNamespacePrefix(std::string &str); | |
| | | | |
| bool addUserRegion(Region *newreg); | | bool addUserRegion(Region *newreg); | |
| bool addUserType(Type *newtypeg); | | bool addUserType(Type *newtypeg); | |
| | | | |
|
| | | void setTOCOffset(Offset offset); | |
| | | | |
| /***** Private Data Members *****/ | | /***** Private Data Members *****/ | |
| private: | | private: | |
| | | | |
| static boost::shared_ptr<typeCollection> setupStdTypes(); | | static boost::shared_ptr<typeCollection> setupStdTypes(); | |
| static boost::shared_ptr<builtInTypeCollection> setupBuiltinTypes(); | | static boost::shared_ptr<builtInTypeCollection> setupBuiltinTypes(); | |
| | | | |
| std::string member_name_; | | std::string member_name_; | |
| Offset member_offset_; | | Offset member_offset_; | |
| Archive * parentArchive_; | | Archive * parentArchive_; | |
| MappedFile *mf; | | MappedFile *mf; | |
| | | | |
| skipping to change at line 452 | | skipping to change at line 467 | |
| | | | |
| bool nativeCompiler; | | bool nativeCompiler; | |
| | | | |
| unsigned address_width_; | | unsigned address_width_; | |
| char *code_ptr_; | | char *code_ptr_; | |
| char *data_ptr_; | | char *data_ptr_; | |
| std::string interpreter_name_; | | std::string interpreter_name_; | |
| Offset entry_address_; | | Offset entry_address_; | |
| Offset base_address_; | | Offset base_address_; | |
| Offset load_address_; | | Offset load_address_; | |
|
| Offset toc_offset_; | | | |
| ObjectType object_type_; | | ObjectType object_type_; | |
| bool is_eel_; | | bool is_eel_; | |
| std::vector<Segment> segments_; | | std::vector<Segment> segments_; | |
| // make sure is_a_out is set before calling symbolsToFunctions | | // make sure is_a_out is set before calling symbolsToFunctions | |
| | | | |
| // A std::vector of all Symtabs. Used to avoid duplicating | | // A std::vector of all Symtabs. Used to avoid duplicating | |
| // a Symtab that already exists. | | // a Symtab that already exists. | |
| static std::vector<Symtab *> allSymtabs; | | static std::vector<Symtab *> allSymtabs; | |
| std::string defaultNamespacePrefix; | | std::string defaultNamespacePrefix; | |
| | | | |
| | | | |
| skipping to change at line 598 | | skipping to change at line 612 | |
| | | | |
| // dynamic library name substitutions | | // dynamic library name substitutions | |
| std::map <std::string, std::string> dynLibSubs; | | std::map <std::string, std::string> dynLibSubs; | |
| | | | |
| public: | | public: | |
| static boost::shared_ptr<Type> type_Error(); | | static boost::shared_ptr<Type> type_Error(); | |
| static boost::shared_ptr<Type> type_Untyped(); | | static boost::shared_ptr<Type> type_Untyped(); | |
| | | | |
| private: | | private: | |
| unsigned _ref_cnt; | | unsigned _ref_cnt; | |
|
| | | | |
| public: | | | |
| /********************************************************************/ | | | |
| /**** DEPRECATED ****************************************************/ | | | |
| /********************************************************************/ | | | |
| dyn_hash_map <std::string, Module *> &getModsByFileName() | | | |
| { | | | |
| return modsByFileName; | | | |
| } | | | |
| dyn_hash_map <std::string, Module *> &getModsByFullName() | | | |
| { | | | |
| return modsByFullName; | | | |
| } | | | |
| | | | |
| SYMTAB_EXPORT bool findFuncByEntryOffset(std::vector<Symbol *>&ret, cons | | | |
| t Offset offset); | | | |
| SYMTAB_EXPORT virtual bool findSymbolByType(std::vector<Symbol *> &ret, | | | |
| const std::string& name, | | | |
| Symbol::SymbolType sType, | | | |
| bool isMangled = false, | | | |
| bool isRegex = false, | | | |
| bool checkCase = false); | | | |
| }; | | }; | |
| | | | |
| /** | | /** | |
| * Used to represent something like a C++ try/catch block. | | * Used to represent something like a C++ try/catch block. | |
| * Currently only used on Linux/x86 | | * Currently only used on Linux/x86 | |
| **/ | | **/ | |
| SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const ExceptionBl
ock &q); | | SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const ExceptionBl
ock &q); | |
| | | | |
| class ExceptionBlock : public Serializable, public AnnotatableSparse { | | class ExceptionBlock : public Serializable, public AnnotatableSparse { | |
| | | | |
| | | | |
| skipping to change at line 673 | | skipping to change at line 666 | |
| SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, Offset add, | | SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, Offset add, | |
| std::string n, Symbol *dynref = NULL, unsigned lon
g relType = 0); | | std::string n, Symbol *dynref = NULL, unsigned lon
g relType = 0); | |
| SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, std::string n, | | SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, std::string n, | |
| Symbol *dynref = NULL, unsigned long relType = 0); | | Symbol *dynref = NULL, unsigned long relType = 0); | |
| SYMTAB_EXPORT relocationEntry(Offset ra, std::string n, Symbol *dynre
f = NULL, | | SYMTAB_EXPORT relocationEntry(Offset ra, std::string n, Symbol *dynre
f = NULL, | |
| unsigned long relType = 0, Region::RegionType rtyp
e = Region::RT_REL); | | unsigned long relType = 0, Region::RegionType rtyp
e = Region::RT_REL); | |
| SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, Offset add, | | SYMTAB_EXPORT relocationEntry(Offset ta, Offset ra, Offset add, | |
| std::string n, Symbol *dynref = NULL, unsigned lo
ng relType = 0, | | std::string n, Symbol *dynref = NULL, unsigned lo
ng relType = 0, | |
| Region::RegionType rtype = Region::RT_REL); | | Region::RegionType rtype = Region::RT_REL); | |
| | | | |
|
| SYMTAB_EXPORT const relocationEntry& operator= (const relocationEntry | | | |
| &ra); | | | |
| | | | |
| SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | | SYMTAB_EXPORT Serializable * serialize_impl(SerializerBase *sb, | |
| const char *tag = "relocationEntry") THROW_SPEC (S
erializerError); | | const char *tag = "relocationEntry") THROW_SPEC (S
erializerError); | |
| | | | |
| SYMTAB_EXPORT Offset target_addr() const; | | SYMTAB_EXPORT Offset target_addr() const; | |
| SYMTAB_EXPORT Offset rel_addr() const; | | SYMTAB_EXPORT Offset rel_addr() const; | |
| SYMTAB_EXPORT Offset addend() const; | | SYMTAB_EXPORT Offset addend() const; | |
| SYMTAB_EXPORT Region::RegionType regionType() const; | | SYMTAB_EXPORT Region::RegionType regionType() const; | |
| SYMTAB_EXPORT const std::string &name() const; | | SYMTAB_EXPORT const std::string &name() const; | |
| SYMTAB_EXPORT Symbol *getDynSym() const; | | SYMTAB_EXPORT Symbol *getDynSym() const; | |
| SYMTAB_EXPORT bool addDynSym(Symbol *dynref); | | SYMTAB_EXPORT bool addDynSym(Symbol *dynref); | |
| SYMTAB_EXPORT unsigned long getRelType() const; | | SYMTAB_EXPORT unsigned long getRelType() const; | |
| | | | |
| SYMTAB_EXPORT void setTargetAddr(const Offset); | | SYMTAB_EXPORT void setTargetAddr(const Offset); | |
| SYMTAB_EXPORT void setRelAddr(const Offset); | | SYMTAB_EXPORT void setRelAddr(const Offset); | |
| SYMTAB_EXPORT void setAddend(const Offset); | | SYMTAB_EXPORT void setAddend(const Offset); | |
| SYMTAB_EXPORT void setRegionType(const Region::RegionType); | | SYMTAB_EXPORT void setRegionType(const Region::RegionType); | |
| SYMTAB_EXPORT void setName(const std::string &newName); | | SYMTAB_EXPORT void setName(const std::string &newName); | |
|
| | | SYMTAB_EXPORT void setRelType(unsigned long relType) { relType_ = rel
Type; } | |
| | | | |
| // dump output. Currently setup as a debugging aid, not really | | // dump output. Currently setup as a debugging aid, not really | |
| // for object persistance.... | | // for object persistance.... | |
| //SYMTAB_EXPORT std::ostream & operator<<(std::ostream &s) const; | | //SYMTAB_EXPORT std::ostream & operator<<(std::ostream &s) const; | |
| friend SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const
relocationEntry &q); | | friend SYMTAB_EXPORT std::ostream &operator<<(std::ostream &os, const
relocationEntry &q); | |
| | | | |
| enum {pltrel = 1, dynrel = 2} relocationType; | | enum {pltrel = 1, dynrel = 2} relocationType; | |
| SYMTAB_EXPORT bool operator==(const relocationEntry &) const; | | SYMTAB_EXPORT bool operator==(const relocationEntry &) const; | |
| | | | |
| // Architecture-specific functions | | // Architecture-specific functions | |
|
| SYMTAB_EXPORT static unsigned long getGlobalRelType(unsigned addressW
idth); | | SYMTAB_EXPORT static unsigned long getGlobalRelType(unsigned addressW
idth, Symbol *sym = NULL); | |
| static const char *relType2Str(unsigned long r, unsigned addressWidth
= sizeof(Address)); | | static const char *relType2Str(unsigned long r, unsigned addressWidth
= sizeof(Address)); | |
| | | | |
| private: | | private: | |
| Offset target_addr_; // target address of call instruction | | Offset target_addr_; // target address of call instruction | |
| Offset rel_addr_; // address of corresponding relocati
on entry | | Offset rel_addr_; // address of corresponding relocati
on entry | |
| Offset addend_; // addend (from RELA entries) | | Offset addend_; // addend (from RELA entries) | |
| Region::RegionType rtype_; // RT_REL vs. RT_RELA | | Region::RegionType rtype_; // RT_REL vs. RT_RELA | |
| std::string name_; | | std::string name_; | |
| Symbol *dynref_; | | Symbol *dynref_; | |
| unsigned long relType_; | | unsigned long relType_; | |
|
| | | Offset rel_struct_addr_; | |
| }; | | }; | |
| | | | |
| #if 1 | | #if 1 | |
| #if 1 | | #if 1 | |
| SYMTAB_EXPORT SerializerBase *nonpublic_make_bin_symtab_serializer(Symtab *
t, std::string file); | | SYMTAB_EXPORT SerializerBase *nonpublic_make_bin_symtab_serializer(Symtab *
t, std::string file); | |
| SYMTAB_EXPORT SerializerBase *nonpublic_make_bin_symtab_deserializer(Symtab
*t, std::string file); | | SYMTAB_EXPORT SerializerBase *nonpublic_make_bin_symtab_deserializer(Symtab
*t, std::string file); | |
| SYMTAB_EXPORT void nonpublic_free_bin_symtab_serializer(SerializerBase *sb)
; | | SYMTAB_EXPORT void nonpublic_free_bin_symtab_serializer(SerializerBase *sb)
; | |
| #else | | #else | |
| | | | |
| template <class T> | | template <class T> | |
| | | | |
End of changes. 11 change blocks. |
| 28 lines changed or deleted | | 19 lines changed or added | |
|