This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [8/9] multiple locations
- From: Mark Kettenis <mark dot kettenis at xs4all dot nl>
- To: vladimir at codesourcery dot com
- Cc: gdb-patches at sources dot redhat dot com
- Date: Sat, 8 Sep 2007 15:14:16 +0200 (CEST)
- Subject: Re: [8/9] multiple locations
- References: <200709080248.52539.vladimir@codesourcery.com>
> 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