Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
95e8e96c
Commit
95e8e96c
authored
Sep 22, 2020
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libbacktrace: handle pc == low correctly
* dwarf.c (report_inlined_functions): Handle PC == -1 and PC == p->low. (dwarf_lookup_pc): Likewise.
parent
c8a81d4e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
11 deletions
+27
-11
dwarf.c
dwarf.c
+27
-11
No files found.
dwarf.c
View file @
95e8e96c
...
...
@@ -3891,6 +3891,11 @@ report_inlined_functions (uintptr_t pc, struct function *function,
if
(
function
->
function_addrs_count
==
0
)
return
0
;
/* Our search isn't safe if pc == -1, as that is the sentinel
value. */
if
(
pc
+
1
==
0
)
return
0
;
p
=
((
struct
function_addrs
*
)
bsearch
(
&
pc
,
function
->
function_addrs
,
function
->
function_addrs_count
,
...
...
@@ -3900,9 +3905,12 @@ report_inlined_functions (uintptr_t pc, struct function *function,
return
0
;
/* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are
sorted by low, so we are at the end of a range of function_addrs
with the same low alue. Walk backward and use the first range
that includes pc. */
sorted by low, so if pc > p->low we are at the end of a range of
function_addrs with the same low value. If pc == p->low walk
forward to the end of the range with that low value. Then walk
backward and use the first range that includes pc. */
while
(
pc
==
(
p
+
1
)
->
low
)
++
p
;
match
=
NULL
;
while
(
1
)
{
...
...
@@ -3969,8 +3977,10 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
*
found
=
1
;
/* Find an address range that includes PC. */
entry
=
(
ddata
->
addrs_count
==
0
/* Find an address range that includes PC. Our search isn't safe if
PC == -1, as we use that as a sentinel value, so skip the search
in that case. */
entry
=
(
ddata
->
addrs_count
==
0
||
pc
+
1
==
0
?
NULL
:
bsearch
(
&
pc
,
ddata
->
addrs
,
ddata
->
addrs_count
,
sizeof
(
struct
unit_addrs
),
unit_addrs_search
));
...
...
@@ -3982,9 +3992,12 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
}
/* Here pc >= entry->low && pc < (entry + 1)->low. The unit_addrs
are sorted by low, so we are at the end of a range of unit_addrs
with the same low value. Walk backward and use the first range
that includes pc. */
are sorted by low, so if pc > p->low we are at the end of a range
of unit_addrs with the same low value. If pc == p->low walk
forward to the end of the range with that low value. Then walk
backward and use the first range that includes pc. */
while
(
pc
==
(
entry
+
1
)
->
low
)
++
entry
;
found_entry
=
0
;
while
(
1
)
{
...
...
@@ -4165,9 +4178,12 @@ dwarf_lookup_pc (struct backtrace_state *state, struct dwarf_data *ddata,
return
callback
(
data
,
pc
,
ln
->
filename
,
ln
->
lineno
,
NULL
);
/* Here pc >= p->low && pc < (p + 1)->low. The function_addrs are
sorted by low, so we are at the end of a range of function_addrs
with the same low alue. Walk backward and use the first range
that includes pc. */
sorted by low, so if pc > p->low we are at the end of a range of
function_addrs with the same low value. If pc == p->low walk
forward to the end of the range with that low value. Then walk
backward and use the first range that includes pc. */
while
(
pc
==
(
p
+
1
)
->
low
)
++
p
;
fmatch
=
NULL
;
while
(
1
)
{
...
...
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