This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] off by one array reference in i386-low.c/i386_show_dr
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Michael Snyder <msnyder at vmware dot com>
- Cc: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>, Doug Evans <dje at google dot com>
- Date: Sun, 27 Feb 2011 17:46:46 +0100
- Subject: Re: [RFA] off by one array reference in i386-low.c/i386_show_dr
- References: <4D698427.2050301@vmware.com>
Hi Michael,
On Sat, 26 Feb 2011 23:52:23 +0100, Michael Snyder wrote:
> I'm not 100 percent sure this is right, but I do know that
> as written, it will overflow the array dr_mirror. What do
> you think?
[...]
> --- i386-low.c 1 Jan 2011 15:33:24 -0000 1.5
> +++ i386-low.c 26 Feb 2011 22:48:38 -0000
/* A macro to loop over all debug registers. */
#define ALL_DEBUG_REGISTERS(i) for (i = 0; i < DR_NADDR; i++)
> @@ -195,7 +195,7 @@ i386_show_dr (struct i386_debug_reg_stat
ALL_DEBUG_REGISTERS(i)
{
printf_unfiltered ("\
> \tDR%d: addr=0x%s, ref.count=%d DR%d: addr=0x%s, ref.count=%d\n",
> i, paddress (state->dr_mirror[i]),
> state->dr_ref_count[i],
> - i + 1, paddress (state->dr_mirror[i + 1]),
> + i + 1, paddress (state->dr_mirror[i]),
> state->dr_ref_count[i + 1]);
> i++;
> }
->
CONTROL (DR7): 0000000000090101 STATUS (DR6): 0000000000004000
DR0: addr=0x0000000001c31f30, ref.count=1 DR1: addr=0x0000000000000000, ref.count=0
DR2: addr=0x0000000000000000, ref.count=0 DR3: addr=0x0000000000000000, ref.count=0
I do not see a bug there; still it could be better commented.
Thanks,
Jan