⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 debug.h

📁 java 反射机制详解示例,实现类属性及方法修改
💻 H
📖 第 1 页 / 共 3 页
字号:

/* A type.  */

struct debug_type
{
  /* Kind of type.  */
  enum debug_type_kind kind;
  /* Size of type (0 if not known).  */
  unsigned int size;
  /* Type which is a pointer to this type.  */
  struct debug_type* pointer;
  /* Tagged union with additional information about the type.  */
  union
    {
      /* DEBUG_KIND_INDIRECT.  */
      struct debug_indirect_type *kindirect;
      /* DEBUG_KIND_INT.  */
      /* Whether the integer is unsigned.  */
      bfd_boolean kint;
      /* DEBUG_KIND_STRUCT, DEBUG_KIND_UNION, DEBUG_KIND_CLASS,
         DEBUG_KIND_UNION_CLASS.  */
      struct debug_class_type *kclass;
      /* DEBUG_KIND_ENUM.  */
      struct debug_enum_type *kenum;
      /* DEBUG_KIND_POINTER.  */
      struct debug_type *kpointer;
      /* DEBUG_KIND_FUNCTION.  */
      struct debug_function_type *kfunction;
      /* DEBUG_KIND_REFERENCE.  */
      struct debug_type *kreference;
      /* DEBUG_KIND_RANGE.  */
      struct debug_range_type *krange;
      /* DEBUG_KIND_ARRAY.  */
      struct debug_array_type *karray;
      /* DEBUG_KIND_SET.  */
      struct debug_set_type *kset;
      /* DEBUG_KIND_OFFSET.  */
      struct debug_offset_type *koffset;
      /* DEBUG_KIND_METHOD.  */
      struct debug_method_type *kmethod;
      /* DEBUG_KIND_CONST.  */
      struct debug_type *kconst;
      /* DEBUG_KIND_VOLATILE.  */
      struct debug_type *kvolatile;
      /* DEBUG_KIND_NAMED, DEBUG_KIND_TAGGED.  */
      struct debug_named_type *knamed;
    } u;
};

/* Information kept for an indirect type.  */

struct debug_indirect_type
{
  /* Slot where the final type will appear.  */
  struct debug_type **slot;
  /* Tag.  */
  const char *tag;
};

/* Information kept for a struct, union, or class.  */

struct debug_class_type
{
  /* NULL terminated array of fields.  */
  struct debug_field **fields;
  /* A mark field which indicates whether the struct has already been
     printed.  */
  unsigned int mark;
  /* This is used to uniquely identify unnamed structs when printing.  */
  unsigned int id;
  /* The remaining fields are only used for DEBUG_KIND_CLASS and
     DEBUG_KIND_UNION_CLASS.  */
  /* NULL terminated array of base classes.  */
  struct debug_baseclass **baseclasses;
  /* NULL terminated array of methods.  */
  struct debug_method **methods;
  /* The type of the class providing the virtual function table for
     this class.  This may point to the type itself.  */
  struct debug_type* vptrbase;
};

/* Information kept for an enum.  */

struct debug_enum_type
{
  /* NULL terminated array of names.  */
  const char **names;
  /* Array of corresponding values.  */
  bfd_signed_vma *values;
};

/* Information kept for a function.  FIXME: We should be able to
   record the parameter types.  */

struct debug_function_type
{
  /* Return type.  */
  struct debug_type* return_type;
  /* NULL terminated array of argument types.  */
  struct debug_type **arg_types;
  /* Whether the function takes a variable number of arguments.  */
  bfd_boolean varargs;
};

/* Information kept for a range.  */

struct debug_range_type
{
  /* Range base type.  */
  struct debug_type* type;
  /* Lower bound.  */
  bfd_signed_vma lower;
  /* Upper bound.  */
  bfd_signed_vma upper;
};

/* Information kept for an array.  */

