+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
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);
}
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;
}
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;
}
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;
+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
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
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);
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);
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;
}
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;
}
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;
}
if (commandline != NULL)
xfree (commandline);
- xasprintf (&commandline, "%s %s", command, args);
+ commandline = xstrprintf ("%s %s", command, args);
}
static void
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,
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,
/* 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)
{
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);
/* generate a name for this object */
id++;
- xasprintf (&obj_name, "var%d", id);
+ obj_name = xstrprintf ("var%d", id);
return obj_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);
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
- xasprintf (&name, "%d", index);
+ name = xstrprintf ("%d", index);
break;
case TYPE_CODE_STRUCT:
break;
default:
- xasprintf (&name, "*%s", parent->name);
+ name = xstrprintf ("*%s", parent->name);
break;
}
break;
case TYPE_CODE_ARRAY:
{
char *number;
- xasprintf (&number, "[%d]", var->num_children);
+ number = xstrprintf ("[%d]", var->num_children);
return (number);
}
/* break; */
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;