From: Michael Snyder Date: Thu, 9 Oct 2008 17:46:55 +0000 (+0000) Subject: 2008-10-09 Michael Snyder X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fcae1cf0ab8422ee4fd296a3157760ca2c93f6a2;p=thirdparty%2Fbinutils-gdb.git 2008-10-09 Michael Snyder * reverse.c (exec_reverse_once): Eliminate fixed-size buffer, use xstrprintf. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 7f1dae85c32..0c9294fdcad 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,8 @@ 2008-10-09 Michael Snyder + * reverse.c (exec_reverse_once): Eliminate fixed-size buffer, + use xstrprintf. + * infcmd.c (finish_forward): New function, abstracted from finish_command. (finish_command): Abstract out finish_forward for symmetry. diff --git a/gdb/reverse.c b/gdb/reverse.c index ee6567586e0..dbee326bba6 100644 --- a/gdb/reverse.c +++ b/gdb/reverse.c @@ -44,8 +44,7 @@ static void exec_direction_default (void *notused) static void exec_reverse_once (char *cmd, char *args, int from_tty) { - /* String buffer for command consing. */ - char reverse_command[512]; + char *reverse_command; enum exec_direction_kind dir = execution_direction; struct cleanup *old_chain; @@ -59,9 +58,9 @@ exec_reverse_once (char *cmd, char *args, int from_tty) if (!target_can_execute_reverse) error (_("Target %s does not support this command."), target_shortname); + reverse_command = xstrprintf ("%s %s", cmd, args ? args : ""); old_chain = make_cleanup (exec_direction_default, NULL); - sprintf (reverse_command, "%s %s", cmd, args ? args : ""); - + make_cleanup (xfree, reverse_command); execution_direction = EXEC_REVERSE; execute_command (reverse_command, from_tty); do_cleanups (old_chain);