From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3421 invoked by alias); 19 May 2005 02:04:52 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3357 invoked from network); 19 May 2005 02:04:45 -0000 Received: from unknown (HELO takamaka.act-europe.fr) (138.130.149.55) by sourceware.org with SMTP; 19 May 2005 02:04:45 -0000 Received: by takamaka.act-europe.fr (Postfix, from userid 507) id 0A02247957; Thu, 19 May 2005 12:04:44 +1000 (EST) Date: Thu, 19 May 2005 02:49:00 -0000 From: Joel Brobecker To: gdb-patches@sources.redhat.com Subject: Question: Checking register value in buffer Message-ID: <20050519020443.GP1462@adacore.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-SW-Source: 2005-05/txt/msg00460.txt.bz2 Hello, I'm wondering if there is a usual way for what I'm trying to do. Basically, I have fetched a 64bit floating point register on alpha using: regcache_cooked_read (current_regcache, (insn >> 21) & 0x1f, reg); where reg is a ``char reg[8]''. Now, I'd like to perform the following tests: zero (reg & 0x7fff_ffff_ffff_ffff) == 0 sign (reg & 0x8000_0000_0000_0000) != 0 Right now, I'm juggling with each byte of the buffer, and doing checks like this: fp_register_zero_p (char *buf) { return ((buf[1] & 0x0f) == 0 && buf[2] == 0 && buf[3] == 0 && buf[4] == 0 && buf[5] == 0 && buf[6] == 0 && buf[7] == 0); I thought about something like: LONGEST rav = extract_signed_integer (buf, 8) and then do the test using integer arithmetics. But then I'm not guarantied that LONGEST is at least 64bit long, am I. How are these sort of checks usually done in GDB? Thanks, -- Joel