Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
elaborate on why we set the thumb bit before the symtab lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
japaric committed Sep 17, 2020
1 parent 12c188b commit a457dfd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -687,8 +687,10 @@ fn backtrace(
}
} else {
// .symtab fallback
// confusingly enough the addresses in the `.symtab` do have their thumb bit set to 1
// so set it back before the lookup
// the .symtab appears to use address ranges that have their thumb bits set (e.g.
// `0x101..0x200`). Passing the `pc` with the thumb bit cleared (e.g. `0x100`) to the
// lookup function sometimes returns the *previous* symbol. Work around the issue by
// setting `pc`'s thumb bit before looking it up
let address = (pc | THUMB_BIT) as u64;
let name = symtab
.get(address)
Expand Down

0 comments on commit a457dfd

Please sign in to comment.