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
a037df7d
Commit
a037df7d
authored
Jul 26, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug when attaching probes to functions with long names
parent
cd898c90
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
12 deletions
+8
-12
src/attached_probe.cpp
src/attached_probe.cpp
+7
-11
src/attached_probe.h
src/attached_probe.h
+1
-1
No files found.
src/attached_probe.cpp
View file @
a037df7d
...
...
@@ -63,11 +63,11 @@ AttachedProbe::~AttachedProbe()
{
case
ProbeType
:
:
kprobe
:
case
ProbeType
:
:
kretprobe
:
err
=
bpf_detach_kprobe
(
eventname
());
err
=
bpf_detach_kprobe
(
eventname
()
.
c_str
()
);
break
;
case
ProbeType
:
:
uprobe
:
case
ProbeType
:
:
uretprobe
:
err
=
bpf_detach_uprobe
(
eventname
());
err
=
bpf_detach_uprobe
(
eventname
()
.
c_str
()
);
break
;
default:
abort
();
...
...
@@ -89,25 +89,21 @@ std::string AttachedProbe::eventprefix() const
}
}
const
char
*
AttachedProbe
::
eventname
()
const
std
::
string
AttachedProbe
::
eventname
()
const
{
std
::
string
event
;
std
::
ostringstream
offset_str
;
switch
(
probe_
.
type
)
{
case
ProbeType
:
:
kprobe
:
case
ProbeType
:
:
kretprobe
:
event
=
eventprefix
()
+
probe_
.
attach_point
;
break
;
return
eventprefix
()
+
probe_
.
attach_point
;
case
ProbeType
:
:
uprobe
:
case
ProbeType
:
:
uretprobe
:
offset_str
<<
std
::
hex
<<
offset
();
event
=
eventprefix
()
+
probe_
.
path
+
"_"
+
offset_str
.
str
();
break
;
return
eventprefix
()
+
probe_
.
path
+
"_"
+
offset_str
.
str
();
default:
abort
();
}
return
event
.
c_str
();
}
uint64_t
AttachedProbe
::
offset
()
const
...
...
@@ -157,7 +153,7 @@ void AttachedProbe::attach_kprobe()
void
*
cb_cookie
=
nullptr
;
perf_reader_
=
bpf_attach_kprobe
(
progfd_
,
attachtype
(
probe_
.
type
),
eventname
(),
probe_
.
attach_point
.
c_str
(),
eventname
()
.
c_str
()
,
probe_
.
attach_point
.
c_str
(),
pid
,
cpu
,
group_fd
,
cb
,
cb_cookie
);
if
(
perf_reader_
==
nullptr
)
...
...
@@ -173,7 +169,7 @@ void AttachedProbe::attach_uprobe()
void
*
cb_cookie
=
nullptr
;
perf_reader_
=
bpf_attach_uprobe
(
progfd_
,
attachtype
(
probe_
.
type
),
eventname
(),
probe_
.
path
.
c_str
(),
offset
(),
eventname
()
.
c_str
()
,
probe_
.
path
.
c_str
(),
offset
(),
pid
,
cpu
,
group_fd
,
cb
,
cb_cookie
);
if
(
perf_reader_
==
nullptr
)
...
...
src/attached_probe.h
View file @
a037df7d
...
...
@@ -19,7 +19,7 @@ public:
private:
std
::
string
eventprefix
()
const
;
const
char
*
eventname
()
const
;
std
::
string
eventname
()
const
;
uint64_t
offset
()
const
;
void
load_prog
();
void
attach_kprobe
();
...
...
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