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

📄 debug.h

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

/* During debug_write, a linked list of these structures is used to
   keep track of ID numbers that have been assigned to classes.  */

struct debug_class_id
{
  /* Next ID number.  */
  struct debug_class_id *next;
  /* The type with the ID.  */
  struct debug_type *type;
  /* The tag; NULL if no tag.  */
  const char *tag;
};


struct string_hash_entry
{
  struct bfd_hash_entry entry;
  const char *name;
  symvalue address;
};

/* Exported functions.  */

/* The first argument to most of these functions is a handle.  This
   handle is returned by the debug_init function.  The purpose of the
   handle is to permit the debugging routines to not use static
   variables, and hence to be reentrant.  This would be useful for a
   program which wanted to handle two executables simultaneously.  */

/* Return a debugging handle.  */

extern PTR debug_init PARAMS ((void));

/* Set the source filename.  This implicitly starts a new compilation
   unit.  */

extern bfd_boolean debug_set_filename PARAMS ((PTR, const char *));

/* Change source files to the given file name.  This is used for
   include files in a single compilation unit.  */

extern bfd_boolean debug_start_source PARAMS ((PTR, const char *));

/* Record a function definition.  This implicitly starts a function
   block.  The debug_type argument is the type of the return value.
   The bfd_boolean indicates whether the function is globally visible.
   The bfd_vma is the address of the start of the function.  Currently
   the parameter types are specified by calls to
   debug_record_parameter.  */

extern bfd_boolean debug_record_function
  PARAMS ((PTR, const char *, struct debug_type*, bfd_boolean, bfd_vma));

/* Record a parameter for the current function.  */

extern bfd_boolean debug_record_parameter
  PARAMS ((PTR, const char *, struct debug_type*, enum debug_parm_kind, bfd_vma));

/* End a function definition.  The argument is the address where the
   function ends.  */

extern bfd_boolean debug_end_function PARAMS ((PTR, bfd_vma));

/* Start a block in a function.  All local information will be
   recorded in this block, until the matching call to debug_end_block.
   debug_start_block and debug_end_block may be nested.  The argument
   is the address at which this block starts.  */

extern bfd_boolean debug_start_block PARAMS ((PTR, bfd_vma));

/* Finish a block in a function.  This matches the call to
   debug_start_block.  The argument is the address at which this block
   ends.  */

extern bfd_boolean debug_end_block PARAMS ((PTR, bfd_vma));

/* Associate a line number in the current source file with a given
   address.  */

extern bfd_boolean debug_record_line PARAMS ((PTR, unsigned long, bfd_vma));

/* Start a named common block.  This is a block of variables that may
   move in memory.  */

extern bfd_boolean debug_start_common_block PARAMS ((PTR, const char *));

/* End a named common block.  */

extern bfd_boolean debug_end_common_block PARAMS ((PTR, const char *));

/* Record a named integer constant.  */

extern bfd_boolean debug_record_int_const PARAMS ((PTR, const char *, bfd_vma));

/* Record a named floating point constant.  */

extern bfd_boolean debug_record_float_const PARAMS ((PTR, const char *, double));

/* Record a typed constant with an integral value.  */

extern bfd_boolean debug_record_typed_const
  PARAMS ((PTR, const char *, struct debug_type*, bfd_vma));

/* Record a label.  */

extern bfd_boolean debug_record_label
  PARAMS ((PTR, const char *, struct debug_type*, bfd_vma));

/* Record a variable.  */

extern bfd_boolean debug_record_variable
  PARAMS ((PTR, const char *, struct debug_type*, enum debug_var_kind, bfd_vma));

/* Make an indirect type.  The first argument is a pointer to the
   location where the real type will be placed.  The second argument
   is the type tag, if there is one; this may be NULL; the only
   purpose of this argument is so that debug_get_type_name can return
   something useful.  This function may be used when a type is
   referenced before it is defined.  */

extern struct debug_type* debug_make_indirect_type
  PARAMS ((PTR, struct debug_type **, const char *));

/* Make a void type.  */

extern struct debug_type* debug_make_void_type PARAMS ((PTR));

/* Make an integer type of a given size.  The bfd_boolean argument is true
   if the integer is unsigned.  */

extern struct debug_type* debug_make_int_type PARAMS ((PTR, unsigned int, bfd_boolean));

/* Make a floating point type of a given size.  FIXME: On some
   platforms, like an Alpha, you probably need to be able to specify
   the format.  */

extern struct debug_type* debug_make_float_type PARAMS ((PTR, unsigned int));

/* Make a bfd_boolean type of a given size.  */

extern struct debug_type* debug_make_bool_type PARAMS ((PTR, unsigned int));

/* Make a complex type of a given size.  */

extern struct debug_type* debug_make_complex_type PARAMS ((PTR, unsigned int));

/* Make a structure type.  The second argument is true for a struct,
   false for a union.  The third argument is the size of the struct.
   The fourth argument is a NULL terminated array of fields.  */

extern struct debug_type* debug_make_struct_type
  PARAMS ((PTR, bfd_boolean, bfd_vma, struct debug_field **));

