diff options
author | Andrew Cagney <cagney@redhat.com> | 2004-06-28 23:59:29 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2004-06-28 23:59:29 +0000 |
commit | b435e160dd3606c70fee73fa1461cf26607e4d6f (patch) | |
tree | b19307c5598434fbf741b2b6c707dd43508da24a /gdb | |
parent | e073c4747aebd9b65de341f6201fa479e57ea275 (diff) | |
download | gdb-b435e160dd3606c70fee73fa1461cf26607e4d6f.zip gdb-b435e160dd3606c70fee73fa1461cf26607e4d6f.tar.gz gdb-b435e160dd3606c70fee73fa1461cf26607e4d6f.tar.bz2 |
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.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 19 | ||||
-rw-r--r-- | gdb/ada-lang.c | 3 | ||||
-rw-r--r-- | gdb/aix-thread.c | 4 | ||||
-rw-r--r-- | gdb/breakpoint.c | 4 | ||||
-rw-r--r-- | gdb/doc/ChangeLog | 4 | ||||
-rw-r--r-- | gdb/doc/gdbint.texinfo | 2 | ||||
-rw-r--r-- | gdb/fbsd-proc.c | 4 | ||||
-rw-r--r-- | gdb/frv-tdep.c | 4 | ||||
-rw-r--r-- | gdb/regcache.c | 2 | ||||
-rw-r--r-- | gdb/remote-rdp.c | 2 | ||||
-rw-r--r-- | gdb/remote.c | 12 | ||||
-rw-r--r-- | gdb/solib-aix5.c | 2 | ||||
-rw-r--r-- | gdb/utils.c | 2 | ||||
-rw-r--r-- | gdb/varobj.c | 10 | ||||
-rw-r--r-- | gdb/xcoffsolib.c | 10 |
15 files changed, 53 insertions, 31 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index ae7e0b5..51d6b36 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -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 diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 57f3733..6ec5044 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -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); } diff --git a/gdb/aix-thread.c b/gdb/aix-thread.c index 05493ae..e5e8a9a 100644 --- a/gdb/aix-thread.c +++ b/gdb/aix-thread.c @@ -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; } diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c index 336264d..018f464 100644 --- a/gdb/breakpoint.c +++ b/gdb/breakpoint.c @@ -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; diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 4ab6104..5a0b810 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -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 diff --git a/gdb/doc/gdbint.texinfo b/gdb/doc/gdbint.texinfo index 5d1ba7f..a3821b5 100644 --- a/gdb/doc/gdbint.texinfo +++ b/gdb/doc/gdbint.texinfo @@ -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 diff --git a/gdb/fbsd-proc.c b/gdb/fbsd-proc.c index 8eed4cc..f021d27 100644 --- a/gdb/fbsd-proc.c +++ b/gdb/fbsd-proc.c @@ -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); diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c index 77f1374..9b7524c 100644 --- a/gdb/frv-tdep.c +++ b/gdb/frv-tdep.c @@ -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; } diff --git a/gdb/regcache.c b/gdb/regcache.c index 4058a98..ceeaca6 100644 --- a/gdb/regcache.c +++ b/gdb/regcache.c @@ -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; } diff --git a/gdb/remote-rdp.c b/gdb/remote-rdp.c index 68e6932..5360467 100644 --- a/gdb/remote-rdp.c +++ b/gdb/remote-rdp.c @@ -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 diff --git a/gdb/remote.c b/gdb/remote.c index 962a58d..f754f80 100644 --- a/gdb/remote.c +++ b/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, diff --git a/gdb/solib-aix5.c b/gdb/solib-aix5.c index 1a8c9df..54b1199 100644 --- a/gdb/solib-aix5.c +++ b/gdb/solib-aix5.c @@ -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) diff --git a/gdb/utils.c b/gdb/utils.c index 504890e..f1c2fe4 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -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); diff --git a/gdb/varobj.c b/gdb/varobj.c index c662518..ea4fa01 100644 --- a/gdb/varobj.c +++ b/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; */ diff --git a/gdb/xcoffsolib.c b/gdb/xcoffsolib.c index 99d2cc8..62426c9 100644 --- a/gdb/xcoffsolib.c +++ b/gdb/xcoffsolib.c @@ -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; |