From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4103 invoked by alias); 11 Mar 2002 15:39:54 -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 4034 invoked from network); 11 Mar 2002 15:39:52 -0000 Received: from unknown (HELO nevyn.them.org) (128.2.145.6) by sources.redhat.com with SMTP; 11 Mar 2002 15:39:52 -0000 Received: from drow by nevyn.them.org with local (Exim 3.35 #1 (Debian)) id 16kRtm-0002Sl-00; Mon, 11 Mar 2002 10:39:42 -0500 Date: Mon, 11 Mar 2002 07:39:00 -0000 From: Daniel Jacobowitz To: Andrew Cagney Cc: Eli Zaretskii , Andrew Morton , gdb@sources.redhat.com Subject: Re: bitwise operations on registers Message-ID: <20020311103942.A9410@nevyn.them.org> Mail-Followup-To: Andrew Cagney , Eli Zaretskii , Andrew Morton , gdb@sources.redhat.com References: <3C8CCEAF.2030803@cygnus.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <3C8CCEAF.2030803@cygnus.com> User-Agent: Mutt/1.3.23i X-SW-Source: 2002-03/txt/msg00097.txt.bz2 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. -- Daniel Jacobowitz Carnegie Mellon University MontaVista Software Debian GNU/Linux Developer