* record.c: White space.
* regcache.c: White space.
* reggroups.c: White space.
* remote-fileio.c: White space.
* remote-m32r-sdi.c: White space.
* remote-mips.c: White space.
* remote-sim.c: White space.
2010-05-16 Michael Snyder <msnyder@vmware.com>
+ * record.c: White space.
+ * regcache.c: White space.
+ * reggroups.c: White space.
+ * remote-fileio.c: White space.
+ * remote-m32r-sdi.c: White space.
+ * remote-mips.c: White space.
+ * remote-sim.c: White space.
* remote.c: White space.
(process_g_packet): Remove orphan braces.
if (record_stop_at_limit)
{
int q;
+
if (set_terminal)
target_terminal_ours ();
q = yquery (_("Do you want to auto delete previous execution "
if (regnum < 0)
{
int i;
+
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
{
if (record_arch_list_add_reg (regcache, i))
if (regno < 0)
{
int i;
+
for (i = 0;
i < gdbarch_num_regs (get_regcache_arch (regcache));
i++)
const gdb_byte *writebuf, ULONGEST offset,
LONGEST len)
{
- if (object == TARGET_OBJECT_MEMORY)
- {
- if (record_gdb_operation_disable || !writebuf)
- {
- struct target_section *p;
- for (p = record_core_start; p < record_core_end; p++)
- {
- if (offset >= p->addr)
- {
- struct record_core_buf_entry *entry;
- ULONGEST sec_offset;
-
- if (offset >= p->endaddr)
- continue;
-
- if (offset + len > p->endaddr)
- len = p->endaddr - offset;
-
- sec_offset = offset - p->addr;
-
- /* Read readbuf or write writebuf p, offset, len. */
- /* Check flags. */
- if (p->the_bfd_section->flags & SEC_CONSTRUCTOR
- || (p->the_bfd_section->flags & SEC_HAS_CONTENTS) == 0)
- {
- if (readbuf)
- memset (readbuf, 0, len);
- return len;
- }
- /* Get record_core_buf_entry. */
- for (entry = record_core_buf_list; entry;
- entry = entry->prev)
- if (entry->p == p)
- break;
- if (writebuf)
- {
- if (!entry)
- {
- /* Add a new entry. */
- entry
- = (struct record_core_buf_entry *)
- xmalloc
- (sizeof (struct record_core_buf_entry));
- entry->p = p;
- if (!bfd_malloc_and_get_section (p->bfd,
- p->the_bfd_section,
- &entry->buf))
- {
- xfree (entry);
- return 0;
- }
- entry->prev = record_core_buf_list;
- record_core_buf_list = entry;
- }
-
- memcpy (entry->buf + sec_offset, writebuf,
- (size_t) len);
- }
- else
- {
- if (!entry)
- return record_beneath_to_xfer_partial
- (record_beneath_to_xfer_partial_ops,
- object, annex, readbuf, writebuf,
- offset, len);
-
- memcpy (readbuf, entry->buf + sec_offset,
- (size_t) len);
- }
-
- return len;
- }
- }
-
- return -1;
- }
- else
- error (_("You can't do that without a process to debug."));
- }
+ if (object == TARGET_OBJECT_MEMORY)
+ {
+ if (record_gdb_operation_disable || !writebuf)
+ {
+ struct target_section *p;
+
+ for (p = record_core_start; p < record_core_end; p++)
+ {
+ if (offset >= p->addr)
+ {
+ struct record_core_buf_entry *entry;
+ ULONGEST sec_offset;
+
+ if (offset >= p->endaddr)
+ continue;
+
+ if (offset + len > p->endaddr)
+ len = p->endaddr - offset;
+
+ sec_offset = offset - p->addr;
+
+ /* Read readbuf or write writebuf p, offset, len. */
+ /* Check flags. */
+ if (p->the_bfd_section->flags & SEC_CONSTRUCTOR
+ || (p->the_bfd_section->flags & SEC_HAS_CONTENTS) == 0)
+ {
+ if (readbuf)
+ memset (readbuf, 0, len);
+ return len;
+ }
+ /* Get record_core_buf_entry. */
+ for (entry = record_core_buf_list; entry;
+ entry = entry->prev)
+ if (entry->p == p)
+ break;
+ if (writebuf)
+ {
+ if (!entry)
+ {
+ /* Add a new entry. */
+ entry = (struct record_core_buf_entry *)
+ xmalloc (sizeof (struct record_core_buf_entry));
+ entry->p = p;
+ if (!bfd_malloc_and_get_section (p->bfd,
+ p->the_bfd_section,
+ &entry->buf))
+ {
+ xfree (entry);
+ return 0;
+ }
+ entry->prev = record_core_buf_list;
+ record_core_buf_list = entry;
+ }
+
+ memcpy (entry->buf + sec_offset, writebuf,
+ (size_t) len);
+ }
+ else
+ {
+ if (!entry)
+ return record_beneath_to_xfer_partial
+ (record_beneath_to_xfer_partial_ops,
+ object, annex, readbuf, writebuf,
+ offset, len);
+
+ memcpy (readbuf, entry->buf + sec_offset,
+ (size_t) len);
+ }
+
+ return len;
+ }
+ }
+
+ return -1;
+ }
+ else
+ error (_("You can't do that without a process to debug."));
+ }
return record_beneath_to_xfer_partial (record_beneath_to_xfer_partial_ops,
object, annex, readbuf, writebuf,
{
bfd *obfd = data;
char *pathname = xstrdup (bfd_get_filename (obfd));
+
bfd_close (obfd);
unlink (pathname);
xfree (pathname);
{
long offset = 0;
+
descr->sizeof_register
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
descr->register_offset
register_type (struct gdbarch *gdbarch, int regnum)
{
struct regcache_descr *descr = regcache_descr (gdbarch);
+
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
return descr->register_type[regnum];
}
{
struct regcache_descr *descr = regcache_descr (gdbarch);
int size;
+
gdb_assert (regnum >= 0
&& regnum < (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch)));
{
struct regcache_descr *descr;
struct regcache *regcache;
+
gdb_assert (gdbarch != NULL);
descr = regcache_descr (gdbarch);
regcache = XMALLOC (struct regcache);
struct gdbarch *gdbarch = dst->descr->gdbarch;
gdb_byte buf[MAX_REGISTER_SIZE];
int regnum;
+
/* The DST should be `read-only', if it wasn't then the save would
end up trying to write the register values back out to the
target. */
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
{
int valid = cooked_read (src, regnum, buf);
+
if (valid)
{
memcpy (register_buffer (dst, regnum), buf,
struct gdbarch *gdbarch = dst->descr->gdbarch;
gdb_byte buf[MAX_REGISTER_SIZE];
int regnum;
+
/* The dst had better not be read-only. If it is, the `restore'
doesn't make much sense. */
gdb_assert (!dst->readonly_p);
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{
int valid = cooked_read (cooked_read_context, regnum, buf);
+
if (valid)
regcache_cooked_write (dst, regnum, buf);
}
do_cooked_read (void *src, int regnum, gdb_byte *buf)
{
struct regcache *regcache = src;
+
if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
/* Don't even think about fetching a register from a read-only
cache when the register isn't yet valid. There isn't a target
regcache_dup (struct regcache *src)
{
struct regcache *newbuf;
+
newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src));
regcache_cpy (newbuf, src);
return newbuf;
regcache_dup_no_passthrough (struct regcache *src)
{
struct regcache *newbuf;
+
newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src));
regcache_cpy_no_passthrough (newbuf, src);
return newbuf;
if (!regcache_valid_p (regcache, regnum))
{
struct cleanup *old_chain = save_inferior_ptid ();
+
inferior_ptid = regcache->ptid;
target_fetch_registers (regcache, regnum);
do_cleanups (old_chain);
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
{
gdb_byte *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
ULONGEST *val)
{
gdb_byte *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
{
void *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
ULONGEST val)
{
void *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
LONGEST *val)
{
gdb_byte *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
ULONGEST *val)
{
gdb_byte *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
LONGEST val)
{
void *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
ULONGEST val)
{
void *buf;
+
gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]);
{
struct regcache_descr *descr = regcache->descr;
gdb_byte reg[MAX_REGISTER_SIZE];
+
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
/* Something to do? */
int offset, int len, gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
+
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
regcache_raw_read, regcache_raw_write);
int offset, int len, const gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
+
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
regcache_raw_read, regcache_raw_write);
int offset, int len, gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
+
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
regcache_cooked_read, regcache_cooked_write);
int offset, int len, const gdb_byte *buf)
{
struct regcache_descr *descr = regcache->descr;
+
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
regcache_cooked_read, regcache_cooked_write);
else if (gdbarch_pc_regnum (gdbarch) >= 0)
{
ULONGEST raw_val;
+
regcache_cooked_read_unsigned (regcache,
gdbarch_pc_regnum (gdbarch),
&raw_val);
const unsigned char *buf, long len)
{
int i;
+
switch (endian)
{
case BFD_ENDIAN_BIG:
else
{
const char *p = gdbarch_register_name (gdbarch, regnum);
+
if (p == NULL)
p = "";
else if (p[0] == '\0')
/* Type. */
{
const char *t;
+
if (regnum < 0)
t = "Type";
else
{
static const char blt[] = "builtin_type";
+
t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
if (t == NULL)
{
char *n;
+
if (!footnote_register_type_name_null)
footnote_register_type_name_null = ++footnote_nr;
n = xstrprintf ("*%d", footnote_register_type_name_null);
{
const char *sep = "";
struct reggroup *group;
+
for (group = reggroup_next (gdbarch, NULL);
group != NULL;
group = reggroup_next (gdbarch, group))
{
struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w");
+
if (file == NULL)
perror_with_name (_("maintenance print architecture"));
cleanups = make_cleanup_ui_file_delete (file);
reggroup_new (const char *name, enum reggroup_type type)
{
struct reggroup *group = XMALLOC (struct reggroup);
+
group->name = name;
group->type = type;
return group;
{
struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch,
struct reggroups);
+
groups->last = &groups->first;
return groups;
}
/* Group name. */
{
const char *name;
+
if (group == NULL)
name = "Group";
else
/* Group type. */
{
const char *type;
+
if (group == NULL)
type = "Type";
else
{
struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w");
+
if (file == NULL)
perror_with_name (_("maintenance print reggroups"));
cleanups = make_cleanup_ui_file_delete (file);
remote_fileio_fd_to_targetfd (int fd)
{
int target_fd = remote_fileio_next_free_fd ();
+
remote_fio_data.fd_map[target_fd] = fd;
return target_fd;
}
{
char *arg_end;
int val = strtoul (args, &arg_end, 10);
+
if (*args && *arg_end == '\0')
{
remote_fio_system_call_allowed = !!val;
send_cmd (unsigned char cmd)
{
unsigned char buf[1];
+
buf[0] = cmd;
return send_data (buf, 1);
}
send_one_arg_cmd (unsigned char cmd, unsigned char arg1)
{
unsigned char buf[2];
+
buf[0] = cmd;
buf[1] = arg1;
return send_data (buf, 2);
send_two_arg_cmd (unsigned char cmd, unsigned char arg1, unsigned long arg2)
{
unsigned char buf[6];
+
buf[0] = cmd;
buf[1] = arg1;
store_long_parameter (buf + 2, arg2);
unsigned long arg3)
{
unsigned char buf[13];
+
buf[0] = cmd;
store_long_parameter (buf + 1, arg1);
store_long_parameter (buf + 5, arg2);
recv_char_data (void)
{
unsigned char val;
+
recv_data (&val, 1);
return val;
}
recv_long_data (void)
{
unsigned long val;
+
recv_data (&val, 4);
return ntohl (val);
}
m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{
int rc = 0;
+
if (hit_watchpoint_addr != 0x00000000)
{
*addr_p = hit_watchpoint_addr;
m32r_stopped_by_watchpoint (void)
{
CORE_ADDR addr;
+
return m32r_stopped_data_address (¤t_target, &addr);
}
static int state = 0;
int mips_monitor_prompt_len = strlen (mips_monitor_prompt);
- {
+ { /* FIXME this whole block is dead code! */
int i;
i = timeout;
{
char buff[DATA_MAXLEN + 1];
+
if (mips_receive_packet (buff, 1, 3) < 0)
mips_error ("Failed to initialize (didn't receive packet).");
}
/* If PMON doesn't support this register, don't waste serial
bandwidth trying to read it. */
int pmon_reg = mips_map_regno (gdbarch, regno);
+
if (regno != 0 && pmon_reg == 0)
val = 0;
else
for (i = 0; i < count; i++, addr += 4)
{
int word;
+
word = extract_unsigned_integer (&buffer[i * 4], 4, byte_order);
status = mips_store_word (addr, word, NULL);
/* Report each kilobyte (we download 32-bit words at a time) */
if (monitor_warnings)
{
int found = 0;
+
for (err = lsi_warning_table; err->code != 0; err++)
{
if ((err->code & rerrflg) == err->code)
if (set) /* set a breakpoint */
{
char *flags;
+
switch (type)
{
case BREAK_WRITE: /* write */
else
{
unsigned int value = ((inbuf[*inptr + 0] << 16) | (inbuf[*inptr + 1] << 8) | inbuf[*inptr + 2]);
+
/* Simple check for zero data. TODO: A better check would be
to check the last, and then the middle byte for being zero
(if the first byte is not). We could then check for
pmon_check_entry_address (char *entry_address, int final)
{
char hexnumber[9]; /* includes '\0' space */
+
mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout);
sprintf (hexnumber, "%x", final);
mips_expect (hexnumber);
pmon_check_total (int bintotal)
{
char hexnumber[9]; /* includes '\0' space */
+
mips_expect ("\r\ntotal = 0x");
sprintf (hexnumber, "%x", bintotal);
mips_expect (hexnumber);
if (len == 8 || len == 4)
{
long l[2];
+
memcpy (l, buf, len);
printf_filtered ("\t0x%lx", l[0]);
if (len == 8)
else
{
int i;
+
printf_filtered ("\t");
for (i = 0; i < len; i++)
printf_filtered ("0x%x ", buf[i]);
gdb_os_printf_filtered (host_callback * p, const char *format,...)
{
va_list args;
- va_start (args, format);
+ va_start (args, format);
vfprintf_filtered (gdb_stdout, format, args);
-
va_end (args);
}
gdb_os_error (host_callback * p, const char *format, ...)
{
va_list args;
+
va_start (args, format);
verror (format, args);
va_end (args);
struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
+
if (regno == -1)
{
for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
as an ``unavailable'' register. */
char buf[MAX_REGISTER_SIZE];
int nr_bytes;
+
memset (buf, 0, MAX_REGISTER_SIZE);
regcache_raw_supply (regcache, regno, buf);
break;
static int warn_user = 1;
char buf[MAX_REGISTER_SIZE];
int nr_bytes;
+
gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch));
memset (buf, 0, MAX_REGISTER_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc,
{
char tmp[MAX_REGISTER_SIZE];
int nr_bytes;
+
regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc,
gdbarch_register_sim_regno