2004-06-26 Andrew Cagney <cagney@gnu.org>
* xcoffsolib.c (xcoff_solib_address): Replace xasprintf with xstrprintf. * varobj.c (varobj_gen_name, create_child, c_name_of_child) (c_value_of_variable): Ditto. * utils.c (internal_vproblem): Ditto. * solib-aix5.c (build_so_list_from_mapfile): Ditto. * remote.c (add_packet_config_cmd): Ditto. * remote-rdp.c (rdp_set_command_line): Ditto. * regcache.c (regcache_dump): Ditto. * frv-tdep.c (new_variant, new_variant): Ditto. * fbsd-proc.c (child_pid_to_exec_file): Ditto. (fbsd_find_memory_regions): Ditto. * breakpoint.c (create_thread_event_breakpoint) (create_breakpoints): Ditto. * aix-thread.c (aix_thread_pid_to_str): Ditto. * ada-lang.c (is_package_name): Ditto. Also delete xmalloc call. Index: doc/ChangeLog 2004-06-26 Andrew Cagney <cagney@gnu.org> * gdbint.texinfo (Coding): Replace xasprintf with xstrprintf.
This commit is contained in:
parent
e073c4747a
commit
b435e160dd
|
@ -1,3 +1,22 @@
|
|||
2004-06-28 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* xcoffsolib.c (xcoff_solib_address): Replace xasprintf with
|
||||
xstrprintf.
|
||||
* varobj.c (varobj_gen_name, create_child, c_name_of_child)
|
||||
(c_value_of_variable): Ditto.
|
||||
* utils.c (internal_vproblem): Ditto.
|
||||
* solib-aix5.c (build_so_list_from_mapfile): Ditto.
|
||||
* remote.c (add_packet_config_cmd): Ditto.
|
||||
* remote-rdp.c (rdp_set_command_line): Ditto.
|
||||
* regcache.c (regcache_dump): Ditto.
|
||||
* frv-tdep.c (new_variant, new_variant): Ditto.
|
||||
* fbsd-proc.c (child_pid_to_exec_file): Ditto.
|
||||
(fbsd_find_memory_regions): Ditto.
|
||||
* breakpoint.c (create_thread_event_breakpoint)
|
||||
(create_breakpoints): Ditto.
|
||||
* aix-thread.c (aix_thread_pid_to_str): Ditto.
|
||||
* ada-lang.c (is_package_name): Ditto. Also delete xmalloc call.
|
||||
|
||||
2004-06-28 Joel Brobecker <brobecker@gnat.com>
|
||||
|
||||
* ada-lang.c: Re-indent file, with some massaging to help indent
|
||||
|
|
|
@ -4369,8 +4369,7 @@ is_package_name (const char *name)
|
|||
if (strstr (name, "__") != NULL)
|
||||
return 0;
|
||||
|
||||
fun_name = (char *) alloca (strlen (name) + 5 + 1);
|
||||
xasprintf (&fun_name, "_ada_%s", name);
|
||||
fun_name = xstrprintf ("_ada_%s", name);
|
||||
|
||||
return (standard_lookup (fun_name, NULL, VAR_DOMAIN) == NULL);
|
||||
}
|
||||
|
|
|
@ -1629,10 +1629,10 @@ aix_thread_pid_to_str (ptid_t ptid)
|
|||
return base_target.to_pid_to_str (ptid);
|
||||
|
||||
/* Free previous return value; a new one will be allocated by
|
||||
xasprintf(). */
|
||||
xstrprintf(). */
|
||||
xfree (ret);
|
||||
|
||||
xasprintf (&ret, "Thread %ld", ptid_get_tid (ptid));
|
||||
ret = xstrprintf ("Thread %ld", ptid_get_tid (ptid));
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -4258,7 +4258,7 @@ create_thread_event_breakpoint (CORE_ADDR address)
|
|||
|
||||
b->enable_state = bp_enabled;
|
||||
/* addr_string has to be used or breakpoint_re_set will delete me. */
|
||||
xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address));
|
||||
b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
|
||||
|
||||
return b;
|
||||
}
|
||||
|
@ -4902,7 +4902,7 @@ create_breakpoints (struct symtabs_and_lines sals, char **addr_string,
|
|||
else
|
||||
/* addr_string has to be used or breakpoint_re_set will delete
|
||||
me. */
|
||||
xasprintf (&b->addr_string, "*0x%s", paddr (b->loc->address));
|
||||
b->addr_string = xstrprintf ("*0x%s", paddr (b->loc->address));
|
||||
b->cond_string = cond_string[i];
|
||||
b->ignore_count = ignore_count;
|
||||
b->enable_state = bp_enabled;
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2004-06-26 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* gdbint.texinfo (Coding): Replace xasprintf with xstrprintf.
|
||||
|
||||
2004-06-20 Andrew Cagney <cagney@gnu.org>
|
||||
|
||||
* gdbint.texinfo (Target Architecture Definition): Deprecate
|
||||
|
|
|
@ -4942,7 +4942,7 @@ allocation of small temporary values (such as strings).
|
|||
restrict the memory being allocated to no more than a few kilobytes.}
|
||||
|
||||
@value{GDBN} uses the string function @code{xstrdup} and the print
|
||||
function @code{xasprintf}.
|
||||
function @code{xstrprintf}.
|
||||
|
||||
@emph{Pragmatics: @code{asprintf} and @code{strdup} can fail. Print
|
||||
functions such as @code{sprintf} are very prone to buffer overflow
|
||||
|
|
|
@ -38,7 +38,7 @@ child_pid_to_exec_file (int pid)
|
|||
char *path;
|
||||
char *buf;
|
||||
|
||||
xasprintf (&path, "/proc/%d/file", pid);
|
||||
path = xstrprintf ("/proc/%d/file", pid);
|
||||
buf = xcalloc (MAXPATHLEN, sizeof (char));
|
||||
make_cleanup (xfree, path);
|
||||
make_cleanup (xfree, buf);
|
||||
|
@ -82,7 +82,7 @@ fbsd_find_memory_regions (int (*func) (CORE_ADDR, unsigned long,
|
|||
char protection[4];
|
||||
int read, write, exec;
|
||||
|
||||
xasprintf (&mapfilename, "/proc/%ld/map", (long) pid);
|
||||
mapfilename = xstrprintf ("/proc/%ld/map", (long) pid);
|
||||
mapfile = fopen (mapfilename, "r");
|
||||
if (mapfile == NULL)
|
||||
error ("Couldn't open %s\n", mapfilename);
|
||||
|
|
|
@ -197,7 +197,7 @@ new_variant (void)
|
|||
for (r = acc0_regnum; r <= acc7_regnum; r++)
|
||||
{
|
||||
char *buf;
|
||||
xasprintf (&buf, "acc%d", r - acc0_regnum);
|
||||
buf = xstrprintf ("acc%d", r - acc0_regnum);
|
||||
var->register_names[r] = buf;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ new_variant (void)
|
|||
for (r = accg0_regnum; r <= accg7_regnum; r++)
|
||||
{
|
||||
char *buf;
|
||||
xasprintf (&buf, "accg%d", r - accg0_regnum);
|
||||
buf = xstrprintf ("accg%d", r - accg0_regnum);
|
||||
var->register_names[r] = buf;
|
||||
}
|
||||
|
||||
|
|
|
@ -1572,7 +1572,7 @@ regcache_dump (struct regcache *regcache, struct ui_file *file,
|
|||
char *n;
|
||||
if (!footnote_register_type_name_null)
|
||||
footnote_register_type_name_null = ++footnote_nr;
|
||||
xasprintf (&n, "*%d", footnote_register_type_name_null);
|
||||
n = xstrprintf ("*%d", footnote_register_type_name_null);
|
||||
make_cleanup (xfree, n);
|
||||
t = n;
|
||||
}
|
||||
|
|
|
@ -721,7 +721,7 @@ rdp_set_command_line (char *command, char *args)
|
|||
if (commandline != NULL)
|
||||
xfree (commandline);
|
||||
|
||||
xasprintf (&commandline, "%s %s", command, args);
|
||||
commandline = xstrprintf ("%s %s", command, args);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
12
gdb/remote.c
12
gdb/remote.c
|
@ -651,12 +651,12 @@ add_packet_config_cmd (struct packet_config *config,
|
|||
config->title = title;
|
||||
config->detect = AUTO_BOOLEAN_AUTO;
|
||||
config->support = PACKET_SUPPORT_UNKNOWN;
|
||||
xasprintf (&set_doc, "Set use of remote protocol `%s' (%s) packet",
|
||||
name, title);
|
||||
xasprintf (&show_doc, "Show current use of remote protocol `%s' (%s) packet",
|
||||
name, title);
|
||||
set_doc = xstrprintf ("Set use of remote protocol `%s' (%s) packet",
|
||||
name, title);
|
||||
show_doc = xstrprintf ("Show current use of remote protocol `%s' (%s) packet",
|
||||
name, title);
|
||||
/* set/show TITLE-packet {auto,on,off} */
|
||||
xasprintf (&cmd_name, "%s-packet", title);
|
||||
cmd_name = xstrprintf ("%s-packet", title);
|
||||
add_setshow_auto_boolean_cmd (cmd_name, class_obscure,
|
||||
&config->detect, set_doc, show_doc,
|
||||
set_func, show_func,
|
||||
|
@ -665,7 +665,7 @@ add_packet_config_cmd (struct packet_config *config,
|
|||
if (legacy)
|
||||
{
|
||||
char *legacy_name;
|
||||
xasprintf (&legacy_name, "%s-packet", name);
|
||||
legacy_name = xstrprintf ("%s-packet", name);
|
||||
add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
|
||||
set_remote_list);
|
||||
add_alias_cmd (legacy_name, cmd_name, class_obscure, 0,
|
||||
|
|
|
@ -193,7 +193,7 @@ build_so_list_from_mapfile (int pid, long match_mask, long match_val)
|
|||
|
||||
/* Open the map file */
|
||||
|
||||
xasprintf (&map_pathname, "/proc/%d/map", pid);
|
||||
map_pathname = xstrprintf ("/proc/%d/map", pid);
|
||||
map_fd = open (map_pathname, O_RDONLY);
|
||||
xfree (map_pathname);
|
||||
if (map_fd < 0)
|
||||
|
|
|
@ -753,7 +753,7 @@ internal_vproblem (struct internal_problem *problem,
|
|||
{
|
||||
char *msg;
|
||||
xvasprintf (&msg, fmt, ap);
|
||||
xasprintf (&reason, "\
|
||||
reason = xstrprintf ("\
|
||||
%s:%d: %s: %s\n\
|
||||
A problem internal to GDB has been detected,\n\
|
||||
further debugging may prove unreliable.", file, line, problem->name, msg);
|
||||
|
|
10
gdb/varobj.c
10
gdb/varobj.c
|
@ -549,7 +549,7 @@ varobj_gen_name (void)
|
|||
|
||||
/* generate a name for this object */
|
||||
id++;
|
||||
xasprintf (&obj_name, "var%d", id);
|
||||
obj_name = xstrprintf ("var%d", id);
|
||||
|
||||
return obj_name;
|
||||
}
|
||||
|
@ -1254,7 +1254,7 @@ create_child (struct varobj *parent, int index, char *name)
|
|||
child->error = 1;
|
||||
child->parent = parent;
|
||||
child->root = parent->root;
|
||||
xasprintf (&childs_name, "%s.%s", parent->obj_name, name);
|
||||
childs_name = xstrprintf ("%s.%s", parent->obj_name, name);
|
||||
child->obj_name = childs_name;
|
||||
install_variable (child);
|
||||
|
||||
|
@ -1837,7 +1837,7 @@ c_name_of_child (struct varobj *parent, int index)
|
|||
switch (TYPE_CODE (type))
|
||||
{
|
||||
case TYPE_CODE_ARRAY:
|
||||
xasprintf (&name, "%d", index);
|
||||
name = xstrprintf ("%d", index);
|
||||
break;
|
||||
|
||||
case TYPE_CODE_STRUCT:
|
||||
|
@ -1856,7 +1856,7 @@ c_name_of_child (struct varobj *parent, int index)
|
|||
break;
|
||||
|
||||
default:
|
||||
xasprintf (&name, "*%s", parent->name);
|
||||
name = xstrprintf ("*%s", parent->name);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
@ -2070,7 +2070,7 @@ c_value_of_variable (struct varobj *var)
|
|||
case TYPE_CODE_ARRAY:
|
||||
{
|
||||
char *number;
|
||||
xasprintf (&number, "[%d]", var->num_children);
|
||||
number = xstrprintf ("[%d]", var->num_children);
|
||||
return (number);
|
||||
}
|
||||
/* break; */
|
||||
|
|
|
@ -48,11 +48,11 @@ xcoff_solib_address (CORE_ADDR addr)
|
|||
if (vp->tstart <= addr && addr < vp->tend)
|
||||
{
|
||||
xfree (buffer);
|
||||
xasprintf (&buffer, "%s%s%s%s",
|
||||
vp->name,
|
||||
*vp->member ? "(" : "",
|
||||
vp->member,
|
||||
*vp->member ? ")" : "");
|
||||
buffer = xstrprintf ("%s%s%s%s",
|
||||
vp->name,
|
||||
*vp->member ? "(" : "",
|
||||
vp->member,
|
||||
*vp->member ? ")" : "");
|
||||
return buffer;
|
||||
}
|
||||
return NULL;
|
||||
|
|
Loading…
Reference in New Issue