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: gdb code review, pointer madness


On Mon, Jan 23, 2006 at 02:38:25PM -0600, NZG wrote:
> I'm trying to get gdb 6.1's machine interface to work correctly with the m68k 
> arch, and I'm having some weird results.
> 
> I've noticed that if I do a (frame -1) command on gdb after connecting to 
> remote gdb server, but before breaking in the main program, gdb goes crazy 
> and starts requesting random memory locations from gdbserver until something 
> crashes.
> 
> Sooo... I'm using regular gdb to debug the m68k-elf-gdb connection, and I'm 
> seeing a problem "extract_unsigned_integer" (pasted below).
> 
> Specifically this loop doesn't seem to be executing correctly
> 
>  for (p = startaddr; p < endaddr; ++p)
> 	retval = (retval << 8) | *p;
> 
> In the function call I'm watching, 
> endaddr = startaddr+4, 
> yet, when I step through the function the loop executes 8 times and overshoots 
> the array.

You are probably just debugging optimized code.  Either that, or your
host compiler is completely broken; the loop is correct.

-- 
Daniel Jacobowitz
CodeSourcery


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