Bug 12136 - @cast can't find namespaced types
Summary: @cast can't find namespaced types
Status: RESOLVED FIXED
Alias: None
Product: systemtap
Classification: Unclassified
Component: translator (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-19 23:38 UTC by Josh Stone
Modified: 2011-11-21 19:10 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 Josh Stone 2010-10-19 23:38:31 UTC
$ stap -e 'probe begin { println( @cast(0, "string")$$ ) }' -p2
semantic error: type definition 'string' not found: identifier '@cast' at <input>:1:24
        source: probe begin { println( @cast(0, "string")$$ ) }
                                       ^
Pass 2: analysis failed.  Try again with another '--vp 01' option.

In the DWARF, the die for "string" is nested under the die for namespace "std", so it escapes our usual iterate-globals search.  @cast(0, "std::string") doesn't work either, but perhaps that's the approach we should take.  We can include namespaces in the global iteration, search for "namespace std" in that, and then do a subsearch for the "string" type.
Comment 1 Josh Stone 2011-11-21 19:10:49 UTC
Fixed and tested by these commits:

3805a31 PR12136: Load nested types for C++ CUs
52dd8bd PR12136: Test a @cast to type sdt::string
3b035c9 PR12136: Add a statement probe for testing @cast scopes
2db5adc PR12136: Tweak the cast-scope testcase

but see also PR13420.