Skip to content

Commit

Permalink
Add dyninstAPI/codeRange.h
Browse files Browse the repository at this point in the history
  • Loading branch information
hainest committed Apr 3, 2024
1 parent 9a137eb commit 5e393a7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 24 deletions.
31 changes: 31 additions & 0 deletions docs/dyninstAPI/developer/codeRange.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,34 @@
codeRange.h
###########

.. cpp:class:: codeRange : public patchTarget

.. cpp:function:: virtual void *getPtrToInstruction(Dyninst::Address) const

.. cpp:function:: virtual void *get_local_ptr() const

This returns a local pointer to the "beginning" of the code range - as opposed to get_address,
which returns the "remote" address.

.. cpp:function:: func_instance *is_function()

returns NULL if not of type so some people who don't like dynamic_cast don't have to be troubled
by it's use This is actually a fake we don't have func_instances as code ranges. However, there are
many times we want to know if we're in a function, and this suffices. We actually do a basic block
lookup, then transform that into a function.

.. cpp:function:: block_instance *is_basicBlock()
.. cpp:function:: block_instance *is_basicBlockInstance()
.. cpp:function:: image *is_image()
.. cpp:function:: mapped_object *is_mapped_object()
.. cpp:function:: parse_func *is_parse_func()
.. cpp:function:: parse_block *is_parse_block()
.. cpp:function:: signal_handler_location *is_signal_handler_location()
.. cpp:function:: inferiorRPCinProgress *is_inferior_rpc()
.. cpp:function:: void print_range(Dyninst::Address addr = 0)

Prints codeRange info to stderr.

.. cpp:function:: codeRange() = default
.. cpp:function:: codeRange(const codeRange&) = default
.. cpp:function:: virtual ~codeRange() = default
24 changes: 0 additions & 24 deletions dyninstAPI/src/codeRange.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,12 @@
#ifndef _codeRangeTree_h_
#define _codeRangeTree_h_

/*******************************************************/
/* header files */
/*******************************************************/

#include <assert.h>
#include <stdlib.h>
#include <vector>
#include "dyntypes.h"
#include "dyninstAPI/src/patch.h"

/** template class for codeRangeTree. The implementation is based on red black
* tree implementation for efficiency concerns and for getting sorted
* elements easier.
* There are two template types, K (key) and V (value).
*/


class func_instance;
class block_instance;
class block_instance;
Expand All @@ -65,27 +54,15 @@ class parse_block;

class codeRange : public patchTarget {
public:
//These are now inherited from relocTarget
//virtual Dyninst::Address get_address() const = 0;
//virtual unsigned get_size() const = 0;

virtual void *getPtrToInstruction(Dyninst::Address) const { assert(0); return NULL; }

// This returns a local pointer to the "beginning" of the
// code range - as opposed to get_address, which returns
// the "remote" address.
virtual void *get_local_ptr() const {
assert(0); return NULL; }


// returns NULL if not of type
// so some people who don't like dynamic_cast don't have to be troubled
// by it's use

// This is actually a fake; we don't have func_instances as
// code ranges. However, there are many times we want to know
// if we're in a function, and this suffices. We actually do a
// basic block lookup, then transform that into a function.
func_instance *is_function();
block_instance *is_basicBlock();
block_instance *is_basicBlockInstance();
Expand All @@ -97,7 +74,6 @@ class codeRange : public patchTarget {
signal_handler_location *is_signal_handler_location();
inferiorRPCinProgress *is_inferior_rpc();

//Prints codeRange info to stderr.
void print_range(Dyninst::Address addr = 0);

codeRange() = default;
Expand Down

0 comments on commit 5e393a7

Please sign in to comment.