[Crash-utility] right shift of the subtraction result
Dave Anderson
anderson at redhat.com
Wed May 20 18:27:22 UTC 2015
----- Original Message -----
>
>
> ----- Original Message -----
> >
> > Hi Dave,
> > Does this sound like a bug, it need right shift of the subtraction result,
> > crash-git> pd (678324157984276 >> 32)
> > $10 = 157934
> > crash-git> pd ((681670518181331-678324157984276) >> 32)
> > p: gdb request failed: p ((681670518181331-678324157984276)
> > crash-git>
> >
> > It might be lacking support of some advanced arithmetic, so what is a
> > proper
> > wayto do some arithmetic like this?
>
> No, it is a crash bug. If you turn on the console mode, you can see the
> string
> that is passed on to gdb. Simple example:
>
> crash> !tty
> /dev/pts/8
> crash> set console /dev/pts/8
> debug console [2850]: /dev/pts/8
> console: /dev/pts/8
> crash> set debug 1
> debug: 1
> crash>
>
> The simple shift case works, and you can see the string that gets passed
> to gdb on the 2nd line of output, in the bracket after gdb_pass_through:
>
> crash> pd (15 >> 1)
> error() trace: 467e99 => 51c147 => 518ca6 => 46eaff
> gdb_pass_through: [p (15 >> 1)]
> p: per_cpu_symbol_search((15 >> 1)): NULL
> $9 = 7
> crash>
>
> But by adding the internal set of parentheses, the string gets
> clipped, and just "p ((15+1)" gets passed to gdb:
>
> crash> pd ((15+1) >> 1)
> error() trace: 467e99 => 51c147 => 518ca6 => 46eaff
> p: per_cpu_symbol_search(((15+1)): NULL
> gdb_pass_through: [p ((15+1)]
> error() trace: 467e99 => 51c1e7 => 51a7d5 => 46eaff
> p: gdb request failed: p ((15+1)
> crash>
>
> So it's either related to the crash command line redirection code,
> or in the process_gdb_output() function. (Feel free to debug it
> if you have the time...)
>
> Thanks,
> Dave
FWIW, because of C operator precedence, you can work around the bug by
removing the inner parentheses:
crash> pd ((681670518181331-678324157984276) >> 32)
p: gdb request failed: p ((681670518181331-678324157984276)
crash> pd (681670518181331-678324157984276 >> 32)
$1 = 779
crash>
Dave
More information about the Crash-utility
mailing list