value.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. /* Definitions for values of C expressions, for GDB.
  2. Copyright (C) 1986, 1987 Free Software Foundation, Inc.
  3. GDB is distributed in the hope that it will be useful, but WITHOUT ANY
  4. WARRANTY. No author or distributor accepts responsibility to anyone
  5. for the consequences of using it or for whether it serves any
  6. particular purpose or works at all, unless he says so in writing.
  7. Refer to the GDB General Public License for full details.
  8. Everyone is granted permission to copy, modify and redistribute GDB,
  9. but only under the conditions described in the GDB General Public
  10. License. A copy of this license is supposed to have been given to you
  11. along with GDB so you can know your rights and responsibilities. It
  12. should be in a file named COPYING. Among other things, the copyright
  13. notice and this notice must be preserved on all copies.
  14. In other words, go ahead and share GDB, but don't try to stop
  15. anyone else from sharing it farther. Help stamp out software hoarding!
  16. */
  17. enum lval_type { not_lval, lval_memory, lval_register, lval_internalvar,
  18. lval_internalvar_component };
  19. struct value
  20. {
  21. enum lval_type lval;
  22. union
  23. {
  24. CORE_ADDR address;
  25. struct internalvar *internalvar;
  26. } location;
  27. int offset;
  28. int bitsize;
  29. int bitpos;
  30. struct type *type;
  31. struct value *next;
  32. short repeated;
  33. short repetitions;
  34. short regno;
  35. char contents[1];
  36. };
  37. typedef struct value *value;
  38. #define VALUE_TYPE(val) (val)->type
  39. #define VALUE_CONTENTS(val) (val)->contents
  40. #define VALUE_LVAL(val) (val)->lval
  41. #define VALUE_ADDRESS(val) (val)->location.address
  42. #define VALUE_INTERNALVAR(val) (val)->location.internalvar
  43. #define VALUE_OFFSET(val) (val)->offset
  44. #define VALUE_BITSIZE(val) (val)->bitsize
  45. #define VALUE_BITPOS(val) (val)->bitpos
  46. #define VALUE_NEXT(val) (val)->next
  47. #define VALUE_REPEATED(val) (val)->repeated
  48. #define VALUE_REPETITIONS(val) (val)->repetitions
  49. #define VALUE_REGNO(val) (val)->regno
  50. #define COERCE_ARRAY(arg) \
  51. if (VALUE_REPEATED (arg) || TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)\
  52. arg = value_coerce_array (arg);
  53. /* Internal variables (variables for convenience of use of debugger)
  54. are recorded as a chain of these structures. */
  55. struct internalvar
  56. {
  57. struct internalvar *next;
  58. char *name;
  59. value value;
  60. };
  61. long value_as_long ();
  62. double value_as_double ();
  63. long unpack_long ();
  64. double unpack_double ();
  65. long unpack_field_as_long ();
  66. value value_from_long ();
  67. value value_from_double ();
  68. value value_at ();
  69. value value_of_variable ();
  70. value value_of_register ();
  71. value read_var_value ();
  72. value locate_var_value ();
  73. value allocate_value ();
  74. value allocate_repeat_value ();
  75. value value_string ();
  76. value value_binop ();
  77. value value_add ();
  78. value value_sub ();
  79. value value_coerce_array ();
  80. value value_ind ();
  81. value value_addr ();
  82. value value_assign ();
  83. value value_neg ();
  84. value value_lognot ();
  85. value value_struct_elt ();
  86. value value_field ();
  87. value value_cast ();
  88. value value_repeat ();
  89. value value_subscript ();
  90. value call_function ();
  91. value value_being_returned ();
  92. value evaluate_expression ();
  93. value evaluate_type ();
  94. value parse_and_eval ();
  95. value access_value_history ();
  96. value value_of_internalvar ();
  97. struct internalvar *lookup_internalvar ();
  98. int value_equal ();
  99. int value_less ();
  100. int value_zerop ();