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
0b79d156
Commit
0b79d156
authored
Sep 12, 2018
by
Brendan Gregg
Committed by
GitHub
Sep 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #85 from iovisor/bug
save bytes on comm usage
parents
82049fe6
07babffc
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
12 deletions
+13
-12
src/ast/semantic_analyser.cpp
src/ast/semantic_analyser.cpp
+1
-1
src/types.h
src/types.h
+1
-0
tests/codegen.cpp
tests/codegen.cpp
+11
-11
No files found.
src/ast/semantic_analyser.cpp
View file @
0b79d156
...
...
@@ -48,7 +48,7 @@ void SemanticAnalyser::visit(Builtin &builtin)
needs_stackid_map_
=
true
;
}
else
if
(
builtin
.
ident
==
"comm"
)
{
builtin
.
type
=
SizedType
(
Type
::
string
,
STRING
_SIZE
);
builtin
.
type
=
SizedType
(
Type
::
string
,
COMM
_SIZE
);
}
else
if
(
builtin
.
ident
==
"func"
)
{
for
(
auto
&
attach_point
:
*
probe_
->
attach_points
)
...
...
src/types.h
View file @
0b79d156
...
...
@@ -10,6 +10,7 @@ namespace bpftrace {
const
int
MAX_STACK_SIZE
=
32
;
const
int
STRING_SIZE
=
64
;
const
int
COMM_SIZE
=
16
;
enum
class
Type
{
...
...
tests/codegen.cpp
View file @
0b79d156
...
...
@@ -646,16 +646,16 @@ declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
define i64 @"kprobe:f"(i8* nocapture readnone) local_unnamed_addr section "s_kprobe:f" {
entry:
%"@x_key" = alloca i64, align 8
%comm = alloca [
64
x i8], align 1
%1 = getelementptr inbounds [
64 x i8], [64
x i8]* %comm, i64 0, i64 0
%comm = alloca [
16
x i8], align 1
%1 = getelementptr inbounds [
16 x i8], [16
x i8]* %comm, i64 0, i64 0
call void @llvm.lifetime.start.p0i8(i64 -1, i8* nonnull %1)
call void @llvm.memset.p0i8.i64(i8* nonnull %1, i8 0, i64
64
, i32 1, i1 false)
%get_comm = call i64 inttoptr (i64 16 to i64 (i8*, i64)*)([
64 x i8]* nonnull %comm, i64 64
)
call void @llvm.memset.p0i8.i64(i8* nonnull %1, i8 0, i64
16
, i32 1, i1 false)
%get_comm = call i64 inttoptr (i64 16 to i64 (i8*, i64)*)([
16 x i8]* nonnull %comm, i64 16
)
%2 = bitcast i64* %"@x_key" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* nonnull %2)
store i64 0, i64* %"@x_key", align 8
%pseudo = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%update_elem = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo, i64* nonnull %"@x_key", [
64
x i8]* nonnull %comm, i64 0)
%update_elem = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo, i64* nonnull %"@x_key", [
16
x i8]* nonnull %comm, i64 0)
call void @llvm.lifetime.end.p0i8(i64 -1, i8* nonnull %2)
call void @llvm.lifetime.end.p0i8(i64 -1, i8* nonnull %1)
ret i64 0
...
...
@@ -2075,22 +2075,22 @@ define i64 @"kprobe:f"(i8* nocapture readnone) local_unnamed_addr section "s_kpr
entry:
%"@y_key" = alloca i64, align 8
%"@x_key" = alloca i64, align 8
%comm = alloca [
64
x i8], align 1
%1 = getelementptr inbounds [
64 x i8], [64
x i8]* %comm, i64 0, i64 0
%comm = alloca [
16
x i8], align 1
%1 = getelementptr inbounds [
16 x i8], [16
x i8]* %comm, i64 0, i64 0
call void @llvm.lifetime.start.p0i8(i64 -1, i8* nonnull %1)
call void @llvm.memset.p0i8.i64(i8* nonnull %1, i8 0, i64
64
, i32 1, i1 false)
%get_comm = call i64 inttoptr (i64 16 to i64 (i8*, i64)*)([
64 x i8]* nonnull %comm, i64 64
)
call void @llvm.memset.p0i8.i64(i8* nonnull %1, i8 0, i64
16
, i32 1, i1 false)
%get_comm = call i64 inttoptr (i64 16 to i64 (i8*, i64)*)([
16 x i8]* nonnull %comm, i64 16
)
%2 = bitcast i64* %"@x_key" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* nonnull %2)
store i64 0, i64* %"@x_key", align 8
%pseudo = call i64 @llvm.bpf.pseudo(i64 1, i64 1)
%update_elem = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo, i64* nonnull %"@x_key", [
64
x i8]* nonnull %comm, i64 0)
%update_elem = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo, i64* nonnull %"@x_key", [
16
x i8]* nonnull %comm, i64 0)
call void @llvm.lifetime.end.p0i8(i64 -1, i8* nonnull %2)
%3 = bitcast i64* %"@y_key" to i8*
call void @llvm.lifetime.start.p0i8(i64 -1, i8* nonnull %3)
store i64 0, i64* %"@y_key", align 8
%pseudo1 = call i64 @llvm.bpf.pseudo(i64 1, i64 2)
%update_elem2 = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo1, i64* nonnull %"@y_key", [
64
x i8]* nonnull %comm, i64 0)
%update_elem2 = call i64 inttoptr (i64 2 to i64 (i8*, i8*, i8*, i64)*)(i64 %pseudo1, i64* nonnull %"@y_key", [
16
x i8]* nonnull %comm, i64 0)
call void @llvm.lifetime.end.p0i8(i64 -1, i8* nonnull %3)
ret i64 0
}
...
...
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