This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Resubmit reverse debugging [5/5]


El mar, 07-10-2008 a las 19:20 -0700, Michael Snyder escribiÃ:
> +static void
> +exec_reverse_once (char *cmd, char *args, int from_tty)
> +{
> +  /* String buffer for command consing.  */
> +  char reverse_command[512];
<snip>
> +  sprintf (reverse_command, "%s %s", cmd, args ? args : "");
> +
> +  execution_direction = EXEC_REVERSE;
> +  execute_command (reverse_command, from_tty);
> +  do_cleanups (old_chain);

That fixed-length buffer being written with sprintf doesn't look good...
What do you think about using xstrprintf instead? That will remove the
possibility of buffer overflow, and also remove an arbitrary limit.

> +  add_com ("reverse-next", class_run, reverse_next, _("\
> +Step program backward, proceeding through subroutine calls.\n\
> +Like the \"reverse-step\" command as long as subroutine calls do not happen;\n\
> +when they do, the call is treated as one instruction.\n\
> +Argument N means do this N times (or till program stops for another reason).")
> +	   );
> +  add_com_alias ("rn", "reverse-next", class_alias, 1);

What about adding "previous" and either "pr" or "pre" as alias to
reverse-next? Sounds more natural to me than "reverse-next". Similarly,
"previousi" and "pri" or "prei".

I'd also half-seriously suggest adding a "step-back" alias on the same
grounds. :-)

-- 
[]'s
Thiago Jung Bauermann
IBM Linux Technology Center


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]