[Bug translator/32964] New: @defined() not find expected member fields

wcohen at redhat dot com sourceware-bugzilla@sourceware.org
Tue May 13 15:56:39 GMT 2025


https://sourceware.org/bugzilla/show_bug.cgi?id=32964

            Bug ID: 32964
           Summary: @defined() not find expected member fields
           Product: systemtap
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: translator
          Assignee: systemtap at sourceware dot org
          Reporter: wcohen at redhat dot com
  Target Milestone: ---

When working to revise tapset/linux/dev.stp to work with the centos 9 stream
kernels that have backported block device code from 6.14 kernel to the 5.14
kernel (kernel-5.14.0-583.el9.x86_64). The revised detection of the __bd_flags
field in dev.stp did not work as expected.  Below is a small script that
demonstrates the issue.  If the __bd_flags member function is found, one would
expect stap to complain about the access to __bd_flagsx member function that
doesn't exist. It is clear that ddev->__bd_flags is found as there is no
complains on the first two calls to dummy function.

$ cat define_test.stp
function dummy(x:long) {printf("%d\n", x)}

probe begin
{
  bdev = & @cast(0, "block_device", "kernel")

  dummy(bdev->__bd_flags->counter)
  dummy(&(bdev->__bd_flags))
  if (@defined( &(bdev->__bd_flags))) dummy(bdev->__bd_flagsx)
}

$ ../install/bin/stap -p2 -vk define_test.stp
Pass 1: parsed user script and 493 library scripts using
429532virt/128616res/16384shr/128312data kb, in 200usr/50sys/154real ms.
# functions
dummy:unknown (x:long)
{ printf("%d\\n", x) }
__private_define_test_stp__dwarf_autocast_get_0:long (pointer:long)
{ {
return @kderef(4, (pointer) + (48));
} }
__private_define_test_stp__dwarf_autocast_get_1:long (pointer:long)
{ {
return (pointer) + (48);
} }
__private_define_test_stp__dwarf_cast_get_cast_0:long (pointer:long)
{ return pointer }
# probes
begin /*  <- begin */ 
  # locals
  bdev:long
{ {
(bdev) = (__private_define_test_stp__dwarf_cast_get_cast_0(0));
__global_dummy__overload_0(__private_define_test_stp__dwarf_autocast_get_0(bdev));
__global_dummy__overload_0(__private_define_test_stp__dwarf_autocast_get_1(bdev));
} }
Pass 2: analyzed script: 1 probe, 4 functions, 0 embeds, 0 globals using
613648virt/313876res/17580shr/312428data kb, in 800usr/40sys/839real ms.
Keeping temporary directory "/tmp/stapABtbVT"

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Systemtap mailing list