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
879bff25
Commit
879bff25
authored
May 03, 2017
by
Teng Qin
Committed by
Sasha Goldshtein
May 03, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Avoid walking all symbols for unknown address
parent
fbd91e2d
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
src/cc/bcc_syms.cc
src/cc/bcc_syms.cc
+9
-1
No files found.
src/cc/bcc_syms.cc
View file @
879bff25
...
@@ -284,12 +284,20 @@ bool ProcSyms::Module::find_addr(uint64_t addr, struct bcc_symbol *sym) {
...
@@ -284,12 +284,20 @@ bool ProcSyms::Module::find_addr(uint64_t addr, struct bcc_symbol *sym) {
// brings us to bar, which does not contain offset 0x12 and is nested inside
// brings us to bar, which does not contain offset 0x12 and is nested inside
// foo. Going back one more symbol brings us to foo, which contains 0x12
// foo. Going back one more symbol brings us to foo, which contains 0x12
// and is a match.
// and is a match.
for
(
--
it
;
offset
>=
it
->
start
;
--
it
)
{
// However, we also don't want to walk through the entire symbol list for
// unknown / missing symbols. So we will break if we reach a function that
// doesn't cover the function immediately before 'it', which means it is
// not possibly a nested function containing the address we're looking for.
--
it
;
uint64_t
limit
=
it
->
start
;
for
(;
offset
>=
it
->
start
;
--
it
)
{
if
(
offset
<
it
->
start
+
it
->
size
)
{
if
(
offset
<
it
->
start
+
it
->
size
)
{
sym
->
name
=
it
->
name
->
c_str
();
sym
->
name
=
it
->
name
->
c_str
();
sym
->
offset
=
(
offset
-
it
->
start
);
sym
->
offset
=
(
offset
-
it
->
start
);
return
true
;
return
true
;
}
}
if
(
limit
>
it
->
start
+
it
->
size
)
break
;
// But don't step beyond begin()!
// But don't step beyond begin()!
if
(
it
==
syms_
.
begin
())
if
(
it
==
syms_
.
begin
())
break
;
break
;
...
...
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