Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
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
bcc
Commits
eaccf275
Commit
eaccf275
authored
Nov 06, 2016
by
Mark Drayton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make bcc_symcache_new(tid) work with symbols from /tmp/perf-pid.map
parent
f02448c6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
9 deletions
+12
-9
src/cc/bcc_perf_map.c
src/cc/bcc_perf_map.c
+11
-8
src/cc/bcc_perf_map.h
src/cc/bcc_perf_map.h
+1
-1
No files found.
src/cc/bcc_perf_map.c
View file @
eaccf275
...
...
@@ -20,7 +20,7 @@
#include "bcc_perf_map.h"
int
bcc_perf_map_ns
p
id
(
int
pid
)
{
int
bcc_perf_map_ns
tg
id
(
int
pid
)
{
char
status_path
[
64
];
FILE
*
status
;
...
...
@@ -30,19 +30,22 @@ int bcc_perf_map_nspid(int pid) {
if
(
!
status
)
return
-
1
;
// return the original PID if
the NSpid line is missing
int
ns
p
id
=
pid
;
// return the original PID if
we fail to work out the TGID
int
ns
tg
id
=
pid
;
size_t
size
=
0
;
char
*
line
=
NULL
;
while
(
getline
(
&
line
,
&
size
,
status
)
!=
-
1
)
{
if
(
strstr
(
line
,
"NSpid:"
)
!=
NULL
)
// check Tgid line first in case CONFIG_PID_NS is off
if
(
strstr
(
line
,
"Tgid:"
)
!=
NULL
)
nstgid
=
(
int
)
strtol
(
strrchr
(
line
,
'\t'
),
NULL
,
10
);
if
(
strstr
(
line
,
"NStgid:"
)
!=
NULL
)
// PID namespaces can be nested -- last number is innermost PID
ns
p
id
=
(
int
)
strtol
(
strrchr
(
line
,
'\t'
),
NULL
,
10
);
ns
tg
id
=
(
int
)
strtol
(
strrchr
(
line
,
'\t'
),
NULL
,
10
);
}
free
(
line
);
return
ns
p
id
;
return
ns
tg
id
;
}
bool
bcc_perf_map_path
(
char
*
map_path
,
size_t
map_len
,
int
pid
)
{
...
...
@@ -58,9 +61,9 @@ bool bcc_perf_map_path(char *map_path, size_t map_len, int pid) {
if
(
strcmp
(
target
,
"/"
)
==
0
)
target
[
0
]
=
'\0'
;
int
ns
pid
=
bcc_perf_map_nsp
id
(
pid
);
int
ns
tgid
=
bcc_perf_map_nstg
id
(
pid
);
snprintf
(
map_path
,
map_len
,
"%s/tmp/perf-%d.map"
,
target
,
ns
p
id
);
snprintf
(
map_path
,
map_len
,
"%s/tmp/perf-%d.map"
,
target
,
ns
tg
id
);
return
true
;
}
...
...
src/cc/bcc_perf_map.h
View file @
eaccf275
...
...
@@ -27,7 +27,7 @@ extern "C" {
typedef
int
(
*
bcc_perf_map_symcb
)(
const
char
*
,
uint64_t
,
uint64_t
,
int
,
void
*
);
int
bcc_perf_map_ns
p
id
(
int
pid
);
int
bcc_perf_map_ns
tg
id
(
int
pid
);
bool
bcc_perf_map_path
(
char
*
map_path
,
size_t
map_len
,
int
pid
);
int
bcc_perf_map_foreach_sym
(
const
char
*
path
,
bcc_perf_map_symcb
callback
,
void
*
payload
);
...
...
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