This is the mail archive of the gdb-patches@sources.redhat.com 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: dwarf2-frame clobbers memory


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;
  }
  


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