From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 19330 invoked by alias); 13 Jul 2006 15:19:06 -0000 Received: (qmail 19321 invoked by uid 22791); 13 Jul 2006 15:19:04 -0000 X-Spam-Check-By: sourceware.org Received: from wx-out-0102.google.com (HELO wx-out-0102.google.com) (66.249.82.197) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 13 Jul 2006 15:19:03 +0000 Received: by wx-out-0102.google.com with SMTP id t13so98534wxc for ; Thu, 13 Jul 2006 08:19:01 -0700 (PDT) Received: by 10.70.98.2 with SMTP id v2mr1424847wxb; Thu, 13 Jul 2006 08:19:01 -0700 (PDT) Received: by 10.70.26.5 with HTTP; Thu, 13 Jul 2006 08:19:01 -0700 (PDT) Message-ID: <40c9f5b20607130819u4dba5d48u636ffd1cb99db77f@mail.gmail.com> Date: Thu, 13 Jul 2006 15:19:00 -0000 From: "zhigang gong" To: "zhigang gong" , gdb-patches@sources.redhat.com Subject: Re: Wrong data type in function unpack_varlen_hex() In-Reply-To: <20060713040658.GZ24622@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <40c9f5b20606160558v277bb813r9d5a497c9899432@mail.gmail.com> <20060713040658.GZ24622@nevyn.them.org> Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-07/txt/msg00153.txt.bz2 On 7/13/06, Daniel Jacobowitz wrote: > 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. I have worried about that too. As I foud that in gdb the signed extention should be the default way. And I also found the watchpoint address 0x000000008xxxxxxx was calculated from the address expression, which is inputted in the command line as belows: gdb ) rwatch *0x8xxxxxxx Maybe change the watchpoint address expression calculating, make it to do an signed extension, is better. > > -- > Daniel Jacobowitz > CodeSourcery >