struct debug_array_type
{
  /* Element type.  */
  struct debug_type* element_type;
  /* Range type.  */
  struct debug_type* range_type;
  /* Lower bound.  */
  bfd_signed_vma lower;
  /* Upper bound.  */
  bfd_signed_vma upper;
  /* Whether this array is really a string.  */
  bfd_boolean stringp;
};

/* Information kept for a set.  */

struct debug_set_type
{
  /* Base type.  */
  struct debug_type* type;
  /* Whether this set is really a bitstring.  */
  bfd_boolean bitstringp;
};

/* Information kept for an offset type (a based pointer).  */

struct debug_offset_type
{
  /* The type the pointer is an offset from.  */
  struct debug_type* base_type;
  /* The type the pointer points to.  */
  struct debug_type* target_type;
};

/* Information kept for a method type.  */

struct debug_method_type
{
  /* The return type.  */
  struct debug_type* return_type;
  /* The object type which this method is for.  */
  struct debug_type* domain_type;
  /* A NULL terminated array of argument types.  */
  struct debug_type **arg_types;
  /* Whether the method takes a variable number of arguments.  */
  bfd_boolean varargs;
};

/* Information kept for a named type.  */

struct debug_named_type
{
  /* Name.  */
  struct debug_name *name;
  /* Real type.  */
  struct debug_type* type;
};

/* A field in a struct or union.  */

struct debug_field
{
  /* Name of the field.  */
  const char *name;
  /* Type of the field.  */
  struct debug_type *type;
  /* Visibility of the field.  */
  enum debug_visibility visibility;
  /* Whether this is a static member.  */
  bfd_boolean static_member;
  union
    {
      /* If static_member is false.  */
      struct
	{
	  /* Bit position of the field in the struct.  */
	  unsigned int bitpos;
	  /* Size of the field in bits.  */
	  unsigned int bitsize;
	} f;
      /* If static_member is true.  */
      struct
	{
	  const char *physname;
	} s;
    } u;
};

/* A base class for an object.  */

struct debug_baseclass
{
  /* Type of the base class.  */
  struct debug_type *type;
  /* Bit position of the base class in the object.  */
  unsigned int bitpos;
  /* Whether the base class is virtual.  */
  bfd_boolean is_virtual;
  /* Visibility of the base class.  */
  enum debug_visibility visibility;
};

/* A method of an object.  */

struct debug_method
{
  /* The name of the method.  */
  const char *name;
  /* A NULL terminated array of different types of variants.  */
  struct debug_method_variant **variants;
};

/* The variants of a method function of an object.  These indicate
   which method to run.  */

struct debug_method_variant
{
  /* The physical name of the function.  */
  const char *physname;
  /* The type of the function.  */
  struct debug_type *type;
  /* The visibility of the function.  */
  enum debug_visibility visibility;
  /* Whether the function is const.  */
  bfd_boolean constp;
  /* Whether the function is volatile.  */
  bfd_boolean volatilep;
  /* The offset to the function in the virtual function table.  */
  bfd_vma voffset;
  /* The address of method */
  bfd_vma address;
  /* If voffset is VOFFSET_STATIC_METHOD, this is a static method.  */
#define VOFFSET_STATIC_METHOD ((bfd_vma) -1)
  /* Context of a virtual method function.  */
  struct debug_type *context;
};

/* A variable.  This is the information we keep for a variable object.
   This has no name; a name is associated with a variable in a
   debug_name structure.  */

struct debug_variable
{
  /* Kind of variable.  */
  enum debug_var_kind kind;
  /* Type.  */
  struct debug_type *type;
  /* Value.  The interpretation of the value depends upon kind.  */
  bfd_vma val;
};

/* A function.  This has no name; a name is associated with a function
   in a debug_name structure.  */

struct debug_function
{
  /* Return type.  */
  struct debug_type* return_type;
  /* Parameter information.  */
  struct debug_parameter *parameters;
  /* Block information.  The first structure on the list is the main
     block of the function, and describes function local variables.  */
  struct debug_block *blocks;
};

/* A function parameter.  */

