2 /* Low level packing and unpacking of values for GDB.
3 Copyright (C) 1986, 1987 Free Software Foundation, Inc.
5 GDB is distributed in the hope that it will be useful, but WITHOUT ANY
6 WARRANTY. No author or distributor accepts responsibility to anyone
7 for the consequences of using it or for whether it serves any
8 particular purpose or works at all, unless he says so in writing.
9 Refer to the GDB General Public License for full details.
11 Everyone is granted permission to copy, modify and redistribute GDB,
12 but only under the conditions described in the GDB General Public
13 License. A copy of this license is supposed to have been given to you
14 along with GDB so you can know your rights and responsibilities. It
15 should be in a file named COPYING. Among other things, the copyright
16 notice and this notice must be preserved on all copies.
18 In other words, go ahead and share GDB, but don't try to stop
19 anyone else from sharing it farther. Help stamp out software hoarding!
28 /* The value-history records all the values printed
29 by print commands during this session. Each chunk
30 records 60 consecutive values. The first chunk on
31 the chain records the most recent values.
32 The total number of values is in value_history_count. */
34 #define VALUE_HISTORY_CHUNK 60
36 struct value_history_chunk
38 struct value_history_chunk
*next
;
39 value values
[VALUE_HISTORY_CHUNK
];
42 /* Chain of chunks now in use. */
44 static struct value_history_chunk
*value_history_chain
;
46 static int value_history_count
; /* Abs number of last entry stored */
49 /* List of all value objects currently allocated
50 (except for those released by calls to release_value)
51 This is so they can be freed after each command. */
53 static value all_values
;
55 /* Allocate a value that has the correct length for type TYPE. */
63 val
= (value
) xmalloc (sizeof (struct value
) + TYPE_LENGTH (type
));
64 VALUE_NEXT (val
) = all_values
;
66 VALUE_TYPE (val
) = type
;
67 VALUE_LVAL (val
) = not_lval
;
68 VALUE_ADDRESS (val
) = 0;
69 VALUE_FRAME (val
) = 0;
70 VALUE_OFFSET (val
) = 0;
71 VALUE_BITPOS (val
) = 0;
72 VALUE_BITSIZE (val
) = 0;
73 VALUE_REPEATED (val
) = 0;
74 VALUE_REPETITIONS (val
) = 0;
75 VALUE_REGNO (val
) = -1;
79 /* Allocate a value that has the correct length
80 for COUNT repetitions type TYPE. */
83 allocate_repeat_value (type
, count
)
89 val
= (value
) xmalloc (sizeof (struct value
) + TYPE_LENGTH (type
) * count
);
90 VALUE_NEXT (val
) = all_values
;
92 VALUE_TYPE (val
) = type
;
93 VALUE_LVAL (val
) = not_lval
;
94 VALUE_ADDRESS (val
) = 0;
95 VALUE_FRAME (val
) = 0;
96 VALUE_OFFSET (val
) = 0;
97 VALUE_BITPOS (val
) = 0;
98 VALUE_BITSIZE (val
) = 0;
99 VALUE_REPEATED (val
) = 1;
100 VALUE_REPETITIONS (val
) = count
;
101 VALUE_REGNO (val
) = -1;
105 /* Free all the values that have been allocated (except for those released).
106 Called after each command, successful or not. */
111 register value val
, next
;
113 for (val
= all_values
; val
; val
= next
)
115 next
= VALUE_NEXT (val
);
122 /* Remove VAL from the chain all_values
123 so it will not be freed automatically. */
131 if (all_values
== val
)
133 all_values
= val
->next
;
137 for (v
= all_values
; v
; v
= v
->next
)
147 /* Return a copy of the value ARG.
148 It contains the same contents, for same memory address,
149 but it's a different block of storage. */
156 register struct type
*type
= VALUE_TYPE (arg
);
157 if (VALUE_REPEATED (arg
))
158 val
= allocate_repeat_value (type
, VALUE_REPETITIONS (arg
));
160 val
= allocate_value (type
);
161 VALUE_LVAL (val
) = VALUE_LVAL (arg
);
162 VALUE_ADDRESS (val
) = VALUE_ADDRESS (arg
);
163 VALUE_OFFSET (val
) = VALUE_OFFSET (arg
);
164 VALUE_BITPOS (val
) = VALUE_BITPOS (arg
);
165 VALUE_BITSIZE (val
) = VALUE_BITSIZE (arg
);
166 VALUE_REGNO (val
) = VALUE_REGNO (arg
);
167 bcopy (VALUE_CONTENTS (arg
), VALUE_CONTENTS (val
),
168 TYPE_LENGTH (VALUE_TYPE (arg
))
169 * (VALUE_REPEATED (arg
) ? VALUE_REPETITIONS (arg
) : 1));
173 /* Access to the value history. */
175 /* Record a new value in the value history.
176 Returns the absolute history index of the entry. */
179 record_latest_value (val
)
185 /* Check error now if about to store an invalid float. We return -1
186 to the caller, but allow them to continue, e.g. to print it as "Nan". */
187 if (TYPE_CODE (VALUE_TYPE (val
)) == TYPE_CODE_FLT
) {
188 foo
= unpack_double (VALUE_TYPE (val
), VALUE_CONTENTS (val
), &i
);
189 if (i
) return -1; /* Indicate value not saved in history */
192 /* Here we treat value_history_count as origin-zero
193 and applying to the value being stored now. */
195 i
= value_history_count
% VALUE_HISTORY_CHUNK
;
198 register struct value_history_chunk
*new
199 = (struct value_history_chunk
*) xmalloc (sizeof (struct value_history_chunk
));
200 bzero (new->values
, sizeof new->values
);
201 new->next
= value_history_chain
;
202 value_history_chain
= new;
205 value_history_chain
->values
[i
] = val
;
208 /* Now we regard value_history_count as origin-one
209 and applying to the value just stored. */
211 return ++value_history_count
;
214 /* Return a copy of the value in the history with sequence number NUM. */
217 access_value_history (num
)
220 register struct value_history_chunk
*chunk
;
222 register int absnum
= num
;
225 absnum
+= value_history_count
;
230 error ("The history is empty.");
232 error ("There is only one value in the history.");
234 error ("History does not go back to $$%d.", -num
);
236 if (absnum
> value_history_count
)
237 error ("History has not yet reached $%d.", absnum
);
241 /* Now absnum is always absolute and origin zero. */
243 chunk
= value_history_chain
;
244 for (i
= (value_history_count
- 1) / VALUE_HISTORY_CHUNK
- absnum
/ VALUE_HISTORY_CHUNK
;
248 return value_copy (chunk
->values
[absnum
% VALUE_HISTORY_CHUNK
]);
251 /* Clear the value history entirely.
252 Must be done when new symbol tables are loaded,
253 because the type pointers become invalid. */
256 clear_value_history ()
258 register struct value_history_chunk
*next
;
262 while (value_history_chain
)
264 for (i
= 0; i
< VALUE_HISTORY_CHUNK
; i
++)
265 if (val
= value_history_chain
->values
[i
])
267 next
= value_history_chain
->next
;
268 free (value_history_chain
);
269 value_history_chain
= next
;
271 value_history_count
= 0;
275 history_info (num_exp
)
283 num
= parse_and_eval_address (num_exp
) - 5;
285 num
= value_history_count
- 9;
290 for (i
= num
; i
< num
+ 10 && i
<= value_history_count
; i
++)
292 val
= access_value_history (i
);
293 printf ("$%d = ", i
);
294 value_print (val
, stdout
, 0);
299 /* Internal variables. These are variables within the debugger
300 that hold values assigned by debugger commands.
301 The user refers to them with a '$' prefix
302 that does not appear in the variable names stored internally. */
304 static struct internalvar
*internalvars
;
306 /* Look up an internal variable with name NAME. NAME should not
307 normally include a dollar sign.
309 If the specified internal variable does not exist,
310 one is created, with a void value. */
313 lookup_internalvar (name
)
316 register struct internalvar
*var
;
318 for (var
= internalvars
; var
; var
= var
->next
)
319 if (!strcmp (var
->name
, name
))
322 var
= (struct internalvar
*) xmalloc (sizeof (struct internalvar
));
323 var
->name
= concat (name
, "", "");
324 var
->value
= allocate_value (builtin_type_void
);
325 release_value (var
->value
);
326 var
->next
= internalvars
;
332 value_of_internalvar (var
)
333 struct internalvar
*var
;
335 register value val
= value_copy (var
->value
);
336 VALUE_LVAL (val
) = lval_internalvar
;
337 VALUE_INTERNALVAR (val
) = var
;
342 set_internalvar_component (var
, offset
, bitpos
, bitsize
, newval
)
343 struct internalvar
*var
;
344 int offset
, bitpos
, bitsize
;
347 register char *addr
= VALUE_CONTENTS (var
->value
) + offset
;
349 modify_field (addr
, (int) value_as_long (newval
),
352 bcopy (VALUE_CONTENTS (newval
), addr
,
353 TYPE_LENGTH (VALUE_TYPE (newval
)));
357 set_internalvar (var
, val
)
358 struct internalvar
*var
;
362 var
->value
= value_copy (val
);
363 release_value (var
->value
);
367 internalvar_name (var
)
368 struct internalvar
*var
;
373 /* Free all internalvars. Done when new symtabs are loaded,
374 because that makes the values invalid. */
377 clear_internalvars ()
379 register struct internalvar
*var
;
384 internalvars
= var
->next
;
394 register struct internalvar
*var
;
397 printf ("Debugger convenience variables:\n\n");
399 printf ("No debugger convenience variables now defined.\n\
400 Convenience variables have names starting with \"$\";\n\
401 use \"set\" as in \"set $foo = 5\" to define them.\n");
403 for (var
= internalvars
; var
; var
= var
->next
)
405 printf ("$%s: ", var
->name
);
406 value_print (var
->value
, stdout
, 0);
411 /* Extract a value as a C number (either long or double).
412 Knows how to convert fixed values to double, or
413 floating values to long.
414 Does not deallocate the value. */
420 return unpack_long (VALUE_TYPE (val
), VALUE_CONTENTS (val
));
424 value_as_double (val
)
430 foo
= unpack_double (VALUE_TYPE (val
), VALUE_CONTENTS (val
), &inv
);
432 error ("Invalid floating value found in program.");
436 /* Unpack raw data (copied from debugee) at VALADDR
437 as a long, or as a double, assuming the raw data is described
438 by type TYPE. Knows how to convert different sizes of values
439 and can convert between fixed and floating point.
441 C++: It is assumed that the front-end has taken care of
442 all matters concerning pointers to members. A pointer
443 to member which reaches here is considered to be equivalent
444 to an INT (or some size). After all, it is only an offset. */
447 unpack_long (type
, valaddr
)
451 register enum type_code code
= TYPE_CODE (type
);
452 register int len
= TYPE_LENGTH (type
);
453 register int nosign
= TYPE_UNSIGNED (type
);
455 if (code
== TYPE_CODE_ENUM
)
456 code
= TYPE_CODE_INT
;
457 if (code
== TYPE_CODE_FLT
)
459 if (len
== sizeof (float))
460 return * (float *) valaddr
;
462 if (len
== sizeof (double))
463 return * (double *) valaddr
;
465 else if (code
== TYPE_CODE_INT
&& nosign
)
467 if (len
== sizeof (char))
468 return * (unsigned char *) valaddr
;
470 if (len
== sizeof (short))
471 return * (unsigned short *) valaddr
;
473 if (len
== sizeof (int))
474 return * (unsigned int *) valaddr
;
476 if (len
== sizeof (long))
477 return * (unsigned long *) valaddr
;
479 else if (code
== TYPE_CODE_INT
)
481 if (len
== sizeof (char))
482 return * (char *) valaddr
;
484 if (len
== sizeof (short))
485 return * (short *) valaddr
;
487 if (len
== sizeof (int))
488 return * (int *) valaddr
;
490 if (len
== sizeof (long))
491 return * (long *) valaddr
;
494 if (len
== sizeof (long long))
495 return * (long long *) valaddr
;
498 else if (code
== TYPE_CODE_PTR
499 || code
== TYPE_CODE_REF
)
501 if (len
== sizeof (char *))
502 return (CORE_ADDR
) * (char **) valaddr
;
504 else if (code
== TYPE_CODE_MEMBER
)
505 error ("not implemented: member types in unpack_long");
507 error ("Value not integer or pointer.");
510 /* Return a double value from the specified type and address.
511 * INVP points to an int which is set to 0 for valid value,
512 * 1 for invalid value (bad float format). In either case,
513 * the returned double is OK to use. */
516 unpack_double (type
, valaddr
, invp
)
521 register enum type_code code
= TYPE_CODE (type
);
522 register int len
= TYPE_LENGTH (type
);
523 register int nosign
= TYPE_UNSIGNED (type
);
525 *invp
= 0; /* Assume valid */
526 if (code
== TYPE_CODE_FLT
)
528 if (INVALID_FLOAT (valaddr
, len
)) {
530 return 1.234567891011121314;
533 if (len
== sizeof (float))
534 return * (float *) valaddr
;
536 if (len
== sizeof (double))
538 /* Some machines require doubleword alignment for doubles.
539 This code works on them, and on other machines. */
541 bcopy ((char *) valaddr
, (char *) &temp
, sizeof (double));
545 else if (code
== TYPE_CODE_INT
&& nosign
)
547 if (len
== sizeof (char))
548 return * (unsigned char *) valaddr
;
550 if (len
== sizeof (short))
551 return * (unsigned short *) valaddr
;
553 if (len
== sizeof (int))
554 return * (unsigned int *) valaddr
;
556 if (len
== sizeof (long))
557 return * (unsigned long *) valaddr
;
560 if (len
== sizeof (long long))
561 return * (unsigned long long *) valaddr
;
564 else if (code
== TYPE_CODE_INT
)
566 if (len
== sizeof (char))
567 return * (char *) valaddr
;
569 if (len
== sizeof (short))
570 return * (short *) valaddr
;
572 if (len
== sizeof (int))
573 return * (int *) valaddr
;
575 if (len
== sizeof (long))
576 return * (long *) valaddr
;
579 if (len
== sizeof (long long))
580 return * (long long *) valaddr
;
584 error ("Value not floating number.");
587 /* Given a value ARG1 of a struct or union type,
588 extract and return the value of one of its fields.
589 FIELDNO says which field.
591 For C++, must also be able to return values from static fields */
594 value_field (arg1
, fieldno
)
596 register int fieldno
;
599 register struct type
*type
= TYPE_FIELD_TYPE (VALUE_TYPE (arg1
), fieldno
);
602 /* Handle packed fields */
604 offset
= TYPE_FIELD_BITPOS (VALUE_TYPE (arg1
), fieldno
) / 8;
605 if (TYPE_FIELD_BITSIZE (VALUE_TYPE (arg1
), fieldno
))
607 v
= value_from_long (type
,
608 (LONGEST
) unpack_field_as_long (VALUE_TYPE (arg1
),
609 VALUE_CONTENTS (arg1
),
611 VALUE_BITPOS (v
) = TYPE_FIELD_BITPOS (VALUE_TYPE (arg1
), fieldno
) % 8;
612 VALUE_BITSIZE (v
) = TYPE_FIELD_BITSIZE (VALUE_TYPE (arg1
), fieldno
);
616 v
= allocate_value (type
);
617 bcopy (VALUE_CONTENTS (arg1
) + offset
,
621 VALUE_LVAL (v
) = VALUE_LVAL (arg1
);
622 if (VALUE_LVAL (arg1
) == lval_internalvar
)
623 VALUE_LVAL (v
) = lval_internalvar_component
;
624 VALUE_ADDRESS (v
) = VALUE_ADDRESS (arg1
);
625 VALUE_OFFSET (v
) = offset
+ VALUE_OFFSET (arg1
);
630 value_fn_field (arg1
, fieldno
, subfieldno
)
632 register int fieldno
;
635 struct fn_field
*f
= TYPE_FN_FIELDLIST1 (VALUE_TYPE (arg1
), fieldno
);
636 register struct type
*type
= TYPE_FN_FIELD_TYPE (f
, subfieldno
);
639 sym
= lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f
, subfieldno
),
640 0, VAR_NAMESPACE
, 0);
641 if (! sym
) error ("Internal error: could not find physical method named %s",
642 TYPE_FN_FIELD_PHYSNAME (f
, subfieldno
));
644 v
= allocate_value (type
);
645 VALUE_ADDRESS (v
) = BLOCK_START (SYMBOL_BLOCK_VALUE (sym
));
646 VALUE_TYPE (v
) = type
;
650 /* Return a virtual function as a value.
651 ARG1 is the object which provides the virtual function
653 F is the list of member functions which contains the desired virtual
655 J is an index into F which provides the desired virtual function.
656 TYPE is the basetype which first provides the virtual function table. */
658 value_virtual_fn_field (arg1
, f
, j
, type
)
664 /* First, get the virtual function table pointer. That comes
665 with a strange type, so cast it to type `pointer to long' (which
666 should serve just fine as a function type). Then, index into
667 the table, and convert final value to appropriate function type. */
669 value vi
= value_from_long (builtin_type_int
,
670 (LONGEST
) TYPE_FN_FIELD_VOFFSET (f
, j
));
671 VALUE_TYPE (arg1
) = TYPE_VPTR_BASETYPE (type
);
673 /* This type may have been defined before its virtual function table
674 was. If so, fill in the virtual function table entry for the
676 if (TYPE_VPTR_FIELDNO (type
) < 0)
677 TYPE_VPTR_FIELDNO (type
)
678 = fill_in_vptr_fieldno (type
);
680 /* Pretend that this array is just an array of pointers to integers.
681 This will have to change for multiple inheritance. */
682 vtbl
= value_copy (value_field (arg1
, TYPE_VPTR_FIELDNO (type
)));
683 VALUE_TYPE (vtbl
) = lookup_pointer_type (builtin_type_int
);
685 /* Index into the virtual function table. */
686 vfn
= value_subscript (vtbl
, vi
);
688 /* Reinstantiate the function pointer with the correct type. */
689 VALUE_TYPE (vfn
) = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f
, j
));
693 /* The value of a static class member does not depend
694 on its instance, only on its type. If FIELDNO >= 0,
695 then fieldno is a valid field number and is used directly.
696 Otherwise, FIELDNAME is the name of the field we are
697 searching for. If it is not a static field name, an
698 error is signaled. TYPE is the type in which we look for the
699 static field member. */
701 value_static_field (type
, fieldname
, fieldno
)
702 register struct type
*type
;
704 register int fieldno
;
711 register struct type
*t
= type
;
712 /* Look for static field. */
716 for (i
= TYPE_NFIELDS (t
) - 1; i
>= 0; i
--)
717 if (! strcmp (TYPE_FIELD_NAME (t
, i
), fieldname
))
719 if (TYPE_FIELD_STATIC (t
, i
))
725 error ("field `%s' is not static");
727 t
= TYPE_BASECLASSES (t
) ? TYPE_BASECLASS (t
, 1) : 0;
732 if (destructor_name_p (fieldname
, t
))
733 error ("use `info method' command to print out value of destructor");
739 for (i
= TYPE_NFN_FIELDS (t
) - 1; i
>= 0; i
--)
741 if (! strcmp (TYPE_FN_FIELDLIST_NAME (t
, i
), fieldname
))
743 error ("use `info method' command to print value of method \"%s\"", fieldname
);
746 t
= TYPE_BASECLASSES (t
) ? TYPE_BASECLASS (t
, 1) : 0;
748 error("there is no field named %s", fieldname
);
753 sym
= lookup_symbol (TYPE_FIELD_STATIC_PHYSNAME (type
, fieldno
),
754 0, VAR_NAMESPACE
, 0);
755 if (! sym
) error ("Internal error: could not find physical static variable named %s", TYPE_FIELD_BITSIZE (type
, fieldno
));
757 type
= TYPE_FIELD_TYPE (type
, fieldno
);
758 v
= value_at (type
, (CORE_ADDR
)SYMBOL_BLOCK_VALUE (sym
));
763 unpack_field_as_long (type
, valaddr
, fieldno
)
769 int bitpos
= TYPE_FIELD_BITPOS (type
, fieldno
);
770 int bitsize
= TYPE_FIELD_BITSIZE (type
, fieldno
);
772 bcopy (valaddr
+ bitpos
/ 8, &val
, sizeof val
);
774 /* Extracting bits depends on endianness of the target machine. */
775 #ifdef BITS_BIG_ENDIAN
776 val
= val
>> (sizeof val
* 8 - bitpos
% 8 - bitsize
);
778 val
= val
>> (bitpos
% 8);
781 val
&= (1 << bitsize
) - 1;
786 modify_field (addr
, fieldval
, bitpos
, bitsize
)
793 bcopy (addr
, &oword
, sizeof oword
);
795 /* Shifting for bit field depends on endianness of the target machine. */
796 #ifdef BITS_BIG_ENDIAN
797 bitpos
= sizeof oword
* 8 - bitpos
- bitsize
;
800 oword
&= ~(((1 << bitsize
) - 1) << bitpos
);
801 oword
|= fieldval
<< bitpos
;
802 bcopy (&oword
, addr
, sizeof oword
);
805 /* Convert C numbers into newly allocated values */
808 value_from_long (type
, num
)
810 register LONGEST num
;
812 register value val
= allocate_value (type
);
813 register enum type_code code
= TYPE_CODE (type
);
814 register int len
= TYPE_LENGTH (type
);
816 if (code
== TYPE_CODE_INT
|| code
== TYPE_CODE_ENUM
)
818 if (len
== sizeof (char))
819 * (char *) VALUE_CONTENTS (val
) = num
;
820 else if (len
== sizeof (short))
821 * (short *) VALUE_CONTENTS (val
) = num
;
822 else if (len
== sizeof (int))
823 * (int *) VALUE_CONTENTS (val
) = num
;
824 else if (len
== sizeof (long))
825 * (long *) VALUE_CONTENTS (val
) = num
;
827 else if (len
== sizeof (long long))
828 * (long long *) VALUE_CONTENTS (val
) = num
;
831 error ("Integer type encountered with unexpected data length.");
834 error ("Unexpected type encountered for integer constant.");
840 value_from_double (type
, num
)
844 register value val
= allocate_value (type
);
845 register enum type_code code
= TYPE_CODE (type
);
846 register int len
= TYPE_LENGTH (type
);
848 if (code
== TYPE_CODE_FLT
)
850 if (len
== sizeof (float))
851 * (float *) VALUE_CONTENTS (val
) = num
;
852 else if (len
== sizeof (double))
853 * (double *) VALUE_CONTENTS (val
) = num
;
855 error ("Floating type encountered with unexpected data length.");
858 error ("Unexpected type encountered for floating constant.");
863 /* Deal with the value that is "about to be returned". */
865 /* Return the value that a function returning now
866 would be returning to its caller, assuming its type is VALTYPE.
867 RETBUF is where we look for what ought to be the contents
868 of the registers (in raw form). This is because it is often
869 desirable to restore old values to those registers
870 after saving the contents of interest, and then call
871 this function using the saved values.
872 struct_return is non-zero when the function in question is
873 using the structure return conventions on the machine in question;
874 0 when it is using the value returning conventions (this often
875 means returning pointer to where structure is vs. returning value). */
878 value_being_returned (valtype
, retbuf
, struct_return
)
879 register struct type
*valtype
;
880 char retbuf
[REGISTER_BYTES
];
886 return value_at (valtype
, EXTRACT_STRUCT_VALUE_ADDRESS (retbuf
));
888 val
= allocate_value (valtype
);
889 EXTRACT_RETURN_VALUE (valtype
, retbuf
, VALUE_CONTENTS (val
));
894 /* Return true if the function specified is using the structure returning
895 convention on this machine to return arguments, or 0 if it is using
896 the value returning convention. FUNCTION is the value representing
897 the function, FUNCADDR is the address of the function, and VALUE_TYPE
898 is the type returned by the function */
900 struct block
*block_for_pc ();
903 using_struct_return (function
, funcaddr
, value_type
)
906 struct type
*value_type
;
908 register enum type_code code
= TYPE_CODE (value_type
);
910 if (code
== TYPE_CODE_STRUCT
||
911 code
== TYPE_CODE_ENUM
||
912 code
== TYPE_CODE_ARRAY
)
914 struct block
*b
= block_for_pc (funcaddr
);
916 if (!(BLOCK_GCC_COMPILED (b
) && TYPE_LENGTH (value_type
) < 8))
923 /* Store VAL so it will be returned if a function returns now.
924 Does not verify that VAL's type matches what the current
925 function wants to return. */
928 set_return_value (val
)
931 register enum type_code code
= TYPE_CODE (VALUE_TYPE (val
));
932 char regbuf
[REGISTER_BYTES
];
936 if (code
== TYPE_CODE_STRUCT
937 || code
== TYPE_CODE_UNION
)
938 error ("Specifying a struct or union return value is not supported.");
940 if (code
== TYPE_CODE_FLT
)
942 dbuf
= value_as_double (val
);
944 STORE_RETURN_VALUE (VALUE_TYPE (val
), &dbuf
);
948 lbuf
= value_as_long (val
);
949 STORE_RETURN_VALUE (VALUE_TYPE (val
), &lbuf
);
954 _initialize_values ()
956 add_info ("convenience", convenience_info
,
957 "Debugger convenience (\"$foo\") variables.\n\
958 These variables are created when you assign them values;\n\
959 thus, \"print $foo=1\" gives \"$foo\" the value 1. Values may be any type.\n\n\
960 A few convenience variables are given values automatically GDB:\n\
961 \"$_\"holds the last address examined with \"x\" or \"info lines\",\n\
962 \"$__\" holds the contents of the last address examined with \"x\".");
964 add_info ("history", history_info
,
965 "Elements of value history (around item number IDX, or last ten).");