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

📄 value.h

📁 早期freebsd实现
💻 H
📖 第 1 页 / 共 2 页
字号:
/* Definitions for values of C expressions, for GDB.   Copyright 1986, 1987, 1989, 1992 Free Software Foundation, Inc.This file is part of GDB.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */#if !defined (VALUE_H)#define VALUE_H 1/* * The structure which defines the type of a value.  It should never * be possible for a program lval value to survive over a call to the inferior * (ie to be put into the history list or an internal variable). */enum lval_type {  /* Not an lval.  */  not_lval,  /* In memory.  Could be a saved register.  */  lval_memory,  /* In a register.  */  lval_register,  /* In a gdb internal variable.  */  lval_internalvar,  /* Part of a gdb internal variable (structure field).  */  lval_internalvar_component,  /* In a register series in a frame not the current one, which may have been     partially saved or saved in different places (otherwise would be     lval_register or lval_memory).  */  lval_reg_frame_relative};struct value  {    /* Type of value; either not an lval, or one of the various       different possible kinds of lval.  */    enum lval_type lval;    /* Location of value (if lval).  */    union      {	/* Address in inferior or byte of registers structure.  */	CORE_ADDR address;	/* Pointer to internal variable.  */	struct internalvar *internalvar;	/* Number of register.  Only used with	   lval_reg_frame_relative.  */	int regnum;      } location;    /* Describes offset of a value within lval a structure in bytes.  */    int offset;	    /* Only used for bitfields; number of bits contained in them.  */    int bitsize;    /* Only used for bitfields; position of start of field.       For BITS_BIG_ENDIAN=0 targets, it is the position of the LSB.       For BITS_BIG_ENDIAN=1 targets, it is the position of the MSB. */    int bitpos;    /* Frame value is relative to.  In practice, this address is only       used if the value is stored in several registers in other than       the current frame, and these registers have not all been saved       at the same place in memory.  This will be described in the       lval enum above as "lval_reg_frame_relative".  */    CORE_ADDR frame_addr;    /* Type of the value.  */    struct type *type;    /* Values are stored in a chain, so that they can be deleted       easily over calls to the inferior.  Values assigned to internal       variables or put into the value history are taken off this       list.  */    struct value *next;    /* If an lval is forced to repeat, a new value is created with       these fields set.  The new value is not an lval.  */    short repeated;    short repetitions;    /* Register number if the value is from a register.  Is not kept       if you take a field of a structure that is stored in a       register.  Shouldn't it be?  */    short regno;    /* If zero, contents of this value are in the contents field.       If nonzero, contents are in inferior memory at address       in the location.address field plus the offset field       (and the lval field should be lval_memory).  */    char lazy;    /* If nonzero, this is the value of a variable which does not       actually exist in the program.  */    char optimized_out;    /* Actual contents of the value.  For use of this value; setting       it uses the stuff above.  Not valid if lazy is nonzero.       Target byte-order.  We force it to be aligned properly for any       possible value.  */    union {      long contents[1];      double force_double_align;#ifdef LONG_LONG      long long force_longlong_align;#endif    } aligner;  };typedef struct value *value;#define VALUE_TYPE(val) (val)->type#define VALUE_LAZY(val) (val)->lazy/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of   the gdb buffer used to hold a copy of the contents of the lval.     VALUE_CONTENTS is used when the contents of the buffer are needed --   it uses value_fetch_lazy() to load the buffer from the process being    debugged if it hasn't already been loaded.  VALUE_CONTENTS_RAW is    used when data is being stored into the buffer, or when it is    certain that the contents of the buffer are valid.  */#define VALUE_CONTENTS_RAW(val) ((char *) (val)->aligner.contents)#define VALUE_CONTENTS(val) ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)),\			     VALUE_CONTENTS_RAW(val))extern intvalue_fetch_lazy PARAMS ((value val));#define VALUE_LVAL(val) (val)->lval#define VALUE_ADDRESS(val) (val)->location.address#define VALUE_INTERNALVAR(val) (val)->location.internalvar#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)#define VALUE_FRAME(val) ((val)->frame_addr)#define VALUE_OFFSET(val) (val)->offset#define VALUE_BITSIZE(val) (val)->bitsize#define VALUE_BITPOS(val) (val)->bitpos#define VALUE_NEXT(val) (val)->next#define VALUE_REPEATED(val) (val)->repeated#define VALUE_REPETITIONS(val) (val)->repetitions#define VALUE_REGNO(val) (val)->regno#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)/* Convert a REF to the object referenced. */#define COERCE_REF(arg)    \{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF)			\    arg = value_at_lazy (TYPE_TARGET_TYPE (VALUE_TYPE (arg)),		\			 unpack_long (VALUE_TYPE (arg),			\				      VALUE_CONTENTS (arg)));}/* If ARG is an array, convert it to a pointer.   If ARG is an enum, convert it to an integer.   If ARG is a function, convert it to a function pointer.   References are dereferenced.  */#define COERCE_ARRAY(arg)    \{ COERCE_REF(arg);							\  if (VALUE_REPEATED (arg)						\      || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)		\    arg = value_coerce_array (arg);					\  if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC)                   \    arg = value_coerce_function (arg);                                  \  if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM)			\    arg = value_cast (builtin_type_unsigned_int, arg);			\}/* If ARG is an enum, convert it to an integer.  */#define COERCE_ENUM(arg)    \{ if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_REF)			\    arg = value_ind (arg);						\  if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ENUM)			\    arg = value_cast (builtin_type_unsigned_int, arg);			\}/* Internal variables (variables for convenience of use of debugger)   are recorded as a chain of these structures.  */struct internalvar{  struct internalvar *next;  char *name;  value value;};/* Pointer to member function.  Depends on compiler implementation. */#define METHOD_PTR_IS_VIRTUAL(ADDR)  ((ADDR) & 0x80000000)#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))#include "symtab.h"#include "gdbtypes.h"#include "expression.h"#ifdef __STDC__struct frame_info;#endifextern voidprint_address_demangle PARAMS ((CORE_ADDR, FILE *, int));extern LONGESTvalue_as_long PARAMS ((value val));extern doublevalue_as_double PARAMS ((value val));extern CORE_ADDRvalue_as_pointer PARAMS ((value val));extern LONGESTunpack_long PARAMS ((struct type *type, char *valaddr));extern doubleunpack_double PARAMS ((struct type *type, char *valaddr, int *invp));extern CORE_ADDRunpack_pointer PARAMS ((struct type *type, char *valaddr));extern LONGESTunpack_field_as_long PARAMS ((struct type *type, char *valaddr,			      int fieldno));extern valuevalue_from_longest PARAMS ((struct type *type, LONGEST num));extern valuevalue_from_double PARAMS ((struct type *type, double num));extern valuevalue_at PARAMS ((struct type *type, CORE_ADDR addr));extern valuevalue_at_lazy PARAMS ((struct type *type, CORE_ADDR addr));/* FIXME:  Assumes equivalence of "struct frame_info *" and "FRAME" */extern valuevalue_from_register PARAMS ((struct type *type, int regnum,			     struct frame_info * frame));extern valuevalue_of_variable PARAMS ((struct symbol *var));extern valuevalue_of_register PARAMS ((int regnum));/* FIXME:  Assumes equivalence of "struct frame_info *" and "FRAME" */extern valueread_var_value PARAMS ((struct symbol *var, struct frame_info *frame));/* FIXME:  Assumes equivalence of "struct frame_info *" and "FRAME" */extern valuelocate_var_value PARAMS ((struct symbol *var, struct frame_info *frame));extern valueallocate_value PARAMS ((struct type *type));extern valueallocate_repeat_value PARAMS ((struct type *type, int count));extern valuevalue_mark PARAMS ((void));extern voidvalue_free_to_mark PARAMS ((value mark));

⌨️ 快捷键说明

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