Bug 18769 - [ppc64BE/--dyninst] unknown operator @__compat_task
Summary: [ppc64BE/--dyninst] unknown operator @__compat_task
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: tapsets (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-08-04 08:03 UTC by Martin Cermak
Modified: 2015-08-04 15:08 UTC (History)
1 user (show)

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 Martin Cermak 2015-08-04 08:03:47 UTC
Commit 7a563a0 added @__compat_task macro to /usr/share/systemtap/tapset/powerpc/registers.stp. The commit is correct, but it causes couple of failures in --dyninst mode on rhel7 ppc64. Thing is that in dyninst mode /usr/share/systemtap/tapset/linux/syscalls.stpm, which defines that macro, isn't being parsed.

This doesn't happen on x86_64, since this macro isn't used within /root/mcermak-systemtap/systemtap-build/share/systemtap/tapset/x86_64/registers.stp (but should be).

What solves the issue for me is symlinking syscalls.stpm to the ../dyninst directory.
Comment 1 Martin Cermak 2015-08-04 11:20:03 UTC
I forgot to mention the reproducer. Here is one:

=======
 7.2 S ppc64 # stap -p2  --dyninst  -e 'probe begin { exit() }'
parse error: unknown operator @__compat_task
        saw: operator '@__compat_task' at /root/mcermak-systemtap/systemtap-build/share/systemtap/tapset/powerpc/registers.stp:159:19
     source:    if ((truncate || @__compat_task) && !force64) {
                                 ^

1 parse error.
WARNING: tapset "/root/mcermak-systemtap/systemtap-build/share/systemtap/tapset/powerpc/registers.stp" has errors, and will be skipped
# functions
exit:unknown ()
# probes
begin /* <- begin */
 7.2 S ppc64 #
=======
Comment 2 Martin Cermak 2015-08-04 11:46:24 UTC
The separation of /linux and /dyninst directories is apparently quite intentional:

=======
$ grep -A 21 'add empty string as last element' main.cxx  | nl
     1    // add empty string as last element
     2    version_suffixes.push_back ("");
       
     3    // Add arch variants of every path, just before each
     4    const string& arch = s.architecture;
     5    for (unsigned i=0; i<version_suffixes.size(); i+=2)
     6      version_suffixes.insert(version_suffixes.begin() + i,
     7                              version_suffixes[i] + "/" + arch);
       
     8    // Add runtime variants of every path, before everything else
     9    string runtime_prefix;
    10    if (s.runtime_mode == systemtap_session::kernel_runtime)
    11      runtime_prefix = "/linux";
    12    else if (s.runtime_mode == systemtap_session::dyninst_runtime)
    13      runtime_prefix = "/dyninst";
    14    if (!runtime_prefix.empty())
    15      for (unsigned i=0; i<version_suffixes.size(); i+=2)
    16        version_suffixes.insert(version_suffixes.begin() + i/2,
    17                                runtime_prefix + version_suffixes[i]);
       
    18    // First, parse .stpm files on the include path. We need to have the
    19    // resulting macro definitions available for parsing library files,
$
=======

I tried to add /linux into version_suffixes, but many tapsets dedicated for kernel runtime are unusable for dyninst runtime, and at the end of the day - it's understandable.

So maybe moving the macro definition from syscalls.stpm one level up in the directory structure to e.g. compat_task.stpm, where it would be consumed by both runtimes, might be a way to go.
Comment 3 David Smith 2015-08-04 13:46:22 UTC
I think the easiest solution might be to move @__compat_task() from tapset/linux/syscalls.stpm to tapset/macros.stpm. That way both the linux and dyninst runtimes could use the definition.
Comment 4 Martin Cermak 2015-08-04 15:08:57 UTC
Fixed in commit 639e6105190df4f80d2230102b53cf0dcaeb559d