Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
ec9d42c8
Commit
ec9d42c8
authored
Jan 16, 2017
by
Brendan Gregg
Committed by
GitHub
Jan 16, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #906 from goldshtn/valid-idents
argdist, trace: Support non-C identifier names
parents
23e0de79
3fa7ba1e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
9 deletions
+14
-9
tools/argdist.py
tools/argdist.py
+13
-7
tools/trace.py
tools/trace.py
+1
-2
No files found.
tools/argdist.py
View file @
ec9d42c8
...
...
@@ -159,7 +159,7 @@ u64 __time = bpf_ktime_get_ns();
if parts[0] not in ["r", "
p
", "
t
", "u"]:
self._bail("
probe
type
must
be
'p'
,
'r'
,
't'
,
or
'u'" +
"
but
got
'%s'" % parts[0])
if re.match(r"
\
w
+
\
(.
*
\
)
", parts[2]) is None:
if re.match(r"
\
S
+
\
(.
*
\
)
", parts[2]) is None:
self._bail(("
function
signature
'%s'
has
an
invalid
" +
"
format
") % parts[2])
...
...
@@ -173,6 +173,9 @@ u64 __time = bpf_ktime_get_ns();
self._bail("
no
exprs
specified
")
self.exprs = exprs.split(',')
def _make_valid_identifier(self, ident):
return re.sub(r'[^A-Za-z0-9_]', '_', ident)
def __init__(self, tool, type, specifier):
self.usdt_ctx = None
self.streq_functions = ""
...
...
@@ -196,8 +199,9 @@ u64 __time = bpf_ktime_get_ns();
self.tp_event = self.function
elif self.probe_type == "u":
self.library = parts[1]
self.probe_func_name = "
%
s_probe
%
d
" %
\
(self.function, Probe.next_probe_index)
self.probe_func_name = self._make_valid_identifier(
"
%
s_probe
%
d
" %
\
(self.function, Probe.next_probe_index))
self._enable_usdt_probe()
else:
self.library = parts[1]
...
...
@@ -233,10 +237,12 @@ u64 __time = bpf_ktime_get_ns();
self
.
entry_probe_required
=
self
.
probe_type
==
"r"
and
\
(
any
(
map
(
check
,
self
.
exprs
))
or
check
(
self
.
filter
))
self
.
probe_func_name
=
"%s_probe%d"
%
\
(
self
.
function
,
Probe
.
next_probe_index
)
self
.
probe_hash_name
=
"%s_hash%d"
%
\
(
self
.
function
,
Probe
.
next_probe_index
)
self
.
probe_func_name
=
self
.
_make_valid_identifier
(
"%s_probe%d"
%
\
(
self
.
function
,
Probe
.
next_probe_index
))
self
.
probe_hash_name
=
self
.
_make_valid_identifier
(
"%s_hash%d"
%
\
(
self
.
function
,
Probe
.
next_probe_index
))
Probe
.
next_probe_index
+=
1
def
_enable_usdt_probe
(
self
):
...
...
tools/trace.py
View file @
ec9d42c8
...
...
@@ -76,8 +76,7 @@ class Probe(object):
self
.
probe_num
=
Probe
.
probe_count
self
.
probe_name
=
"probe_%s_%d"
%
\
(
self
.
_display_function
(),
self
.
probe_num
)
if
self
.
probe_name
.
find
(
"."
)
>
0
:
# for golang
self
.
probe_name
=
self
.
probe_name
.
replace
(
"."
,
"_DOT_"
)
self
.
probe_name
=
re
.
sub
(
r'[^A-Za-z0-9_]'
,
'_'
,
self
.
probe_name
)
def
__str__
(
self
):
return
"%s:%s:%s FLT=%s ACT=%s/%s"
%
(
self
.
probe_type
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment