Skip to content

Commit

Permalink
Use file size in gsym-in-apk example
Browse files Browse the repository at this point in the history
The gsym-in-apk example still uses the memory size in the file offse to
virtual offset translation. Similar to what we did in commit
1a4e107 ("Use file size in file offset -> virtual offset
translation") switch to using the file size instead.

Signed-off-by: Daniel Müller <[email protected]>
  • Loading branch information
d-e-s-o committed Feb 26, 2025
1 parent 0e6c4c8 commit 92d1b7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion examples/gsym-in-apk/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl TranslateFileOffset for CustomApkResolver {
);
let addr = phdrs.iter().find_map(|phdr| {
if phdr.p_type == elf64::program_header::PT_LOAD {
if (phdr.p_offset..phdr.p_offset + phdr.p_memsz).contains(&file_offset) {
if (phdr.p_offset..phdr.p_offset + phdr.p_filesz).contains(&file_offset) {
return Some((file_offset - phdr.p_offset + phdr.p_vaddr) as Addr)
}
}
Expand Down

0 comments on commit 92d1b7b

Please sign in to comment.