Skip to content

Commit

Permalink
Add dyninstAPI/Widget.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 24367c5 commit 7edcb48
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 6 deletions.
29 changes: 29 additions & 0 deletions docs/dyninstAPI/developer/Relocation/Widgets/Widget.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,32 @@ Widget.h
########

.. cpp:namespace:: Dyninst::Relocation

.. cpp:class:: Widget

Widget code generation class

.. cpp:type:: boost::shared_ptr<Widget> Ptr
.. cpp:type:: boost::shared_ptr<RelocBlock> RelocBlockPtr
.. cpp:function:: Widget()
.. cpp:function:: virtual Address addr() const

A default value to make sure things don't go wonky.

.. cpp:function:: virtual unsigned size() const
.. cpp:function:: virtual InstructionAPI::Instruction insn() const
.. cpp:function:: virtual bool generate(const codeGen &templ, const RelocBlock *trace, CodeBuffer &buffer) = 0

Make binary from the thing Current address (if we need it) is in the codeGen object.

.. cpp:function:: virtual std::string format() const = 0
.. cpp:function:: virtual ~Widget()


.. cpp:struct:: Patch

A generic code patching mechanism

.. cpp:function:: virtual bool apply(codeGen &gen, CodeBuffer *buf) = 0
.. cpp:function:: virtual unsigned estimate(codeGen &templ) = 0
.. cpp:function:: virtual ~Patch()
6 changes: 0 additions & 6 deletions dyninstAPI/src/Relocation/Widgets/Widget.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ class TrackerElement;
class CodeTracker;
class CodeBuffer;

// Widget code generation class
class Widget {
friend class Transformer;
public:
Expand All @@ -63,16 +62,12 @@ class Widget {

Widget() {}

// A default value to make sure things don't go wonky.
virtual Address addr() const { return 0; }
virtual unsigned size() const { return 0; }
virtual InstructionAPI::Instruction insn() const {
return InstructionAPI::Instruction();
}

// Make binary from the thing
// Current address (if we need it)
// is in the codeGen object.
virtual bool generate(const codeGen &templ,
const RelocBlock *trace,
CodeBuffer &buffer) = 0;
Expand All @@ -82,7 +77,6 @@ class Widget {
virtual ~Widget() {}
};

// A generic code patching mechanism
struct Patch {
virtual bool apply(codeGen &gen, CodeBuffer *buf) = 0;
virtual unsigned estimate(codeGen &templ) = 0;
Expand Down

0 comments on commit 7edcb48

Please sign in to comment.