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
946c7859
Commit
946c7859
authored
Jan 17, 2019
by
Brendan Gregg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix tracepoint wildcards
parent
e73f69c9
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
9 deletions
+21
-9
src/bpftrace.cpp
src/bpftrace.cpp
+1
-4
src/tracepoint_format_parser.cpp
src/tracepoint_format_parser.cpp
+9
-5
src/utils.cpp
src/utils.cpp
+10
-0
src/utils.h
src/utils.h
+1
-0
No files found.
src/bpftrace.cpp
View file @
946c7859
...
...
@@ -87,10 +87,7 @@ int BPFtrace::add_probe(ast::Probe &p)
}
std
::
vector
<
std
::
string
>
attach_funcs
;
if
(
attach_point
->
need_expansion
&&
(
attach_point
->
func
.
find
(
"*"
)
!=
std
::
string
::
npos
||
attach_point
->
func
.
find
(
"["
)
!=
std
::
string
::
npos
&&
attach_point
->
func
.
find
(
"]"
)
!=
std
::
string
::
npos
))
if
(
attach_point
->
need_expansion
&&
has_wildcard
(
attach_point
->
func
))
{
std
::
set
<
std
::
string
>
matches
;
switch
(
probetype
(
attach_point
->
provider
))
...
...
src/tracepoint_format_parser.cpp
View file @
946c7859
...
...
@@ -29,20 +29,24 @@ bool TracepointFormatParser::parse(ast::Program *program)
{
std
::
string
&
category
=
ap
->
target
;
std
::
string
&
event_name
=
ap
->
func
;
if
(
has_wildcard
(
event_name
))
{
// args not supported with wildcards yet: #132
return
true
;
}
std
::
string
format_file_path
=
"/sys/kernel/debug/tracing/events/"
+
category
+
"/"
+
event_name
+
"/format"
;
std
::
ifstream
format_file
(
format_file_path
.
c_str
());
if
(
format_file
.
fail
())
{
std
::
cerr
<<
"ERROR: tracepoint not found: "
<<
ap
->
target
<<
":"
<<
ap
->
func
<<
std
::
endl
;
std
::
cerr
<<
"ERROR: tracepoint not found: "
<<
category
<<
":"
<<
event_name
<<
std
::
endl
;
// helper message:
if
(
ap
->
target
==
"syscall"
)
std
::
cerr
<<
"Did you mean syscalls:"
<<
ap
->
func
<<
"?"
<<
std
::
endl
;
if
(
category
==
"syscall"
)
std
::
cerr
<<
"Did you mean syscalls:"
<<
event_name
<<
"?"
<<
std
::
endl
;
if
(
bt_verbose
)
{
if
(
format_file_path
.
find
(
'*'
)
==
std
::
string
::
npos
)
std
::
cerr
<<
strerror
(
errno
)
<<
": "
<<
format_file_path
<<
std
::
endl
;
}
return
false
;
}
...
...
src/utils.cpp
View file @
946c7859
...
...
@@ -31,6 +31,16 @@ std::vector<int> read_cpu_range(std::string path)
namespace
bpftrace
{
bool
has_wildcard
(
const
std
::
string
&
str
)
{
if
(
str
.
find
(
"*"
)
!=
std
::
string
::
npos
||
str
.
find
(
"["
)
!=
std
::
string
::
npos
&&
str
.
find
(
"]"
)
!=
std
::
string
::
npos
)
return
true
;
else
return
false
;
}
std
::
vector
<
int
>
get_online_cpus
()
{
return
read_cpu_range
(
"/sys/devices/system/cpu/online"
);
...
...
src/utils.h
View file @
946c7859
...
...
@@ -6,6 +6,7 @@
namespace
bpftrace
{
inline
std
::
string
GetProviderFromPath
(
std
::
string
path
);
bool
has_wildcard
(
const
std
::
string
&
str
);
std
::
vector
<
int
>
get_online_cpus
();
std
::
vector
<
int
>
get_possible_cpus
();
std
::
vector
<
std
::
string
>
get_kernel_cflags
(
...
...
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