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
62303f49
Commit
62303f49
authored
Jun 10, 2017
by
Alastair Robertson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add indent before printing stack trace values (not keys)
parent
1c305ec9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
src/bpftrace.cpp
src/bpftrace.cpp
+6
-4
src/bpftrace.h
src/bpftrace.h
+1
-1
No files found.
src/bpftrace.cpp
View file @
62303f49
...
...
@@ -95,7 +95,7 @@ int BPFtrace::print_map(Map &map) const
return
-
1
;
}
if
(
map
.
type_
==
Type
::
stack
)
std
::
cout
<<
get_stack
(
value
);
std
::
cout
<<
get_stack
(
value
,
8
);
else
std
::
cout
<<
value
<<
std
::
endl
;
...
...
@@ -261,9 +261,8 @@ std::vector<uint8_t> BPFtrace::find_empty_key(Map &map, size_t size) const
throw
std
::
runtime_error
(
"Could not find empty key"
);
}
std
::
string
BPFtrace
::
get_stack
(
uint64_t
stackid
)
const
std
::
string
BPFtrace
::
get_stack
(
uint64_t
stackid
,
int
indent
)
const
{
std
::
ostringstream
stack
;
auto
stack_trace
=
std
::
vector
<
void
*>
(
MAX_STACK_SIZE
);
int
err
=
bpf_lookup_elem
(
stackid_map_
->
mapfd_
,
&
stackid
,
stack_trace
.
data
());
if
(
err
)
...
...
@@ -272,12 +271,15 @@ std::string BPFtrace::get_stack(uint64_t stackid) const
return
""
;
}
std
::
ostringstream
stack
;
std
::
string
padding
(
indent
,
' '
);
stack
<<
"
\n
"
;
for
(
auto
&
addr
:
stack_trace
)
{
if
(
addr
==
nullptr
)
break
;
stack
<<
(
void
*
)
addr
<<
std
::
endl
;
stack
<<
padding
<<
(
void
*
)
addr
<<
std
::
endl
;
}
return
stack
.
str
();
...
...
src/bpftrace.h
View file @
62303f49
...
...
@@ -19,7 +19,7 @@ public:
int
start
();
void
stop
();
int
print_maps
()
const
;
std
::
string
get_stack
(
uint64_t
stackid
)
const
;
std
::
string
get_stack
(
uint64_t
stackid
,
int
indent
=
0
)
const
;
std
::
map
<
std
::
string
,
std
::
unique_ptr
<
Map
>>
maps_
;
std
::
map
<
std
::
string
,
std
::
tuple
<
uint8_t
*
,
uintptr_t
>>
sections_
;
...
...
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