* [Bug translator/20394] New: inconsistency in exe/library paths searching between @cast() and process.library.function probes
@ 2016-07-21 14:55 dsmith at redhat dot com
2016-07-21 15:06 ` [Bug translator/20394] " fche at redhat dot com
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2016-07-21 14:55 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=20394
Bug ID: 20394
Summary: inconsistency in exe/library paths searching between
@cast() and process.library.function probes
Product: systemtap
Version: unspecified
Status: NEW
Severity: normal
Priority: P2
Component: translator
Assignee: systemtap at sourceware dot org
Reporter: dsmith at redhat dot com
Target Milestone: ---
When writing probes, you can do the following:
====
probe
process("python").library("libpython2.7.so*").function("PyEval_EvalFrameEx")
{
# ... probe contents here ...
}
====
Notice that I'm just probing "python" as the "process" argument, a non-absolute
path. The translator will look up "python" in my PATH and find it. Notice I'm
using a wildcarded and non-absolute path for the "library" argument.
The above works fine and is very user friendly.
So, when using @cast(), I'd like to specify the symbol search path the same
way:
====
# cat pytest1.stp
function foo:long(object:long)
{
printf("%d\n",
@cast(object, "PyFrameObject", "python:libpython2.7.so*")->f_lineno)
}
probe
process("python").library("libpython2.7.so*").function("PyEval_EvalFrameEx")
{
foo($f)
exit()
}
# stap -v ./pytest1.stp -c "python -c 'import sys; sys.exit(0)'"
Pass 1: parsed user script and 117 library scripts using
242808virt/39472res/7568shr/32212data kb, in 190usr/30sys/234real ms.
semantic error: while processing function foo
semantic error: type definition 'PyFrameObject' not found in
'python:libpython2.7.so*': operator '@cast' at ./pytest1.stp:4:3
source: @cast(object, "PyFrameObject",
"python:libpython2.7.so*")->f_lineno)
^
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using
250612virt/48776res/8880shr/40016data kb, in 120usr/380sys/498real ms.
Pass 2: analysis failed. [man error::pass2]
====
So, that didn't work. Let's try without the wildcard:
====
# cat pytest2.stp
function foo:long(object:long)
{
printf("%d\n",
@cast(object, "PyFrameObject", "python:libpython2.7.so")->f_lineno)
}
probe
process("python").library("libpython2.7.so*").function("PyEval_EvalFrameEx")
{
foo($f)
exit()
}
# stap -v ./pytest2.stp -c "python -c 'import sys; sys.exit(0)'"
Pass 1: parsed user script and 117 library scripts using
242808virt/39644res/7740shr/32212data kb, in 200usr/40sys/240real ms.
semantic error: while processing function foo
semantic error: type definition 'PyFrameObject' not found in
'python:libpython2.7.so': operator '@cast' at ./pytest2.stp:4:3
source: @cast(object, "PyFrameObject",
"python:libpython2.7.so")->f_lineno)
^
Pass 2: analyzed script: 1 probe, 3 functions, 0 embeds, 0 globals using
250608virt/48792res/8892shr/40012data kb, in 100usr/400sys/511real ms.
Pass 2: analysis failed. [man error::pass2]
====
OK, on this system /usr/lib64/libpython2.7.so is a symbolic link to
/usr/lib64/libpython2.7.so.1.0. Let's give that a shot:
====
# cat pytest3.stp
function foo:long(object:long)
{
printf("%d\n",
@cast(object, "PyFrameObject",
"python:libpython2.7.so.1.0")->f_lineno)
}
probe
process("python").library("libpython2.7.so*").function("PyEval_EvalFrameEx")
{
foo($f)
exit()
}
# stap -v ./pytest3.stp -c "python -c 'import sys; sys.exit(0)'"
Pass 1: parsed user script and 117 library scripts using
242804virt/39504res/7604shr/32208data kb, in 210usr/30sys/242real ms.
semantic error: while processing function foo
semantic error: type definition 'PyFrameObject' not found in
'python:libpython2.7.so.1.0': operator '@cast' at ./pytest3.stp:4:3
source: @cast(object, "PyFrameObject",
"python:libpython2.7.so.1.0")->f_lineno)
^
Pass 2: analyzed script: 1 probe, 1 function, 0 embeds, 0 globals using
250608virt/48804res/8912shr/40012data kb, in 100usr/370sys/492real ms.
Pass 2: analysis failed. [man error::pass2]
====
Nope.
The only thing I can seem to get to work for @cast() is a full absolute path to
the library. One reason why this is annoying is that to handle both 32-bit
distros and 64-bit distros, I'll have to specify the library in both /usr/lib/
and /usr/lib64:
====
# cat pytest4.stp
function foo:long(object:long)
{
printf("%d\n",
@cast(object, "PyFrameObject",
"python:/usr/lib64/libpython2.7.so:/usr/lib/libpython2.7.so")->f_lineno)
}
probe
process("python").library("libpython2.7.so*").function("PyEval_EvalFrameEx")
{
foo($f)
exit()
}
# stap -v ./pytest4.stp -c "python -c 'import sys; sys.exit(0)'"
Pass 1: parsed user script and 117 library scripts using
242808virt/39712res/7812shr/32212data kb, in 210usr/30sys/238real ms.
Pass 2: analyzed script: 1 probe, 4 functions, 0 embeds, 0 globals using
251388virt/49532res/8828shr/40792data kb, in 120usr/190sys/317real ms.
Pass 3: translated to C into
"/tmp/stapYGfpK4/stap_d4c98f72a2d5b7cef816271d6bd3e397_3084_src.c" using
251388virt/49724res/9020shr/40792data kb, in 20usr/190sys/206real ms.
Pass 4: compiled C into "stap_d4c98f72a2d5b7cef816271d6bd3e397_3084.ko" in
4730usr/1000sys/5459real ms.
Pass 5: starting run.
59
Pass 5: run completed in 30usr/70sys/392real ms.
====
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug translator/20394] inconsistency in exe/library paths searching between @cast() and process.library.function probes
2016-07-21 14:55 [Bug translator/20394] New: inconsistency in exe/library paths searching between @cast() and process.library.function probes dsmith at redhat dot com
@ 2016-07-21 15:06 ` fche at redhat dot com
2016-07-21 15:50 ` dsmith at redhat dot com
2020-04-24 20:26 ` fche at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: fche at redhat dot com @ 2016-07-21 15:06 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=20394
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |fche at redhat dot com
--- Comment #1 from Frank Ch. Eigler <fche at redhat dot com> ---
Having a search path in @cast in a function() makes it possible that a mismatch
will exist between the probe (whose $context variable is being passed) and the
@cast (who interprets that pointer). What you seem to really want is to make
@cast() in a function refer to - match - the context of the probe that invoked
it. This is kind of what we do already for @cast()s in probe handler bodies.
It's as though we want to specialize the functions invoked from a probe handler
by the probe handler, almost as if they were inlined. Then syntactic elements
inside the functions (even $vars) could conceivably be resolved in the context
of each probe where those functions are actually called from.
What do you think?
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug translator/20394] inconsistency in exe/library paths searching between @cast() and process.library.function probes
2016-07-21 14:55 [Bug translator/20394] New: inconsistency in exe/library paths searching between @cast() and process.library.function probes dsmith at redhat dot com
2016-07-21 15:06 ` [Bug translator/20394] " fche at redhat dot com
@ 2016-07-21 15:50 ` dsmith at redhat dot com
2020-04-24 20:26 ` fche at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: dsmith at redhat dot com @ 2016-07-21 15:50 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=20394
--- Comment #2 from David Smith <dsmith at redhat dot com> ---
(In reply to Frank Ch. Eigler from comment #1)
> Having a search path in @cast in a function() makes it possible that a
> mismatch will exist between the probe (whose $context variable is being
> passed) and the @cast (who interprets that pointer). What you seem to
> really want is to make @cast() in a function refer to - match - the context
> of the probe that invoked it. This is kind of what we do already for
> @cast()s in probe handler bodies.
>
> It's as though we want to specialize the functions invoked from a probe
> handler by the probe handler, almost as if they were inlined. Then
> syntactic elements inside the functions (even $vars) could conceivably be
> resolved in the context of each probe where those functions are actually
> called from.
>
> What do you think?
That's an interesting idea. If it is doable, I'd say it would be quite handy.
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug translator/20394] inconsistency in exe/library paths searching between @cast() and process.library.function probes
2016-07-21 14:55 [Bug translator/20394] New: inconsistency in exe/library paths searching between @cast() and process.library.function probes dsmith at redhat dot com
2016-07-21 15:06 ` [Bug translator/20394] " fche at redhat dot com
2016-07-21 15:50 ` dsmith at redhat dot com
@ 2020-04-24 20:26 ` fche at redhat dot com
2 siblings, 0 replies; 4+ messages in thread
From: fche at redhat dot com @ 2020-04-24 20:26 UTC (permalink / raw)
To: systemtap
https://sourceware.org/bugzilla/show_bug.cgi?id=20394
Frank Ch. Eigler <fche at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Frank Ch. Eigler <fche at redhat dot com> ---
more general solution
--
You are receiving this mail because:
You are the assignee for the bug.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-04-24 20:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-21 14:55 [Bug translator/20394] New: inconsistency in exe/library paths searching between @cast() and process.library.function probes dsmith at redhat dot com
2016-07-21 15:06 ` [Bug translator/20394] " fche at redhat dot com
2016-07-21 15:50 ` dsmith at redhat dot com
2020-04-24 20:26 ` fche at redhat dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).