Bug 5377 - Wildcards following the dwarf probe are expanded incorrectly
Summary: Wildcards following the dwarf probe are expanded incorrectly
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: David Smith
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-21 00:41 UTC by Masami Hiramatsu
Modified: 2007-11-27 21:08 UTC (History)
0 users

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Masami Hiramatsu 2007-11-21 00:41:06 UTC
I found wildcards at the tail of the dwarf probes were expanded incorrectly.

For example,
---
 probe kernel.function("sys_read").* {}
---
This script was expanded as below (output of 'stap -p2');
---
 # probes
 kernel.function("sys_read@fs/read_write.c:358") /* pc=0x807ff */ /* <-
kernel.function("sys_read").* */
 kernel.function("sys_read@fs/read_write.c:358") /* pc=0x807ff */ /* <-
kernel.function("sys_read").* */
 kernel.function("sys_read@fs/read_write.c:358") /* pc=0x807ff */ /* <-
kernel.function("sys_read").* */
---
I expected that it should be expanded as below;
---
 # probes
 kernel.function("sys_read@fs/read_write.c:358").call /* pc=0x807ff */ /* <-
kernel.function("sys_read").* */
 kernel.function("sys_read@fs/read_write.c:358").return /* pc=0x807ff */ /* <-
kernel.function("sys_read").* */
---

And also,
---
 probe kernel.function("sys_read").ret* {}
---
This was expanded as below;
---
 # probes
 kernel.function("sys_read@fs/read_write.c:358") /* pc=0x807ff */ /* <-
kernel.function("sys_read").ret* */
---
But it should be expanded as below;
---
 # probes
 kernel.function("sys_read@fs/read_write.c:358").return /* pc=0x807ff */ /* <-
kernel.function("sys_read").ret* */
---

Thanks,
Comment 1 David Smith 2007-11-21 20:33:59 UTC
This appears to be a bug in the wildcard logic.  The current logic seems to work
correctly, unless the wildcard is in the last token (which is the case you've
found).  This doesn't just apply to dwarf probes, it applies to all probes.  For
instance:

  # stap -p2 -e 'probe be* {}'
  # probes
  be* /* <- be* */

Should look like:

  # stap -p2 -e 'probe be* {}'
  # probes
  begin /* <- be* */
Comment 2 David Smith 2007-11-27 17:10:17 UTC
Here's another example of where the current wildcard logic has problems:

# stap -v -p3 -e 'probe procf*("xyz").write {}'

If you look through the C output, the code is going to create a procfs entry
called "command" (which is the default), instead of one called "xyz".  This is
happening because of the following code in tapsets.cxx:

  bool has_procfs = get_param(parameters, "procfs", path);

Since 'procfs' != 'procf*', we don't find the correct path.
Comment 3 David Smith 2007-11-27 21:08:38 UTC
Patch committed to fix the problem.