}
}
+/* Release all values up to mark */
+value_ptr
+value_release_to_mark (mark)
+ value_ptr mark;
+{
+ value_ptr val, next;
+
+ for (val = next = all_values; next; next = VALUE_NEXT (next))
+ if (VALUE_NEXT (next) == mark)
+ {
+ all_values = VALUE_NEXT (next);
+ VALUE_NEXT (next) = 0;
+ return val;
+ }
+ all_values = 0;
+ return val;
+}
+
/* Return a copy of the value ARG.
It contains the same contents, for same memory address,
but it's a different block of storage. */
to member which reaches here is considered to be equivalent
to an INT (or some size). After all, it is only an offset. */
-/* FIXME: This should be rewritten as a switch statement for speed and
- ease of comprehension. */
-
LONGEST
unpack_long (type, valaddr)
struct type *type;
a virtual function. */
entry = value_subscript (vtbl, vi);
- /* Move the `this' pointer according to the virtual function table. */
- VALUE_OFFSET (arg1) += value_as_long (value_field (entry, 0))/* + offset*/;
-
- if (! VALUE_LAZY (arg1))
+ if (TYPE_CODE (VALUE_TYPE (entry)) == TYPE_CODE_STRUCT)
{
- VALUE_LAZY (arg1) = 1;
- value_fetch_lazy (arg1);
- }
+ /* Move the `this' pointer according to the virtual function table. */
+ VALUE_OFFSET (arg1) += value_as_long (value_field (entry, 0));
+
+ if (! VALUE_LAZY (arg1))
+ {
+ VALUE_LAZY (arg1) = 1;
+ value_fetch_lazy (arg1);
+ }
- vfn = value_field (entry, 2);
+ vfn = value_field (entry, 2);
+ }
+ else if (TYPE_CODE (VALUE_TYPE (entry)) == TYPE_CODE_PTR)
+ vfn = entry;
+ else
+ error ("I'm confused: virtual function table has bad type");
/* Reinstantiate the function pointer with the correct type. */
VALUE_TYPE (vfn) = lookup_pointer_type (TYPE_FN_FIELD_TYPE (f, j));
/* Check that VTBL looks like it points to a virtual function table. */
msymbol = lookup_minimal_symbol_by_pc (VALUE_ADDRESS (vtbl));
if (msymbol == NULL
- || !VTBL_PREFIX_P (demangled_name = SYMBOL_NAME (msymbol)))
+ || (demangled_name = SYMBOL_NAME (msymbol)) == NULL
+ || !VTBL_PREFIX_P (demangled_name))
{
/* If we expected to find a vtable, but did not, let the user
know that we aren't happy, but don't throw an error.
{
entry = value_subscript (vtbl, value_from_longest (builtin_type_int,
(LONGEST) i));
+ /* This won't work if we're using thunks. */
+ if (TYPE_CODE (VALUE_TYPE (entry)) != TYPE_CODE_STRUCT)
+ break;
offset = longest_to_int (value_as_long (value_field (entry, 0)));
/* If we use '<=' we can handle single inheritance
* where all offsets are zero - just use the first entry found. */