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
c489081e
Commit
c489081e
authored
Oct 20, 2018
by
Alastair Robertson
Committed by
GitHub
Oct 20, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #205 from rantala/fixlets
Fixlets
parents
8ec651e9
08fdc458
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
18 additions
and
15 deletions
+18
-15
src/ast/codegen_llvm.cpp
src/ast/codegen_llvm.cpp
+2
-2
src/ast/codegen_llvm.h
src/ast/codegen_llvm.h
+2
-2
src/attached_probe.cpp
src/attached_probe.cpp
+7
-5
src/bpftrace.cpp
src/bpftrace.cpp
+1
-1
src/clang_parser.cpp
src/clang_parser.cpp
+1
-1
src/list.cpp
src/list.cpp
+2
-1
src/main.cpp
src/main.cpp
+1
-1
src/map.cpp
src/map.cpp
+2
-1
src/utils-inl.h
src/utils-inl.h
+0
-1
No files found.
src/ast/codegen_llvm.cpp
View file @
c489081e
...
...
@@ -1141,7 +1141,7 @@ void CodegenLLVM::visit(Program &program)
probe
->
accept
(
*
this
);
}
int
CodegenLLVM
::
getNextIndexForProbe
(
std
::
string
probe_name
)
{
int
CodegenLLVM
::
getNextIndexForProbe
(
const
std
::
string
&
probe_name
)
{
if
(
next_probe_index_
.
count
(
probe_name
)
==
0
)
next_probe_index_
[
probe_name
]
=
1
;
int
index
=
next_probe_index_
[
probe_name
];
...
...
@@ -1149,7 +1149,7 @@ int CodegenLLVM::getNextIndexForProbe(std::string probe_name) {
return
index
;
}
std
::
string
CodegenLLVM
::
getSectionNameForProbe
(
std
::
string
probe_name
,
int
index
)
{
std
::
string
CodegenLLVM
::
getSectionNameForProbe
(
const
std
::
string
&
probe_name
,
int
index
)
{
return
"s_"
+
probe_name
+
"_"
+
std
::
to_string
(
index
);
}
...
...
src/ast/codegen_llvm.h
View file @
c489081e
...
...
@@ -49,8 +49,8 @@ public:
void
visit
(
Program
&
program
)
override
;
AllocaInst
*
getMapKey
(
Map
&
map
);
AllocaInst
*
getHistMapKey
(
Map
&
map
,
Value
*
log2
);
int
getNextIndexForProbe
(
std
::
string
probe_name
);
std
::
string
getSectionNameForProbe
(
std
::
string
probe_name
,
int
index
);
int
getNextIndexForProbe
(
const
std
::
string
&
probe_name
);
std
::
string
getSectionNameForProbe
(
const
std
::
string
&
probe_name
,
int
index
);
Value
*
createLogicalAnd
(
Binop
&
binop
);
Value
*
createLogicalOr
(
Binop
&
binop
);
...
...
src/attached_probe.cpp
View file @
c489081e
...
...
@@ -104,7 +104,8 @@ AttachedProbe::AttachedProbe(Probe &probe, std::tuple<uint8_t *, uintptr_t> func
AttachedProbe
::~
AttachedProbe
()
{
close
(
progfd_
);
if
(
progfd_
>=
0
)
close
(
progfd_
);
int
err
=
0
;
for
(
int
perf_event_fd
:
perf_event_fds_
)
...
...
@@ -200,9 +201,11 @@ static unsigned kernel_version(int attempt)
return
LINUX_VERSION_CODE
;
case
1
:
struct
utsname
utsname
;
uname
(
&
utsname
);
if
(
uname
(
&
utsname
)
<
0
)
return
0
;
unsigned
x
,
y
,
z
;
sscanf
(
utsname
.
release
,
"%d.%d.%d"
,
&
x
,
&
y
,
&
z
);
if
(
sscanf
(
utsname
.
release
,
"%u.%u.%u"
,
&
x
,
&
y
,
&
z
)
!=
3
)
return
0
;
return
KERNEL_VERSION
(
x
,
y
,
z
);
case
2
:
// try to get the definition of LINUX_VERSION_CODE at runtime.
...
...
@@ -319,8 +322,7 @@ void AttachedProbe::attach_uprobe()
void
AttachedProbe
::
attach_usdt
(
int
pid
)
{
struct
bcc_usdt_location
loc
=
{};
int
err
,
i
;
std
::
ostringstream
offset_str
;
int
err
;
void
*
ctx
;
if
(
pid
)
...
...
src/bpftrace.cpp
View file @
c489081e
...
...
@@ -400,7 +400,7 @@ std::unique_ptr<AttachedProbe> BPFtrace::attach_probe(Probe &probe, const BpfOrc
else
return
std
::
make_unique
<
AttachedProbe
>
(
probe
,
func
->
second
);
}
catch
(
std
::
runtime_error
e
)
catch
(
std
::
runtime_error
&
e
)
{
std
::
cerr
<<
e
.
what
()
<<
std
::
endl
;
}
...
...
src/clang_parser.cpp
View file @
c489081e
...
...
@@ -106,7 +106,7 @@ static bool is_dir(const std::string& path)
return
S_ISDIR
(
buf
.
st_mode
);
}
static
std
::
pair
<
bool
,
std
::
string
>
get_kernel_path_info
(
const
std
::
string
kdir
)
static
std
::
pair
<
bool
,
std
::
string
>
get_kernel_path_info
(
const
std
::
string
&
kdir
)
{
if
(
is_dir
(
kdir
+
"/build"
)
&&
is_dir
(
kdir
+
"/source"
))
return
std
::
make_pair
(
true
,
"source"
);
...
...
src/list.cpp
View file @
c489081e
...
...
@@ -61,6 +61,8 @@ void list_dir(const std::string path, std::vector<std::string> &files)
while
((
dep
=
readdir
(
dp
))
!=
NULL
)
files
.
push_back
(
std
::
string
(
dep
->
d_name
));
closedir
(
dp
);
}
void
list_probes
(
const
std
::
string
&
search
)
...
...
@@ -103,7 +105,6 @@ void list_probes(const std::string &search)
return
;
}
std
::
set
<
std
::
string
>
matches
;
size_t
loc
;
while
(
std
::
getline
(
file
,
line
))
{
...
...
src/main.cpp
View file @
c489081e
...
...
@@ -180,7 +180,7 @@ int main(int argc, char *argv[])
return
0
;
// Empty signal handler for cleanly terminating the program
struct
sigaction
act
;
struct
sigaction
act
=
{}
;
act
.
sa_handler
=
[](
int
)
{
};
sigaction
(
SIGINT
,
&
act
,
NULL
);
...
...
src/map.cpp
View file @
c489081e
...
...
@@ -101,7 +101,8 @@ Map::Map(enum bpf_map_type map_type)
Map
::~
Map
()
{
close
(
mapfd_
);
if
(
mapfd_
>=
0
)
close
(
mapfd_
);
}
}
// namespace bpftrace
src/utils-inl.h
View file @
c489081e
...
...
@@ -5,7 +5,6 @@
namespace
bpftrace
{
inline
std
::
string
GetProviderFromPath
(
std
::
string
path
)
{
std
::
string
provider
;
int
i
=
path
.
rfind
(
"/"
);
return
(
i
!=
std
::
string
::
npos
)
?
path
.
substr
(
i
+
1
)
:
path
;
}
...
...
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