Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bpftrace
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
bpftrace
Commits
4a048fcc
Commit
4a048fcc
authored
Jan 22, 2019
by
Augusto Caringi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support to list tracepoint arguments (#323)
parent
62285be0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
0 deletions
+54
-0
docs/reference_guide.md
docs/reference_guide.md
+11
-0
src/list.cpp
src/list.cpp
+43
-0
No files found.
docs/reference_guide.md
View file @
4a048fcc
...
@@ -230,6 +230,17 @@ kprobe:hrtimer_nanosleep
...
@@ -230,6 +230,17 @@ kprobe:hrtimer_nanosleep
[...]
[...]
```
```
The
`-v`
option when listing tracepoints will show their arguments for use from the args builtin. For example:
```
# bpftrace -lv tracepoint:syscalls:sys_enter_open
tracepoint:syscalls:sys_enter_open
int __syscall_nr;
const char * filename;
int flags;
umode_t mode;
```
## 5. `-d`: Debug Output
## 5. `-d`: Debug Output
The
`-d`
option produces debug output, and does not run the program. This is mostly useful for debugging issues with bpftrace itself.
The
`-d`
option produces debug output, and does not run the program. This is mostly useful for debugging issues with bpftrace itself.
...
...
src/list.cpp
View file @
4a048fcc
...
@@ -77,6 +77,42 @@ void list_probes_from_list(const std::vector<ProbeListItem> &probes_list,
...
@@ -77,6 +77,42 @@ void list_probes_from_list(const std::vector<ProbeListItem> &probes_list,
}
}
}
}
void
print_tracepoint_args
(
const
std
::
string
&
category
,
const
std
::
string
&
event
)
{
std
::
string
format_file_path
=
tp_path
+
"/"
+
category
+
"/"
+
event
+
"/format"
;
std
::
ifstream
format_file
(
format_file_path
.
c_str
());
std
::
regex
re
(
"^ field:.*;$"
,
std
::
regex
::
icase
|
std
::
regex
::
grep
|
std
::
regex
::
nosubs
|
std
::
regex
::
optimize
);
std
::
string
line
;
if
(
format_file
.
fail
())
{
std
::
cerr
<<
"ERROR: tracepoint format file not found: "
<<
format_file_path
<<
std
::
endl
;
return
;
}
// Skip lines until the first empty line
do
{
getline
(
format_file
,
line
);
}
while
(
line
.
length
()
>
0
);
for
(;
getline
(
format_file
,
line
);
)
{
try
{
if
(
std
::
regex_match
(
line
,
re
))
{
unsigned
idx
=
line
.
find
(
":"
)
+
1
;
line
=
line
.
substr
(
idx
);
idx
=
line
.
find
(
";"
)
+
1
;
line
=
line
.
substr
(
0
,
idx
);
std
::
cout
<<
" "
<<
line
<<
std
::
endl
;
}
}
catch
(
std
::
regex_error
&
e
)
{
return
;
}
}
}
void
list_probes
(
const
std
::
string
&
search
)
void
list_probes
(
const
std
::
string
&
search
)
{
{
unsigned
int
i
,
j
;
unsigned
int
i
,
j
;
...
@@ -118,9 +154,16 @@ void list_probes(const std::string &search)
...
@@ -118,9 +154,16 @@ void list_probes(const std::string &search)
}
}
std
::
cout
<<
probe
<<
std
::
endl
;
std
::
cout
<<
probe
<<
std
::
endl
;
if
(
bt_verbose
)
print_tracepoint_args
(
cats
[
i
],
events
[
j
]);
}
}
}
}
// Optimization: If the search expression starts with "t" (tracepoint) there is
// no need to search for kprobes.
if
(
search
.
rfind
(
"t"
,
0
)
==
0
)
return
;
// kprobes
// kprobes
std
::
ifstream
file
(
kprobe_path
);
std
::
ifstream
file
(
kprobe_path
);
if
(
file
.
fail
())
if
(
file
.
fail
())
...
...
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