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
cbcfe37c
Commit
cbcfe37c
authored
Aug 07, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix attaching uprobes - replace bad characters in path with '_'
parent
6408d5a5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
2 deletions
+9
-2
src/attached_probe.cpp
src/attached_probe.cpp
+8
-2
src/attached_probe.h
src/attached_probe.h
+1
-0
No files found.
src/attached_probe.cpp
View file @
cbcfe37c
#include <iostream>
#include <iostream>
#include <
tuple
>
#include <
regex
>
#include <sys/utsname.h>
#include <sys/utsname.h>
#include <tuple>
#include <unistd.h>
#include <unistd.h>
#include "attached_probe.h"
#include "attached_probe.h"
...
@@ -100,12 +101,17 @@ std::string AttachedProbe::eventname() const
...
@@ -100,12 +101,17 @@ std::string AttachedProbe::eventname() const
case
ProbeType
:
:
uprobe
:
case
ProbeType
:
:
uprobe
:
case
ProbeType
:
:
uretprobe
:
case
ProbeType
:
:
uretprobe
:
offset_str
<<
std
::
hex
<<
offset
();
offset_str
<<
std
::
hex
<<
offset
();
return
eventprefix
()
+
probe_
.
path
+
"_"
+
offset_str
.
str
();
return
eventprefix
()
+
sanitise
(
probe_
.
path
)
+
"_"
+
offset_str
.
str
();
default:
default:
abort
();
abort
();
}
}
}
}
std
::
string
AttachedProbe
::
sanitise
(
const
std
::
string
&
str
)
{
return
std
::
regex_replace
(
str
,
std
::
regex
(
"[^A-Za-z0-9_]"
),
"_"
);
}
uint64_t
AttachedProbe
::
offset
()
const
uint64_t
AttachedProbe
::
offset
()
const
{
{
bcc_symbol
sym
;
bcc_symbol
sym
;
...
...
src/attached_probe.h
View file @
cbcfe37c
...
@@ -20,6 +20,7 @@ public:
...
@@ -20,6 +20,7 @@ public:
private:
private:
std
::
string
eventprefix
()
const
;
std
::
string
eventprefix
()
const
;
std
::
string
eventname
()
const
;
std
::
string
eventname
()
const
;
static
std
::
string
sanitise
(
const
std
::
string
&
str
);
uint64_t
offset
()
const
;
uint64_t
offset
()
const
;
void
load_prog
();
void
load_prog
();
void
attach_kprobe
();
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