/* Low level packing and unpacking of values for GDB, the GNU Debugger.
- Copyright (C) 1986-2016 Free Software Foundation, Inc.
+ Copyright (C) 1986-2017 Free Software Foundation, Inc.
This file is part of GDB.
#include "tracepoint.h"
#include "cp-abi.h"
#include "user-regs.h"
+#include <algorithm>
/* Prototypes for exported functions. */
struct range
{
/* Lowest offset in the range. */
- int offset;
+ LONGEST offset;
/* Length of the range. */
- int length;
+ LONGEST length;
};
typedef struct range range_s;
[offset2, offset2+len2) overlap. */
static int
-ranges_overlap (int offset1, int len1,
- int offset2, int len2)
+ranges_overlap (LONGEST offset1, LONGEST len1,
+ LONGEST offset2, LONGEST len2)
{
ULONGEST h, l;
- l = max (offset1, offset2);
- h = min (offset1 + len1, offset2 + len2);
+ l = std::max (offset1, offset2);
+ h = std::min (offset1 + len1, offset2 + len2);
return (l < h);
}
OFFSET+LENGTH). */
static int
-ranges_contain (VEC(range_s) *ranges, int offset, int length)
+ranges_contain (VEC(range_s) *ranges, LONGEST offset, LONGEST length)
{
range_s what;
- int i;
+ LONGEST i;
what.offset = offset;
what.length = length;
/* If the value has been released. */
unsigned int released : 1;
- /* Register number if the value is from a register. */
- short regnum;
-
/* Location of value (if lval). */
union
{
- /* If lval == lval_memory, this is the address in the inferior.
- If lval == lval_register, this is the byte offset into the
- registers structure. */
+ /* If lval == lval_memory, this is the address in the inferior */
CORE_ADDR address;
+ /*If lval == lval_register, the value is from a register. */
+ struct
+ {
+ /* Register number. */
+ int regnum;
+ /* Frame ID of "next" frame to which a register value is relative.
+ If the register value is found relative to frame F, then the
+ frame id of F->next will be stored in next_frame_id. */
+ struct frame_id next_frame_id;
+ } reg;
+
/* Pointer to internal variable. */
struct internalvar *internalvar;
} location;
/* Describes offset of a value within lval of a structure in target
- addressable memory units. If lval == lval_memory, this is an offset to
- the address. If lval == lval_register, this is a further offset from
- location.address within the registers structure. Note also the member
- embedded_offset below. */
- int offset;
+ addressable memory units. Note also the member embedded_offset
+ below. */
+ LONGEST offset;
/* Only used for bitfields; number of bits contained in them. */
- int bitsize;
+ LONGEST bitsize;
/* Only used for bitfields; position of start of field. For
gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
- int bitpos;
+ LONGEST bitpos;
/* The number of references to this value. When a value is created,
the value chain holds a reference, so REFERENCE_COUNT is 1. If
bitfields. */
struct value *parent;
- /* Frame register value is relative to. This will be described in
- the lval enum above as "lval_register". */
- struct frame_id frame_id;
-
/* Type of the value. */
struct type *type;
`type', and `embedded_offset' is zero, so everything works
normally. */
struct type *enclosing_type;
- int embedded_offset;
- int pointed_to_offset;
+ LONGEST embedded_offset;
+ LONGEST pointed_to_offset;
/* Values are stored in a chain, so that they can be deleted easily
over calls to the inferior. Values assigned to internal
}
int
-value_bits_available (const struct value *value, int offset, int length)
+value_bits_available (const struct value *value, LONGEST offset, LONGEST length)
{
gdb_assert (!value->lazy);
}
int
-value_bytes_available (const struct value *value, int offset, int length)
+value_bytes_available (const struct value *value,
+ LONGEST offset, LONGEST length)
{
return value_bits_available (value,
offset * TARGET_CHAR_BIT,
OFFSET bits, and extending for the next LENGTH bits. */
static void
-insert_into_bit_range_vector (VEC(range_s) **vectorp, int offset, int length)
+insert_into_bit_range_vector (VEC(range_s) **vectorp,
+ LONGEST offset, LONGEST length)
{
range_s newr;
int i;
if (ranges_overlap (bef->offset, bef->length, offset, length))
{
/* #1 */
- ULONGEST l = min (bef->offset, offset);
- ULONGEST h = max (bef->offset + bef->length, offset + length);
+ ULONGEST l = std::min (bef->offset, offset);
+ ULONGEST h = std::max (bef->offset + bef->length, offset + length);
bef->offset = l;
bef->length = h - l;
{
ULONGEST l, h;
- l = min (t->offset, r->offset);
- h = max (t->offset + t->length, r->offset + r->length);
+ l = std::min (t->offset, r->offset);
+ h = std::max (t->offset + t->length, r->offset + r->length);
t->offset = l;
t->length = h - l;
}
void
-mark_value_bits_unavailable (struct value *value, int offset, int length)
+mark_value_bits_unavailable (struct value *value,
+ LONGEST offset, LONGEST length)
{
insert_into_bit_range_vector (&value->unavailable, offset, length);
}
void
-mark_value_bytes_unavailable (struct value *value, int offset, int length)
+mark_value_bytes_unavailable (struct value *value,
+ LONGEST offset, LONGEST length)
{
mark_value_bits_unavailable (value,
offset * TARGET_CHAR_BIT,
static int
find_first_range_overlap (VEC(range_s) *ranges, int pos,
- int offset, int length)
+ LONGEST offset, LONGEST length)
{
range_s *r;
int i;
static int
find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
struct ranges_and_idx *rp2,
- int offset1, int offset2,
- int length, ULONGEST *l, ULONGEST *h)
+ LONGEST offset1, LONGEST offset2,
+ LONGEST length, ULONGEST *l, ULONGEST *h)
{
rp1->idx = find_first_range_overlap (rp1->ranges, rp1->idx,
offset1, length);
/* Get the unavailable windows intersected by the incoming
ranges. The first and last ranges that overlap the argument
range may be wider than said incoming arguments ranges. */
- l1 = max (offset1, r1->offset);
- h1 = min (offset1 + length, r1->offset + r1->length);
+ l1 = std::max (offset1, r1->offset);
+ h1 = std::min (offset1 + length, r1->offset + r1->length);
- l2 = max (offset2, r2->offset);
- h2 = min (offset2 + length, offset2 + r2->length);
+ l2 = std::max (offset2, r2->offset);
+ h2 = std::min (offset2 + length, offset2 + r2->length);
/* Make them relative to the respective start offsets, so we can
compare them for equality. */
}
int
-value_contents_eq (const struct value *val1, int offset1,
- const struct value *val2, int offset2,
- int length)
+value_contents_eq (const struct value *val1, LONGEST offset1,
+ const struct value *val2, LONGEST offset2,
+ LONGEST length)
{
return value_contents_bits_eq (val1, offset1 * TARGET_CHAR_BIT,
val2, offset2 * TARGET_CHAR_BIT,
val->enclosing_type = type;
VALUE_LVAL (val) = not_lval;
val->location.address = 0;
- VALUE_FRAME_ID (val) = null_frame_id;
val->offset = 0;
val->bitpos = 0;
val->bitsize = 0;
- VALUE_REGNUM (val) = -1;
val->lazy = 1;
val->embedded_offset = 0;
val->pointed_to_offset = 0;
value->type = type;
}
-int
+LONGEST
value_offset (const struct value *value)
{
return value->offset;
}
void
-set_value_offset (struct value *value, int offset)
+set_value_offset (struct value *value, LONGEST offset)
{
value->offset = offset;
}
-int
+LONGEST
value_bitpos (const struct value *value)
{
return value->bitpos;
}
void
-set_value_bitpos (struct value *value, int bit)
+set_value_bitpos (struct value *value, LONGEST bit)
{
value->bitpos = bit;
}
-int
+LONGEST
value_bitsize (const struct value *value)
{
return value->bitsize;
}
void
-set_value_bitsize (struct value *value, int bit)
+set_value_bitsize (struct value *value, LONGEST bit)
{
value->bitsize = bit;
}
{
/* If result's target type is TYPE_CODE_STRUCT, proceed to
fetch its rtti type. */
- if ((TYPE_CODE (result) == TYPE_CODE_PTR
- || TYPE_CODE (result) == TYPE_CODE_REF)
+ if ((TYPE_CODE (result) == TYPE_CODE_PTR || TYPE_IS_REFERENCE (result))
&& TYPE_CODE (check_typedef (TYPE_TARGET_TYPE (result)))
== TYPE_CODE_STRUCT
&& !value_optimized_out (value))
{
ULONGEST h, l;
- l = max (r->offset, src_bit_offset);
- h = min (r->offset + r->length, src_bit_offset + bit_length);
+ l = std::max (r->offset, (LONGEST) src_bit_offset);
+ h = std::min (r->offset + r->length,
+ (LONGEST) src_bit_offset + bit_length);
if (l < h)
insert_into_bit_range_vector (dst_range,
DST_OFFSET+LENGTH) range are wholly available. */
void
-value_contents_copy_raw (struct value *dst, int dst_offset,
- struct value *src, int src_offset, int length)
+value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset, LONGEST length)
{
- int src_bit_offset, dst_bit_offset, bit_length;
+ LONGEST src_bit_offset, dst_bit_offset, bit_length;
struct gdbarch *arch = get_value_arch (src);
int unit_size = gdbarch_addressable_memory_unit_size (arch);
DST_OFFSET+LENGTH) range are wholly available. */
void
-value_contents_copy (struct value *dst, int dst_offset,
- struct value *src, int src_offset, int length)
+value_contents_copy (struct value *dst, LONGEST dst_offset,
+ struct value *src, LONGEST src_offset, LONGEST length)
{
if (src->lazy)
value_fetch_lazy (src);
/* See value.h. */
void
-mark_value_bits_optimized_out (struct value *value, int offset, int length)
+mark_value_bits_optimized_out (struct value *value,
+ LONGEST offset, LONGEST length)
{
insert_into_bit_range_vector (&value->optimized_out, offset, length);
}
int
value_bits_synthetic_pointer (const struct value *value,
- int offset, int length)
+ LONGEST offset, LONGEST length)
{
if (value->lval != lval_computed
|| !value->location.computed.funcs->check_synthetic_pointer)
length);
}
-int
+LONGEST
value_embedded_offset (const struct value *value)
{
return value->embedded_offset;
}
void
-set_value_embedded_offset (struct value *value, int val)
+set_value_embedded_offset (struct value *value, LONGEST val)
{
value->embedded_offset = val;
}
-int
+LONGEST
value_pointed_to_offset (const struct value *value)
{
return value->pointed_to_offset;
}
void
-set_value_pointed_to_offset (struct value *value, int val)
+set_value_pointed_to_offset (struct value *value, LONGEST val)
{
value->pointed_to_offset = val;
}
CORE_ADDR
value_address (const struct value *value)
{
- if (value->lval == lval_internalvar
- || value->lval == lval_internalvar_component
- || value->lval == lval_xcallable)
+ if (value->lval != lval_memory)
return 0;
if (value->parent != NULL)
return value_address (value->parent) + value->offset;
CORE_ADDR
value_raw_address (const struct value *value)
{
- if (value->lval == lval_internalvar
- || value->lval == lval_internalvar_component
- || value->lval == lval_xcallable)
+ if (value->lval != lval_memory)
return 0;
return value->location.address;
}
void
set_value_address (struct value *value, CORE_ADDR addr)
{
- gdb_assert (value->lval != lval_internalvar
- && value->lval != lval_internalvar_component
- && value->lval != lval_xcallable);
+ gdb_assert (value->lval == lval_memory);
value->location.address = addr;
}
}
struct frame_id *
-deprecated_value_frame_id_hack (struct value *value)
+deprecated_value_next_frame_id_hack (struct value *value)
{
- return &value->frame_id;
+ gdb_assert (value->lval == lval_register);
+ return &value->location.reg.next_frame_id;
}
-short *
+int *
deprecated_value_regnum_hack (struct value *value)
{
- return &value->regnum;
+ gdb_assert (value->lval == lval_register);
+ return &value->location.reg.regnum;
}
int
val->offset = arg->offset;
val->bitpos = arg->bitpos;
val->bitsize = arg->bitsize;
- VALUE_FRAME_ID (val) = VALUE_FRAME_ID (arg);
- VALUE_REGNUM (val) = VALUE_REGNUM (arg);
val->lazy = arg->lazy;
val->embedded_offset = value_embedded_offset (arg);
val->pointed_to_offset = arg->pointed_to_offset;
struct internalvar* intvar;
/* Parse the expression - this is taken from set_command(). */
- struct expression *expr = parse_expression (args);
- register struct cleanup *old_chain =
- make_cleanup (free_current_contents, &expr);
+ expression_up expr = parse_expression (args);
/* Validate the expression.
Was the expression an assignment?
/* Only evaluate the expression if the lvalue is void.
This may still fail if the expresssion is invalid. */
if (intvar->kind == INTERNALVAR_VOID)
- evaluate_expression (expr);
-
- do_cleanups (old_chain);
+ evaluate_expression (expr.get ());
}
}
void
-set_internalvar_component (struct internalvar *var, int offset, int bitpos,
- int bitsize, struct value *newval)
+set_internalvar_component (struct internalvar *var,
+ LONGEST offset, LONGEST bitpos,
+ LONGEST bitsize, struct value *newval)
{
gdb_byte *addr;
struct gdbarch *arch;
ABI-specific code is a more reasonable place to handle it. */
if (TYPE_CODE (value_type (val)) != TYPE_CODE_PTR
- && TYPE_CODE (value_type (val)) != TYPE_CODE_REF
+ && !TYPE_IS_REFERENCE (value_type (val))
&& gdbarch_integer_to_address_p (gdbarch))
return gdbarch_integer_to_address (gdbarch, value_type (val),
value_contents (val));
case TYPE_CODE_PTR:
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
/* Assume a CORE_ADDR can fit in a LONGEST (for now). Not sure
whether we want this to be true eventually. */
return extract_typed_address (valaddr, type);
FIELDNO says which field. */
struct value *
-value_primitive_field (struct value *arg1, int offset,
+value_primitive_field (struct value *arg1, LONGEST offset,
int fieldno, struct type *arg_type)
{
struct value *v;
bit. Assume that the address, offset, and embedded offset
are sufficiently aligned. */
- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
- int container_bitsize = TYPE_LENGTH (type) * 8;
+ LONGEST bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ LONGEST container_bitsize = TYPE_LENGTH (type) * 8;
v = allocate_value_lazy (type);
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
/* This field is actually a base subobject, so preserve the
entire object's contents for later references to virtual
bases, etc. */
- int boffset;
+ LONGEST boffset;
/* Lazy register values with offsets are not supported. */
if (VALUE_LVAL (arg1) == lval_register && value_lazy (arg1))
+ value_embedded_offset (arg1));
}
set_value_component_location (v, arg1);
- VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
- VALUE_FRAME_ID (v) = VALUE_FRAME_ID (arg1);
return v;
}
struct value *
value_fn_field (struct value **arg1p, struct fn_field *f,
int j, struct type *type,
- int offset)
+ LONGEST offset)
{
struct value *v;
struct type *ftype = TYPE_FN_FIELD_TYPE (f, j);
}
v = allocate_value (ftype);
+ VALUE_LVAL (v) = lval_memory;
if (sym)
{
set_value_address (v, BLOCK_START (SYMBOL_BLOCK_VALUE (sym)));
static LONGEST
unpack_bits_as_long (struct type *field_type, const gdb_byte *valaddr,
- int bitpos, int bitsize)
+ LONGEST bitpos, LONGEST bitsize)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (field_type));
ULONGEST val;
ULONGEST valmask;
int lsbcount;
- int bytes_read;
- int read_offset;
+ LONGEST bytes_read;
+ LONGEST read_offset;
/* Read the minimum number of bytes required; there may not be
enough bytes to read an entire ULONGEST. */
int
unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, int fieldno,
+ LONGEST embedded_offset, int fieldno,
const struct value *val, LONGEST *result)
{
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
void
unpack_value_bitfield (struct value *dest_val,
- int bitpos, int bitsize,
- const gdb_byte *valaddr, int embedded_offset,
+ LONGEST bitpos, LONGEST bitsize,
+ const gdb_byte *valaddr, LONGEST embedded_offset,
const struct value *val)
{
enum bfd_endian byte_order;
int src_bit_offset;
int dst_bit_offset;
- LONGEST num;
struct type *field_type = value_type (dest_val);
- /* First, unpack and sign extend the bitfield as if it was wholly
- available. Invalid/unavailable bits are read as zero, but that's
- OK, as they'll end up marked below. */
byte_order = gdbarch_byte_order (get_type_arch (field_type));
- num = unpack_bits_as_long (field_type, valaddr + embedded_offset,
- bitpos, bitsize);
- store_signed_integer (value_contents_raw (dest_val),
- TYPE_LENGTH (field_type), byte_order, num);
+
+ /* First, unpack and sign extend the bitfield as if it was wholly
+ valid. Optimized out/unavailable bits are read as zero, but
+ that's OK, as they'll end up marked below. If the VAL is
+ wholly-invalid we may have skipped allocating its contents,
+ though. See allocate_optimized_out_value. */
+ if (valaddr != NULL)
+ {
+ LONGEST num;
+
+ num = unpack_bits_as_long (field_type, valaddr + embedded_offset,
+ bitpos, bitsize);
+ store_signed_integer (value_contents_raw (dest_val),
+ TYPE_LENGTH (field_type), byte_order, num);
+ }
/* Now copy the optimized out / unavailability ranges to the right
bits. */
struct value *
value_field_bitfield (struct type *type, int fieldno,
const gdb_byte *valaddr,
- int embedded_offset, const struct value *val)
+ LONGEST embedded_offset, const struct value *val)
{
int bitpos = TYPE_FIELD_BITPOS (type, fieldno);
int bitsize = TYPE_FIELD_BITSIZE (type, fieldno);
void
modify_field (struct type *type, gdb_byte *addr,
- LONGEST fieldval, int bitpos, int bitsize)
+ LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
ULONGEST oword;
ULONGEST mask = (ULONGEST) -1 >> (8 * sizeof (ULONGEST) - bitsize);
- int bytesize;
+ LONGEST bytesize;
/* Normalize BITPOS. */
addr += bitpos / 8;
{
/* FIXME: would like to include fieldval in the message, but
we don't have a sprintf_longest. */
- warning (_("Value does not fit in %d bits."), bitsize);
+ warning (_("Value does not fit in %s bits."), plongest (bitsize));
/* Truncate it, otherwise adjoining fields may be corrupted. */
fieldval &= mask;
pack_long (gdb_byte *buf, struct type *type, LONGEST num)
{
enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
- int len;
+ LONGEST len;
type = check_typedef (type);
len = TYPE_LENGTH (type);
break;
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_PTR:
store_typed_address (buf, type, (CORE_ADDR) num);
break;
static void
pack_unsigned_long (gdb_byte *buf, struct type *type, ULONGEST num)
{
- int len;
+ LONGEST len;
enum bfd_endian byte_order;
type = check_typedef (type);
break;
case TYPE_CODE_REF:
+ case TYPE_CODE_RVALUE_REF:
case TYPE_CODE_PTR:
store_typed_address (buf, type, (CORE_ADDR) num);
break;
v = allocate_value_lazy (type);
else
v = value_from_contents (type, valaddr);
- set_value_address (v, address);
VALUE_LVAL (v) = lval_memory;
+ set_value_address (v, address);
return v;
}
if (TYPE_DATA_LOCATION (resolved_type_no_typedef) != NULL
&& TYPE_DATA_LOCATION_KIND (resolved_type_no_typedef) == PROP_CONST)
address = TYPE_DATA_LOCATION_ADDR (resolved_type_no_typedef);
- set_value_address (v, address);
VALUE_LVAL (v) = lval_memory;
+ set_value_address (v, address);
return v;
}
return access_value_history (index);
}
+/* Get the component value (offset by OFFSET bytes) of a struct or
+ union WHOLE. Component's type is TYPE. */
+
+struct value *
+value_from_component (struct value *whole, struct type *type, LONGEST offset)
+{
+ struct value *v;
+
+ if (VALUE_LVAL (whole) == lval_memory && value_lazy (whole))
+ v = allocate_value_lazy (type);
+ else
+ {
+ v = allocate_value (type);
+ value_contents_copy (v, value_embedded_offset (v),
+ whole, value_embedded_offset (whole) + offset,
+ type_length_units (type));
+ }
+ v->offset = value_offset (whole) + offset + value_embedded_offset (whole);
+ set_value_component_location (v, whole);
+
+ return v;
+}
+
struct value *
coerce_ref_if_computed (const struct value *arg)
{
const struct lval_funcs *funcs;
- if (TYPE_CODE (check_typedef (value_type (arg))) != TYPE_CODE_REF)
+ if (!TYPE_IS_REFERENCE (check_typedef (value_type (arg))))
return NULL;
if (value_lval_const (arg) != lval_computed)
if (retval)
return retval;
- if (TYPE_CODE (value_type_arg_tmp) != TYPE_CODE_REF)
+ if (!TYPE_IS_REFERENCE (value_type_arg_tmp))
return arg;
enc_type = check_typedef (value_enclosing_type (arg));
}
else if (VALUE_LVAL (val) == lval_register)
{
- struct frame_info *frame;
+ struct frame_info *next_frame;
int regnum;
struct type *type = check_typedef (value_type (val));
struct value *new_val = val, *mark = value_mark ();
while (VALUE_LVAL (new_val) == lval_register && value_lazy (new_val))
{
- struct frame_id frame_id = VALUE_FRAME_ID (new_val);
+ struct frame_id next_frame_id = VALUE_NEXT_FRAME_ID (new_val);
- frame = frame_find_by_id (frame_id);
+ next_frame = frame_find_by_id (next_frame_id);
regnum = VALUE_REGNUM (new_val);
- gdb_assert (frame != NULL);
+ gdb_assert (next_frame != NULL);
/* Convertible register routines are used for multi-register
values and for interpretation in different types
(e.g. float or int from a double register). Lazy
register values should have the register's natural type,
so they do not apply. */
- gdb_assert (!gdbarch_convert_register_p (get_frame_arch (frame),
+ gdb_assert (!gdbarch_convert_register_p (get_frame_arch (next_frame),
regnum, type));
- new_val = get_frame_register_value (frame, regnum);
+ /* FRAME was obtained, above, via VALUE_NEXT_FRAME_ID.
+ Since a "->next" operation was performed when setting
+ this field, we do not need to perform a "next" operation
+ again when unwinding the register. That's why
+ frame_unwind_register_value() is called here instead of
+ get_frame_register_value(). */
+ new_val = frame_unwind_register_value (next_frame, regnum);
/* If we get another lazy lval_register value, it means the
- register is found by reading it from the next frame.
- get_frame_register_value should never return a value with
- the frame id pointing to FRAME. If it does, it means we
+ register is found by reading it from NEXT_FRAME's next frame.
+ frame_unwind_register_value should never return a value with
+ the frame id pointing to NEXT_FRAME. If it does, it means we
either have two consecutive frames with the same frame id
in the frame chain, or some code is trying to unwind
behind get_prev_frame's back (e.g., a frame unwind
in this situation. */
if (VALUE_LVAL (new_val) == lval_register
&& value_lazy (new_val)
- && frame_id_eq (VALUE_FRAME_ID (new_val), frame_id))
+ && frame_id_eq (VALUE_NEXT_FRAME_ID (new_val), next_frame_id))
internal_error (__FILE__, __LINE__,
_("infinite loop while fetching a register"));
}
if (frame_debug)
{
struct gdbarch *gdbarch;
+ struct frame_info *frame;
+ /* VALUE_FRAME_ID is used here, instead of VALUE_NEXT_FRAME_ID,
+ so that the frame level will be shown correctly. */
frame = frame_find_by_id (VALUE_FRAME_ID (val));
regnum = VALUE_REGNUM (val);
gdbarch = get_frame_arch (frame);