This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap 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]

[Bug translator/13283] New: script -> C translator incorrect comparison (using ==) of kernel_string() operands


http://sourceware.org/bugzilla/show_bug.cgi?id=13283

             Bug #: 13283
           Summary: script -> C translator incorrect comparison (using ==)
                    of kernel_string() operands
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
        AssignedTo: systemtap@sourceware.org
        ReportedBy: david.pat.skindell@hp.com
    Classification: Unclassified


stap v1.6/0.152 (non-git sources)
  installed at /usr/local/bin
gcc 4.4.5 (Red Hat 4.4.5-6)
OS: RHEL 6.1x64 (Linux hp-nvkj29ytemmz 2.6.32 #1 SMP Thu Sep 29 10:37:42 CDT
2011 x86_64 x86_64 x86_64 GNU/Linux) 

Description:
Script incorrectly evaluating the comparison of 2 strings from kernel_string()
as operands of the == operator.

Line in script: 
printf("Equal? %X\n",kernel_char($dev1->scsi3addr) ==
kernel_char($dev2->scsi3addr));
//$dev1->scsi3addr = "a"
//$dev2->scsi3addr = "b"

Expected Output:
"Equal? 0"

Actual Output:
"Equal? 1"

Psudo/Temp-Fix:
Got expected output if I assigned the operands to variables first and then
compared.

DETAILS:
Segment of Relevant C Code:
  (void) 
  ({
    l->__tmp0 = (((
    ({
      l->__tmp1 = 
      ({
        l->__tmp2 = ((int64_t)0LL);
        c->locals[c->nesting+1].function__get_kretprobe_long.i = l->__tmp2;
        function__get_kretprobe_long (c);
        if (unlikely(c->last_error)) goto out;
        c->locals[c->nesting+1].function__get_kretprobe_long.__retvalue;
      });
      c->locals[c->nesting+1].function_kernel_char.addr = l->__tmp1;
      function_kernel_char (c);
      if (unlikely(c->last_error)) goto out;
      c->locals[c->nesting+1].function_kernel_char.__retvalue;
    })) == (
    ({
      l->__tmp3 = 
      ({
        l->__tmp4 = ((int64_t)1LL);
        c->locals[c->nesting+1].function__get_kretprobe_long.i = l->__tmp4;
        function__get_kretprobe_long (c);
        if (unlikely(c->last_error)) goto out;
        c->locals[c->nesting+1].function__get_kretprobe_long.__retvalue;
      });
      c->locals[c->nesting+1].function_kernel_char.addr = l->__tmp3;
      function_kernel_char (c);
      if (unlikely(c->last_error)) goto out;
      c->locals[c->nesting+1].function_kernel_char.__retvalue;
    }))));
    _stp_printf ("Equal? %llX\n", l->__tmp0);
    ((int64_t)0LL);
  });

ENVIRONMENTAL_VARIABLES:

ORBIT_SOCKETDIR=/tmp/orbit-root
VNCDESKTOP=hp-nvkj29ytemmz:2 (root)
SSH_AGENT_PID=3758
HOSTNAME=hp-nvkj29ytemmz
IMSETTINGS_INTEGRATE_DESKTOP=yes
TERM=xterm
SHELL=/bin/bash
XDG_SESSION_COOKIE=a8b33d80112e2f124b150ffc00000025-1318355847.28159-935212003
HISTSIZE=1000
GTK_RC_FILES=/etc/gtk/gtkrc:/root/.gtkrc-1.2-gnome2
WINDOWID=14680117
SYSFONT=latarcyrheb-sun16
QTDIR=/usr/lib64/qt-3.3
QTINC=/usr/lib64/qt-3.3/include
IMSETTINGS_MODULE=none
USER=root
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lz=01;31:*.xz=01;31:*.bz2=01;31:*.tbz=01;31:*.tbz2=01;31:*.bz=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.rar=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
GNOME_KEYRING_SOCKET=/tmp/keyring-iTmfOy/socket
SSH_AUTH_SOCK=/tmp/keyring-iTmfOy/socket.ssh
SESSION_MANAGER=local/unix:@/tmp/.ICE-unix/3757,unix/unix:/tmp/.ICE-unix/3757
MAIL=/var/spool/mail/root
PATH=/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
QT_IM_MODULE=xim
PWD=/root/project/shifu/workbench_david/scripts
XMODIFIERS=@im=none
LANG=en_US.UTF-8
SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass
HISTCONTROL=ignoredups
HOME=/root
SHLVL=3
GNOME_DESKTOP_SESSION_ID=this-is-deprecated
LOGNAME=root
QTLIB=/usr/lib64/qt-3.3/lib
CVS_RSH=ssh
DBUS_SESSION_BUS_ADDRESS=unix:abstract=/tmp/dbus-l0fYFHkUAs,guid=53c49850c8d5cf3f2e6fd48800000039
LESSOPEN=|/usr/bin/lesspipe.sh %s
DISPLAY=:2.0
GTK_IM_MODULE=gtk-im-context-simple
G_BROKEN_FILENAMES=1
COLORTERM=gnome-terminal
OLDPWD=/tmp/staphkPtjd
_=/bin/env

