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
e30eaecd
Commit
e30eaecd
authored
Jan 17, 2017
by
4ast
Committed by
GitHub
Jan 17, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #909 from goldshtn/tp-str-fixes
trace, tplist, argdist: UDST probe miscellaneous fixes
parents
7e78f3a6
dcf1675a
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
25 deletions
+27
-25
tools/argdist.py
tools/argdist.py
+1
-1
tools/tplist.py
tools/tplist.py
+2
-2
tools/trace.py
tools/trace.py
+24
-22
No files found.
tools/argdist.py
View file @
e30eaecd
...
...
@@ -258,7 +258,7 @@ static inline bool %s(char const *ignored, char const *str) {
char needle[] = %s;
char haystack[sizeof(needle)];
bpf_probe_read(&haystack, sizeof(haystack), (void *)str);
for (int i = 0; i < sizeof(needle); ++i) {
for (int i = 0; i < sizeof(needle)
- 1
; ++i) {
if (needle[i] != haystack[i]) {
return false;
}
...
...
tools/tplist.py
View file @
e30eaecd
...
...
@@ -68,7 +68,7 @@ def print_tracepoints():
def
print_usdt_argument_details
(
location
):
for
idx
in
xrange
(
0
,
location
.
num_arguments
):
arg
=
location
.
get_argument
(
idx
)
print
(
" argument #%d %s"
%
(
idx
,
arg
))
print
(
" argument #%d %s"
%
(
idx
+
1
,
arg
))
def
print_usdt_details
(
probe
):
if
args
.
verbosity
>
0
:
...
...
@@ -76,7 +76,7 @@ def print_usdt_details(probe):
if
args
.
verbosity
>
1
:
for
idx
in
xrange
(
0
,
probe
.
num_locations
):
loc
=
probe
.
get_location
(
idx
)
print
(
" location #%d %s"
%
(
idx
,
loc
))
print
(
" location #%d %s"
%
(
idx
+
1
,
loc
))
print_usdt_argument_details
(
loc
)
else
:
print
(
" %d location(s)"
%
probe
.
num_locations
)
...
...
tools/trace.py
View file @
e30eaecd
...
...
@@ -217,11 +217,11 @@ class Probe(object):
fname
=
"streq_%d"
%
Probe
.
streq_index
Probe
.
streq_index
+=
1
self
.
streq_functions
+=
"""
static inline bool %s(char const *ignored, u
nsigned long
str) {
static inline bool %s(char const *ignored, u
intptr_t
str) {
char needle[] = %s;
char haystack[sizeof(needle)];
bpf_probe_read(&haystack, sizeof(haystack), (void *)str);
for (int i = 0; i < sizeof(needle); ++i) {
for (int i = 0; i < sizeof(needle)
- 1
; ++i) {
if (needle[i] != haystack[i]) {
return false;
}
...
...
@@ -354,14 +354,15 @@ BPF_PERF_OUTPUT(%s);
def
_generate_usdt_filter_read
(
self
):
text
=
""
if
self
.
probe_type
==
"u"
:
if
self
.
probe_type
!=
"u"
:
return
text
for
arg
,
_
in
Probe
.
aliases
.
items
():
if
not
(
arg
.
startswith
(
"arg"
)
and
(
arg
in
self
.
filter
)):
continue
arg_index
=
int
(
arg
.
replace
(
"arg"
,
""
))
arg_ctype
=
self
.
usdt
.
get_probe_arg_ctype
(
self
.
usdt_name
,
arg_index
)
self
.
usdt_name
,
arg_index
-
1
)
if
not
arg_ctype
:
self
.
_bail
(
"Unable to determine type of {} "
"in the filter"
.
format
(
arg
))
...
...
@@ -375,12 +376,13 @@ BPF_PERF_OUTPUT(%s);
def
generate_program
(
self
,
include_self
):
data_decl
=
self
.
_generate_data_decl
()
# kprobes don't have built-in pid filters, so we have to add
# it to the function body:
if
len
(
self
.
library
)
==
0
and
Probe
.
pid
!=
-
1
:
if
Probe
.
pid
!=
-
1
:
pid_filter
=
"""
if (__pid != %d) { return 0; }
"""
%
Probe
.
pid
# uprobes can have a built-in tgid filter passed to
# attach_uprobe, hence the check here -- for kprobes, we
# need to do the tgid test by hand:
elif
len
(
self
.
library
)
==
0
and
Probe
.
tgid
!=
-
1
:
pid_filter
=
"""
if (__tgid != %d) { return 0; }
...
...
@@ -542,12 +544,12 @@ BPF_PERF_OUTPUT(%s);
bpf
.
attach_uretprobe
(
name
=
libpath
,
sym
=
self
.
function
,
fn_name
=
self
.
probe_name
,
pid
=
Probe
.
p
id
)
pid
=
Probe
.
tg
id
)
else
:
bpf
.
attach_uprobe
(
name
=
libpath
,
sym
=
self
.
function
,
fn_name
=
self
.
probe_name
,
pid
=
Probe
.
p
id
)
pid
=
Probe
.
tg
id
)
class
Tool
(
object
):
examples
=
"""
...
...
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