/* Make an object type.  The first three arguments after the handle
   are the same as for debug_make_struct_type.  The next arguments are
   a NULL terminated array of base classes, a NULL terminated array of
   methods, the type of the object holding the virtual function table
   if it is not this object, and a bfd_boolean which is true if this
   object has its own virtual function table.  */

extern struct debug_type* debug_make_object_type
  PARAMS ((PTR, bfd_boolean, bfd_vma, struct debug_field **, struct debug_baseclass **,
	   struct debug_method **, struct debug_type*, bfd_boolean));

/* Make an enumeration type.  The arguments are a null terminated
   array of strings, and an array of corresponding values.  */

extern struct debug_type* debug_make_enum_type
  PARAMS ((PTR, const char **, bfd_signed_vma *));

/* Make a pointer to a given type.  */

extern struct debug_type* debug_make_pointer_type
  PARAMS ((PTR, struct debug_type*));

/* Make a function type.  The second argument is the return type.  The
   third argument is a NULL terminated array of argument types.  The
   fourth argument is true if the function takes a variable number of
   arguments.  If the third argument is NULL, then the argument types
   are unknown.  */

extern struct debug_type* debug_make_function_type
  PARAMS ((PTR, struct debug_type*, struct debug_type* *, bfd_boolean));

/* Make a reference to a given type.  */

extern struct debug_type* debug_make_reference_type PARAMS ((PTR, struct debug_type*));

/* Make a range of a given type from a lower to an upper bound.  */

extern struct debug_type* debug_make_range_type
  PARAMS ((PTR, struct debug_type*, bfd_signed_vma, bfd_signed_vma));

/* Make an array type.  The second argument is the type of an element
   of the array.  The third argument is the type of a range of the
   array.  The fourth and fifth argument are the lower and upper
   bounds, respectively (if the bounds are not known, lower should be
   0 and upper should be -1).  The sixth argument is true if this
   array is actually a string, as in C.  */

extern struct debug_type* debug_make_array_type
  PARAMS ((PTR, struct debug_type*, struct debug_type*, bfd_signed_vma, bfd_signed_vma,
	   bfd_boolean));

/* Make a set of a given type.  For example, a Pascal set type.  The
   bfd_boolean argument is true if this set is actually a bitstring, as in
   CHILL.  */

extern struct debug_type* debug_make_set_type PARAMS ((PTR, struct debug_type*, bfd_boolean));

/* Make a type for a pointer which is relative to an object.  The
   second argument is the type of the object to which the pointer is
   relative.  The third argument is the type that the pointer points
   to.  */

extern struct debug_type* debug_make_offset_type
  PARAMS ((PTR, struct debug_type*, struct debug_type*));

/* Make a type for a method function.  The second argument is the
   return type.  The third argument is the domain.  The fourth
   argument is a NULL terminated array of argument types.  The fifth
   argument is true if the function takes a variable number of
   arguments, in which case the array of argument types indicates the
   types of the first arguments.  The domain and the argument array
   may be NULL, in which case this is a stub method and that
   information is not available.  Stabs debugging uses this, and gets
   the argument types from the mangled name.  */

extern struct debug_type* debug_make_method_type
  PARAMS ((PTR, struct debug_type*, struct debug_type*, struct debug_type* *, bfd_boolean));

/* Make a const qualified version of a given type.  */

extern struct debug_type* debug_make_const_type PARAMS ((PTR, struct debug_type*));

/* Make a volatile qualified version of a given type.  */

extern struct debug_type* debug_make_volatile_type PARAMS ((PTR, struct debug_type*));

/* Make an undefined tagged type.  For example, a struct which has
   been mentioned, but not defined.  */

extern struct debug_type* debug_make_undefined_tagged_type
  PARAMS ((PTR, const char *, enum debug_type_kind));

/* Make a base class for an object.  The second argument is the base
   class type.  The third argument is the bit position of this base
   class in the object.  The fourth argument is whether this is a
   virtual class.  The fifth argument is the visibility of the base
   class.  */

extern struct debug_baseclass* debug_make_baseclass
  PARAMS ((PTR, struct debug_type*, bfd_vma, bfd_boolean, enum debug_visibility));

/* Make a field for a struct.  The second argument is the name.  The
   third argument is the type of the field.  The fourth argument is
   the bit position of the field.  The fifth argument is the size of
   the field (it may be zero).  The sixth argument is the visibility
   of the field.  */

extern struct debug_field* debug_make_field
  PARAMS ((PTR, const char *, struct debug_type*, bfd_vma, bfd_vma,
	   enum debug_visibility));

/* Make a static member of an object.  The second argument is the
   name.  The third argument is the type of the member.  The fourth
   argument is the physical name of the member (i.e., the name as a
   global variable).  The fifth argument is the visibility of the
   member.  */

extern struct debug_field* debug_make_static_member
  PARAMS ((PTR, const char *, struct debug_type*, const char *,
	   enum debug_visibility));

/* Make a method.  The second argument is the name, and the third
   argument is a NULL terminated array of method variants.  Each
   method variant is a method with this name but with different
   argument types.  */

