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
fe6a7209
Commit
fe6a7209
authored
May 17, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IRBuilderBPF: Stricter type checking (stop using llvm::Value for everything)
parent
77f34295
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
src/irbuilderbpf.cpp
src/irbuilderbpf.cpp
+6
-6
src/irbuilderbpf.h
src/irbuilderbpf.h
+6
-6
No files found.
src/irbuilderbpf.cpp
View file @
fe6a7209
...
...
@@ -36,7 +36,7 @@ AllocaInst *IRBuilderBPF::CreateAllocaBPF(llvm::Type *ty, const std::string &nam
return
new
AllocaInst
(
ty
,
""
,
&
entry_block
.
front
());
}
Value
*
IRBuilderBPF
::
CreateBpfPseudoCall
(
Map
&
map
)
CallInst
*
IRBuilderBPF
::
CreateBpfPseudoCall
(
Map
&
map
)
{
int
mapfd
;
if
(
bpftrace_
.
maps_
.
find
(
map
.
ident
)
==
bpftrace_
.
maps_
.
end
())
{
...
...
@@ -47,7 +47,7 @@ Value *IRBuilderBPF::CreateBpfPseudoCall(Map &map)
return
CreateCall
(
pseudo_func
,
{
getInt64
(
BPF_PSEUDO_MAP_FD
),
getInt64
(
mapfd
)});
}
Value
*
IRBuilderBPF
::
CreateMapLookupElem
(
Map
&
map
,
Value
*
key
)
LoadInst
*
IRBuilderBPF
::
CreateMapLookupElem
(
Map
&
map
,
AllocaInst
*
key
)
{
Value
*
map_ptr
=
CreateBpfPseudoCall
(
map
);
...
...
@@ -87,7 +87,7 @@ Value *IRBuilderBPF::CreateMapLookupElem(Map &map, Value *key)
return
CreateLoad
(
value
);
}
void
IRBuilderBPF
::
CreateMapUpdateElem
(
Map
&
map
,
Value
*
key
,
Value
*
val
)
void
IRBuilderBPF
::
CreateMapUpdateElem
(
Map
&
map
,
AllocaInst
*
key
,
AllocaInst
*
val
)
{
Value
*
map_ptr
=
CreateBpfPseudoCall
(
map
);
Value
*
flags
=
getInt64
(
0
);
...
...
@@ -106,7 +106,7 @@ void IRBuilderBPF::CreateMapUpdateElem(Map &map, Value *key, Value *val)
CallInst
*
call
=
CreateCall
(
update_func
,
{
map_ptr
,
key
,
val
,
flags
});
}
Value
*
IRBuilderBPF
::
CreateGetNs
()
CallInst
*
IRBuilderBPF
::
CreateGetNs
()
{
// u64 ktime_get_ns()
// Return: current ktime
...
...
@@ -119,7 +119,7 @@ Value *IRBuilderBPF::CreateGetNs()
return
CreateCall
(
gettime_func
);
}
Value
*
IRBuilderBPF
::
CreateGetPidTgid
()
CallInst
*
IRBuilderBPF
::
CreateGetPidTgid
()
{
// u64 bpf_get_current_pid_tgid(void)
// Return: current->tgid << 32 | current->pid
...
...
@@ -132,7 +132,7 @@ Value *IRBuilderBPF::CreateGetPidTgid()
return
CreateCall
(
getpidtgid_func
);
}
Value
*
IRBuilderBPF
::
CreateGetUidGid
()
CallInst
*
IRBuilderBPF
::
CreateGetUidGid
()
{
// u64 bpf_get_current_uid_gid(void)
// Return: current_gid << 32 | current_uid
...
...
src/irbuilderbpf.h
View file @
fe6a7209
...
...
@@ -19,12 +19,12 @@ public:
BPFtrace
&
bpftrace
);
AllocaInst
*
CreateAllocaBPF
(
llvm
::
Type
*
ty
,
const
std
::
string
&
name
=
""
)
const
;
Value
*
CreateBpfPseudoCall
(
Map
&
map
);
Value
*
CreateMapLookupElem
(
Map
&
map
,
Value
*
key
);
void
CreateMapUpdateElem
(
Map
&
map
,
Value
*
key
,
Value
*
val
);
Value
*
CreateGetNs
();
Value
*
CreateGetPidTgid
();
Value
*
CreateGetUidGid
();
CallInst
*
CreateBpfPseudoCall
(
Map
&
map
);
LoadInst
*
CreateMapLookupElem
(
Map
&
map
,
AllocaInst
*
key
);
void
CreateMapUpdateElem
(
Map
&
map
,
AllocaInst
*
key
,
AllocaInst
*
val
);
CallInst
*
CreateGetNs
();
CallInst
*
CreateGetPidTgid
();
CallInst
*
CreateGetUidGid
();
private:
Module
&
module_
;
...
...
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