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
83a9e292
Commit
83a9e292
authored
Sep 13, 2018
by
williangaspar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
indentation and mapkey
parent
5f9875a6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
27 deletions
+30
-27
src/bpftrace.cpp
src/bpftrace.cpp
+28
-27
src/mapkey.cpp
src/mapkey.cpp
+2
-0
No files found.
src/bpftrace.cpp
View file @
83a9e292
...
...
@@ -1112,44 +1112,45 @@ std::string BPFtrace::get_stack(uint64_t stackidpid, bool ustack, int indent)
std
::
string
BPFtrace
::
resolve_uid
(
uintptr_t
addr
)
{
std
::
string
file_name
=
"/etc/passwd"
;
std
::
string
uid
=
std
::
to_string
(
addr
);
std
::
string
username
=
""
;
std
::
string
file_name
=
"/etc/passwd"
;
std
::
string
uid
=
std
::
to_string
(
addr
);
std
::
string
username
=
""
;
std
::
ifstream
file
(
file_name
);
if
(
file
.
fail
())
{
std
::
cerr
<<
strerror
(
errno
)
<<
": "
<<
file_name
<<
std
::
endl
;
return
username
;
}
std
::
ifstream
file
(
file_name
);
if
(
file
.
fail
())
{
std
::
cerr
<<
strerror
(
errno
)
<<
": "
<<
file_name
<<
std
::
endl
;
return
username
;
}
std
::
string
line
;
bool
found
=
false
;
std
::
string
line
;
bool
found
=
false
;
while
(
std
::
getline
(
file
,
line
)
&&
!
found
)
{
auto
fields
=
split_string
(
line
,
':'
);
while
(
std
::
getline
(
file
,
line
)
&&
!
foun
d
)
if
(
fields
[
2
]
==
ui
d
)
{
auto
fields
=
split_string
(
line
,
':'
);
if
(
fields
[
2
]
==
uid
)
{
found
=
true
;
username
=
fields
[
0
];
}
found
=
true
;
username
=
fields
[
0
];
}
}
file
.
close
();
file
.
close
();
return
username
;
return
username
;
}
std
::
vector
<
std
::
string
>
BPFtrace
::
split_string
(
std
::
string
&
str
,
char
split_by
)
{
std
::
vector
<
std
::
string
>
elems
;
std
::
stringstream
ss
(
str
);
std
::
string
value
;
while
(
std
::
getline
(
ss
,
value
,
split_by
))
{
elems
.
push_back
(
value
);
}
return
elems
;
std
::
vector
<
std
::
string
>
elems
;
std
::
stringstream
ss
(
str
);
std
::
string
value
;
while
(
std
::
getline
(
ss
,
value
,
split_by
))
{
elems
.
push_back
(
value
);
}
return
elems
;
}
std
::
string
BPFtrace
::
resolve_sym
(
uintptr_t
addr
,
bool
show_offset
)
...
...
src/mapkey.cpp
View file @
83a9e292
...
...
@@ -74,6 +74,8 @@ std::string MapKey::argument_value(BPFtrace &bpftrace,
return
bpftrace
.
resolve_sym
(
*
(
uint64_t
*
)
data
);
case
Type
:
:
usym
:
return
bpftrace
.
resolve_usym
(
*
(
uint64_t
*
)
data
,
*
(
uint64_t
*
)(
arg_data
+
8
));
case
Type
:
:
username
:
return
bpftrace
.
resolve_uid
(
*
(
uint64_t
*
)
data
);
case
Type
:
:
name
:
return
bpftrace
.
name_ids_
[
*
(
uint64_t
*
)
data
];
case
Type
:
:
string
:
...
...
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