This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bitwise operations on registers



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.)


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]