This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: gdb code review, pointer madness
- From: Daniel Jacobowitz <drow at false dot org>
- To: NZG <ngustavson at emacinc dot com>
- Cc: gdb-patches at sourceware dot org, uClinux development list <uclinux-dev at uclinux dot org>
- Date: Mon, 23 Jan 2006 15:48:04 -0500
- Subject: Re: gdb code review, pointer madness
- References: <200601231438.26040.ngustavson@emacinc.com>
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