Packages:

brt-addon-kerneloops-1.1.16-3.el6.x86_64
dracut-kernel-004-53.el6.noarch
elfutils-0.152-1.el6.x86_64
elfutils-devel-0.152-1.el6.x86_64
elfutils-libelf-0.152-1.el6.x86_64
elfutils-libelf-devel-0.152-1.el6.x86_64
elfutils-libs-0.152-1.el6.x86_64
gcc-4.4.5-6.el6.x86_64
gcc-c++-4.4.5-6.el6.x86_64
gcc-gfortran-4.4.5-6.el6.x86_64
kernel-2.6.32-131.0.15.el6.x86_64
kernel-devel-2.6.32-131.0.15.el6.x86_64
kernel-firmware-2.6.32-131.0.15.el6.noarch
kernel-headers-2.6.32-131.0.15.el6.x86_64
libgcc-4.4.5-6.el6.i686
libgcc-4.4.5-6.el6.x86_64
systemtap-1.4-6.el6.x86_64
systemtap-runtime-1.4-6.el6.x86_64

modinfo:

filename:       /tmp/stapeNOgrM/stap_7155.ko
license:        GPL
description:    systemtap-generated probe
license:        GPL
srcversion:     F756761A4C4AB359E53E32A
depends:        
vermagic:       2.6.32 SMP mod_unload modversions 
parm:           _stp_bufsize:buffer size (int)

Output From -vv:

Systemtap translator/driver (version 1.6/0.152 non-git sources)
Copyright (C) 2005-2011 Red Hat, Inc. and others
This is free software; see the source for copying conditions.
enabled features: LIBSQLITE3 NSS BOOST_SHARED_PTR TR1_UNORDERED_MAP NLS
Created temporary directory "/tmp/stapeNOgrM"
Session arch: x86_64 release: 2.6.32
Searched: " /usr/local/share/systemtap/tapset/x86_64/*.stp ", found: 4,
processed: 4
Searched: " /usr/local/share/systemtap/tapset/*.stp ", found: 72, processed: 72
Searched: " ../scripts/tapsets/*.stp ", found: 10, processed: 10
Pass 1: parsed user script and 86 library script(s) using
166552virt/22276res/2476shr kb, in 180usr/10sys/197real ms.
probe device_is_the_same@drivers/scsi/hpsa.c:797 module=hpsa reloc=.text
pc=0x16910
Pass 2: analyzed script: 2 probe(s), 5 function(s), 1 embed(s), 0 global(s)
using 301752virt/24988res/3552shr kb, in 50usr/330sys/373real ms.
function recursion-analysis: max-nesting 0  non-recursive
probe
module("hpsa").function("device_is_the_same@drivers/scsi/hpsa.c:797").call
locks nothing
probe
module("hpsa").function("device_is_the_same@drivers/scsi/hpsa.c:797").return
locks nothing
dump_unwindsyms hpsa index=0 base=0x10000
Found build-id in hpsa, length 20, start at 0x0x10
Pass 3: translated to C into "/tmp/stapeNOgrM/stap_7155.c" using
301564virt/27136res/5572shr kb, in 60usr/290sys/356real ms.
Pass 4: using cached
/root/.systemtap/cache/b9/stapconf_b9c8b7d1b65441d6a594e7dade6d5afe_458.h
Running make -C /lib/modules/2.6.32/build M=/tmp/stapeNOgrM modules ARCH=x86_64
--no-print-directory
  CC [M]  /tmp/stapeNOgrM/stap_7155.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /tmp/stapeNOgrM/stap_7155.mod.o
  LD [M]  /tmp/stapeNOgrM/stap_7155.ko
Spawn waitpid result (0x0): 0
Pass 4: compiled C into "stap_7155.ko" in 2310usr/460sys/2677real ms.
Copying /tmp/stapeNOgrM/stapconf_b9c8b7d1b65441d6a594e7dade6d5afe_458.h to
/root/.systemtap/cache/b9/stapconf_b9c8b7d1b65441d6a594e7dade6d5afe_458.h
Pass 5: starting run.
Running /usr/local/bin/staprun -v -R /tmp/stapeNOgrM/stap_7155.ko
Equal? 1

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


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