This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Wrong data type in function unpack_varlen_hex()
- From: Daniel Jacobowitz <drow at false dot org>
- To: zhigang gong <zhigang dot gong at gmail dot com>
- Cc: gdb-patches at sources dot redhat dot com
- Date: Thu, 13 Jul 2006 00:06:58 -0400
- Subject: Re: Wrong data type in function unpack_varlen_hex()
- References: <40c9f5b20606160558v277bb813r9d5a497c9899432@mail.gmail.com>
On Fri, Jun 16, 2006 at 08:58:33PM +0800, zhigang gong wrote:
> Hi,
>
> I am working on an mips4k platform. When I added hw watchpoint
> support for my target board and debug it with gdb. The write
> watchpoint works fine, but rwatch and awatch doesn't work. After trace
> the source code of the gdb, I found there is a bug in
> unpack_varlen_hex. The local variable retval is a signed integer. For
> my case, the ULONGEST is a 64bit integer type. So when the
> watchpoint's address is 0x8XXXXXXX, the "retval" will be 0x8XXXXXXX,
> and pass its value to variable "result", the "result"'s value will be
> sign extended to 0xFFFFFFFF8XXXXXXX. Then when i set a rwatch point,
> the address matching will fail when the read watchpoint ocurred.
> The patch is as belows. And I test it,
Thank you for the patch. This is definitely an improvement, so I have
committed it.
There may be more problems here: addresses on MIPS are generally
considered to be signed, so it might be a bug somewhere else in GDB
that you're getting 0x000000008xxxxxxx. But, we'll worry about that
only if it causes a problem for someone else.
--
Daniel Jacobowitz
CodeSourcery