struct debug_parameter
{
  /* Next parameter.  */
  struct debug_parameter *next;
  /* Name.  */
  const char *name;
  /* Type.  */
  struct debug_type* type;
  /* Kind.  */
  enum debug_parm_kind kind;
  /* Value (meaning depends upon kind).  */
  bfd_vma val;
};

/* A typed constant.  */

struct debug_typed_constant
{
  /* Type.  */
  struct debug_type* type;
  /* Value.  FIXME: We may eventually need to support non-integral
     values.  */
  bfd_vma val;
};

/* Information about a block within a function.  */

struct debug_block
{
  /* Next block with the same parent.  */
  struct debug_block *next;
  /* Parent block.  */
  struct debug_block *parent;
  /* List of child blocks.  */
  struct debug_block *children;
  /* Start address of the block.  */
  bfd_vma start;
  /* End address of the block.  */
  bfd_vma end;
  /* Local variables.  */
  struct debug_namespace *locals;
};

/* Line number information we keep for a compilation unit.  FIXME:
   This structure is easy to create, but can be very space
   inefficient.  */

struct debug_lineno
{
  /* More line number information for this block.  */
  struct debug_lineno *next;
  /* Source file.  */
  struct debug_file *file;
  /* Line numbers, terminated by a -1 or the end of the array.  */
#define DEBUG_LINENO_COUNT 10
  unsigned long linenos[DEBUG_LINENO_COUNT];
  /* Addresses for the line numbers.  */
  bfd_vma addrs[DEBUG_LINENO_COUNT];
};

/* A namespace.  This is a mapping from names to objects.  FIXME: This
   should be implemented as a hash table.  */

struct debug_namespace
{
  /* List of items in this namespace.  */
  struct debug_name *list;
  /* Pointer to where the next item in this namespace should go.  */
  struct debug_name **tail;
};

/* Kinds of objects that appear in a namespace.  */

enum debug_object_kind
{
  /* A type.  */
  DEBUG_OBJECT_TYPE,
  /* A tagged type (really a different sort of namespace).  */
  DEBUG_OBJECT_TAG,
  /* A variable.  */
  DEBUG_OBJECT_VARIABLE,
  /* A function.  */
  DEBUG_OBJECT_FUNCTION,
  /* An integer constant.  */
  DEBUG_OBJECT_INT_CONSTANT,
  /* A floating point constant.  */
  DEBUG_OBJECT_FLOAT_CONSTANT,
  /* A typed constant.  */
  DEBUG_OBJECT_TYPED_CONSTANT
};

/* Linkage of an object that appears in a namespace.  */

enum debug_object_linkage
{
  /* Local variable.  */
  DEBUG_LINKAGE_AUTOMATIC,
  /* Static--either file static or function static, depending upon the
     namespace is.  */
  DEBUG_LINKAGE_STATIC,
  /* Global.  */
  DEBUG_LINKAGE_GLOBAL,
  /* No linkage.  */
  DEBUG_LINKAGE_NONE
};

/* A name in a namespace.  */

struct debug_name
{
  /* Next name in this namespace.  */
  struct debug_name *next;
  /* Name.  */
  const char *name;
  /* Mark.  This is used by debug_write.  */
  unsigned int mark;
  /* Kind of object.  */
  enum debug_object_kind kind;
  /* Linkage of object.  */
  enum debug_object_linkage linkage;
  /* Tagged union with additional information about the object.  */
  union
    {
      /* DEBUG_OBJECT_TYPE.  */
      struct debug_type *type;
      /* DEBUG_OBJECT_TAG.  */
      struct debug_type *tag;
      /* DEBUG_OBJECT_VARIABLE.  */
      struct debug_variable *variable;
      /* DEBUG_OBJECT_FUNCTION.  */
      struct debug_function *function;
      /* DEBUG_OBJECT_INT_CONSTANT.  */
      bfd_vma int_constant;
      /* DEBUG_OBJECT_FLOAT_CONSTANT.  */
      double float_constant;
      /* DEBUG_OBJECT_TYPED_CONSTANT.  */
      struct debug_typed_constant *typed_constant;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -