This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: dwarf2-frame clobbers memory
- From: Richard Henderson <rth at redhat dot com>
- To: kettenis at gnu dot org, gdb-patches at sources dot redhat dot com
- Date: Sun, 1 Jun 2003 00:47:33 -0700
- Subject: Re: dwarf2-frame clobbers memory
- References: <20030601033621.GA12145@redhat.com>
On Sat, May 31, 2003 at 08:36:21PM -0700, Richard Henderson wrote:
> At the following traceback, memmove is overwriting the "help"
> command, which results in a segv on the next command. Is this
> enough to track down the problem?
Nevermind, found it. Let us remember how pointer arithmetic works. ;-)
r~
* dwarf2-frame.c (dwarf2_frame_state_alloc_regs): Fix ptr arithmetic.
Index: dwarf2-frame.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v
retrieving revision 1.1
diff -c -p -d -r1.1 dwarf2-frame.c
*** dwarf2-frame.c 31 May 2003 19:18:05 -0000 1.1
--- dwarf2-frame.c 1 Jun 2003 07:45:41 -0000
*************** dwarf2_frame_state_alloc_regs (struct dw
*** 163,169 ****
xrealloc (rs->reg, num_regs * size);
/* Initialize newly allocated registers. */
! memset (rs->reg + rs->num_regs * size, 0, (num_regs - rs->num_regs) * size);
rs->num_regs = num_regs;
}
--- 166,172 ----
xrealloc (rs->reg, num_regs * size);
/* Initialize newly allocated registers. */
! memset (rs->reg + rs->num_regs, 0, (num_regs - rs->num_regs) * size);
rs->num_regs = num_regs;
}