summaryrefslogtreecommitdiff
path: root/gdb/cli
diff options
context:
space:
mode:
authorPierre Muller <muller@ics.u-strasbg.fr>2012-11-20 22:51:04 +0000
committerPierre Muller <muller@ics.u-strasbg.fr>2012-11-20 22:51:04 +0000
commitaaa4c204022c51b391cdbd0563a452fd7d54926a (patch)
tree5890b1171c321713d3652b1439124a11fb1bc160 /gdb/cli
parentb0c6d92127413913e56a74dd71d150927fa94bea (diff)
downloadgdb-aaa4c204022c51b391cdbd0563a452fd7d54926a.tar.gz
ARI fixes: sprintf rule.
Replace sprintf function calls for char arrays by calls to xsnprintf calls. * arm-tdep.c (arm_push_dummy_call): Replace sprintf by xsnprintf. (arm_dwarf_reg_to_regnum, arm_return_value): Ditto. (arm_neon_quad_read, arm_pseudo_read): Ditto. (arm_neon_quad_write, arm_pseudo_write): Ditto. * breakpoint.c (condition_completer): Ditto. (create_tracepoint_from_upload): Ditto. * dwarf2read.c (file_full_name): Ditto. * gcore.c (gcore_command): Ditto. * gnu-nat.c (proc_string, gnu_pid_to_str): Ditto. * go32-nat.c (go32_sysinfo): Ditto. * interps.c (interp_set): Ditto. * m32c-tdep.c (make_types): Ditto. * ppc-linux-nat.c (fetch_register, store_register): Ditto. * remote-m32r-sdi.c (m32r_open): Ditto. * sol-thread.c (td_err_string): Ditto. (td_state_string, solaris_pid_to_str): Ditto. * symtab.c (gdb_mangle_name): Ditto. * cli/cli-script.c (execute_control_command): Ditto. (define_command, document_command): Ditto. * tui/tui-io.c (tui_rl_display_match_list): Ditto. * tui/tui-stack.c (tui_make_status_line): Ditto. * tui/tui-win.c (tui_update_gdb_sizes): Ditto.
Diffstat (limited to 'gdb/cli')
-rw-r--r--gdb/cli/cli-script.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 743c65fd05e..6a31dd0c22d 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -441,9 +441,10 @@ execute_control_command (struct command_line *cmd)
case while_control:
{
- char *buffer = alloca (strlen (cmd->line) + 7);
+ int len = strlen (cmd->line) + 7;
+ char *buffer = alloca (len);
- sprintf (buffer, "while %s", cmd->line);
+ xsnprintf (buffer, len, "while %s", cmd->line);
print_command_trace (buffer);
/* Parse the loop control expression for the while statement. */
@@ -509,9 +510,10 @@ execute_control_command (struct command_line *cmd)
case if_control:
{
- char *buffer = alloca (strlen (cmd->line) + 4);
+ int len = strlen (cmd->line) + 4;
+ char *buffer = alloca (len);
- sprintf (buffer, "if %s", cmd->line);
+ xsnprintf (buffer, len, "if %s", cmd->line);
print_command_trace (buffer);
new_line = insert_args (cmd->line);
@@ -1529,7 +1531,8 @@ define_command (char *comname, int from_tty)
if (isupper (*tem))
*tem = tolower (*tem);
- sprintf (tmpbuf, "Type commands for definition of \"%s\".", comfull);
+ xsnprintf (tmpbuf, sizeof (tmpbuf),
+ "Type commands for definition of \"%s\".", comfull);
cmds = read_command_lines (tmpbuf, from_tty, 1, 0, 0);
if (c && c->class == class_user)
@@ -1579,7 +1582,8 @@ document_command (char *comname, int from_tty)
if (c->class != class_user)
error (_("Command \"%s\" is built-in."), comfull);
- sprintf (tmpbuf, "Type documentation for \"%s\".", comfull);
+ xsnprintf (tmpbuf, sizeof (tmpbuf), "Type documentation for \"%s\".",
+ comfull);
doclines = read_command_lines (tmpbuf, from_tty, 0, 0, 0);
if (c->doc)