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: [8/9] multiple locations


> From: Vladimir Prus <vladimir@codesourcery.com>
> Date: Sat, 8 Sep 2007 02:48:52 +0400
> 
> This patch allows a breakpoint to have several breakpoint locations.
> There's lot of mechanical changes -- from iteration over breakpoints
> to iteration over locations. Also, this splits breakpoint enable/disable
> state, changeable by user, from 'shlib_disabled' state, maintained by
> gdb and stored inside location. The breakpoint printing code is modified
> to print locations of breakpoint. OK?
> 
> - Volodya
> 
>    /* 1 */
>    annotate_field (0);
> -  ui_out_field_int (uiout, "number", b->number);
> +  if (part_of_multiple)
> +    {
> +      char buf[30];
> +      sprintf (buf, "%d.%d", b->number, loc_number);

Please don't use sprintf(); it's an evil function since it doesn't
check for buffer overflows.  And even when you can prove that the
buffer is large enough, it's better not to use it, to make auditing
the code easier.  So please use xsnprintf() (or snprintf() outside of
GDB).

Or if you want to address Eli's concerns, you could use xasprintf, but
make sure you xfree() the memory allocated by it.

Mark


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