From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27067 invoked by alias); 15 Mar 2002 03:12:32 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 27005 invoked from network); 15 Mar 2002 03:12:27 -0000 Received: from unknown (HELO localhost.redhat.com) (216.138.202.10) by sources.redhat.com with SMTP; 15 Mar 2002 03:12:27 -0000 Received: from cygnus.com (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id 657483C97; Thu, 14 Mar 2002 22:12:23 -0500 (EST) Message-ID: <3C916697.5060302@cygnus.com> Date: Thu, 14 Mar 2002 19:12:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:0.9.8) Gecko/20020210 X-Accept-Language: en-us MIME-Version: 1.0 To: Andrew Morton Cc: Daniel Jacobowitz , Eli Zaretskii , gdb@sources.redhat.com Subject: Re: bitwise operations on registers References: <3C8CCEAF.2030803@cygnus.com> <20020311103942.A9410@nevyn.them.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2002-03/txt/msg00132.txt.bz2 Andrew, Sounds like a bug report is in order (http://sources.redhat.com/gdb/bugs) Andrew > On Mon, Mar 11, 2002 at 10:35:11AM -0500, Andrew Cagney wrote: > >> >On Sun, 10 Mar 2002, Andrew Morton wrote: >> > >> > > >> >>(gdb) p $esp & 4 >> >>Argument to arithmetic operation not a number or boolean. >> >>(gdb) >> >> >> >>I don't seem to be able to perform the `&' and `|' arithmetic >> >>operators against machine registers. > >> > >> > >> >"p $eax & 4" works for me. Doesn't it work for you? >> > >> >As for $esp, I think GDB knows that it's not a number, so try >> > >> > (gdb) p (int)$esp & 4 >> > >> >(I don't know whether the built-in knowledge GDB has about $esp should >> >prevent it from working without the cast, though.) > >> >> Yes, try: >> (gdb) p (void*)0 & 4 >> So, this a bug? > > > I think so. C won't let you do it either, but historically we've been > more permissive than C about things that have a clearly defined > meaning, and this does. > >