Skip to content

Commit 23dfddb

Browse files
committed
Fix symbol lookup failure on the lowest-address symbol.
The `for` statement that looped backwards from `addrtab.upper_bound()` was accidentally checking for `it == addrtab.begin()` _after_ decrementing `it`, not before. So after stepping the iterator backwards to point at the first symbol in the map, that symbol wasn't actually considered eligible to be the answer.
1 parent f2be8bf commit 23dfddb

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

lib/image.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ const Symbol *Image::find_symbol(Addr address) const
174174
return nullptr;
175175

176176
// find the first symbol that contains or starts before 'address'
177-
for (--it; it != addrtab.begin(); --it) {
177+
while (it != addrtab.begin()) {
178+
--it;
178179
const vector<const Symbol *> &syms = it->second;
179180

180181
for (const Symbol *sym : syms) {

0 commit comments

Comments
 (0)