/* Target-dependent code for the IQ2000 architecture, for GDB, the GNU
Debugger.
- Copyright (C) 2000-2020 Free Software Foundation, Inc.
+ Copyright (C) 2000-2021 Free Software Foundation, Inc.
Contributed by Red Hat.
{
LONGEST insn = read_memory_unsigned_integer (pc, 4, byte_order);
/* Skip any instructions writing to (sp) or decrementing the
- SP. */
+ SP. */
if ((insn & 0xffe00000) == 0xac200000)
{
/* sw using SP/%1 as base. */
}
/* Unknown instruction encountered in frame. Bail out?
- 1) If we have a subsequent line symbol, we can keep going.
- 2) If not, we need to bail out and quit scanning instructions. */
+ 1) If we have a subsequent line symbol, we can keep going.
+ 2) If not, we need to bail out and quit scanning instructions. */
if (fi && sal.end && (pc < sal.end)) /* Keep scanning. */
continue;
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1)
return frame_unwind_got_memory (this_frame, regnum,
- cache->saved_regs[regnum]);
+ cache->saved_regs[regnum]);
return frame_unwind_got_register (this_frame, regnum, regnum);
}
}
static const struct frame_unwind iq2000_frame_unwind = {
+ "iq2000 prologue",
NORMAL_FRAME,
default_frame_unwind_stop_reason,
iq2000_frame_this_id,
if (type->num_fields () != 1)
return 1;
/* Get field type. */
- ftype = (TYPE_FIELDS (type))[0].type;
+ ftype = type->field (0).type ();
/* The field type must have size 8, otherwise pass by address. */
if (TYPE_LENGTH (ftype) != 8)
return 1;
static CORE_ADDR
iq2000_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
- struct regcache *regcache, CORE_ADDR bp_addr,
- int nargs, struct value **args, CORE_ADDR sp,
+ struct regcache *regcache, CORE_ADDR bp_addr,
+ int nargs, struct value **args, CORE_ADDR sp,
function_call_return_method return_method,
CORE_ADDR struct_addr)
{
type = value_type (args[i]);
typelen = TYPE_LENGTH (type);
if (typelen <= 4)
- {
- /* Scalars of up to 4 bytes,
- structs of up to 4 bytes, and
- pointers. */
- if (argreg <= E_LAST_ARGREG)
- argreg++;
- else
- stackspace += 4;
- }
+ {
+ /* Scalars of up to 4 bytes,
+ structs of up to 4 bytes, and
+ pointers. */
+ if (argreg <= E_LAST_ARGREG)
+ argreg++;
+ else
+ stackspace += 4;
+ }
else if (typelen == 8 && !iq2000_pass_8bytetype_by_address (type))
- {
- /* long long,
- double, and possibly
- structs with a single field of long long or double. */
- if (argreg <= E_LAST_ARGREG - 1)
- {
- /* 8-byte arg goes into a register pair
- (must start with an even-numbered reg). */
- if (((argreg - E_1ST_ARGREG) % 2) != 0)
- argreg ++;
- argreg += 2;
- }
- else
- {
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
- /* 8-byte arg goes on stack, must be 8-byte aligned. */
- stackspace = ((stackspace + 7) & ~7);
- stackspace += 8;
- }
- }
+ {
+ /* long long,
+ double, and possibly
+ structs with a single field of long long or double. */
+ if (argreg <= E_LAST_ARGREG - 1)
+ {
+ /* 8-byte arg goes into a register pair
+ (must start with an even-numbered reg). */
+ if (((argreg - E_1ST_ARGREG) % 2) != 0)
+ argreg ++;
+ argreg += 2;
+ }
+ else
+ {
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ /* 8-byte arg goes on stack, must be 8-byte aligned. */
+ stackspace = ((stackspace + 7) & ~7);
+ stackspace += 8;
+ }
+ }
else
{
/* Structs are passed as pointer to a copy of the struct.
So we need room on the stack for a copy of the struct
plus for the argument pointer. */
- if (argreg <= E_LAST_ARGREG)
- argreg++;
- else
- stackspace += 4;
+ if (argreg <= E_LAST_ARGREG)
+ argreg++;
+ else
+ stackspace += 4;
/* Care for 8-byte alignment of structs saved on stack. */
stackspace += ((typelen + 7) & ~7);
}
typelen = TYPE_LENGTH (type);
val = value_contents (args[i]);
if (typelen <= 4)
- {
- /* Char, short, int, float, pointer, and structs <= four bytes. */
+ {
+ /* Char, short, int, float, pointer, and structs <= four bytes. */
slacklen = (4 - (typelen % 4)) % 4;
memset (buf, 0, sizeof (buf));
memcpy (buf + slacklen, val, typelen);
- if (argreg <= E_LAST_ARGREG)
- {
- /* Passed in a register. */
+ if (argreg <= E_LAST_ARGREG)
+ {
+ /* Passed in a register. */
regcache->raw_write (argreg++, buf);
- }
- else
- {
- /* Passed on the stack. */
- write_memory (sp + stackspace, buf, 4);
- stackspace += 4;
- }
- }
+ }
+ else
+ {
+ /* Passed on the stack. */
+ write_memory (sp + stackspace, buf, 4);
+ stackspace += 4;
+ }
+ }
else if (typelen == 8 && !iq2000_pass_8bytetype_by_address (type))
- {
- /* (long long), (double), or struct consisting of
- a single (long long) or (double). */
- if (argreg <= E_LAST_ARGREG - 1)
- {
- /* 8-byte arg goes into a register pair
- (must start with an even-numbered reg). */
- if (((argreg - E_1ST_ARGREG) % 2) != 0)
- argreg++;
+ {
+ /* (long long), (double), or struct consisting of
+ a single (long long) or (double). */
+ if (argreg <= E_LAST_ARGREG - 1)
+ {
+ /* 8-byte arg goes into a register pair
+ (must start with an even-numbered reg). */
+ if (((argreg - E_1ST_ARGREG) % 2) != 0)
+ argreg++;
regcache->raw_write (argreg++, val);
regcache->raw_write (argreg++, val + 4);
- }
- else
- {
- /* 8-byte arg goes on stack, must be 8-byte aligned. */
- argreg = E_LAST_ARGREG + 1; /* no more argregs. */
- stackspace = ((stackspace + 7) & ~7);
- write_memory (sp + stackspace, val, typelen);
- stackspace += 8;
- }
- }
+ }
+ else
+ {
+ /* 8-byte arg goes on stack, must be 8-byte aligned. */
+ argreg = E_LAST_ARGREG + 1; /* no more argregs. */
+ stackspace = ((stackspace + 7) & ~7);
+ write_memory (sp + stackspace, val, typelen);
+ stackspace += 8;
+ }
+ }
else
- {
+ {
/* Store struct beginning at the upper end of the previously
computed stack space. Then store the address of the struct
using the usual rules for a 4 byte value. */
write_memory (sp + stackspace, buf, 4);
stackspace += 4;
}
- }
+ }
}
/* Store return address. */