extern struct debug_method* debug_make_method
  PARAMS ((PTR, const char *, struct debug_method_variant **));

/* Make a method variant.  The second argument is the physical name of
   the function.  The third argument is the type of the function,
   probably constructed by debug_make_method_type.  The fourth
   argument is the visibility.  The fifth argument is whether this is
   a const function.  The sixth argument is whether this is a volatile
   function.  The seventh argument is the index in the virtual
   function table, if any.  The eighth argument is the virtual
   function context.  */

extern struct debug_method_variant* debug_make_method_variant
  PARAMS ((PTR, const char *, struct debug_type*, enum debug_visibility, bfd_boolean,
	   bfd_boolean, bfd_vma, bfd_vma, struct debug_type*));

/* Make a static method argument.  The arguments are the same as for
   debug_make_method_variant, except that the last two are omitted
   since a static method can not also be virtual.  */

extern struct debug_method_variant* debug_make_static_method_variant
  PARAMS ((PTR, const char *, struct debug_type*, enum debug_visibility, bfd_boolean,
	   bfd_boolean, bfd_vma));

/* Name a type.  This returns a new type with an attached name.  */

extern struct debug_type* debug_name_type PARAMS ((PTR, const char *, struct debug_type*));

/* Give a tag to a type, such as a struct or union.  This returns a
   new type with an attached tag.  */

extern struct debug_type* debug_tag_type PARAMS ((PTR, const char *, struct debug_type*));

/* Record the size of a given type.  */

extern bfd_boolean debug_record_type_size PARAMS ((PTR, struct debug_type*, unsigned int));

/* Find a named type.  */

extern struct debug_type* debug_find_named_type PARAMS ((PTR, const char *));

/* Find a tagged type.  */

extern struct debug_type* debug_find_tagged_type
  PARAMS ((PTR, const char *, enum debug_type_kind));

/* Get the kind of a type.  */

extern enum debug_type_kind debug_get_type_kind PARAMS ((PTR, struct debug_type*));

/* Get the name of a type.  */

extern const char *debug_get_type_name PARAMS ((PTR, struct debug_type*));

/* Get the size of a type.  */

extern bfd_vma debug_get_type_size PARAMS ((PTR, struct debug_type*));

/* Get the return type of a function or method type.  */

extern struct debug_type* debug_get_return_type PARAMS ((PTR, struct debug_type*));

/* Get the NULL terminated array of parameter types for a function or
   method type (actually, parameter types are not currently stored for
   function types).  This may be used to determine whether a method
   type is a stub method or not.  The last argument points to a
   bfd_boolean which is set to true if the function takes a variable
   number of arguments.  */

extern struct debug_type* const* debug_get_parameter_types PARAMS ((PTR,
							    struct debug_type*,
							    bfd_boolean *));

/* Get the target type of a pointer or reference or const or volatile
   type.  */

extern struct debug_type* debug_get_target_type PARAMS ((PTR, struct debug_type*));

/* Get the NULL terminated array of fields for a struct, union, or
   class.  */

extern struct debug_field* const* debug_get_fields PARAMS ((PTR, struct debug_type*));

/* Get the type of a field.  */

extern struct debug_type* debug_get_field_type PARAMS ((PTR, struct debug_field*));

/* Get the name of a field.  */

extern const char *debug_get_field_name PARAMS ((PTR, struct debug_field*));

/* Get the bit position of a field within the containing structure.
   If the field is a static member, this will return (bfd_vma) -1.  */

extern bfd_vma debug_get_field_bitpos PARAMS ((PTR, struct debug_field*));

/* Get the bit size of a field.  If the field is a static member, this
   will return (bfd_vma) -1.  */

extern bfd_vma debug_get_field_bitsize PARAMS ((PTR, struct debug_field*));

/* Get the visibility of a field.  */

extern enum debug_visibility debug_get_field_visibility
  PARAMS ((PTR, struct debug_field*));

/* Get the physical name of a field, if it is a static member.  If the
   field is not a static member, this will return NULL.  */

extern const char *debug_get_field_physname PARAMS ((PTR, struct debug_field*));

/* Write out the recorded debugging information.  This takes a set of
   function pointers which are called to do the actual writing.  The
   first PTR is the debugging handle.  The second PTR is a handle
   which is passed to the functions.  */

extern bfd_boolean debug_write PARAMS ((PTR, const struct debug_write_fns *, PTR));

/* During debug_get_real_type, a linked list of these structures is
   kept on the stack to avoid infinite recursion.  */

struct debug_type_real_list
{
  /* Next type on list.  */
  struct debug_type_real_list *next;
  /* The type we are checking.  */
  struct debug_type *t;
};

extern struct debug_type *debug_get_real_type
PARAMS ((PTR, struct debug_type*, struct debug_type_real_list *));

extern struct debug_type **debug_get_all_classes PARAMS ((PTR));

extern struct bfd_hash_entry *string_hash_newfunc
  PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
#endif /* DEBUG_H */

⌨️ 快捷键说明

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