2010-05-16 Michael Snyder <msnyder@vmware.com>

* target.c: White space.
	* target-descriptions.c: White space.
	* target-memory.c: White space.
	* thread.c: White space.
	* top.c: White space.
	* tracepoint.c: White space.
	* trad-frame.c: White space.
	* tramp-frame.c: White space.
	* ui-file.c: White space.
	* ui-out.c: White space.
	* user-regs.c: White space.
	* utils.c: White space.
This commit is contained in:
Michael Snyder 2010-05-17 01:15:20 +00:00
parent 3a6f1766e1
commit 5d5021647d
13 changed files with 145 additions and 29 deletions

View File

@ -1,5 +1,18 @@
2010-05-16 Michael Snyder <msnyder@vmware.com>
* target.c: White space.
* target-descriptions.c: White space.
* target-memory.c: White space.
* thread.c: White space.
* top.c: White space.
* tracepoint.c: White space.
* trad-frame.c: White space.
* tramp-frame.c: White space.
* ui-file.c: White space.
* ui-out.c: White space.
* user-regs.c: White space.
* utils.c: White space.
* scm-exp.c: White space.
* scm-lang.c: White space.
* scm-valprint.c: White space.

View File

@ -864,6 +864,7 @@ static struct tdesc_reg *
tdesc_find_register (struct gdbarch *gdbarch, int regno)
{
struct tdesc_arch_reg *reg = tdesc_find_arch_register (gdbarch, regno);
return reg? reg->reg : NULL;
}
@ -883,6 +884,7 @@ tdesc_register_name (struct gdbarch *gdbarch, int regno)
if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
{
struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
gdb_assert (data->pseudo_register_name != NULL);
return data->pseudo_register_name (gdbarch, regno);
}
@ -901,6 +903,7 @@ tdesc_register_type (struct gdbarch *gdbarch, int regno)
if (reg == NULL && regno >= num_regs && regno < num_regs + num_pseudo_regs)
{
struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
gdb_assert (data->pseudo_register_type != NULL);
return data->pseudo_register_type (gdbarch, regno);
}
@ -1038,6 +1041,7 @@ tdesc_register_reggroup_p (struct gdbarch *gdbarch, int regno,
if (regno >= num_regs && regno < num_regs + num_pseudo_regs)
{
struct tdesc_arch_data *data = gdbarch_data (gdbarch, tdesc_data);
if (data->pseudo_register_reggroup_p != NULL)
return data->pseudo_register_reggroup_p (gdbarch, regno, reggroup);
/* Otherwise fall through to the default reggroup_p. */
@ -1198,7 +1202,6 @@ tdesc_create_reg (struct tdesc_feature *feature, const char *name,
static void
tdesc_free_type (struct tdesc_type *type)
{
switch (type->kind)
{
case TDESC_TYPE_STRUCT:

View File

@ -84,6 +84,7 @@ claim_memory (VEC(memory_write_request_s) *blocks,
{
struct memory_write_request *n =
VEC_safe_push (memory_write_request_s, *result, NULL);
*n = *r;
n->begin = claimed_begin;
n->end = claimed_end;
@ -116,8 +117,8 @@ split_regular_and_flash_blocks (VEC(memory_write_request_s) *blocks,
while (1)
{
VEC(memory_write_request_s) **r;
region = lookup_mem_region (cur_address);
region = lookup_mem_region (cur_address);
r = region->attrib.mode == MEM_FLASH ? flash_blocks : regular_blocks;
cur_address = region->hi;
claim_memory (blocks, r, region->lo, region->hi);
@ -175,6 +176,7 @@ blocks_to_erase (VEC(memory_write_request_s) *written)
{
struct memory_write_request *n =
VEC_safe_push (memory_write_request_s, result, NULL);
memset (n, 0, sizeof (struct memory_write_request));
n->begin = begin;
n->end = end;
@ -255,6 +257,7 @@ compute_garbled_blocks (VEC(memory_write_request_s) *erased_blocks,
{
struct memory_write_request *n =
VEC_safe_push (memory_write_request_s, result, NULL);
memset (n, 0, sizeof (struct memory_write_request));
n->begin = erased.begin;
n->end = written->begin;
@ -300,6 +303,7 @@ static void
cleanup_write_requests_vector (void *p)
{
VEC(memory_write_request_s) **v = p;
VEC_free (memory_write_request_s, *v);
}

View File

@ -457,6 +457,7 @@ target_create_inferior (char *exec_file, char *args,
char **env, int from_tty)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_create_inferior != NULL)
@ -908,6 +909,7 @@ push_target (struct target_ops *t)
/* There's already something at this stratum level. Close it,
and un-hook it from the stack. */
struct target_ops *tmp = (*cur);
(*cur) = (*cur)->beneath;
tmp->beneath = NULL;
target_close (tmp, 0);
@ -976,7 +978,8 @@ pop_target (void)
fprintf_unfiltered (gdb_stderr,
"pop_target couldn't find target %s\n",
current_target.to_shortname);
internal_error (__FILE__, __LINE__, _("failed internal consistency check"));
internal_error (__FILE__, __LINE__,
_("failed internal consistency check"));
}
void
@ -1148,6 +1151,7 @@ target_read_string (CORE_ADDR memaddr, char **string, int len, int *errnop)
if (bufptr - buffer + tlen > buffer_allocated)
{
unsigned int bytes;
bytes = bufptr - buffer;
buffer_allocated *= 2;
buffer = xrealloc (buffer, buffer_allocated);
@ -1231,11 +1235,13 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
if (readbuf != NULL && overlay_debugging)
{
struct obj_section *section = find_pc_overlay (memaddr);
if (pc_in_unmapped_range (memaddr, section))
{
struct target_section_table *table
= target_get_section_table (ops);
const char *section_name = section->the_bfd_section->name;
memaddr = overlay_mapped_address (memaddr, section);
return section_table_xfer_memory_partial (readbuf, writebuf,
memaddr, len,
@ -1386,8 +1392,8 @@ struct cleanup *
make_show_memory_breakpoints_cleanup (int show)
{
int current = show_memory_breakpoints;
show_memory_breakpoints = show;
show_memory_breakpoints = show;
return make_cleanup (restore_show_memory_breakpoints,
(void *) (uintptr_t) current);
}
@ -1581,13 +1587,13 @@ target_flash_erase (ULONGEST address, LONGEST length)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_flash_erase != NULL)
{
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_flash_erase (%s, %s)\n",
hex_string (address), phex (length, 0));
t->to_flash_erase (t, address, length);
return;
}
{
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_flash_erase (%s, %s)\n",
hex_string (address), phex (length, 0));
t->to_flash_erase (t, address, length);
return;
}
tcomplain ();
}
@ -1599,12 +1605,12 @@ target_flash_done (void)
for (t = current_target.beneath; t != NULL; t = t->beneath)
if (t->to_flash_done != NULL)
{
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_flash_done\n");
t->to_flash_done (t);
return;
}
{
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_flash_done\n");
t->to_flash_done (t);
return;
}
tcomplain ();
}
@ -1631,11 +1637,13 @@ default_xfer_partial (struct target_ops *ops, enum target_object object,
"deprecated_xfer_memory" method. */
{
int xfered = -1;
errno = 0;
if (writebuf != NULL)
{
void *buffer = xmalloc (len);
struct cleanup *cleanup = make_cleanup (xfree, buffer);
memcpy (buffer, writebuf, len);
xfered = ops->deprecated_xfer_memory (offset, buffer, len,
1/*write*/, NULL, ops);
@ -1707,11 +1715,13 @@ target_read (struct target_ops *ops,
ULONGEST offset, LONGEST len)
{
LONGEST xfered = 0;
while (xfered < len)
{
LONGEST xfer = target_read_partial (ops, object, annex,
(gdb_byte *) buf + xfered,
offset + xfered, len - xfered);
/* Call an observer, notifying them of the xfer progress? */
if (xfer == 0)
return xfered;
@ -1730,11 +1740,13 @@ target_read_until_error (struct target_ops *ops,
ULONGEST offset, LONGEST len)
{
LONGEST xfered = 0;
while (xfered < len)
{
LONGEST xfer = target_read_partial (ops, object, annex,
(gdb_byte *) buf + xfered,
offset + xfered, len - xfered);
/* Call an observer, notifying them of the xfer progress? */
if (xfer == 0)
return xfered;
@ -1951,8 +1963,8 @@ get_target_memory (struct target_ops *ops, CORE_ADDR addr, gdb_byte *buf,
}
ULONGEST
get_target_memory_unsigned (struct target_ops *ops,
CORE_ADDR addr, int len, enum bfd_endian byte_order)
get_target_memory_unsigned (struct target_ops *ops, CORE_ADDR addr,
int len, enum bfd_endian byte_order)
{
gdb_byte buf[sizeof (ULONGEST)];
@ -2215,6 +2227,7 @@ target_follow_fork (int follow_child)
if (t->to_follow_fork != NULL)
{
int retval = t->to_follow_fork (t, follow_child);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_follow_fork (%d) = %d\n",
follow_child, retval);
@ -2231,6 +2244,10 @@ void
target_mourn_inferior (void)
{
struct target_ops *t;
/* Clear schedlock in infrun.c */
reset_schedlock ();
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_mourn_inferior != NULL)
@ -2331,6 +2348,7 @@ simple_search_memory (struct target_ops *ops,
if (found_ptr != NULL)
{
CORE_ADDR found_addr = start_addr + (found_ptr - search_buf);
*found_addrp = found_addr;
do_cleanups (old_cleanups);
return 1;
@ -2564,6 +2582,7 @@ int
target_supports_non_stop (void)
{
struct target_ops *t;
for (t = &current_target; t != NULL; t = t->beneath)
if (t->to_supports_non_stop)
return t->to_supports_non_stop ();
@ -2881,6 +2900,7 @@ void
target_attach (char *args, int from_tty)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_attach != NULL)
@ -2901,6 +2921,7 @@ int
target_thread_alive (ptid_t ptid)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_thread_alive != NULL)
@ -2923,6 +2944,7 @@ void
target_find_new_threads (void)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_find_new_threads != NULL)
@ -2991,6 +3013,7 @@ debug_print_register (const char * func,
struct regcache *regcache, int regno)
{
struct gdbarch *gdbarch = get_regcache_arch (regcache);
fprintf_unfiltered (gdb_stdlog, "%s ", func);
if (regno >= 0 && regno < gdbarch_num_regs (gdbarch)
&& gdbarch_register_name (gdbarch, regno) != NULL
@ -3004,6 +3027,7 @@ debug_print_register (const char * func,
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int i, size = register_size (gdbarch, regno);
unsigned char buf[MAX_REGISTER_SIZE];
regcache_raw_collect (regcache, regno, buf);
fprintf_unfiltered (gdb_stdlog, " = ");
for (i = 0; i < size; i++)
@ -3013,6 +3037,7 @@ debug_print_register (const char * func,
if (size <= sizeof (LONGEST))
{
ULONGEST val = extract_unsigned_integer (buf, size, byte_order);
fprintf_unfiltered (gdb_stdlog, " %s %s",
core_addr_to_string_nz (val), plongest (val));
}
@ -3024,6 +3049,7 @@ void
target_fetch_registers (struct regcache *regcache, int regno)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_fetch_registers != NULL)
@ -3039,8 +3065,8 @@ target_fetch_registers (struct regcache *regcache, int regno)
void
target_store_registers (struct regcache *regcache, int regno)
{
struct target_ops *t;
for (t = current_target.beneath; t != NULL; t = t->beneath)
{
if (t->to_store_registers != NULL)
@ -3067,6 +3093,7 @@ target_core_of_thread (ptid_t ptid)
if (t->to_core_of_thread != NULL)
{
int retval = t->to_core_of_thread (t, ptid);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_core_of_thread (%d) = %d\n",
PIDGET (ptid), retval);
@ -3087,6 +3114,7 @@ target_verify_memory (const gdb_byte *data, CORE_ADDR memaddr, ULONGEST size)
if (t->to_verify_memory != NULL)
{
int retval = t->to_verify_memory (t, data, memaddr, size);
if (targetdebug)
fprintf_unfiltered (gdb_stdlog, "target_verify_memory (%s, %s) = %d\n",
paddress (target_gdbarch, memaddr),

View File

@ -397,6 +397,7 @@ ptid_t
thread_id_to_pid (int num)
{
struct thread_info *thread = find_thread_id (num);
if (thread)
return thread->ptid;
else
@ -560,6 +561,7 @@ set_running (ptid_t ptid, int running)
if (all || ptid_is_pid (ptid))
{
int any_started = 0;
for (tp = thread_list; tp; tp = tp->next)
if (all || ptid_get_pid (tp->ptid) == ptid_get_pid (ptid))
{
@ -575,6 +577,7 @@ set_running (ptid_t ptid, int running)
else
{
int started = 0;
tp = find_thread_ptid (ptid);
gdb_assert (tp);
gdb_assert (tp->state_ != THREAD_EXITED);
@ -814,6 +817,7 @@ print_thread_info (struct ui_out *uiout, int requested_thread, int pid)
if (ui_out_is_mi_like_p (uiout))
{
char *state = "stopped";
if (tp->state_ == THREAD_RUNNING)
state = "running";
ui_out_field_string (uiout, "state", state);
@ -1005,6 +1009,7 @@ restore_current_thread_cleanup_dtor (void *arg)
{
struct current_thread_cleanup *old = arg;
struct thread_info *tp;
tp = find_thread_ptid (old->inferior_ptid);
if (tp)
tp->refcount--;

View File

@ -370,6 +370,7 @@ execute_command (char *p, int from_tty)
{
#ifdef HAVE_SBRK
char *lim = (char *) sbrk (0);
space_at_cmd_start = lim - lim_at_start;
#endif
}
@ -515,6 +516,7 @@ command_loop (void)
{
#ifdef HAVE_SBRK
char *lim = (char *) sbrk (0);
space_at_cmd_start = lim - lim_at_start;
#endif
}
@ -538,6 +540,7 @@ command_loop (void)
{
#ifdef HAVE_SBRK
char *lim = (char *) sbrk (0);
long space_now = lim - lim_at_start;
long space_diff = space_now - space_at_cmd_start;
@ -785,6 +788,7 @@ static void
gdb_rl_operate_and_get_next_completion (void)
{
int delta = where_history () - operate_saved_history;
/* The `key' argument to rl_get_previous_history is ignored. */
rl_get_previous_history (delta, 0);
operate_saved_history = -1;

View File

@ -1474,7 +1474,7 @@ add_aexpr (struct collection_list *collect, struct agent_expr *aexpr)
{
collect->aexpr_list =
xrealloc (collect->aexpr_list,
2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
2 * collect->aexpr_listsize * sizeof (struct agent_expr *));
collect->aexpr_listsize *= 2;
}
collect->aexpr_list[collect->next_aexpr_elt] = aexpr;
@ -2622,6 +2622,7 @@ trace_save (const char *filename, int target_does_save)
if (ts->stop_reason == tracepoint_error)
{
char *buf = (char *) alloca (strlen (ts->error_desc) * 2 + 1);
bin2hex ((gdb_byte *) ts->error_desc, buf, 0);
fprintf (fp, ":%s", buf);
}

View File

@ -57,6 +57,7 @@ trad_frame_alloc_saved_regs (struct frame_info *this_frame)
int numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch);
struct trad_frame_saved_reg *this_saved_regs
= FRAME_OBSTACK_CALLOC (numregs, struct trad_frame_saved_reg);
for (regnum = 0; regnum < numregs; regnum++)
{
this_saved_regs[regnum].realreg = regnum;

View File

@ -45,6 +45,7 @@ tramp_frame_cache (struct frame_info *this_frame,
void **this_cache)
{
struct tramp_frame_cache *tramp_cache = (*this_cache);
if (tramp_cache->trad_cache == NULL)
{
tramp_cache->trad_cache = trad_frame_cache_zalloc (this_frame);
@ -63,6 +64,7 @@ tramp_frame_this_id (struct frame_info *this_frame,
{
struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache);
trad_frame_get_id (trad_cache, this_id);
}
@ -73,6 +75,7 @@ tramp_frame_prev_register (struct frame_info *this_frame,
{
struct trad_frame_cache *trad_cache
= tramp_frame_cache (this_frame, this_cache);
return trad_frame_get_register (trad_cache, this_frame, prev_regnum);
}
@ -83,16 +86,19 @@ tramp_frame_start (const struct tramp_frame *tramp,
struct gdbarch *gdbarch = get_frame_arch (this_frame);
enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
int ti;
/* Search through the trampoline for one that matches the
instruction sequence around PC. */
for (ti = 0; tramp->insn[ti].bytes != TRAMP_SENTINEL_INSN; ti++)
{
CORE_ADDR func = pc - tramp->insn_size * ti;
int i;
for (i = 0; 1; i++)
{
gdb_byte buf[sizeof (tramp->insn[0])];
ULONGEST insn;
if (tramp->insn[i].bytes == TRAMP_SENTINEL_INSN)
return func;
if (!safe_frame_unwind_memory (this_frame,

View File

@ -56,6 +56,7 @@ struct ui_file *
ui_file_new (void)
{
struct ui_file *file = xmalloc (sizeof (struct ui_file));
file->magic = &ui_file_magic;
set_ui_file_data (file, NULL, null_file_delete);
set_ui_file_flush (file, null_file_flush);
@ -119,6 +120,7 @@ null_file_write (struct ui_file *file,
is possible to clean up that code. */
int i;
char b[2];
b[1] = '\0';
for (i = 0; i < sizeof_buf; i++)
{
@ -277,6 +279,7 @@ static void
do_ui_file_xstrdup (void *context, const char *buffer, long length)
{
struct accumulated_ui_file *acc = context;
if (acc->buffer == NULL)
acc->buffer = xmalloc (length + 1);
else
@ -290,6 +293,7 @@ char *
ui_file_xstrdup (struct ui_file *file, long *length)
{
struct accumulated_ui_file acc;
acc.buffer = NULL;
acc.length = 0;
ui_file_put (file, do_ui_file_xstrdup, &acc);
@ -304,6 +308,7 @@ static void
do_ui_file_obsavestring (void *context, const char *buffer, long length)
{
struct obstack *obstack = (struct obstack *) context;
obstack_grow (obstack, buffer, length);
}
@ -341,6 +346,7 @@ mem_file_new (void)
{
struct mem_file *stream = XMALLOC (struct mem_file);
struct ui_file *file = ui_file_new ();
set_ui_file_data (file, stream, mem_file_delete);
set_ui_file_rewind (file, mem_file_rewind);
set_ui_file_put (file, mem_file_put);
@ -356,6 +362,7 @@ static void
mem_file_delete (struct ui_file *file)
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
_("mem_file_delete: bad magic number"));
@ -374,6 +381,7 @@ static void
mem_file_rewind (struct ui_file *file)
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
_("mem_file_rewind: bad magic number"));
@ -386,6 +394,7 @@ mem_file_put (struct ui_file *file,
void *dest)
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
_("mem_file_put: bad magic number"));
@ -399,6 +408,7 @@ mem_file_write (struct ui_file *file,
long length_buffer)
{
struct mem_file *stream = ui_file_data (file);
if (stream->magic != &mem_file_magic)
internal_error (__FILE__, __LINE__,
_("mem_file_write: bad magic number"));
@ -412,6 +422,7 @@ mem_file_write (struct ui_file *file,
else
{
int new_length = stream->length_buffer + length_buffer;
if (new_length >= stream->sizeof_buffer)
{
stream->sizeof_buffer = new_length;
@ -447,6 +458,7 @@ stdio_file_new (FILE *file, int close_p)
{
struct ui_file *ui_file = ui_file_new ();
struct stdio_file *stdio = xmalloc (sizeof (struct stdio_file));
stdio->magic = &stdio_file_magic;
stdio->file = file;
stdio->close_p = close_p;
@ -463,6 +475,7 @@ static void
stdio_file_delete (struct ui_file *file)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_delete: bad magic number"));
@ -477,6 +490,7 @@ static void
stdio_file_flush (struct ui_file *file)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_flush: bad magic number"));
@ -487,6 +501,7 @@ static long
stdio_file_read (struct ui_file *file, char *buf, long length_buf)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_read: bad magic number"));
@ -496,6 +511,7 @@ stdio_file_read (struct ui_file *file, char *buf, long length_buf)
Control-C can interrupt gdb_select, but not read. */
{
int fd = fileno (stdio->file);
fd_set readfds;
FD_ZERO (&readfds);
FD_SET (fd, &readfds);
@ -510,6 +526,7 @@ static void
stdio_file_write (struct ui_file *file, const char *buf, long length_buf)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_write: bad magic number"));
@ -522,6 +539,7 @@ static void
stdio_file_fputs (const char *linebuffer, struct ui_file *file)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_fputs: bad magic number"));
@ -534,6 +552,7 @@ static int
stdio_file_isatty (struct ui_file *file)
{
struct stdio_file *stdio = ui_file_data (file);
if (stdio->magic != &stdio_file_magic)
internal_error (__FILE__, __LINE__,
_("stdio_file_isatty: bad magic number"));
@ -552,6 +571,7 @@ struct ui_file *
gdb_fopen (char *name, char *mode)
{
FILE *f = fopen (name, mode);
if (f == NULL)
return NULL;
return stdio_file_new (f, 1);
@ -580,6 +600,7 @@ tee_file_new (struct ui_file *one, int close_one,
{
struct ui_file *ui_file = ui_file_new ();
struct tee_file *tee = xmalloc (sizeof (struct tee_file));
tee->magic = &tee_file_magic;
tee->one = one;
tee->two = two;
@ -597,6 +618,7 @@ static void
tee_file_delete (struct ui_file *file)
{
struct tee_file *tee = ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
_("tee_file_delete: bad magic number"));
@ -612,6 +634,7 @@ static void
tee_file_flush (struct ui_file *file)
{
struct tee_file *tee = ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
_("tee_file_flush: bad magic number"));
@ -623,6 +646,7 @@ static void
tee_file_write (struct ui_file *file, const char *buf, long length_buf)
{
struct tee_file *tee = ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
_("tee_file_write: bad magic number"));
@ -634,6 +658,7 @@ static void
tee_file_fputs (const char *linebuffer, struct ui_file *file)
{
struct tee_file *tee = ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
_("tee_file_fputs: bad magic number"));
@ -645,6 +670,7 @@ static int
tee_file_isatty (struct ui_file *file)
{
struct tee_file *tee = ui_file_data (file);
if (tee->magic != &tee_file_magic)
internal_error (__FILE__, __LINE__,
_("tee_file_isatty: bad magic number"));

View File

@ -124,6 +124,7 @@ push_level (struct ui_out *uiout,
const char *id)
{
struct ui_out_level *current;
/* We had better not overflow the buffer. */
uiout->level++;
gdb_assert (uiout->level >= 0 && uiout->level < MAX_UI_OUT_LEVELS);
@ -371,6 +372,7 @@ ui_out_begin (struct ui_out *uiout,
const char *id)
{
int new_level;
if (uiout->table.flag && !uiout->table.body_flag)
internal_error (__FILE__, __LINE__,
_("table header or table_body expected; lists must be \
@ -387,6 +389,7 @@ specified after table_body."));
int fldno;
int width;
int align;
verify_field (uiout, &fldno, &width, &align);
}
@ -406,6 +409,7 @@ ui_out_end (struct ui_out *uiout,
enum ui_out_type type)
{
int old_level = pop_level (uiout, type);
uo_end (uiout, type, old_level);
}
@ -419,6 +423,7 @@ static void
do_cleanup_end (void *data)
{
struct ui_out_end_cleanup_data *end_cleanup_data = data;
ui_out_end (end_cleanup_data->uiout, end_cleanup_data->type);
xfree (end_cleanup_data);
}
@ -428,6 +433,7 @@ make_cleanup_ui_out_end (struct ui_out *uiout,
enum ui_out_type type)
{
struct ui_out_end_cleanup_data *end_cleanup_data;
end_cleanup_data = XMALLOC (struct ui_out_end_cleanup_data);
end_cleanup_data->uiout = uiout;
end_cleanup_data->type = type;
@ -511,6 +517,7 @@ ui_out_field_stream (struct ui_out *uiout,
long length;
char *buffer = ui_file_xstrdup (buf->stream, &length);
struct cleanup *old_cleanup = make_cleanup (xfree, buffer);
if (length > 0)
ui_out_field_string (uiout, fldname, buffer);
else
@ -589,9 +596,7 @@ ui_out_message (struct ui_out *uiout, int verbosity,
va_list args;
va_start (args, format);
uo_message (uiout, verbosity, format, args);
va_end (args);
}
@ -651,7 +656,6 @@ ui_out_set_flags (struct ui_out *uiout, int mask)
int oldflags = uiout->flags;
uiout->flags |= mask;
return oldflags;
}
@ -662,7 +666,6 @@ ui_out_clear_flags (struct ui_out *uiout, int mask)
int oldflags = uiout->flags;
uiout->flags &= ~mask;
return oldflags;
}
@ -1145,6 +1148,7 @@ ui_out_new (struct ui_out_impl *impl, void *data,
int flags)
{
struct ui_out *uiout = XMALLOC (struct ui_out);
uiout->data = data;
uiout->impl = impl;
uiout->flags = flags;

View File

@ -96,7 +96,9 @@ static void *
user_regs_init (struct gdbarch *gdbarch)
{
struct user_reg *reg;
struct gdb_user_regs *regs = GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdb_user_regs);
struct gdb_user_regs *regs
= GDBARCH_OBSTACK_ZALLOC (gdbarch, struct gdb_user_regs);
regs->last = &regs->first;
for (reg = builtin_user_regs.first; reg != NULL; reg = reg->next)
append_user_reg (regs, reg->name, reg->read, reg->baton,
@ -109,6 +111,7 @@ user_reg_add (struct gdbarch *gdbarch, const char *name,
user_reg_read_ftype *read, const void *baton)
{
struct gdb_user_regs *regs = gdbarch_data (gdbarch, user_regs_data);
if (regs == NULL)
{
/* ULGH, called during architecture initialization. Patch
@ -134,9 +137,11 @@ user_reg_map_name_to_regnum (struct gdbarch *gdbarch, const char *name,
int i;
int maxregs = (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch));
for (i = 0; i < maxregs; i++)
{
const char *regname = gdbarch_register_name (gdbarch, i);
if (regname != NULL && len == strlen (regname)
&& strncmp (regname, name, len) == 0)
{
@ -150,6 +155,7 @@ user_reg_map_name_to_regnum (struct gdbarch *gdbarch, const char *name,
struct gdb_user_regs *regs = gdbarch_data (gdbarch, user_regs_data);
struct user_reg *reg;
int nr;
for (nr = 0, reg = regs->first; reg != NULL; reg = reg->next, nr++)
{
if ((len < 0 && strcmp (reg->name, name))
@ -168,6 +174,7 @@ usernum_to_user_reg (struct gdbarch *gdbarch, int usernum)
{
struct gdb_user_regs *regs = gdbarch_data (gdbarch, user_regs_data);
struct user_reg *reg;
for (reg = regs->first; reg != NULL; reg = reg->next)
{
if (usernum == 0)
@ -182,6 +189,7 @@ user_reg_map_regnum_to_name (struct gdbarch *gdbarch, int regnum)
{
int maxregs = (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch));
if (regnum < 0)
return NULL;
else if (regnum < maxregs)
@ -203,6 +211,7 @@ value_of_user_reg (int regnum, struct frame_info *frame)
int maxregs = (gdbarch_num_regs (gdbarch)
+ gdbarch_num_pseudo_regs (gdbarch));
struct user_reg *reg = usernum_to_user_reg (gdbarch, regnum - maxregs);
gdb_assert (reg != NULL);
return reg->read (frame, reg->baton);
}

View File

@ -943,6 +943,7 @@ internal_vproblem (struct internal_problem *problem,
/* Don't allow infinite error/warning recursion. */
{
static char msg[] = "Recursive internal problem.\n";
switch (dejavu)
{
case 0:
@ -976,6 +977,7 @@ internal_vproblem (struct internal_problem *problem,
so that the user knows that they are living on the edge. */
{
char *msg;
msg = xstrvprintf (fmt, ap);
reason = xstrprintf ("\
%s:%d: %s: %s\n\
@ -1801,7 +1803,6 @@ printchar (int c, void (*do_fputs) (const char *, struct ui_file *),
void (*do_fprintf) (struct ui_file *, const char *, ...)
ATTRIBUTE_FPTR_PRINTF_2, struct ui_file *stream, int quoter)
{
c &= 0xFF; /* Avoid sign bit follies */
if (c < 0x20 || /* Low control chars */
@ -1878,6 +1879,7 @@ fputstrn_unfiltered (const char *str, int n, int quoter,
struct ui_file *stream)
{
int i;
for (i = 0; i < n; i++)
printchar (str[i], fputs_unfiltered, fprintf_unfiltered, stream, quoter);
}
@ -2073,6 +2075,7 @@ prompt_for_continue (void)
if (ignore)
{
char *p = ignore;
while (*p == ' ' || *p == '\t')
++p;
if (p[0] == 'q')
@ -2965,8 +2968,8 @@ decimal2str (char *sign, ULONGEST addr, int width)
about the real size of addr as the above does? */
unsigned long temp[3];
char *str = get_cell ();
int i = 0;
do
{
temp[i] = addr % (1000 * 1000 * 1000);
@ -3006,8 +3009,8 @@ octal2str (ULONGEST addr, int width)
{
unsigned long temp[3];
char *str = get_cell ();
int i = 0;
do
{
temp[i] = addr % (0100000 * 0100000);
@ -3101,6 +3104,7 @@ phex_nz (ULONGEST l, int sizeof_l)
case 8:
{
unsigned long high = (unsigned long) (l >> thirty_two);
str = get_cell ();
if (high == 0)
xsnprintf (str, CELLSIZE, "%lx",
@ -3177,6 +3181,7 @@ int_string (LONGEST val, int radix, int is_signed, int width,
case 16:
{
char *result;
if (width == 0)
result = hex_string (val);
else
@ -3195,6 +3200,7 @@ int_string (LONGEST val, int radix, int is_signed, int width,
case 8:
{
char *result = octal2str (val, width);
if (use_c_format || val == 0)
return result;
else
@ -3237,6 +3243,7 @@ string_to_core_addr (const char *my_string)
{
/* Assume that it is in hex. */
int i;
for (i = 2; my_string[i] != '\0'; i++)
{
if (isdigit (my_string[i]))
@ -3251,6 +3258,7 @@ string_to_core_addr (const char *my_string)
{
/* Assume that it is in decimal. */
int i;
for (i = 0; my_string[i] != '\0'; i++)
{
if (isdigit (my_string[i]))
@ -3290,6 +3298,7 @@ gdb_realpath (const char *filename)
# endif
# if defined (USE_REALPATH)
const char *rp = realpath (filename, buf);
if (rp == NULL)
rp = filename;
return xstrdup (rp);
@ -3303,6 +3312,7 @@ gdb_realpath (const char *filename)
#if defined(HAVE_CANONICALIZE_FILE_NAME)
{
char *rp = canonicalize_file_name (filename);
if (rp == NULL)
return xstrdup (filename);
else
@ -3330,11 +3340,13 @@ gdb_realpath (const char *filename)
{
/* Find out the max path size. */
long path_max = pathconf ("/", _PC_PATH_MAX);
if (path_max > 0)
{
/* PATH_MAX is bounded. */
char *buf = alloca (path_max);
char *rp = realpath (filename, buf);
return xstrdup (rp ? rp : filename);
}
}