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.
This commit is contained in:
Michael Snyder 2010-05-16 21:11:14 +00:00
parent a744cf537e
commit 123f5f96b6
8 changed files with 146 additions and 74 deletions

View file

@ -1,5 +1,12 @@
2010-05-16 Michael Snyder <msnyder@vmware.com> 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. * remote.c: White space.
(process_g_packet): Remove orphan braces. (process_g_packet): Remove orphan braces.

View file

@ -544,6 +544,7 @@ record_check_insn_num (int set_terminal)
if (record_stop_at_limit) if (record_stop_at_limit)
{ {
int q; int q;
if (set_terminal) if (set_terminal)
target_terminal_ours (); target_terminal_ours ();
q = yquery (_("Do you want to auto delete previous execution " q = yquery (_("Do you want to auto delete previous execution "
@ -1396,6 +1397,7 @@ record_registers_change (struct regcache *regcache, int regnum)
if (regnum < 0) if (regnum < 0)
{ {
int i; int i;
for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++) for (i = 0; i < gdbarch_num_regs (get_regcache_arch (regcache)); i++)
{ {
if (record_arch_list_add_reg (regcache, i)) if (record_arch_list_add_reg (regcache, i))
@ -1462,6 +1464,7 @@ record_store_registers (struct target_ops *ops, struct regcache *regcache,
if (regno < 0) if (regno < 0)
{ {
int i; int i;
for (i = 0; for (i = 0;
i < gdbarch_num_regs (get_regcache_arch (regcache)); i < gdbarch_num_regs (get_regcache_arch (regcache));
i++) i++)
@ -1747,85 +1750,84 @@ record_core_xfer_partial (struct target_ops *ops, enum target_object object,
const gdb_byte *writebuf, ULONGEST offset, const gdb_byte *writebuf, ULONGEST offset,
LONGEST len) LONGEST len)
{ {
if (object == TARGET_OBJECT_MEMORY) if (object == TARGET_OBJECT_MEMORY)
{ {
if (record_gdb_operation_disable || !writebuf) if (record_gdb_operation_disable || !writebuf)
{ {
struct target_section *p; 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) for (p = record_core_start; p < record_core_end; p++)
continue; {
if (offset >= p->addr)
{
struct record_core_buf_entry *entry;
ULONGEST sec_offset;
if (offset + len > p->endaddr) if (offset >= p->endaddr)
len = p->endaddr - offset; continue;
sec_offset = offset - p->addr; if (offset + len > p->endaddr)
len = p->endaddr - offset;
/* Read readbuf or write writebuf p, offset, len. */ sec_offset = offset - p->addr;
/* 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, /* Read readbuf or write writebuf p, offset, len. */
(size_t) len); /* Check flags. */
} if (p->the_bfd_section->flags & SEC_CONSTRUCTOR
else || (p->the_bfd_section->flags & SEC_HAS_CONTENTS) == 0)
{ {
if (!entry) if (readbuf)
return record_beneath_to_xfer_partial memset (readbuf, 0, len);
(record_beneath_to_xfer_partial_ops, return len;
object, annex, readbuf, writebuf, }
offset, 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 (readbuf, entry->buf + sec_offset, memcpy (entry->buf + sec_offset, writebuf,
(size_t) len); (size_t) len);
} }
else
{
if (!entry)
return record_beneath_to_xfer_partial
(record_beneath_to_xfer_partial_ops,
object, annex, readbuf, writebuf,
offset, len);
return len; memcpy (readbuf, entry->buf + sec_offset,
} (size_t) len);
} }
return -1; return len;
} }
else }
error (_("You can't do that without a process to debug."));
} 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, return record_beneath_to_xfer_partial (record_beneath_to_xfer_partial_ops,
object, annex, readbuf, writebuf, object, annex, readbuf, writebuf,
@ -2318,6 +2320,7 @@ record_save_cleanups (void *data)
{ {
bfd *obfd = data; bfd *obfd = data;
char *pathname = xstrdup (bfd_get_filename (obfd)); char *pathname = xstrdup (bfd_get_filename (obfd));
bfd_close (obfd); bfd_close (obfd);
unlink (pathname); unlink (pathname);
xfree (pathname); xfree (pathname);

View file

@ -123,6 +123,7 @@ init_regcache_descr (struct gdbarch *gdbarch)
{ {
long offset = 0; long offset = 0;
descr->sizeof_register descr->sizeof_register
= GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long); = GDBARCH_OBSTACK_CALLOC (gdbarch, descr->nr_cooked_registers, long);
descr->register_offset descr->register_offset
@ -161,6 +162,7 @@ struct type *
register_type (struct gdbarch *gdbarch, int regnum) register_type (struct gdbarch *gdbarch, int regnum)
{ {
struct regcache_descr *descr = regcache_descr (gdbarch); struct regcache_descr *descr = regcache_descr (gdbarch);
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers); gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
return descr->register_type[regnum]; return descr->register_type[regnum];
} }
@ -173,6 +175,7 @@ register_size (struct gdbarch *gdbarch, int regnum)
{ {
struct regcache_descr *descr = regcache_descr (gdbarch); struct regcache_descr *descr = regcache_descr (gdbarch);
int size; int size;
gdb_assert (regnum >= 0 gdb_assert (regnum >= 0
&& regnum < (gdbarch_num_regs (gdbarch) && regnum < (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch))); + gdbarch_num_pseudo_regs (gdbarch)));
@ -216,6 +219,7 @@ regcache_xmalloc (struct gdbarch *gdbarch, struct address_space *aspace)
{ {
struct regcache_descr *descr; struct regcache_descr *descr;
struct regcache *regcache; struct regcache *regcache;
gdb_assert (gdbarch != NULL); gdb_assert (gdbarch != NULL);
descr = regcache_descr (gdbarch); descr = regcache_descr (gdbarch);
regcache = XMALLOC (struct regcache); regcache = XMALLOC (struct regcache);
@ -281,6 +285,7 @@ regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
struct gdbarch *gdbarch = dst->descr->gdbarch; struct gdbarch *gdbarch = dst->descr->gdbarch;
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
int regnum; int regnum;
/* The DST should be `read-only', if it wasn't then the save would /* 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 end up trying to write the register values back out to the
target. */ target. */
@ -297,6 +302,7 @@ regcache_save (struct regcache *dst, regcache_cooked_read_ftype *cooked_read,
if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup)) if (gdbarch_register_reggroup_p (gdbarch, regnum, save_reggroup))
{ {
int valid = cooked_read (src, regnum, buf); int valid = cooked_read (src, regnum, buf);
if (valid) if (valid)
{ {
memcpy (register_buffer (dst, regnum), buf, memcpy (register_buffer (dst, regnum), buf,
@ -315,6 +321,7 @@ regcache_restore (struct regcache *dst,
struct gdbarch *gdbarch = dst->descr->gdbarch; struct gdbarch *gdbarch = dst->descr->gdbarch;
gdb_byte buf[MAX_REGISTER_SIZE]; gdb_byte buf[MAX_REGISTER_SIZE];
int regnum; int regnum;
/* The dst had better not be read-only. If it is, the `restore' /* The dst had better not be read-only. If it is, the `restore'
doesn't make much sense. */ doesn't make much sense. */
gdb_assert (!dst->readonly_p); gdb_assert (!dst->readonly_p);
@ -327,6 +334,7 @@ regcache_restore (struct regcache *dst,
if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup)) if (gdbarch_register_reggroup_p (gdbarch, regnum, restore_reggroup))
{ {
int valid = cooked_read (cooked_read_context, regnum, buf); int valid = cooked_read (cooked_read_context, regnum, buf);
if (valid) if (valid)
regcache_cooked_write (dst, regnum, buf); regcache_cooked_write (dst, regnum, buf);
} }
@ -337,6 +345,7 @@ static int
do_cooked_read (void *src, int regnum, gdb_byte *buf) do_cooked_read (void *src, int regnum, gdb_byte *buf)
{ {
struct regcache *regcache = src; struct regcache *regcache = src;
if (!regcache->register_valid_p[regnum] && regcache->readonly_p) if (!regcache->register_valid_p[regnum] && regcache->readonly_p)
/* Don't even think about fetching a register from a read-only /* 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 cache when the register isn't yet valid. There isn't a target
@ -382,6 +391,7 @@ struct regcache *
regcache_dup (struct regcache *src) regcache_dup (struct regcache *src)
{ {
struct regcache *newbuf; struct regcache *newbuf;
newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src)); newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src));
regcache_cpy (newbuf, src); regcache_cpy (newbuf, src);
return newbuf; return newbuf;
@ -391,6 +401,7 @@ struct regcache *
regcache_dup_no_passthrough (struct regcache *src) regcache_dup_no_passthrough (struct regcache *src)
{ {
struct regcache *newbuf; struct regcache *newbuf;
newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src)); newbuf = regcache_xmalloc (src->descr->gdbarch, get_regcache_aspace (src));
regcache_cpy_no_passthrough (newbuf, src); regcache_cpy_no_passthrough (newbuf, src);
return newbuf; return newbuf;
@ -573,6 +584,7 @@ regcache_raw_read (struct regcache *regcache, int regnum, gdb_byte *buf)
if (!regcache_valid_p (regcache, regnum)) if (!regcache_valid_p (regcache, regnum))
{ {
struct cleanup *old_chain = save_inferior_ptid (); struct cleanup *old_chain = save_inferior_ptid ();
inferior_ptid = regcache->ptid; inferior_ptid = regcache->ptid;
target_fetch_registers (regcache, regnum); target_fetch_registers (regcache, regnum);
do_cleanups (old_chain); do_cleanups (old_chain);
@ -596,6 +608,7 @@ void
regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val) regcache_raw_read_signed (struct regcache *regcache, int regnum, LONGEST *val)
{ {
gdb_byte *buf; gdb_byte *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -610,6 +623,7 @@ regcache_raw_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val) ULONGEST *val)
{ {
gdb_byte *buf; gdb_byte *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -623,6 +637,7 @@ void
regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val) regcache_raw_write_signed (struct regcache *regcache, int regnum, LONGEST val)
{ {
void *buf; void *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers); gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -636,6 +651,7 @@ regcache_raw_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val) ULONGEST val)
{ {
void *buf; void *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers); gdb_assert (regnum >=0 && regnum < regcache->descr->nr_raw_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -667,6 +683,7 @@ regcache_cooked_read_signed (struct regcache *regcache, int regnum,
LONGEST *val) LONGEST *val)
{ {
gdb_byte *buf; gdb_byte *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -681,6 +698,7 @@ regcache_cooked_read_unsigned (struct regcache *regcache, int regnum,
ULONGEST *val) ULONGEST *val)
{ {
gdb_byte *buf; gdb_byte *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers); gdb_assert (regnum >= 0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -695,6 +713,7 @@ regcache_cooked_write_signed (struct regcache *regcache, int regnum,
LONGEST val) LONGEST val)
{ {
void *buf; void *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -708,6 +727,7 @@ regcache_cooked_write_unsigned (struct regcache *regcache, int regnum,
ULONGEST val) ULONGEST val)
{ {
void *buf; void *buf;
gdb_assert (regcache != NULL); gdb_assert (regcache != NULL);
gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers); gdb_assert (regnum >=0 && regnum < regcache->descr->nr_cooked_registers);
buf = alloca (regcache->descr->sizeof_register[regnum]); buf = alloca (regcache->descr->sizeof_register[regnum]);
@ -781,6 +801,7 @@ regcache_xfer_part (struct regcache *regcache, int regnum,
{ {
struct regcache_descr *descr = regcache->descr; struct regcache_descr *descr = regcache->descr;
gdb_byte reg[MAX_REGISTER_SIZE]; gdb_byte reg[MAX_REGISTER_SIZE];
gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]); gdb_assert (offset >= 0 && offset <= descr->sizeof_register[regnum]);
gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]); gdb_assert (len >= 0 && offset + len <= descr->sizeof_register[regnum]);
/* Something to do? */ /* Something to do? */
@ -812,6 +833,7 @@ regcache_raw_read_part (struct regcache *regcache, int regnum,
int offset, int len, gdb_byte *buf) int offset, int len, gdb_byte *buf)
{ {
struct regcache_descr *descr = regcache->descr; struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers); gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL, regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
regcache_raw_read, regcache_raw_write); regcache_raw_read, regcache_raw_write);
@ -822,6 +844,7 @@ regcache_raw_write_part (struct regcache *regcache, int regnum,
int offset, int len, const gdb_byte *buf) int offset, int len, const gdb_byte *buf)
{ {
struct regcache_descr *descr = regcache->descr; struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers); gdb_assert (regnum >= 0 && regnum < descr->nr_raw_registers);
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf, regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
regcache_raw_read, regcache_raw_write); regcache_raw_read, regcache_raw_write);
@ -832,6 +855,7 @@ regcache_cooked_read_part (struct regcache *regcache, int regnum,
int offset, int len, gdb_byte *buf) int offset, int len, gdb_byte *buf)
{ {
struct regcache_descr *descr = regcache->descr; struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers); gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
regcache_xfer_part (regcache, regnum, offset, len, buf, NULL, regcache_xfer_part (regcache, regnum, offset, len, buf, NULL,
regcache_cooked_read, regcache_cooked_write); regcache_cooked_read, regcache_cooked_write);
@ -842,6 +866,7 @@ regcache_cooked_write_part (struct regcache *regcache, int regnum,
int offset, int len, const gdb_byte *buf) int offset, int len, const gdb_byte *buf)
{ {
struct regcache_descr *descr = regcache->descr; struct regcache_descr *descr = regcache->descr;
gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers); gdb_assert (regnum >= 0 && regnum < descr->nr_cooked_registers);
regcache_xfer_part (regcache, regnum, offset, len, NULL, buf, regcache_xfer_part (regcache, regnum, offset, len, NULL, buf,
regcache_cooked_read, regcache_cooked_write); regcache_cooked_read, regcache_cooked_write);
@ -903,6 +928,7 @@ regcache_read_pc (struct regcache *regcache)
else if (gdbarch_pc_regnum (gdbarch) >= 0) else if (gdbarch_pc_regnum (gdbarch) >= 0)
{ {
ULONGEST raw_val; ULONGEST raw_val;
regcache_cooked_read_unsigned (regcache, regcache_cooked_read_unsigned (regcache,
gdbarch_pc_regnum (gdbarch), gdbarch_pc_regnum (gdbarch),
&raw_val); &raw_val);
@ -948,6 +974,7 @@ dump_endian_bytes (struct ui_file *file, enum bfd_endian endian,
const unsigned char *buf, long len) const unsigned char *buf, long len)
{ {
int i; int i;
switch (endian) switch (endian)
{ {
case BFD_ENDIAN_BIG: case BFD_ENDIAN_BIG:
@ -1009,6 +1036,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
else else
{ {
const char *p = gdbarch_register_name (gdbarch, regnum); const char *p = gdbarch_register_name (gdbarch, regnum);
if (p == NULL) if (p == NULL)
p = ""; p = "";
else if (p[0] == '\0') else if (p[0] == '\0')
@ -1065,15 +1093,18 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
/* Type. */ /* Type. */
{ {
const char *t; const char *t;
if (regnum < 0) if (regnum < 0)
t = "Type"; t = "Type";
else else
{ {
static const char blt[] = "builtin_type"; static const char blt[] = "builtin_type";
t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum)); t = TYPE_NAME (register_type (regcache->descr->gdbarch, regnum));
if (t == NULL) if (t == NULL)
{ {
char *n; char *n;
if (!footnote_register_type_name_null) if (!footnote_register_type_name_null)
footnote_register_type_name_null = ++footnote_nr; footnote_register_type_name_null = ++footnote_nr;
n = xstrprintf ("*%d", footnote_register_type_name_null); n = xstrprintf ("*%d", footnote_register_type_name_null);
@ -1133,6 +1164,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
{ {
const char *sep = ""; const char *sep = "";
struct reggroup *group; struct reggroup *group;
for (group = reggroup_next (gdbarch, NULL); for (group = reggroup_next (gdbarch, NULL);
group != NULL; group != NULL;
group = reggroup_next (gdbarch, group)) group = reggroup_next (gdbarch, group))
@ -1171,6 +1203,7 @@ regcache_print (char *args, enum regcache_dump_what what_to_dump)
{ {
struct cleanup *cleanups; struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w"); struct ui_file *file = gdb_fopen (args, "w");
if (file == NULL) if (file == NULL)
perror_with_name (_("maintenance print architecture")); perror_with_name (_("maintenance print architecture"));
cleanups = make_cleanup_ui_file_delete (file); cleanups = make_cleanup_ui_file_delete (file);

View file

@ -41,6 +41,7 @@ struct reggroup *
reggroup_new (const char *name, enum reggroup_type type) reggroup_new (const char *name, enum reggroup_type type)
{ {
struct reggroup *group = XMALLOC (struct reggroup); struct reggroup *group = XMALLOC (struct reggroup);
group->name = name; group->name = name;
group->type = type; group->type = type;
return group; return group;
@ -81,6 +82,7 @@ reggroups_init (struct gdbarch *gdbarch)
{ {
struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct reggroups *groups = GDBARCH_OBSTACK_ZALLOC (gdbarch,
struct reggroups); struct reggroups);
groups->last = &groups->first; groups->last = &groups->first;
return groups; return groups;
} }
@ -190,6 +192,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
/* Group name. */ /* Group name. */
{ {
const char *name; const char *name;
if (group == NULL) if (group == NULL)
name = "Group"; name = "Group";
else else
@ -200,6 +203,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
/* Group type. */ /* Group type. */
{ {
const char *type; const char *type;
if (group == NULL) if (group == NULL)
type = "Type"; type = "Type";
else else
@ -240,6 +244,7 @@ maintenance_print_reggroups (char *args, int from_tty)
{ {
struct cleanup *cleanups; struct cleanup *cleanups;
struct ui_file *file = gdb_fopen (args, "w"); struct ui_file *file = gdb_fopen (args, "w");
if (file == NULL) if (file == NULL)
perror_with_name (_("maintenance print reggroups")); perror_with_name (_("maintenance print reggroups"));
cleanups = make_cleanup_ui_file_delete (file); cleanups = make_cleanup_ui_file_delete (file);

View file

@ -109,6 +109,7 @@ static int
remote_fileio_fd_to_targetfd (int fd) remote_fileio_fd_to_targetfd (int fd)
{ {
int target_fd = remote_fileio_next_free_fd (); int target_fd = remote_fileio_next_free_fd ();
remote_fio_data.fd_map[target_fd] = fd; remote_fio_data.fd_map[target_fd] = fd;
return target_fd; return target_fd;
} }
@ -1477,6 +1478,7 @@ set_system_call_allowed (char *args, int from_tty)
{ {
char *arg_end; char *arg_end;
int val = strtoul (args, &arg_end, 10); int val = strtoul (args, &arg_end, 10);
if (*args && *arg_end == '\0') if (*args && *arg_end == '\0')
{ {
remote_fio_system_call_allowed = !!val; remote_fio_system_call_allowed = !!val;

View file

@ -231,6 +231,7 @@ static int
send_cmd (unsigned char cmd) send_cmd (unsigned char cmd)
{ {
unsigned char buf[1]; unsigned char buf[1];
buf[0] = cmd; buf[0] = cmd;
return send_data (buf, 1); return send_data (buf, 1);
} }
@ -239,6 +240,7 @@ static int
send_one_arg_cmd (unsigned char cmd, unsigned char arg1) send_one_arg_cmd (unsigned char cmd, unsigned char arg1)
{ {
unsigned char buf[2]; unsigned char buf[2];
buf[0] = cmd; buf[0] = cmd;
buf[1] = arg1; buf[1] = arg1;
return send_data (buf, 2); return send_data (buf, 2);
@ -248,6 +250,7 @@ static int
send_two_arg_cmd (unsigned char cmd, unsigned char arg1, unsigned long arg2) send_two_arg_cmd (unsigned char cmd, unsigned char arg1, unsigned long arg2)
{ {
unsigned char buf[6]; unsigned char buf[6];
buf[0] = cmd; buf[0] = cmd;
buf[1] = arg1; buf[1] = arg1;
store_long_parameter (buf + 2, arg2); store_long_parameter (buf + 2, arg2);
@ -259,6 +262,7 @@ send_three_arg_cmd (unsigned char cmd, unsigned long arg1, unsigned long arg2,
unsigned long arg3) unsigned long arg3)
{ {
unsigned char buf[13]; unsigned char buf[13];
buf[0] = cmd; buf[0] = cmd;
store_long_parameter (buf + 1, arg1); store_long_parameter (buf + 1, arg1);
store_long_parameter (buf + 5, arg2); store_long_parameter (buf + 5, arg2);
@ -270,6 +274,7 @@ static unsigned char
recv_char_data (void) recv_char_data (void)
{ {
unsigned char val; unsigned char val;
recv_data (&val, 1); recv_data (&val, 1);
return val; return val;
} }
@ -278,6 +283,7 @@ static unsigned long
recv_long_data (void) recv_long_data (void)
{ {
unsigned long val; unsigned long val;
recv_data (&val, 4); recv_data (&val, 4);
return ntohl (val); return ntohl (val);
} }
@ -1463,6 +1469,7 @@ static int
m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p) m32r_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
{ {
int rc = 0; int rc = 0;
if (hit_watchpoint_addr != 0x00000000) if (hit_watchpoint_addr != 0x00000000)
{ {
*addr_p = hit_watchpoint_addr; *addr_p = hit_watchpoint_addr;
@ -1475,6 +1482,7 @@ static int
m32r_stopped_by_watchpoint (void) m32r_stopped_by_watchpoint (void)
{ {
CORE_ADDR addr; CORE_ADDR addr;
return m32r_stopped_data_address (&current_target, &addr); return m32r_stopped_data_address (&current_target, &addr);
} }

View file

@ -648,7 +648,7 @@ mips_readchar (int timeout)
static int state = 0; static int state = 0;
int mips_monitor_prompt_len = strlen (mips_monitor_prompt); int mips_monitor_prompt_len = strlen (mips_monitor_prompt);
{ { /* FIXME this whole block is dead code! */
int i; int i;
i = timeout; i = timeout;
@ -1348,6 +1348,7 @@ mips_enter_debug (void)
{ {
char buff[DATA_MAXLEN + 1]; char buff[DATA_MAXLEN + 1];
if (mips_receive_packet (buff, 1, 3) < 0) if (mips_receive_packet (buff, 1, 3) < 0)
mips_error ("Failed to initialize (didn't receive packet)."); mips_error ("Failed to initialize (didn't receive packet).");
} }
@ -2014,6 +2015,7 @@ mips_fetch_registers (struct target_ops *ops,
/* If PMON doesn't support this register, don't waste serial /* If PMON doesn't support this register, don't waste serial
bandwidth trying to read it. */ bandwidth trying to read it. */
int pmon_reg = mips_map_regno (gdbarch, regno); int pmon_reg = mips_map_regno (gdbarch, regno);
if (regno != 0 && pmon_reg == 0) if (regno != 0 && pmon_reg == 0)
val = 0; val = 0;
else else
@ -2182,6 +2184,7 @@ mips_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
for (i = 0; i < count; i++, addr += 4) for (i = 0; i < count; i++, addr += 4)
{ {
int word; int word;
word = extract_unsigned_integer (&buffer[i * 4], 4, byte_order); word = extract_unsigned_integer (&buffer[i * 4], 4, byte_order);
status = mips_store_word (addr, word, NULL); status = mips_store_word (addr, word, NULL);
/* Report each kilobyte (we download 32-bit words at a time) */ /* Report each kilobyte (we download 32-bit words at a time) */
@ -2467,6 +2470,7 @@ mips_check_lsi_error (CORE_ADDR addr, int rerrflg)
if (monitor_warnings) if (monitor_warnings)
{ {
int found = 0; int found = 0;
for (err = lsi_warning_table; err->code != 0; err++) for (err = lsi_warning_table; err->code != 0; err++)
{ {
if ((err->code & rerrflg) == err->code) if ((err->code & rerrflg) == err->code)
@ -2657,6 +2661,7 @@ mips_common_breakpoint: Bad response from remote board: %s",
if (set) /* set a breakpoint */ if (set) /* set a breakpoint */
{ {
char *flags; char *flags;
switch (type) switch (type)
{ {
case BREAK_WRITE: /* write */ case BREAK_WRITE: /* write */
@ -3095,6 +3100,7 @@ pmon_make_fastrec (char **outbuf, unsigned char *inbuf, int *inptr,
else else
{ {
unsigned int value = ((inbuf[*inptr + 0] << 16) | (inbuf[*inptr + 1] << 8) | inbuf[*inptr + 2]); 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 /* Simple check for zero data. TODO: A better check would be
to check the last, and then the middle byte for being zero to check the last, and then the middle byte for being zero
(if the first byte is not). We could then check for (if the first byte is not). We could then check for
@ -3203,6 +3209,7 @@ static void
pmon_check_entry_address (char *entry_address, int final) pmon_check_entry_address (char *entry_address, int final)
{ {
char hexnumber[9]; /* includes '\0' space */ char hexnumber[9]; /* includes '\0' space */
mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout); mips_expect_timeout (entry_address, tftp_in_use ? 15 : remote_timeout);
sprintf (hexnumber, "%x", final); sprintf (hexnumber, "%x", final);
mips_expect (hexnumber); mips_expect (hexnumber);
@ -3217,6 +3224,7 @@ static int
pmon_check_total (int bintotal) pmon_check_total (int bintotal)
{ {
char hexnumber[9]; /* includes '\0' space */ char hexnumber[9]; /* includes '\0' space */
mips_expect ("\r\ntotal = 0x"); mips_expect ("\r\ntotal = 0x");
sprintf (hexnumber, "%x", bintotal); sprintf (hexnumber, "%x", bintotal);
mips_expect (hexnumber); mips_expect (hexnumber);

View file

@ -123,6 +123,7 @@ dump_mem (char *buf, int len)
if (len == 8 || len == 4) if (len == 8 || len == 4)
{ {
long l[2]; long l[2];
memcpy (l, buf, len); memcpy (l, buf, len);
printf_filtered ("\t0x%lx", l[0]); printf_filtered ("\t0x%lx", l[0]);
if (len == 8) if (len == 8)
@ -132,6 +133,7 @@ dump_mem (char *buf, int len)
else else
{ {
int i; int i;
printf_filtered ("\t"); printf_filtered ("\t");
for (i = 0; i < len; i++) for (i = 0; i < len; i++)
printf_filtered ("0x%x ", buf[i]); printf_filtered ("0x%x ", buf[i]);
@ -229,10 +231,9 @@ static void
gdb_os_printf_filtered (host_callback * p, const char *format,...) gdb_os_printf_filtered (host_callback * p, const char *format,...)
{ {
va_list args; va_list args;
va_start (args, format); va_start (args, format);
vfprintf_filtered (gdb_stdout, format, args); vfprintf_filtered (gdb_stdout, format, args);
va_end (args); va_end (args);
} }
@ -258,6 +259,7 @@ static void
gdb_os_error (host_callback * p, const char *format, ...) gdb_os_error (host_callback * p, const char *format, ...)
{ {
va_list args; va_list args;
va_start (args, format); va_start (args, format);
verror (format, args); verror (format, args);
va_end (args); va_end (args);
@ -276,6 +278,7 @@ gdbsim_fetch_register (struct target_ops *ops,
struct regcache *regcache, int regno) struct regcache *regcache, int regno)
{ {
struct gdbarch *gdbarch = get_regcache_arch (regcache); struct gdbarch *gdbarch = get_regcache_arch (regcache);
if (regno == -1) if (regno == -1)
{ {
for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++) for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
@ -293,6 +296,7 @@ gdbsim_fetch_register (struct target_ops *ops,
as an ``unavailable'' register. */ as an ``unavailable'' register. */
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
int nr_bytes; int nr_bytes;
memset (buf, 0, MAX_REGISTER_SIZE); memset (buf, 0, MAX_REGISTER_SIZE);
regcache_raw_supply (regcache, regno, buf); regcache_raw_supply (regcache, regno, buf);
break; break;
@ -303,6 +307,7 @@ gdbsim_fetch_register (struct target_ops *ops,
static int warn_user = 1; static int warn_user = 1;
char buf[MAX_REGISTER_SIZE]; char buf[MAX_REGISTER_SIZE];
int nr_bytes; int nr_bytes;
gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch)); gdb_assert (regno >= 0 && regno < gdbarch_num_regs (gdbarch));
memset (buf, 0, MAX_REGISTER_SIZE); memset (buf, 0, MAX_REGISTER_SIZE);
nr_bytes = sim_fetch_register (gdbsim_desc, nr_bytes = sim_fetch_register (gdbsim_desc,
@ -355,6 +360,7 @@ gdbsim_store_register (struct target_ops *ops,
{ {
char tmp[MAX_REGISTER_SIZE]; char tmp[MAX_REGISTER_SIZE];
int nr_bytes; int nr_bytes;
regcache_cooked_read (regcache, regno, tmp); regcache_cooked_read (regcache, regno, tmp);
nr_bytes = sim_store_register (gdbsim_desc, nr_bytes = sim_store_register (gdbsim_desc,
gdbarch_register_sim_regno gdbarch_register_sim_regno